Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Thu Apr 18, 2019 11:41 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: lighttpd Statistics - 1.0
PostPosted: Tue Feb 13, 2007 5:28 pm 
Offline
User avatar

Joined: Sun Feb 11, 2007 9:43 am
Posts: 5
Hi,

This package provides a script server script and cacti templates
for graphing statistics for a lighttpd webserver [1].

These templates are based on the work of Rolf Poser (ApacheStats) [2],
using the version ApacheStats 0.6 (PHP Script Server Version) by
mahuani [3].

As lighttpd does not provide all informations in "?auto" mode of
the server status page and the variables are not named the same way,
I reimplemented the script server script and copied the existing
templates.

Note: the query script needs PHP 5.

Regards,
Matthias

[1] http://www.lighttpd.net/
[2] http://forums.cacti.net/about4028.html
[3] http://forums.cacti.net/about17995.html


Attachments:
lighttpd_stats_1.0.tar.gz [13.5 KiB]
Downloaded 3576 times
Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 02, 2007 8:34 pm 
Offline

Joined: Sun May 27, 2007 2:13 am
Posts: 16
Thanks a lot Moo. :)
However, I have a little problem.
I run Cacti on CentoOS5 with PHP 5.1.6, MySQL 5.0.22 and lighttpd 1.4.15 fcgi installed.

When I do:
Code:
php /usr/lib/cacti/scripts/ss_lighttpd_stats.php localhost

nothing is returned.

If I do:
Code:
php /usr/lib/cacti/scripts/ss_fping.php localhost

I get:
Code:
min:0.0600 avg:0.0733 max:0.1000 dev:0.0125 loss:0.0000


Is there something I should edit in ss_lighttpd_stats.php?
I use a soft link to point the /usr/lib/cacti/scripts to /var/www/html/stats/scripts directory.

Thanks for your input.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 21, 2007 9:26 am 
Offline
User avatar

Joined: Sun Feb 11, 2007 9:43 am
Posts: 5
Hi Teck,

Sorry about my delay, I was quite busy lately :cry:

TECK wrote:
When I do:
Code:
php /usr/lib/cacti/scripts/ss_lighttpd_stats.php localhost

nothing is returned.

TECK wrote:
Is there something I should edit in ss_lighttpd_stats.php?
I use a soft link to point the /usr/lib/cacti/scripts to /var/www/html/stats/scripts directory.


Usually, you don't have to edit something in the script itself. Just make sure the server status page is accessible - when calling with localhost this would be http://localhost/server-status

You can enable it by activating "mod_status" module and url config in lighttpd.conf:
Code:
server.modules += ("mod_status")
status.status-url = "/server-status"


Greetz,
Matthias


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 21, 2007 8:32 pm 
Offline

Joined: Sun May 27, 2007 2:13 am
Posts: 16
Thanks for the info. Ya, the module was disabled. :)
Is there a way not to enable the status page? I really don't want to show users the server status.

I wonder if just enabling the status module will fix it. I will try it tonight and let you know.
As you can see I follow this thread... I guess I'm the only one?
Nobody posted anything related to this issue... yet.

Can't wait to use the lighty stats on Cacti.
Thanks one more time for your support.

_________________
yqed.com (why queued) - my blog


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 22, 2007 1:34 am 
Offline
User avatar

Joined: Sun Feb 11, 2007 9:43 am
Posts: 5
TECK wrote:
Is there a way not to enable the status page? I really don't want to show users the server status.


No, the poller script grabs the information out of this page. But you can limit the access to allow only specific IP addresses, virtual host or whatever, like:

Code:
$HTTP["remoteip"] == "127.0.0.0/8" {
  status.status-url = "/server-status"
}


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 25, 2007 11:04 am 
Offline

Joined: Sun May 27, 2007 2:13 am
Posts: 16
Thanks for the info mOo.
However, I encountered the cacti bug for empty comments:
http://bugs.cacti.net/view.php?id=938
Code:
RRDTool Says:
ERROR: Expected some arguments after 'COMMENT:'


in the bytes/request template. I looked at the xml file and I cannot find the comments tag?

Code:
/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="Localhost - Lighttpd Network Traffic (bytes/request)" \
--base=1024 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="bytes per request" \
--slope-mode \
DEF:a="/var/www/html/stats/rra/localhost_busy_servers_12.rrd":total_kbytes:AVERAGE \
DEF:b="/var/www/html/stats/rra/localhost_busy_servers_12.rrd":total_hits:AVERAGE \
CDEF:cdefa=a,UN,0,a,100000,GT,0,a,IF,IF \
CDEF:cdefb=b,UN,0,b,100000,GT,0,b,IF,IF \
CDEF:cdefc=cdefb,0,EQ,0,cdefa,1024,*,cdefb,/,IF,0,1000000,LIMIT \
CDEF:cdefg=a,0,0,LIMIT \
CDEF:cdefba=b,0,0,LIMIT \
COMMENT:""  \
COMMENT:""  \
AREA:cdefc#4123A1:"Bytes / Request"  \
GPRINT:cdefc:LAST:"Current\:%8.2lf %s"  \
GPRINT:cdefc:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:cdefc:MAX:"Maximum\:%8.2lf %s\n"  \
LINE2:cdefg#FF0000:"kBytes"  \
GPRINT:a:LAST:"         Current\:%8.2lf %s"  \
GPRINT:a:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:a:MAX:"Maximum\:%8.2lf %s\n"  \
LINE2:cdefba#00FF00:"Hits"  \
GPRINT:b:LAST:"           Current\:%8.2lf %s"  \
GPRINT:b:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:b:MAX:"Maximum\:%8.2lf %s\n"


What is the tag that defines a comment?

_________________
yqed.com (why queued) - my blog


Top
 Profile  
 
 Post subject: error while importing the template
PostPosted: Thu Jul 05, 2007 5:14 am 
Offline

Joined: Thu Jul 05, 2007 5:13 am
Posts: 2
Location: Amsterdam
Error: XML: Hash version does not exist.

I get this when I try to import the template.
any ideas?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 17, 2007 5:37 am 
Offline

Joined: Tue Jul 17, 2007 5:32 am
Posts: 8
when running the script from command line I get
lighttpd_total_hits:695144 lighttpd_total_kbytes:4683115 lighttpd_uptime:263647 lighttpd_busy_servers:2

but when trying to graph in cacti I get

7/17/2007 10:35:05 AM - CMDPHP: Poller[0] Host[26] DS[515] WARNING: Result from SERVER not valid. Partial Result: WARNING: Function do
07/17/2007 10:35:05 AM - PHPSVR: Poller[0] WARNING: Function does not exist


Top
 Profile  
 
 Post subject: Great!
PostPosted: Sat Jul 21, 2007 5:43 am 
Offline

Joined: Sat Jul 21, 2007 5:41 am
Posts: 2
Great work!

Thanks for this module, your instructions were clear and worked fine (thanks to the other users for asking questions too :D )


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 30, 2007 11:13 pm 
Offline

Joined: Sun May 27, 2007 2:13 am
Posts: 16
If you get it working well, can you tell us what you did different from us? :)

_________________
yqed.com (why queued) - my blog


Top
 Profile  
 
 Post subject: actually, it's broken :)
PostPosted: Mon Jul 30, 2007 11:22 pm 
Offline

Joined: Sat Jul 21, 2007 5:41 am
Posts: 2
good point! turns out i posted too soon!

the graphs turned up and i assumed they were waiting for data, but the data never comes ...

i do have the stats path enabled... and manual query on the command line works .. but the graphs never get any data on them. :( :( :(


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 18, 2007 5:35 am 
Offline

Joined: Thu Feb 08, 2007 2:16 am
Posts: 5
in my setup i just found out that script was at mode 600 as root owned, and if you've just placed it as is and let the cactiuser poller to run, it can't run it...

i just changed it with 644 and i hope it works.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 04, 2007 3:18 am 
Offline

Joined: Tue Nov 23, 2004 8:30 am
Posts: 10
How I can delete own post?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 06, 2008 2:38 pm 
Offline
User avatar

Joined: Wed Feb 06, 2008 2:33 pm
Posts: 1
Great work, thx.

Just one thing bugs me:

It's meant to be "kbytes/s" in your graph template, not "kbits/s", isn't it?
At least that ss_lighttpd_stats.php script returns "kbytes/s"

As everybody should know,
Code:
1kbit/s != 1kbyte/s


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 24, 2008 9:13 am 
Offline

Joined: Mon Feb 04, 2008 9:16 am
Posts: 35
Realize that this thread is a little older, but I had a question. Internal policy requires that our sites all use SSL connections. I believe this requirement is breaking the function of the script to gather stats.

If I connect via Firefox to the results page, I'm prompted by the SSL cert, but ultimately get the status page.

I reviewed the PHP script but it's not apparent to me where a change might be required. Any tips?

Thanks,
joey


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 15 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group