|
|
| Author |
Message |
TheWitness Developer
Joined: 14 May 2002 Posts: 9723 Location: MI, USA
|
Posted: Thu Oct 27, 2005 9:50 pm Post subject: EDIT: Advanced Ping Template Version 1.3 for Cacti 0.8.6g |
|
|
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
| Description: |
|
 Download |
| Filename: |
ss_fping.zip |
| Filesize: |
1.1 KB |
| Downloaded: |
12268 Time(s) |
| Description: |
|
 Download |
| Filename: |
cacti_graph_template_ping_advanced_ping_v1_3.zip |
| Filesize: |
5.49 KB |
| Downloaded: |
12991 Time(s) |
Last edited by TheWitness on Mon Aug 11, 2008 8:10 pm; edited 2 times in total |
|
| Back to top |
|
 |
N3NCY Cacti User
Joined: 22 Sep 2005 Posts: 242 Location: Landenberg, PA
|
Posted: Sat Oct 29, 2005 12:50 am Post subject: NEW Advanced Ping Template Version 1.3 for Cacti 0.8.6g |
|
|
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?
|
|
| Back to top |
|
 |
gandalf Developer
Joined: 02 Dec 2004 Posts: 12295 Location: Muenster, Germany
|
Posted: Sat Oct 29, 2005 3:44 am Post subject: |
|
|
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
|
|
| Back to top |
|
 |
cbutler-SJP
Joined: 29 Oct 2005 Posts: 2 Location: St. John's Preparatory School
|
Posted: Sat Oct 29, 2005 10:23 am Post subject: |
|
|
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
|
|
| Back to top |
|
 |
N3NCY Cacti User
Joined: 22 Sep 2005 Posts: 242 Location: Landenberg, PA
|
Posted: Sat Oct 29, 2005 11:13 am Post subject: |
|
|
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
|
|
| Back to top |
|
 |
gandalf Developer
Joined: 02 Dec 2004 Posts: 12295 Location: Muenster, Germany
|
Posted: Sat Oct 29, 2005 12:47 pm Post subject: |
|
|
| 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: | | /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: | | /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 )
Reinhard
|
|
| Back to top |
|
 |
gandalf Developer
Joined: 02 Dec 2004 Posts: 12295 Location: Muenster, Germany
|
Posted: Sat Oct 29, 2005 12:57 pm Post subject: |
|
|
| 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
|
|
| Back to top |
|
 |
N3NCY Cacti User
Joined: 22 Sep 2005 Posts: 242 Location: Landenberg, PA
|
Posted: Sat Oct 29, 2005 12:58 pm Post subject: |
|
|
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()
|
|
| Back to top |
|
 |
gandalf Developer
Joined: 02 Dec 2004 Posts: 12295 Location: Muenster, Germany
|
Posted: Sat Oct 29, 2005 1:12 pm Post subject: |
|
|
| 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() |
(slapping hand on forehead)
Did not realize that this is a php script server script. To run this from cli, either use | Code: | | 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: | 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
|
|
| Back to top |
|
 |
N3NCY Cacti User
Joined: 22 Sep 2005 Posts: 242 Location: Landenberg, PA
|
Posted: Sat Oct 29, 2005 1:26 pm Post subject: |
|
|
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()
|
|
| Back to top |
|
 |
gandalf Developer
Joined: 02 Dec 2004 Posts: 12295 Location: Muenster, Germany
|
|
| Back to top |
|
 |
N3NCY Cacti User
Joined: 22 Sep 2005 Posts: 242 Location: Landenberg, PA
|
Posted: Sat Oct 29, 2005 3:57 pm Post subject: |
|
|
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!
|
|
| Back to top |
|
 |
cbutler-SJP
Joined: 29 Oct 2005 Posts: 2 Location: St. John's Preparatory School
|
Posted: Sun Oct 30, 2005 8:01 am Post subject: |
|
|
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 |
|
|
| Back to top |
|
 |
gandalf Developer
Joined: 02 Dec 2004 Posts: 12295 Location: Muenster, Germany
|
Posted: Sun Oct 30, 2005 8:10 am Post subject: |
|
|
| 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
|
|
| Back to top |
|
 |
TheWitness Developer
Joined: 14 May 2002 Posts: 9723 Location: MI, USA
|
Posted: Sun Oct 30, 2005 8:58 am Post subject: |
|
|
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
|
|
| Back to top |
|
 |
|