ApacheStats 0.6 (PHP Script Server Version)

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

Moderators: Developers, Moderators

User avatar
mahuani
Cacti User
Posts: 72
Joined: Tue Nov 01, 2005 2:10 pm
Location: Lafayette, LA
Contact:

ApacheStats 0.6 (PHP Script Server Version)

Post by mahuani »

This is an update to the the popular apachestats script by Rolf Poser. I promised The Witness i would convert the perl script to a SS version (php), so here is is. I'm still in the process of learning PHP, so if anyone has any suggestions, comments, etc.. the are most welcome.

Here is I believe the latest thread on the original script
http://forums.cacti.net/viewtopic.php?t=9861


There is a host template for a 5 min poller and a 30 sec poller in the zip file.

Fixed the PHP4 problem. So the script SHOULD work on both PHP4 and PHP5. I've tested on my servers but anyone who is willing to test it out please let me know of any problems.

Here are some screenshots.
Image
Image
Image
Image
Image
Image
Image
Attachments
ss_apache_stats.zip
This version doesn't use cURL, so if you don't have it compiled into PHP use this version. This .zip file doesn't contain the host template, script only.
(1.32 KiB) Downloaded 4150 times
SS_Apache_Stats.zip
ApacheStats 0.64. This version uses cURL so if you know you have it compiled into PHP use this version.
(23.56 KiB) Downloaded 6571 times
Last edited by mahuani on Sun Dec 17, 2006 4:55 pm, edited 6 times in total.
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Very Nice!!!

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Phyo
Posts: 1
Joined: Wed Nov 22, 2006 10:49 pm

Post by Phyo »

Cannot Import XML file. It saids XML parse error.
User avatar
mahuani
Cacti User
Posts: 72
Joined: Tue Nov 01, 2005 2:10 pm
Location: Lafayette, LA
Contact:

Post by mahuani »

Hum... I'm getting the same thing. I thought it might be because I changed the 30 second template to a 5 min template, but I get the parse error when I export it, then immediately try to re-import it. I'll try to look at it tonight, but I might not get any real time untill Friday morning.

:x
User avatar
mahuani
Cacti User
Posts: 72
Joined: Tue Nov 01, 2005 2:10 pm
Location: Lafayette, LA
Contact:

Post by mahuani »

Ok, I think I fixed it. I uploaded a new version to the intital post. Try to download it again.
xmtx
Posts: 4
Joined: Fri Nov 17, 2006 11:09 am

Post by xmtx »

im getting the same error with your "new" version: Error: XML parse error.
xmtx
Posts: 4
Joined: Fri Nov 17, 2006 11:09 am

Post by xmtx »

well if you are using Cacti - 0.8.6i i've found my failure...i'm using 0.8.6g :(

damn this script looks so nice...
marcmo
Posts: 27
Joined: Wed Sep 21, 2005 3:39 pm

Post by marcmo »

I also noticed a few instances of rrd_heartbead instead of rrd_heartbeat in the 5min xml file. Once I fixed these it imported fine.
User avatar
mahuani
Cacti User
Posts: 72
Joined: Tue Nov 01, 2005 2:10 pm
Location: Lafayette, LA
Contact:

Post by mahuani »

Yea, the import worked for me because I was using the 30 second template. I've fixed the five minute template, rrd_heartbead -> rrd_heartbeat, problem. New version on OP.

Is anyone having problems with the script itself?
User avatar
Pumpi
Cacti User
Posts: 259
Joined: Wed Jan 14, 2004 3:23 am
Location: Germany

Post by Pumpi »

mahuani,

it will be nice that you can share a version for PHP 4.x.

Pumpi
User avatar
mahuani
Cacti User
Posts: 72
Joined: Tue Nov 01, 2005 2:10 pm
Location: Lafayette, LA
Contact:

Post by mahuani »

The script should work with PHP4 and PHP5 now. I've updated the zip file so everyone can test away. It is working on one of my boxes, but since I'm not at work I'll wait till tomorrow to fully deploy it.

If anyone has any problems with it please let me know.
User avatar
mahuani
Cacti User
Posts: 72
Joined: Tue Nov 01, 2005 2:10 pm
Location: Lafayette, LA
Contact:

Post by mahuani »

That change I made last night had one small minor mistake in it :(. It has been fixed. I have it running in my PHP4 environment now, and it seems to be doing fine.
cray74
Posts: 4
Joined: Fri Dec 01, 2006 4:46 am

empty graphs

Post by cray74 »

Hi!

Accidentally posted my question as a new topic:

[http://forums.cacti.net/viewtopic.php?t=18203]

Any help would be appreciated.

P.S: how can I contact a moderator to move my posting to this thread?[/url]
User avatar
mahuani
Cacti User
Posts: 72
Joined: Tue Nov 01, 2005 2:10 pm
Location: Lafayette, LA
Contact:

Post by mahuani »

What happens if you run the script from the script server on the command line?

See the documentation [Testing your Script in the Script Server]

Code: Select all


Testing Your Script in the Script Server

To test your script in the script server, simply follow the instructions below. When you have finished you testing, simply type "quit" <cr< at the Script Server command line to exit the script server.

   1. Start the script server - You can do this by typing the following command:

      shell> php <path_cacti>/script_server.php

      NOTE: Due to a bug in Windows implementation of PHP, you must type the full path name to the script_server.php file.
   2. Type in your command - Using the example from above, you would type in the following:

      script server> <path_myfunction> my_function argument1 argument2 ...

      In the Windows environment, your example could be the following:

      script server> c:\wwwroot\cacti\scripts\ss_myfunction.php ss_myfunction localhost public 1 get duddle

   3. If your function is operating properly, you should get a result.

   4. To quit the script server, simply type "quit" <cr> at the command line.

NOTE: If there are errors in your script, you must restart the script server before your retest your code.
cray74
Posts: 4
Joined: Fri Dec 01, 2006 4:46 am

Post by cray74 »

from the CLI it works:
[root@eunbrwi03c scripts]# php ./ss_apache_stats.php eunbrux09.eun.org
apache_total_hits:5465153 apache_total_kbytes:40996177 apache_cpuload:.196092 thread_W:14 threadS:0 threadR:0 threadW:4 threadK:28 threadD:0 threadC:0 threadL:0 threadG:9 threadI:0 thread_O:201[root@eunbrwi03c scripts]#
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest