Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


lighttpd Statistics - 1.0
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates
Author Message
Mooch



Joined: 11 Feb 2007
Posts: 5

PostPosted: Tue Feb 13, 2007 5:28 pm    Post subject: lighttpd Statistics - 1.0 Reply with quote

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



lighttpd_stats_1.0.tar.gz
 Description:

Download
 Filename:  lighttpd_stats_1.0.tar.gz
 Filesize:  13.5 KB
 Downloaded:  1040 Time(s)

Back to top
TECK



Joined: 27 May 2007
Posts: 13

PostPosted: Sat Jun 02, 2007 8:34 pm    Post subject: Reply with quote

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.
Back to top
Mooch



Joined: 11 Feb 2007
Posts: 5

PostPosted: Thu Jun 21, 2007 9:26 am    Post subject: Reply with quote

Hi Teck,

Sorry about my delay, I was quite busy lately

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
Back to top
TECK



Joined: 27 May 2007
Posts: 13

PostPosted: Thu Jun 21, 2007 8:32 pm    Post subject: Reply with quote

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.
Back to top
Mooch



Joined: 11 Feb 2007
Posts: 5

PostPosted: Fri Jun 22, 2007 1:34 am    Post subject: Reply with quote

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"
}
Back to top
TECK



Joined: 27 May 2007
Posts: 13

PostPosted: Mon Jun 25, 2007 11:04 am    Post subject: Reply with quote

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?
Back to top
ykanello



Joined: 05 Jul 2007
Posts: 1
Location: Amsterdam

PostPosted: Thu Jul 05, 2007 5:14 am    Post subject: error while importing the template Reply with quote

Error: XML: Hash version does not exist.

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



Joined: 17 Jul 2007
Posts: 8

PostPosted: Tue Jul 17, 2007 5:37 am    Post subject: Reply with quote

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
Back to top
the_other_user



Joined: 21 Jul 2007
Posts: 2

PostPosted: Sat Jul 21, 2007 5:43 am    Post subject: Great! Reply with quote

Great work!

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



Joined: 27 May 2007
Posts: 13

PostPosted: Mon Jul 30, 2007 11:13 pm    Post subject: Reply with quote

If you get it working well, can you tell us what you did different from us?
Back to top
the_other_user



Joined: 21 Jul 2007
Posts: 2

PostPosted: Mon Jul 30, 2007 11:22 pm    Post subject: actually, it's broken :) Reply with quote

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.
Back to top
sithgunner



Joined: 08 Feb 2007
Posts: 5

PostPosted: Tue Sep 18, 2007 5:35 am    Post subject: Reply with quote

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.
Back to top
alekiv



Joined: 23 Nov 2004
Posts: 10

PostPosted: Thu Oct 04, 2007 3:18 am    Post subject: Reply with quote

How I can delete own post?
Back to top
drbloed



Joined: 06 Feb 2008
Posts: 1

PostPosted: Wed Feb 06, 2008 2:38 pm    Post subject: Reply with quote

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
Back to top
jofficer



Joined: 04 Feb 2008
Posts: 33

PostPosted: Mon Mar 24, 2008 9:13 am    Post subject: Reply with quote

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
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 



Powered by phpBB © 2001, 2005 phpBB Group