[XML] successor to apachestats 0.4

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

Moderators: Developers, Moderators

Post Reply
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Again, all DEF statements are missing. They refer to the datasources that should be graphed. Please check your Graph Template (or try to re-import again; some people reported that this solved their problems; should not be needed, but no error has been discovered yet)
Reinhard
soulshepard
Posts: 9
Joined: Fri Feb 09, 2007 8:20 am

Post by soulshepard »

gandalf wrote:
pyoung wrote:How did you pare down the script so it's not storing duplicated RRD data?
Well, to be honest, it DOES create all that duplicate rrd's if you create all graphs from the device screen.
You may do so and AFTERWARDS change the references to these rrd's from the Data Source list. Then you may delete the obsolete rrd's.
OR, you create only ONE of the graphs from the device screen. The others must be created from the Graph Management screen (not remembering exactly, no cacti installation here at the moment). There you may refer to the Graph Template AND define the rrd file manually (if I'm mistaken, it must have been the [/b]Data Source screen instead).
AFAIK there's no option to do this automatically
Reinhard
but will there be one in the future?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

I've heard of it, but this will definitively be left to the core developers.
Reinhard
overclokkato
Posts: 5
Joined: Thu Oct 19, 2006 2:33 am

Problem Apache Graphs

Post by overclokkato »

Hi,
i solved this problem enabling mod_status on apache ( http://httpd.apache.org/docs/2.0/mod/mod_status.html )
Insert this code in httpd.conf:
LoadModule status_module /usr/lib/apache2/mod_status.so
<Location /server-status>
SetHandler server-status
Order Deny,Allow
Allow from all
</Location>
ExtendedStatus On

restart Apache and then try : http://yourWebServer/server-status
Bye Bye
Simone
overclokkato
Posts: 5
Joined: Thu Oct 19, 2006 2:33 am

Problem Apache Graphs

Post by overclokkato »

Hi,
i solved this problem enabling mod_status on apache ( http://httpd.apache.org/docs/2.0/mod/mod_status.html )
Insert this code in httpd.conf:
LoadModule status_module /usr/lib/apache2/mod_status.so
<Location /server-status>
SetHandler server-status
Order Deny,Allow
Allow from all
</Location>
ExtendedStatus On

restart Apache and then try : http://yourWebServer/server-status
Bye Bye
Simone
joedunn
Posts: 9
Joined: Mon Jan 29, 2007 3:34 pm

Post by joedunn »

Is this template/script meant to work with Version 0.8.6j
wtb1
Posts: 47
Joined: Thu May 03, 2007 8:11 am

Problems getting web stats

Post by wtb1 »

I have been trying to get apachestats to work for me but have an issue. When running the scripts from command I get errors posted in the first screen shot. When I go to a browser and go to http://localhost/server-status I get the second screen shot . Any thoughts?
Attachments
webstats.JPG
webstats.JPG (76.86 KiB) Viewed 13862 times
apacheerror.JPG
apacheerror.JPG (60.58 KiB) Viewed 13862 times
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

I came across this lately. I will have to revisit my solution, please stay tuned
Reinhard
cksrealm
Cacti User
Posts: 140
Joined: Sun May 08, 2005 5:45 pm
Location: Sydney,Australia
Contact:

Post by cksrealm »

Hi all, I am trying to get this working as well and run into some problems as a few of your seem to have had. When I run the script from the CLI I get

Use of uninitialized value in concatenation (.) or string at ./ws_apachestats.pl line 63.
Use of uninitialized value in concatenation (.) or string at ./ws_apachestats.pl line 65.
Use of uninitialized value in concatenation (.) or string at ./ws_apachestats.pl line 67.
Use of uninitialized value in concatenation (.) or string at ./ws_apachestats.pl line 69.
Use of uninitialized value in split at ./ws_apachestats.pl line 89.
Use of uninitialized value in concatenation (.) or string at ./ws_apachestats.pl line 103.
apache_total_hits: apache_total_kbytes: apache_busy_workers: apache_idle_workers: thread_O:0 threadC:0 threadD:0 threadG:0 threadI:0 threadK:0 threadL:0 threadR:0 threadS:0 threadW:0 thread_W:0 apache_cpuload:viper:/var/www/cacti/scripts#

One thing I will add is that this server is only listening on port 443 (https) when I browse to https://server/server-status?auto all I get is a 404 not found error, the modules have been set in the httpd.conf file to load so cant see any issues there, anyone got this working on a server running https at all?

Thanks

CK
cksrealm
Cacti User
Posts: 140
Joined: Sun May 08, 2005 5:45 pm
Location: Sydney,Australia
Contact:

Post by cksrealm »

Ok I sorted it out to a point I can now access https://server/server-status? without any problems , however when I run the script from the command line I am still getting.

Use of uninitialized value in concatenation (.) or string at ./ws_apachestats.pl line 63.
Use of uninitialized value in concatenation (.) or string at ./ws_apachestats.pl line 65.
Use of uninitialized value in concatenation (.) or string at ./ws_apachestats.pl line 67.
Use of uninitialized value in concatenation (.) or string at ./ws_apachestats.pl line 69.


Is there something I can/need to edit in the script to get it to use https rather than http?

Thanks

CK
opus
Posts: 1
Joined: Wed Jun 13, 2007 2:56 pm
Location: Slovakia
Contact:

Error = Localhost - Apache Statistics - Hits / s

Post by opus »

After succesful xml import I am trying to create graph "Localhost - Apache Statistics - Hits / s" with error:

RRDTool Command:

/usr/local/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="Localhost - Apache Statistics - Hits / s" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="Hits/sec" \
--slope-mode \
AREA:#AAABA1:"Hits/sec" \
GPRINT::LAST:"Current\:%8.2lf %s" \
GPRINT::AVERAGE:"Average\:%8.2lf %s" \
GPRINT::MAX:"Maximum\:%8.2lf %s\n" \
COMMENT:" Represents the number of hits per second\n" \
COMMENT:" ApacheStats v0.4 - Rolf Poser\n"

RRDTool Says:

ERROR: parameter '#AAABA1' does not represent a number in line AREA:#AAABA1:Hits/sec


what's wrong?

Thread Details Graph:
RRDTool Command:

/usr/local/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="Localhost - Apache Statistics - Thread Details" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="number of threads" \
--slope-mode \
CDEF:cdefi= \
AREA:#FF0000:"Busy" \
GPRINT::LAST:" Current\:%8.0lf" \
GPRINT::AVERAGE:"Average\:%8.0lf" \
GPRINT::MAX:"Maximum\:%8.0lf\n" \
AREA:#4444FF:"Idle":STACK \
GPRINT::LAST:" Current\:%8.0lf" \
GPRINT::AVERAGE:"Average\:%8.0lf" \
GPRINT::MAX:"Maximum\:%8.0lf\n" \
LINE1:cdefi#000000:"Total" \
GPRINT:cdefi:LAST:"Current\:%8.0lf" \
GPRINT:cdefi:AVERAGE:"Average\:%8.0lf" \
GPRINT:cdefi:MAX:"Maximum\:%8.0lf\n" \
COMMENT:" Represents the number of busy and idle threads\n" \
COMMENT:" ApacheStats v0.4 - Rolf Poser\n"

RRDTool Says:

Segmentation fault



Other graphs work ok, please help.
etn
Posts: 8
Joined: Mon Feb 13, 2006 4:32 am

Post by etn »

Hello,

I'm a new user of this fantastic template and i discover a small 'bug'.

Indeed, it appears that if your apache has no request, the CPULoad var doesn't exists in the server-status?auto url:

Code: Select all

Total Accesses: 180161
Total kBytes: 50907
Uptime: 27832
ReqPerSec: 6.47316
BytesPerSec: 1872.98
BytesPerReq: 289.345
BusyWorkers: 5
IdleWorkers: 49
Scoreboard: ____CK_______C__________W________C____________________
.................................................................................................
..................................................................................................
.......
In this case, result of ws_apachestats.pl is like that :

apache_total_hits:180161 apache_total_kbytes:50907 apache_busy_workers:5 apache_idle_workers:49 thread_O:202 threadC:3 threadD:0 threadG:0 threadI:0 threadK:1 threadL:0 threadR:0 threadS:0 threadW:1 thread_W:49 apache_cpuload:____CK_______C__________W________C___________
_________..........................................................................................
.........................................................................................................
.......

in order to return a 0 value for the CPULoad in this precise case, i modify the script, i replace the line:

Code: Select all

# added CPULoad
$output =~ /CPULoad.*: (.*)/;
$out .= "apache_cpuload:".$1;
By :

Code: Select all

# added CPULoad
$output =~ /CPULoad.*: (.*)/;
if(substr($1,1,1) ne ".")
{
        $out .= "apache_cpuload:0";
}else
{
        $out .= "apache_cpuload:".$1;
}
I want your opinion about this hack, i don't know if it's better to return .0 or 0 when CPULoad is null.

Etn
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

cksrealm wrote:Ok I sorted it out to a point I can now access https://server/server-status? without any problems , however when I run the script from the command line I am still getting.

Use of uninitialized value in concatenation (.) or string at ./ws_apachestats.pl line 63.
Use of uninitialized value in concatenation (.) or string at ./ws_apachestats.pl line 65.
Use of uninitialized value in concatenation (.) or string at ./ws_apachestats.pl line 67.
Use of uninitialized value in concatenation (.) or string at ./ws_apachestats.pl line 69.


Is there something I can/need to edit in the script to get it to use https rather than http?

Thanks

CK
I posted a modified script to the original posting. Please try http://forums.cacti.net/viewtopic.php?p=44950#44950
Reinhard
paul-lmi
Posts: 13
Joined: Sun Aug 26, 2007 7:29 pm

Post by paul-lmi »

I'm having issues with a few specific graphs.

RRDTool 1.2.23
Cacti is the newest avail. as of 8/25/07

Bytes / request is a broken image.

Debug on the graphs shows:

Code: Select all

RRDTool Command:

/usr/local/rrdtool-1.2.23/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="httpd - Bytes / Request" \
--base=1024 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="bytes / hit" \
--slope-mode \
DEF:a="/var/www/html/cacti/rra/localhost_apache_cpuload_8.rrd":apache_total_kbytes:AVERAGE \
DEF:b="/var/www/html/cacti/rra/localhost_apache_cpuload_8.rrd":apache_total_hits:AVERAGE \
CDEF:cdefa=cdefb,0,EQ,0,cdefa,1024,*,cdefb,/,IF,0,1000000,LIMIT \
CDEF:cdefe=a,0,0,LIMIT \
CDEF:cdefi=b,0,0,LIMIT \
AREA:cdefa#4123A1:"Bytes / Request"  \
GPRINT:cdefa:LAST:"Current\:%8.2lf %s"  \
GPRINT:cdefa:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:cdefa:MAX:"Maximum\:%8.2lf %s\n"  \
LINE2:cdefe#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:cdefi#00FF00:"Hits"  \
GPRINT:b:LAST:"           Current\:%8.2lf %s"  \
GPRINT:b:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:b:MAX:"Maximum\:%8.2lf %s\n"  \
COMMENT:"                            Represents the number of bytes per hit\n" 

RRDTool Says:

ERROR: invalid rpn expression in: cdefb,0,EQ,0,cdefa,1024,*,cdefb,/,IF,0,1000000,LIMIT
Hits / s is a broken image

Debug of graph shows:

Code: Select all

RRDTool Command:

/usr/local/rrdtool-1.2.23/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="httpd - Hits / s" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="Hits/sec" \
--slope-mode \
AREA:#AAABA1:"Hits/sec"  \
GPRINT::LAST:"Current\:%8.2lf %s"  \
GPRINT::AVERAGE:"Average\:%8.2lf %s"  \
GPRINT::MAX:"Maximum\:%8.2lf %s\n"  \
COMMENT:"                            Represents the number of hits per second\n"  \
COMMENT:"                                 ApacheStats v0.4 - Rolf Poser\n" 

RRDTool Says:

ERROR: parameter '#AAABA1' does not represent a number in line AREA:#AAABA1:Hits/sec
Thread Details % is a broken image

Graph debug shows:

Code: Select all

 RRDTool Command:

/usr/local/rrdtool-1.2.23/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="httpd - Thread Details (%)" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="number of threads" \
--slope-mode \
DEF:a="/var/www/html/cacti/rra/localhost_apache_cpuload_8.rrd":apache_busy_workers:AVERAGE \
DEF:b="/var/www/html/cacti/rra/localhost_apache_cpuload_8.rrd":apache_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=cdefa,cdefb,+ \
CDEF:cdefd=cdefc,0,EQ,0,cdefa,100,*,cdefc,/,IF,0,110,LIMIT \
CDEF:cdefh=cdefc,0,EQ,0,cdefb,100,*,cdefc,/,IF,0,110,LIMIT \
CDEF:cdefbe=a,0,0,LIMIT \
CDEF:cdefbf=b,0,0,LIMIT \
COMMENT:"-\n"  \
COMMENT:"-\n"  \
COMMENT:"-\n"  \
AREA:cdefd#FF0000:"Busy"  \
GPRINT:cdefd:LAST:"        Current\:%8.0lf"  \
GPRINT:cdefd:AVERAGE:"Average\:%8.0lf"  \
GPRINT:cdefd:MAX:"Maximum\:%8.0lf\n"  \
AREA:cdefh#4444FF:"Idle":STACK \
GPRINT:cdefh:LAST:"        Current\:%8.0lf"  \
GPRINT:cdefh:AVERAGE:"Average\:%8.0lf"  \
GPRINT:cdefh:MAX:"Maximum\:%8.0lf\n"  \
GPRINT:cdefc:LAST:"Total Number of threads \:%8.0lf"  \
GPRINT:cdefc:AVERAGE:"Average\:%8.0lf"  \
GPRINT:cdefc:MAX:"Maximum\:%8.0lf\n"  \
COMMENT:""  \
COMMENT:"\n"  \
COMMENT:"           Represents the number of busy threads as a % of total number of threads\n"  \
COMMENT:"                             based on ApacheStats v0.4 - Rolf Poser\n" 

RRDTool Says:

ERROR: Expected some arguments after 'COMMENT:'
if i remove the comments from the template, it's a similar error as above.

Thread Details is a broken image

The debug shows:

Code: Select all

RRDTool Command:

/usr/local/rrdtool-1.2.23/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="httpd - Thread Details" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="number of threads" \
--slope-mode \
CDEF:cdefi= \
AREA:#FF0000:"Busy"  \
GPRINT::LAST:" Current\:%8.0lf"  \
GPRINT::AVERAGE:"Average\:%8.0lf"  \
GPRINT::MAX:"Maximum\:%8.0lf\n"  \
AREA:#4444FF:"Idle":STACK \
GPRINT::LAST:" Current\:%8.0lf"  \
GPRINT::AVERAGE:"Average\:%8.0lf"  \
GPRINT::MAX:"Maximum\:%8.0lf\n"  \
LINE1:cdefi#000000:"Total"  \
GPRINT:cdefi:LAST:"Current\:%8.0lf"  \
GPRINT:cdefi:AVERAGE:"Average\:%8.0lf"  \
GPRINT:cdefi:MAX:"Maximum\:%8.0lf\n"  \
COMMENT:"                        Represents the number of busy and idle threads\n"  \
COMMENT:"                                 ApacheStats v0.4 - Rolf Poser\n" 

RRDTool Says:
weird that is doesn't return anything


what i've tried:
*removing all traces of the template and script, and reuploading.
*ensuring the RRDTool setting was on 1.2.x in the settings (this fixed the time based graphs issue i had)
*running the script from the terminal, no errors.

I also noticed a discrepancy in the Kbytes / s template. It refers to bytes in the template, but bits in the graph by default. Which one should it be?

i'm at a total loss here. i'll admit perl isn't my strong point and i'm new to this package in general, but i'm throwing the white flag for some help here. :)

edit, fixed hits/s graph. apparantly the graph template didn't have the CDEF function defined for each line. I changed it to Total All Data Sources for each of the 3 lines, and then fixed the data source entry in the Graph's config to point to the total hits data source.
JohnneyBoy
Posts: 7
Joined: Fri Aug 24, 2007 9:30 am

Post by JohnneyBoy »

Hello,

Any chance of publishing the fixed xml?

John
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests