lighttpd Statistics - 1.0

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

User avatar
Mooch
Posts: 5
Joined: Sun Feb 11, 2007 9:43 am

lighttpd Statistics - 1.0

Post by Mooch »

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 3972 times
TECK
Posts: 16
Joined: Sun May 27, 2007 2:13 am

Post by TECK »

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: Select all

php /usr/lib/cacti/scripts/ss_lighttpd_stats.php localhost
nothing is returned.

If I do:

Code: Select all

php /usr/lib/cacti/scripts/ss_fping.php localhost
I get:

Code: Select all

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.
User avatar
Mooch
Posts: 5
Joined: Sun Feb 11, 2007 9:43 am

Post by Mooch »

Hi Teck,

Sorry about my delay, I was quite busy lately :cry:
TECK wrote: When I do:

Code: Select all

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: Select all

server.modules += ("mod_status")
status.status-url = "/server-status"
Greetz,
Matthias
TECK
Posts: 16
Joined: Sun May 27, 2007 2:13 am

Post by TECK »

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.
User avatar
Mooch
Posts: 5
Joined: Sun Feb 11, 2007 9:43 am

Post by Mooch »

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: Select all

$HTTP["remoteip"] == "127.0.0.0/8" {
  status.status-url = "/server-status"
}
TECK
Posts: 16
Joined: Sun May 27, 2007 2:13 am

Post by TECK »

Thanks for the info mOo.
However, I encountered the cacti bug for empty comments:
http://bugs.cacti.net/view.php?id=938

Code: Select all

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: Select all

/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?
ykanello
Posts: 2
Joined: Thu Jul 05, 2007 5:13 am
Location: Amsterdam
Contact:

error while importing the template

Post by ykanello »

Error: XML: Hash version does not exist.

I get this when I try to import the template.
any ideas?
loke
Posts: 8
Joined: Tue Jul 17, 2007 5:32 am

Post by loke »

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
the_other_user
Posts: 2
Joined: Sat Jul 21, 2007 5:41 am

Great!

Post by the_other_user »

Great work!

Thanks for this module, your instructions were clear and worked fine (thanks to the other users for asking questions too :D )
TECK
Posts: 16
Joined: Sun May 27, 2007 2:13 am

Post by TECK »

If you get it working well, can you tell us what you did different from us? :)
the_other_user
Posts: 2
Joined: Sat Jul 21, 2007 5:41 am

actually, it's broken :)

Post by the_other_user »

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. :( :( :(
sithgunner
Posts: 5
Joined: Thu Feb 08, 2007 2:16 am

Post by sithgunner »

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.
alekiv
Posts: 10
Joined: Tue Nov 23, 2004 8:30 am

Post by alekiv »

How I can delete own post?
User avatar
drbloed
Posts: 1
Joined: Wed Feb 06, 2008 2:33 pm
Contact:

Post by drbloed »

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: Select all

1kbit/s != 1kbyte/s
jofficer
Posts: 35
Joined: Mon Feb 04, 2008 9:16 am

Post by jofficer »

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
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests