EDIT: Advanced Ping Template Version 1.3 for Cacti 0.8.6g

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

Moderators: Developers, Moderators

Post Reply
User avatar
TheWitness
Developer
Posts: 16863
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

EDIT: Advanced Ping Template Version 1.3 for Cacti 0.8.6g

Post by TheWitness »

All,

With the release of 0.8.6i, the ping.php is not longer required. I am removing.

TheWitness

________________________________________________

All,

I have revised the Advanced Ping Template to version 1.3. In this new version, I have added the following:

1) Ability to ping using either ICMP, TCP, or UDP protocols
2) Ability to choose the port number to ping (TCP, UDP)
3) Improved timeout logic so that you don't get gaps in your graph when a host in not available.
4) Improved Ping.php by using socket_select call whose timeout syntax is consistent between various PHP OS platforms
5) Cleaned up the Template that was causing issues with graph performance

In order to use this template properly, you will need to use the attached/updated files in addition to importing the new version of the template. Your prior template will be overwritten. So, make a backup of your database first.

I would also like to acknowledge Predou, the original author of the Ping template, who provided the inspiration for the whole thing. It appears through all the thousands of posts I have read and reviewed, I loose track of who posted what and where. Here is his original post: http://forums.cacti.net/viewtopic.php?t=7090

Regards,

TheWitness

Edit:
this post deep into the thread contains v2.2 which has been updated for 0.8.7 (BSOD2600)
Attachments
cacti_graph_template_ping_advanced_ping_v1_3.zip
(5.49 KiB) Downloaded 48578 times
ss_fping.zip
(1.1 KiB) Downloaded 42024 times
Last edited by TheWitness on Mon Aug 11, 2008 8:10 pm, edited 2 times in total.
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?
User avatar
N3NCY
Cacti User
Posts: 260
Joined: Thu Sep 22, 2005 7:50 pm
Location: Landenberg, PA
Contact:

NEW Advanced Ping Template Version 1.3 for Cacti 0.8.6g

Post by N3NCY »

hmm, I don't get any data in my graphs.
Do I need to add a line to my crontab to call the ping.php or ss_ping.php or something?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

TheWitness,
thank you for this next version of Advanced Ping.
I'd like to add a few words about installing this for those, who do not remember the original post.
- download and unpack ping.zip to <path_cacti>/lib/ping.php
- download and unpack ss_fping.php to <path_cacti/scripts/ss_fping.php
- download and unpack cacti_graph_template_ping_advanced_ping_v1_3.zip to a place of your own choice. Use the cacti web interface to import this template.
- generate graphs for your host using this Graph Template. You will be prompted to enter the protocol, the port (not for ICMP usage) and the number of pings to use.

For those who upgraded from V1.2:
- If you used only the "number of pings" as input to the scripts, there's no need to change the Data Source inputs.
- If you are using the extended input to V1.2, specifying e.g. "20 TCP 80" for checking port 80 with protocol TCP, there's again no need to modify the input parms. But it may be better to do so for clarity. Select Data Sources and filter for Advanced Ping. Select eachh of the displayed data sources and modify the Custom Data input fields accordingly. Please Clear Poller cache when done

Reinhard
cbutler-SJP
Posts: 2
Joined: Sat Oct 29, 2005 10:18 am
Location: St. John's Preparatory School
Contact:

Post by cbutler-SJP »

I am trying to measure ping latency times from my cacti server inside my network to
1 - the intranet port on my proxy server
2 - our public IP gateway
3 - our off-site web site

I'd like to have a separate tree in my graph set for just these three and the three hosts do not have SNMP enabled. What is the best way to set this up using this add-on? Do I have to have a host? Or can I just create the three ping graphs? How?

Thanks
Christopher
User avatar
N3NCY
Cacti User
Posts: 260
Joined: Thu Sep 22, 2005 7:50 pm
Location: Landenberg, PA
Contact:

Post by N3NCY »

IVR: Putting ping.php in the correct dir has helped.
<path_cacti>/lib/ping.php

I still get errors from ping.php, a test from the command line:
root@dhssnms1# /usr/local/bin/php /opt/apache/htdocs/cacti/scripts/ss_fping.php ss_fping 10.0.0.1
Notice: Undefined variable: method in /opt/apache/htdocs/cacti/scripts/ss_fping.php on line 56
Fatal error: Call to undefined function socket_create() in /opt/apache/htdocs/cacti/lib/ping.php on line 218

Now, ss_fping.php can find and include ping.php
It looks like ping.php can't perform:
function socket_create()
I am running as root.

I think getting the command line working will solve this.

On a side note, these new files are filled with ^M on the end of each line.
It looks like CR-LF from being edited within Windows.
I didn't edit them and they still run that way, just FYI
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

N3NCY wrote:root@dhssnms1# /usr/local/bin/php /opt/apache/htdocs/cacti/scripts/ss_fping.php ss_fping 10.0.0.1
AFAIK at least the number of requests MUST be given as input parm (do not know exactly). Try

Code: Select all

/opt/apache/htdocs/cacti/scripts/ss_fping.php ss_fping 10.0.0.1 20 ICMP
for ICMP requests (btw: does ICMP need root privs?). Or

Code: Select all

/opt/apache/htdocs/cacti/scripts/ss_fping.php ss_fping 10.0.0.1 20 TCP 80
for querying the http port of host 10.0.0.1 (well, this seems to be a router :wink: )
Reinhard
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

cbutler-SJP wrote:I am trying to measure ping latency times from my cacti server inside my network to
1 - the intranet port on my proxy server
2 - our public IP gateway
3 - our off-site web site

I'd like to have a separate tree in my graph set for just these three and the three hosts do not have SNMP enabled. What is the best way to set this up using this add-on? Do I have to have a host? Or can I just create the three ping graphs? How?

Thanks
Christopher
Christopher,
you will need to
- create a device (host entry) for your proxy, for your gateway and for your webserver
- from the device screen, select the Advanced Ping from Associated Graph Templates and Add. Specify Protocol, optional port and number of requests from the next screen and you're done (please allow time for some polling cycles, at least about 10 min).
Reinhard
User avatar
N3NCY
Cacti User
Posts: 260
Joined: Thu Sep 22, 2005 7:50 pm
Location: Landenberg, PA
Contact:

Post by N3NCY »

hmm, same exact thing:
/usr/local/bin/php /opt/apache/htdocs/cacti/scripts/ss_fping.php ss_fping 10.0.0.1 20 ICMP
Notice: Undefined variable: method in /opt/apache/htdocs/cacti/scripts/ss_fping.php on line 56
Fatal error: Call to undefined function socket_create() in /opt/apache/htdocs/cacti/lib/ping.php on line 218

Still can't create: socket_create()
Thank you,

Ernie
http://www.NMSWorld.com
[b]Dual Zeon Dual Core 2.6Ghz / 8GB RAM / 4x15k RPM SATA RAID5[/b]
[b]Cacti Version[/b] - 0.8.7b
[b]Poller Type[/b] - cactid 0.8.7 with Boost v1.7
[b]Server Info[/b] - FreeBSD 7.0-RELEASE
[b]Web Server[/b] - Apache/2.2.6 (Unix) mod_ssl/2.2.6 OpenSSL/0.9.8g DAV/2 PHP/5.2.5 mod_perl/2.0.3 Perl/v5.8.8
[b]PHP[/b] - 5.2.6
[b]MySQL[/b] - 5.0.51b Mod: poller_output ENGINE = MEMORY
[b]RRDTool[/b] - 1.3.0
[b]SNMP[/b] - 5.4.1
[b]Plugins[/b] - Host Info (hostinfo - v0.2), Update Checker (update - v0.3), Network Tools (tools - v0.2), FlowView (flowview - v0.3), Read-only Devices Tab (devices - v0.4), Network Discovery (discovery - v0.8.3), Syslog Monitoring (syslog - v0.5.2), Thresholds (thold - v0.3.9), Device Monitoring (monitor - v0.8.2), PHP Network Weathermap (weathermap - v0.941), SuperLinks (superlinks - v0.72), Report Creator (reports - v0.1b)
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

N3NCY wrote:hmm, same exact thing:
/usr/local/bin/php /opt/apache/htdocs/cacti/scripts/ss_fping.php ss_fping 10.0.0.1 20 ICMP
Notice: Undefined variable: method in /opt/apache/htdocs/cacti/scripts/ss_fping.php on line 56
Fatal error: Call to undefined function socket_create() in /opt/apache/htdocs/cacti/lib/ping.php on line 218

Still can't create: socket_create()
:o (slapping hand on forehead) :o :o :o
Did not realize that this is a php script server script. To run this from cli, either use

Code: Select all

php /usr/local/bin/php /opt/apache/htdocs/cacti/scripts/ss_fping.php 10.0.0.1 20 ICMP
(ATTENTION: omit parm ss_fping here) or start the script server and run the script there:

Code: Select all

php /opt/apache/htdocs/cacti/script_server.php
PHP Script Server has Started - Parent is cmd
/opt/apache/htdocs//cacti/scripts/ss_fping.php ss_fping 10.0.0.1 20 ICMP
min:0.3600 avg:0.4995 max:2.3800 dev:0.4372 loss:0.0000
quit
PHP Script Server Shutdown request received, exiting
Content-type: text/html
X-Powered-By: PHP/4.3.9
Reinhard
User avatar
N3NCY
Cacti User
Posts: 260
Joined: Thu Sep 22, 2005 7:50 pm
Location: Landenberg, PA
Contact:

Post by N3NCY »

Same deal:
/usr/local/bin/php /opt/apache/htdocs/cacti/scripts/ss_fping.php ss_fping 10.0.0.1 20 ICMP
Notice: Undefined variable: method in /opt/apache/htdocs/cacti/scripts/ss_fping.php on line 56
Fatal error: Call to undefined function socket_create() in /opt/apache/htdocs/cacti/lib/ping.php on line 218


Or this way:
/opt/apache/htdocs/cacti/scripts/ss_fping.php ss_fping 10.0.0.1 20 ICMP
: No such file or directoryripts/ss_fping.php: line 1: ?php
: command not foundcacti/scripts/ss_fping.php: line 3:
/opt/apache/htdocs/cacti/scripts/ss_fping.php: line 4: //STANDARD: No such file or directory
/opt/apache/htdocs/cacti/scripts/ss_fping.php: line 5: =: command not found
: command not foundcacti/scripts/ss_fping.php: line 5:
: command not foundcacti/scripts/ss_fping.php: line 6:
/opt/apache/htdocs/cacti/scripts/ss_fping.php: line 7: /COPYRIGHT: Permission denied
/opt/apache/htdocs/cacti/scripts/ss_fping.php: line 8: syntax error near unexpected token `E_ERROR'
'opt/apache/htdocs/cacti/scripts/ss_fping.php: line 8: `error_reporting(E_ERROR);


Or even if launched from the script server:
root@dhssnms1# /usr/local/bin/php /opt/apache/htdocs/cacti/script_server.php
PHP Script Server has Started - Parent is cmd
/opt/apache/htdocs/cacti/scripts/ss_fping.php ss_fping 10.0.0.1 20 ICMP
Fatal error: Call to undefined function socket_create() in /opt/apache/htdocs/cacti/lib/ping.php on line 96


ping.php just can't seem to socket_create()
Thank you,

Ernie
http://www.NMSWorld.com
[b]Dual Zeon Dual Core 2.6Ghz / 8GB RAM / 4x15k RPM SATA RAID5[/b]
[b]Cacti Version[/b] - 0.8.7b
[b]Poller Type[/b] - cactid 0.8.7 with Boost v1.7
[b]Server Info[/b] - FreeBSD 7.0-RELEASE
[b]Web Server[/b] - Apache/2.2.6 (Unix) mod_ssl/2.2.6 OpenSSL/0.9.8g DAV/2 PHP/5.2.5 mod_perl/2.0.3 Perl/v5.8.8
[b]PHP[/b] - 5.2.6
[b]MySQL[/b] - 5.0.51b Mod: poller_output ENGINE = MEMORY
[b]RRDTool[/b] - 1.3.0
[b]SNMP[/b] - 5.4.1
[b]Plugins[/b] - Host Info (hostinfo - v0.2), Update Checker (update - v0.3), Network Tools (tools - v0.2), FlowView (flowview - v0.3), Read-only Devices Tab (devices - v0.4), Network Discovery (discovery - v0.8.3), Syslog Monitoring (syslog - v0.5.2), Thresholds (thold - v0.3.9), Device Monitoring (monitor - v0.8.2), PHP Network Weathermap (weathermap - v0.941), SuperLinks (superlinks - v0.72), Report Creator (reports - v0.1b)
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Perhaps you need to activate the sockets option in php, see http://forums.cacti.net/viewtopic.php?t ... highlight=
Reinhard
User avatar
N3NCY
Cacti User
Posts: 260
Joined: Thu Sep 22, 2005 7:50 pm
Location: Landenberg, PA
Contact:

Post by N3NCY »

Ivm: Rock on! You nailed it!

Back when I compiled PHP, I missed socket support!

So I recompiled and re-installed PHP:
cd /usr/src/php-5.0.5
make clean
./configure --with-apxs2=/opt/apache/bin/apxs --with-mysql=/opt/mysql --with-openssl=/usr/local/ssl --with-mssql=/usr/local --with-zlib-dir=/usr/local/lib --with-jpeg-dir=/usr/local/lib --with-freetype-dir=/usr/local/lib --enable-exif --with-png-dir=/usr/local/lib --enable-calendar --enable-ftp --with-libxml-dir=/usr/local/lib --with-snmp=/opt/net-snmp/ --enable-fastcgi --enable-magic-quotes --enable-mbstring --enable-sockets
make install

And now:
/usr/local/bin/php /opt/apache/htdocs/cacti/scripts/ss_fping.php 10.0.0.1 20 ICMP
min:0.2400 avg:0.3340 max:0.4800 dev:0.0649 loss:0.0000


Note: If this was on my Windows 2003 server, I would have edited PHP.ini
and uncommented:
;extension=php_sockets.dll

Thanks again Ivm!
Thank you,

Ernie
http://www.NMSWorld.com
[b]Dual Zeon Dual Core 2.6Ghz / 8GB RAM / 4x15k RPM SATA RAID5[/b]
[b]Cacti Version[/b] - 0.8.7b
[b]Poller Type[/b] - cactid 0.8.7 with Boost v1.7
[b]Server Info[/b] - FreeBSD 7.0-RELEASE
[b]Web Server[/b] - Apache/2.2.6 (Unix) mod_ssl/2.2.6 OpenSSL/0.9.8g DAV/2 PHP/5.2.5 mod_perl/2.0.3 Perl/v5.8.8
[b]PHP[/b] - 5.2.6
[b]MySQL[/b] - 5.0.51b Mod: poller_output ENGINE = MEMORY
[b]RRDTool[/b] - 1.3.0
[b]SNMP[/b] - 5.4.1
[b]Plugins[/b] - Host Info (hostinfo - v0.2), Update Checker (update - v0.3), Network Tools (tools - v0.2), FlowView (flowview - v0.3), Read-only Devices Tab (devices - v0.4), Network Discovery (discovery - v0.8.3), Syslog Monitoring (syslog - v0.5.2), Thresholds (thold - v0.3.9), Device Monitoring (monitor - v0.8.2), PHP Network Weathermap (weathermap - v0.941), SuperLinks (superlinks - v0.72), Report Creator (reports - v0.1b)
cbutler-SJP
Posts: 2
Joined: Sat Oct 29, 2005 10:18 am
Location: St. John's Preparatory School
Contact:

Post by cbutler-SJP »

lvm -- thanks!

After sending my message I did poke around a bit more and found an even better way to do this. Instead of creating extra hosts, I just went back to the Data Template and the Graph Template for "PING - Advanced 1.3" and checked the "Use Per-Device" check boxes and voila! I could create a data source and be allowed to pick the IP/hostname that I wanted to ping. I then had to create a Graph Source to match, but I've now got my sequence of hosts that I am pinging to measure where the slowdowns are leaving my network.

Thanks to everyone for the code and the help!
lvm wrote:
cbutler-SJP wrote:I am trying to measure ping latency times from my cacti server inside my network to
1 - the intranet port on my proxy server
2 - our public IP gateway
3 - our off-site web site

I'd like to have a separate tree in my graph set for just these three and the three hosts do not have SNMP enabled. What is the best way to set this up using this add-on? Do I have to have a host? Or can I just create the three ping graphs? How?

Thanks
Christopher
Christopher,
you will need to
- create a device (host entry) for your proxy, for your gateway and for your webserver
- from the device screen, select the Advanced Ping from Associated Graph Templates and Add. Specify Protocol, optional port and number of requests from the next screen and you're done (please allow time for some polling cycles, at least about 10 min).
Reinhard
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

cbutler-SJP wrote:Instead of creating extra hosts, I just went back to the Data Template and the Graph Template for "PING - Advanced 1.3" and checked the "Use Per-Device" check boxes and voila! I could create a data source and be allowed to pick the IP/hostname that I wanted to ping. I then had to create a Graph Source to match, but I've now got my sequence of hosts that I am pinging to measure where the slowdowns are leaving my network.
For resolviong just that single approach, well.
But if you want to know more about your devices (e.g. if you're using a squid proxy, you way want to implement the squid templates to be found in the forum, traffic stats, errors, info about your apache webserver and the like), it would be easier to create a host and associate all graphs you need to that host. You may group your graphs using the "tree" function and more.
Have fun discovering the features of cacti!
Reinhard
User avatar
TheWitness
Developer
Posts: 16863
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

LVM is correct. The idea is to create an object called a "device/host" and then associate graphs with it. The other approach works, but, is well..., problematic in that everything I am writing right now is based upon the "device/host" approach. The host_id=0 is depricated.

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?
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests