Graph Poller Times.

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

Moderators: Developers, Moderators

byrons
Posts: 17
Joined: Thu Jan 27, 2005 6:30 am
Contact:

Graph Poller Times.

Post by byrons »

Hi all, if this has been done before, sorry, I couldn’t find it.

I take no responsibility for this ‘hack’. USE AT YOUR OWN RISK.

Open Poller.php

Find Line 171

Paste the code below.


Code: Select all

/* Graph Polling Times */
$time = fopen('scripts/pollertime.txt', 'w');
fwrite($time, round($end-$start,4));
fclose($time);


Next

Copy Pollertime.php into the scripts/ directory.

Data Input Method:

Click Add

Name: Cacti Poller Time
Type: Script/Command
String: <path_php_binary> -q <path_cacti>/scripts/pollertime.php <path_cacti>/scripts/pollertime.txt

Click Create

Add Output Fields

Click Add

Field [Output]: time
Friendly Name: seconds
Output Fields: checked

Create

Data Sources:

Click Add
Leave both on NONE
Click Create

Data Source Name: Cacti Poller Time
Data Input Method: Select Cacti Poller Time

Internal Data Source Name: time

Click Create and then click save

Graph Management:

Click Add
Leave both on NONE
Click Create

Title: Cacti Poller Time

Create

Graph Items:

Click Add

Data Source: select ‘No Host – Cacti Poller Time (time)
Colour: select one
Graph Item type: Area

Click Create

All done.

If anyone knows of a better way to do this, it would be good to see. Also, not sure of performance issues regarding adding code to poller.php.

Cheers
Byron

EDIT: Thanks to Phil a.k.a pvd for the graph template.

import it for 086d
go into the data input method and set YOUR paths up.
select a device (localhost)
add a specific graph

Attachments
cacti_graph_template_local_poller_time.xml
graph template for pollertime done by pvd
(5.73 KiB) Downloaded 544 times
pollertime.zip
Pollertime.zip
(232 Bytes) Downloaded 477 times
The Graph
The Graph
graph.jpg (229.33 KiB) Viewed 10928 times
Last edited by byrons on Thu Jun 09, 2005 4:57 am, edited 5 times in total.
ihweb
Posts: 2
Joined: Sat Feb 05, 2005 4:41 am

Post by ihweb »

Ok,thanks !!
byrons
Posts: 17
Joined: Thu Jan 27, 2005 6:30 am
Contact:

Post by byrons »

That's wierd, I thought it was a pretty useful graph. Only 14 downloads. :oops:

Anyway, thanks ihweb :p
vtmgr
Posts: 27
Joined: Wed Aug 11, 2004 2:23 pm
Location: Vermont, USA

pollertime

Post by vtmgr »

Works swell. 'twould be sweller if it would show me that nice "fire effect" and (particularly) the last/average/max numbers, tho...

I suppose I could figure it out, but it looks like you already did, so I thought I could be lazy.

Thanks!
Cacti 0.8.6f
CMD
MySQL 4.0.20
Net-SNMP 5.1.1
IIS 6
PHP 5.0.2
RRDtool 1.2.10
Windows 2003 Server
byrons
Posts: 17
Joined: Thu Jan 27, 2005 6:30 am
Contact:

Post by byrons »

I borrowed the fired effect from this http://forums.cacti.net/about6039.html
henryd31
Posts: 30
Joined: Wed Apr 13, 2005 3:11 pm

Graphing poller

Post by henryd31 »

Hi, this is real cool. I am not able to get this working, not sure if the placement of the code I paste to the poller.php is the issue, it would seem so, I get following errors when running the code manually:

PHP Warning: fopen(scripts/pollertime.txt): failed to open stream: No such file or directory in /var/www/html/cacti/poller.php on line 172
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/html/cacti/poller.php on line 173
PHP Warning: fclose(): supplied argument is not a valid stream resource in /var/www/html/cacti/poller.php on line 174

but the pollertime.txt does exist...

running 0.8.6c
dbdg
Posts: 1
Joined: Mon Apr 18, 2005 12:38 am
Location: Russia

Re: Graphing poller

Post by dbdg »

henryd31 wrote:Hi, this is real cool. I am not able to get this working, not sure if the placement of the code I paste to the poller.php is the issue, it would seem so, I get following errors when running the code manually:

PHP Warning: fopen(scripts/pollertime.txt): failed to open stream: No such file or directory in /var/www/html/cacti/poller.php on line 172
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/html/cacti/poller.php on line 173
PHP Warning: fclose(): supplied argument is not a valid stream resource in /var/www/html/cacti/poller.php on line 174

but the pollertime.txt does exist...

running 0.8.6c
may be full path requied?
I add this in poller.php :

Code: Select all

$olddir=getcwd();
chdir('/usr/local/www/cacti/scripts');
$time = fopen('pollertime.txt', 'w'); 
fwrite($time, round($end-$start,4)); 
fclose($time);
chdir($olddir);
User avatar
TheWitness
Developer
Posts: 16997
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Other than I don't like it going into the scripts directory, this is quite cool. The power of Cacti and it's user group is awsome!

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?
mgb
Cacti User
Posts: 124
Joined: Mon Jun 21, 2004 4:06 am
Location: North of the Netherlands

Post by mgb »

Works great. Is this something that will be build into the next cacti version. It would be a great addition for fault finding and to check the speed of the program.

Great work!
User avatar
TheWitness
Developer
Posts: 16997
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

I had not considered this as the method. What we are going to do is save this information in the MySQL database and then create a template the pulls the information using a data input method call SQL Call or something like it. So, it is effectively the same thing.

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?
mgb
Cacti User
Posts: 124
Joined: Mon Jun 21, 2004 4:06 am
Location: North of the Netherlands

Post by mgb »

Just liked the simplicity of the solution
:wink:

Michael
User avatar
TheWitness
Developer
Posts: 16997
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Me too. It will continue to work in future versions.
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?
henryd31
Posts: 30
Joined: Wed Apr 13, 2005 3:11 pm

Re: Graphing poller

Post by henryd31 »

I did apply the change you suggested and I'm not seeing the error
anymore when running the script manually. But the rrd and the graphs are still not being created..

help :-(
may be full path requied?
I add this in poller.php :

Code: Select all

$olddir=getcwd();
chdir('/usr/local/www/cacti/scripts');
$time = fopen('pollertime.txt', 'w'); 
fwrite($time, round($end-$start,4)); 
fclose($time);
chdir($olddir);
pvd
Posts: 30
Joined: Sat Aug 09, 2003 3:02 pm

Post by pvd »

Small tip - I needed to create the pollertime.txt file

cd ~cacti/scripts ( or whever it is )
touch pollertime.txt
chown cacti pollertime.txt
Phil
pvd
Posts: 30
Joined: Sat Aug 09, 2003 3:02 pm

Post by pvd »

If you want to save yourself some typeing here is a graph template for pollertime.

import it for 086d
go into the data input method and set YOUR paths up.
select a device (localhost)
add a specific graph
Attachments
cacti_graph_template_local_poller_time.xml
graph template for pollertime
(5.73 KiB) Downloaded 449 times
Phil
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests