• Accueil
  • Hébergement Sites
  • Accès Internet
  • Consulting
  • CohProg SàRL
  • Contactez nous

Langues

Français

Outils

  • Webmail
  • Gestionnaire mail
  • Statistiques site web
  • Test bande passante
  • Looking Glass

Logiciel

  • Cacti Ping Server
  • mod_bandwidth
  • Camt.054 à V11
  • wlan@cohprog hotspot
Accueil

Cacti Ping Server & Template

Set of advanced templates for Cacti and ping server in Perl that use fping to continuously ping, in parallel, one or several hosts and return the summary when queried.

Download: ftp://www.cohprog.com/pub/cacti/pingserver.tgz

Installation:

1. pingsrv.pl
This is the stand-alone ping server. Normaly it runs as a daemon on the server(s) that will do the ping.
It can be run in the foreground (useful for debugging/testing) if started with the "-f" argument.

Edit the script:
- Set the FPING variable to the location of the "fping" binary.
- Change the SECRET value to whatever you want. It acts as a password so limit access to the data.
- Set the INTERVAL value. For best result it must be set to the same value as the Cacti poller interval (default 5min).
- Change the FREQ value. It's the interval between 2 pings (default 200ms).
- Change the BINDTO variable to the IP address on which the server will listen (ie 127.0.0.1 if accept only local connections. Or 0.0.0.0 to accept connections incoming from any network interface)
- By default, the server will listen on port 9928. Change the PORT variable if you want to use another port.

Optionaly, you can use the HostList array to define an initial list of hosts to ping. The script will learn which hosts it need to ping based on the query it receives so that list can be left empty.

Note: fping need to run as root. So you can start pingsrv.pl as root or setuid it or the fping binary.

2. ss_fping.pl
This script is a replacement for ss_fping.php. You probably want to put it into the "scripts" directory of your Cacti installation.

Edit the script:
- Set SERVER to the IP address of the ping server (default 127.0.0.1)
- Set PORT to the port on which the server listen (default 9928)
- Set SECRET to the same value as the one you used in pingsrv.pl

The pingsrv.pl script doesn't have to run on the same server as Cacti. In fact, you can ping different hosts from different servers. You can define the address of the ping server to use for a given host by editing the "PingServer" hash or you can configure it directly in Cacti.

In Cacti, change the "Data Input Methods" of "PING - Advanced Ping" and set the following:
Input Type: Script/command
Input string: perl
/scripts/ss_fping.pl

Remove the unused input fields and add a new one with those values:
Field: server
Friendly name: IP address or hostname of the ping server
Allow empty Input: checked

In the "Data Templates" "PING - Advanced Ping", make sure that you checked "Use Per-Data Source Value" for the "IP address or hostname of the ping server" custom data if you want to be able to set the address of the ping server inside Cacti (Else, you can set it into the ss_fping.pl script for each hosts or just use the default value).

3. queryping.sh
The ping server can also be used without Cacti. For that, you need to telnet to it and first type the SECRET and then the hostname/IP address of the host you want to ping or query results. For example:

telnet 127.0.0.1 9928
12345
192.168.0.1

If the hostname/IP address isn't pinged yet, it will be added to the list of hosts to ping. If the hostname/IP is already being pinged, the data from the last interval are returned.

Instead of typing an hostname/IP address, it's possible to type "summary" to get a list of all those hosts currently being pinged with their data. Ie:

telnet 127.0.0.1 9928
12345
summary

Because of timeout, you have to type fast. So, as an example, I provided the queryping.sh shell script.
Edit it to set the PORT number of the ping server. Optionaly, set the SECRET and SERVER values so that you won't have to specify them when using the script.

Use -h parameter to get the full syntax:

queryping.sh -h
Usage: /usr/local/bin/queryping.sh -k [secret_key] -s [ping_server] -p [port] -q [host]
       [secret_key]  = Secret key to access the ping server
       [ping_server] = IP/Hostname of ping server
       [port]        = TCP port used by the ping server
       [host]        = Return information for this host
       if -q is omitted, return information for all hosts

Here is an example of summary:

Host                          Sent  Lost     %     Min     Max     Avg     Dev
------------------------------------------------------------------------------
172.16.101.195                1475     0   0.0   0.440   3.120   1.443   0.577
172.16.100.112                1475     0   0.0   0.490   2.710   1.431   0.572
172.16.100.195                1475     0   0.0   1.350   7.030   2.259   0.643
172.16.133.191                1475     0   0.0   1.050  23.880   1.530   0.751
172.16.201.132                1475     0   0.0   0.500   6.020   1.445   0.582
172.16.100.228                1475     0   0.0   2.220  11.090   3.524   0.735
192.168.252.3                 1475     0   0.0   2.220   9.810   3.922   0.905
172.16.100.67                 1475     0   0.0   2.330  23.290   3.467   0.808
192.168.254.6                 1475     0   0.0   3.200  28.110   6.293   3.075

Cacti ping graph example:

Contact Us | Terms of Use | CohProg SàRL | Privacy Statement
Copyright © 2011 CohProg SàRL. All Rights Reserved.