ApacheStats 0.8.2 (multiple RRD, Low hdd, Script Server)

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

Moderators: Developers, Moderators

Post Reply
ocoralan
Posts: 21
Joined: Mon Apr 25, 2011 7:38 pm

Re: ApacheStats 0.8.2 (multiple RRD, Low hdd, Script Server)

Post by ocoralan »

Oh, I solved this question by myself. Thank you.

But I met another question, all graphs work fine except the CPU load, there is no data on the graph. I manually execute the rrdtool command as the following:

Code: Select all

C:\rrdtool>rrdtool fetch c:\AppServ\www\netvisual\rra\apache_web_server_apache_cpuload_17.rrd AVERAGE
The result is:

Code: Select all

...
1306902600: nan
1306902900: nan
1306903200: nan
1306903500: 0.0000000000e+00
1306903800: nan
1306904100: nan
1306904400: nan
1306904700: nan
I had checked the log, it says:

Code: Select all

06/01/2011 01:17:01 PM - CMDPHP: Poller[0] Host[3] DS[17] WARNING: Result from SERVER not valid. Partial Result: U 
I donn't know what had happened? I hope somebody can help me.
My environment is cacti 0.8.7g + PA v2.8 on windows xp and the apache server is installed on the localhost.
laerg
Posts: 19
Joined: Sat Jul 02, 2005 7:12 pm

Re: ApacheStats 0.8.2 (multiple RRD, Low hdd, Script Server)

Post by laerg »

Hey RCK,

love your work on the apache stats ... I have had to make a change to the php script however, because my situation requires me to be able to attach a specific port to the "hostname" part. So I have <hostname> = <some_ip_or_host:some_port> ... this fails with file_get_contents, because it does a DNS lookup and times out obviously...

anyway, I've implemented libcurl native function, this will also allow defining proxies and many other things the file_get_contents hack can't do. Might be a good idea to implement it in following release :)

grtz & thnx
Gert
Attachments
gert_ss_apache_stats.txt
(4.47 KiB) Downloaded 761 times
catchvjay
Posts: 22
Joined: Tue May 17, 2011 11:39 am

Re: ApacheStats 0.8.2 (multiple RRD, Low hdd, Script Server)

Post by catchvjay »

Hi All,

I have apache (Compiled version 2.2.3) running on secure port 443. My cacti is not able to generate graphs for apache server. I am able to get webpage https://hostname/server-status. When i run php ss_apache_stats.php $host , i am getting all thread values zero.
I have applied suggetions given to use curl for ports other than 80 but with no effect.
Can anyone tell what should i do get this working? Do we need public key certificate to be copied to cacti from apache server?

Regards,
Vijay
rock100773
Posts: 11
Joined: Mon Apr 04, 2011 4:01 pm

Re: ApacheStats 0.8.2 (multiple RRD, Low hdd, Script Server)

Post by rock100773 »

rock100773 wrote:Hello,

Am running:
cacti version 0.8.7g
OS: CentOS release 5.2
PHP: PHP 5.1.6
--------
Am having issue with apache stats template!!
I was able to configure ApacheStats 0.6 (PHP Script Server Version) to use port 80 (http://hostname/server-status?auto)
Also am trying to use the same template for port 443 (https://hostname/server-status?auto)
The problem am facing is that, each time I tried to use "data template" and "data input method" are made for port 443, it fail to graph.
When i turn on the debug mode, everything came back ok
-----

This is the cacti php server script:
<path_cacti>/scripts/ss_https_apache_stats.php ss_apache_stats <hostname>

This is the error am receiving from log file:
"CMDPHP: Poller[0] ERROR: ApacheStats08 - Host parameter missing, can not continue"
-----------------
Example of the RRDTool from debug mode:

RRDTool Command:

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title='hostname port 443 - Apache Statistics - Bytes / Request' \
--base=1024 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label='bytes / hit' \
--slope-mode \
--font TITLE:9: \
--font AXIS:8: \
--font LEGEND:8: \
--font UNIT:8: \
DEF:a="/web/cacti/rra/hostname_port_443_apache_total_hits_21582.rrd":apache_total_kbytes:AVERAGE \
DEF:b="/web/cacti/rra/hostname_port_443_apache_total_hits_21582.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=cdefb,0,EQ,0,cdefa,1024,*,cdefb,/,IF,0,1000000,LIMIT \
CDEF:cdefg=a,0,0,LIMIT \
CDEF:cdefba=b,0,0,LIMIT \
\
\
AREA:cdefc#4123A1FF:"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#FF0000FF:"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#00FF00FF:"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" \
COMMENT:" based on ApacheStats v0.4 - Rolf Poser\n"
--------------------------------

As anyone use cacti apache stats for port 443 together with port 80 on same cacti ? Since there is no apache stats template for port 443, have search the internet could find any.

Any suggestion or comments will be appreciated.

Thanks
cacti user.


Report this post
This problem was fixed under cacti forum:
http://forums.cacti.net/viewtopic.php?f=21&t=42484

Thanks
rock1000773
linebacker2
Posts: 28
Joined: Fri May 08, 2009 11:34 am

Re: ApacheStats 0.8.2 (multiple RRD, Low hdd, Script Server)

Post by linebacker2 »

Ocoralan,

Did you ever get the CPU load working? I am having exactly the same issue. The rest of my graphs work perfectly. Any assistance would be greatly appreciated.
sharifu
Posts: 13
Joined: Mon Apr 16, 2012 10:08 am

Re: ApacheStats 0.8.2 (multiple RRD, Low hdd, Script Server)

Post by sharifu »

I have set this up but it is not working for me i am getting the following error in the log

Code: Select all

04/16/2012 04:09:32 PM - CMDPHP: Poller[0] Host[51] DS[1267] WARNING: Result from CMD not valid. Partial Result: U
04/16/2012 04:06:54 PM - CMDPHP: Poller[0] Host[52] DS[1282] WARNING: Result from SERVER not valid. Partial Result: U
04/16/2012 04:06:54 PM - CMDPHP: Poller[0] Host[52] DS[1281] WARNING: Result from SERVER not valid. Partial Result: U
04/16/2012 04:06:54 PM - CMDPHP: Poller[0] Host[52] DS[1277] WARNING: Result from SERVER not valid. Partial Result: U
04/16/2012 04:06:54 PM - CMDPHP: Poller[0] Host[52] DS[1276] WARNING: Result from SERVER not valid. Partial Result: U
04/16/2012 04:06:54 PM - CMDPHP: Poller[0] Host[52] DS[1275] WARNING: Result from SERVER not valid. Partial Result: 04/16/2012 04:06:54 


I have noticed in "data in put methods", the "input string is as follows"

Code: Select all

<path_cacti>/scripts/ss_apache_stats.php ss_apache_stats <hostname> cpuload
Shoudl that not be

Code: Select all

<path_php_binary> -q /scripts/ss_apache_stats.php <hostname> cpuload
Can anyone help
sharifu
Posts: 13
Joined: Mon Apr 16, 2012 10:08 am

Re: ApacheStats 0.8.2 (multiple RRD, Low hdd, Script Server)

Post by sharifu »

sharifu wrote:I have set this up but it is not working for me i am getting the following error in the log

Code: Select all

04/16/2012 04:09:32 PM - CMDPHP: Poller[0] Host[51] DS[1267] WARNING: Result from CMD not valid. Partial Result: U
04/16/2012 04:06:54 PM - CMDPHP: Poller[0] Host[52] DS[1282] WARNING: Result from SERVER not valid. Partial Result: U
04/16/2012 04:06:54 PM - CMDPHP: Poller[0] Host[52] DS[1281] WARNING: Result from SERVER not valid. Partial Result: U
04/16/2012 04:06:54 PM - CMDPHP: Poller[0] Host[52] DS[1277] WARNING: Result from SERVER not valid. Partial Result: U
04/16/2012 04:06:54 PM - CMDPHP: Poller[0] Host[52] DS[1276] WARNING: Result from SERVER not valid. Partial Result: U
04/16/2012 04:06:54 PM - CMDPHP: Poller[0] Host[52] DS[1275] WARNING: Result from SERVER not valid. Partial Result: 04/16/2012 04:06:54 


I have noticed in "data in put methods", the "input string is as follows"

Code: Select all

<path_cacti>/scripts/ss_apache_stats.php ss_apache_stats <hostname> cpuload
Should that not be

Code: Select all

<path_php_binary> -q /scripts/ss_apache_stats.php <hostname> cpuload
Can anyone help
jocvtrhythgd
Posts: 5
Joined: Mon Apr 23, 2012 8:55 pm

Re: ApacheStats 0.8.2 (multiple RRD, Low hdd, Script Server)

Post by jocvtrhythgd »

no way in hell thats right), anyway I'm going to make the edit and see how it works.
sharifu
Posts: 13
Joined: Mon Apr 16, 2012 10:08 am

Re: ApacheStats 0.8.2 (multiple RRD, Low hdd, Script Server)

Post by sharifu »

I have noticed since I am behind a proxy, you will need to set the proxy on the script or else it would not work.
stormonts
Cacti User
Posts: 349
Joined: Tue Mar 31, 2009 10:05 am

Re: ApacheStats 0.8.2 (multiple RRD, Low hdd, Script Server)

Post by stormonts »

I'm having the same issue with these templates that I was having with the .4 xml version from Gandalf. Does anyone know how to make the "Thread Details %" and "Bytes/hit" graphs to display non zeros on the first graph (it seems like it will show the correct values every other polling cycle)?

Link to other post with images is here: http://forums.cacti.net/viewtopic.php?p=228606#p228606
lbm
Posts: 29
Joined: Tue Nov 22, 2011 11:04 am

Re: Apache Stats graphing issue?

Post by lbm »

I was getting output like this below, (Lots of unwanted output stripped! )

Code: Select all

threads, output: thread_W:0 threadS:0 threadR:0 threadW:0 threadK:0 threadD:0 threadC:0 threadL:0 threadG:0 threadI:0 thread_O:0
workers, output: U
kbytes, output: U
hits, output: U
kbytes, output: U
hits, output: U
cpuload, output: U
But the below fixed it for me.
So just posting this, because it might be helpful for others!
Your cacti install looks perfect, but the php script is not able to grab the value from the 172.18.100.25 webpage.

For me it's one configuration problem into your apache.

You can check if the apache installation is giving you the server-status webpage on your cacti server with text browser like:
w3m http://172.18.100.25/server-status?auto
lynx http://172.18.100.25/server-status?auto

If you can't see the webpage, it's the apache fault on 172.18.100.25
- check if the mod_status is loaded
- check if you activate it in config file
Code:
<IfModule mod_status.c>
ExtendedStatus On
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from 127.0.0.1
Allow from your_cacti_ip_here
</Location>
</IfModule>
ILikeVoltron
Posts: 5
Joined: Wed Oct 19, 2011 12:44 pm

Re: ApacheStats 0.8.2 (multiple RRD, Low hdd, Script Server)

Post by ILikeVoltron »

I'm having a problem where the graphs have 'm' which I assume stands for million behind most of them.

Cacti 0.8.7h, PHP 5.1.6, host side: Apache/2.2.15
The output of server-status?auto

Code: Select all

Total Accesses: 515
Total kBytes: 1156
CPULoad: .0384304
Uptime: 12360
ReqPerSec: .0416667
BytesPerSec: 95.7722
BytesPerReq: 2298.53
BusyWorkers: 1
IdleWorkers: 9
Scoreboard: ___...__....._.._..__.W.......................................................................................................................
........
Anybody have any idea what's wrong with this?

See attached

Code: Select all

/usr/bin/php -q ./ss_apache_stats.php dev-web1-ip-address hits
apache_total_hits:4564
Edit: Some more info

Code: Select all


06/07/2012 01:04:49 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/cacti/rra/dev-web1_apache_cpuload_281.rrd --template apache_cpuload 1339092289:.0347801
06/07/2012 01:04:49 PM - CMDPHP: Poller[0] Host[23] DS[281] SERVER: /var/www/cacti/scripts/ss_apache_stats.php ss_apache_stats dev-web1.host.com cpuload, output: apache_cpuload:.0347801
06/07/2012 01:04:49 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/cacti/rra/dev-web1_apache_total_hits_282.rrd --template apache_total_hits 1339092289:227
06/07/2012 01:04:49 PM - PHPSVR: Poller[0] DEBUG: PID[4848] CTR[8] INC: 'ss_apache_stats.php' FUNC: 'ss_apache_stats' PARMS: 'dev-web1.host.com cpuload'
06/07/2012 01:04:49 PM - CMDPHP: Poller[0] Host[23] DS[282] SERVER: /var/www/cacti/scripts/ss_apache_stats.php ss_apache_stats dev-web1.host.com hits, output: apache_total_hits:227
06/07/2012 01:04:49 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/cacti/rra/dev-web1_apache_total_kbytes_283.rrd --template apache_total_kbytes 1339092289:60
06/07/2012 01:04:49 PM - PHPSVR: Poller[0] DEBUG: PID[4848] CTR[7] INC: 'ss_apache_stats.php' FUNC: 'ss_apache_stats' PARMS: 'dev-web1.host.com hits'
06/07/2012 01:04:49 PM - CMDPHP: Poller[0] Host[23] DS[283] SERVER: /var/www/cacti/scripts/ss_apache_stats.php ss_apache_stats dev-web1.host.com kbytes, output: apache_total_kbytes:60
06/07/2012 01:04:49 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/cacti/rra/dev-web1_threadc_285.rrd --template thread_W:threadS:threadR:threadW:threadK:threadD:threadC:threadL:threadG:threadI 1339092289:5:0:0:1:0:0:0:0:0:0
06/07/2012 01:04:49 PM - PHPSVR: Poller[0] DEBUG: PID[4848] CTR[6] INC: 'ss_apache_stats.php' FUNC: 'ss_apache_stats' PARMS: 'dev-web1.host.com kbytes'
06/07/2012 01:04:49 PM - CMDPHP: Poller[0] Host[23] DS[285] SERVER: /var/www/cacti/scripts/ss_apache_stats.php ss_apache_stats dev-web1.host.com threads, output: thread_W:5 threadS:0 threadR:0 threadW:1 threadK:0 threadD:0 threadC:0 threadL:0 threadG:0 threadI:0 thread_O:144
06/07/2012 01:04:49 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/cacti/rra/dev-web1_apache_idle_workers_284.rrd --template apache_busy_workers:apache_idle_workers 1339092289:1:5
06/07/2012 01:04:49 PM - PHPSVR: Poller[0] DEBUG: PID[4848] CTR[5] INC: 'ss_apache_stats.php' FUNC: 'ss_apache_stats' PARMS: 'dev-web1.host.com threads'
06/07/2012 01:04:49 PM - CMDPHP: Poller[0] Host[23] DS[284] SERVER: /var/www/cacti/scripts/ss_apache_stats.php ss_apache_stats dev-web1.host.com workers, output: apache_busy_workers:1 apache_idle_workers:5
06/07/2012 01:04:49 PM - PHPSVR: Poller[0] DEBUG: PID[4848] CTR[4] INC: 'ss_apache_stats.php' FUNC: 'ss_apache_stats' PARMS: 'dev-web1.host.com workers'
Attachments
graph_image.png
graph_image.png (21.3 KiB) Viewed 5910 times
stormonts
Cacti User
Posts: 349
Joined: Tue Mar 31, 2009 10:05 am

Re: ApacheStats 0.8.2 (multiple RRD, Low hdd, Script Server)

Post by stormonts »

I still am having the problem even with 0.8.8a where I see the data graphed correctly, but the values at the bottom of the graph are 0. Clicking on the graph to then see the various hourly versions of that graph does correctly show the values. How do we make the graphs display the correct values when just viewing the main graphs in Cacti? This happens on the "Bytes/Hit" graphs as well as the "Thread Details %" graphs.

What we see in the main tree view in Cacti:
main.jpg
main.jpg (70.71 KiB) Viewed 5357 times
What we then see when we click on that graph:
clicked.jpg
clicked.jpg (63.73 KiB) Viewed 5357 times
JJX
Cacti User
Posts: 402
Joined: Thu Oct 06, 2005 5:03 am

Re: ApacheStats 0.8.2 (multiple RRD, Low hdd, Script Server)

Post by JJX »

This seems to be the most fresh topic regarding apache stats.
After importing the graphs, "Hits/s" and "kbits/s" doesn't seem to work!

Script runs ok as root and cacti user:
php ss_apache_stats.php 10.10.11.21 threads
thread_W:17 threadS:0 threadR:0 threadW:1 threadK:0 threadD:0 threadC:0 threadL:0 threadG:0 threadI:0 thread_O:238

php ss_apache_stats.php 10.10.11.21 hits
apache_total_hits:657034

php ss_apache_stats.php 10.10.11.21 kbytes
apache_total_kbytes:7144701
"thread details" & "CPU usage" work fine.

However, ""Hits/s" and "kbits/s" graphs are always "0"

* Data Templates --> ApacheStats08 - Total Hits --> ApacheStats08 - Total Hits --> "0"
I changed to zero because some values where higher than default value 500
Is that ok or not ?

* thread_O:238 --> This data source item doesn't exist . Should exist? Its absence can cause any problem?


Any ideas why graphs appear with zero values?
Thank you
cacti rulez!
JJX
Cacti User
Posts: 402
Joined: Thu Oct 06, 2005 5:03 am

Re: ApacheStats 0.8.2 (multiple RRD, Low hdd, Script Server)

Post by JJX »

The above problem was solved following these steps:

* Delete non working apache graphs

* Go to Data Sources --> RRAs . Create a new copy of "Daily (5 Minute Average)" . I named it "Daily (5 Minute Average) AVG""
Same values but select ONLY average!

* Go to graph template, and select only the new RRA "Daily (5 Minute Average) AVG"". Save

* Create the graphs

* Allow poller to run twice and verify that graphs collect data. Great!

* Go back to Data Sources --> RRAs and select Weekly, Monthly and Yearly RRA

* Done :-)
cacti rulez!
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests