EDIT: Advanced Ping Template Version 1.3 for Cacti 0.8.6g

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

Moderators: Moderators, Developers

Post Reply
Author
Message
JiiPee
Posts: 10
Joined: Sun Oct 02, 2005 9:33 pm
Location: FINLAND
Contact:

#316 Post by JiiPee » Fri Dec 28, 2007 6:47 pm

Ping result is not same when you polling with spice and then with cmd.php

As you can see from picture. First I running spice polling and then there is short outage when I changed to cmd.php

and it looks like spice give wrong result, because this is what I get when I ping from console:
--- ns-secondary.funet.fi ping statistics ---
27 packets transmitted, 27 received, 0% packet loss, time 26057ms
rtt min/avg/max/mdev = 4.340/4.740/5.660/0.308 ms
Attachments
ping.png
ping.png (52.97 KiB) Viewed 11120 times

atrias
Posts: 25
Joined: Sat Dec 29, 2007 8:01 am

#317 Post by atrias » Thu Jan 10, 2008 4:58 am

how can i make advanced ping run more frequently that 5 minutes???
i need 1 minute!!!
I guess i have to make the poller cron job run every minute right??

Would that be too much load for my linux machine?
I have about 70 devices an all of which i use advanced ping and on some of them cisco cpu usage and on most of them snmp interface traffic.
My machine is P4 3Ghz with 2GB ram

In

Code: Select all

Data Templates -> Advanced ping -> data source
there is a step value saying 300 which is 5 minutes (if 300 is seconds)
What is this value used for?
Do i need to change it to make advanced ping run every minute?
If i only change this and not the poller cron job frequency what will happen?

Thnk you for any help

jmit
Posts: 13
Joined: Tue Feb 21, 2006 8:39 am

#318 Post by jmit » Fri Jan 18, 2008 3:38 am

Hello,

I have download the atachements from the first posting.
I have the ping.php in the correct path. The file ss_fping.php already exists in the cacti path, I have renamed the old file, and have copied the new one in the same folder.
Then I have umpacked the zip file cacti_graph_template_ping_advanced_ping_v1_3.zip. After this I have import the graph-template. I can choose the new template in cacti.
I have create a new device for the server which I want to ping. After this I have create a new data source with the new template. I also have a new graph management entry, but when I want to see the new graph, I see nothing.
I tried to explane it as good as possible.
Is there any explanation how to create those graph?

Thanks
Jörg
gandalf wrote: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

ABX
Cacti User
Posts: 68
Joined: Thu Mar 01, 2007 5:55 am

#319 Post by ABX » Wed Jan 23, 2008 3:42 am

mandor101 wrote:Just did any upgrade to 0.8.7 and just installed advanced ping and seem to be having a problem with ss_fping.php. Looks like the script it trying to find:

$script_timeout = read_config_option("script_timeout");
$ping_timeout = read_config_option("ping_timeout");

And can't....I added a line to include

include_once(dirname(__FILE__) . "/../include/global_settings.php

and that took care of the script_timeout value, but the ping_timeout is still give me some fits...What's the value of ping_timeout supposed to be?

Thanks
Same problem here.

ABX
Cacti User
Posts: 68
Joined: Thu Mar 01, 2007 5:55 am

#320 Post by ABX » Wed Jan 23, 2008 4:01 am

cricrou wrote:Using cacti 0.8.7a, I do have the same problems.

I figured it out using the following method :

Continue using the script "ss_fping.php" bundled in the 0.8.7a release
Add the script "ping.php" to the cacti/lib directory
If you do "ICMP" ping, launch the poller with root instead of the cacti user

Pay attention to the syntax of the data input script, it must look like :

Code: Select all

<path_cacti>/scripts/ss_fping.php ss_fping <hostname> <attempts> <protocol> <port>
This solved my problem.

raskil
Posts: 1
Joined: Wed Jan 23, 2008 9:30 am

100% packet loss

#321 Post by raskil » Wed Jan 23, 2008 9:35 am

I've played around with this template for serveral hours now, without getting the packet loss values to work. I've found out that the letter case for of the protocol type is important. So try using ICMP, UDP or TCP instead of icmp, udp or tcp when you set up the data source. Doesn't know if this is mentioned elswhere.

Greets

Raskil

Alex.C
Posts: 1
Joined: Sun Jan 27, 2008 1:37 pm

#322 Post by Alex.C » Sun Jan 27, 2008 1:39 pm

I've installed advanced ping and got it working fine. However my graphs are like the one posted by JiiPee above. When there is downtime there is just a gap in the graph like the one around 8am in the above. It would be preferable for a red space filling bar to appear so the downtime is more obvious, how would I go about making it do that?

Fhtagn
Posts: 1
Joined: Tue Feb 05, 2008 10:43 am

#323 Post by Fhtagn » Tue Feb 05, 2008 11:43 am

I wanted to ICMP ping hosts but I didn't want to make this script sudoable, so I've added some code to launch /bin/ping on ICMP scan.
My ping output looks like this, so if last two lines differ, you'll need to change this code somehow:

Code: Select all

$ /bin/ping -q -c 20 -W 2 www.google.com
PING www.l.google.com (66.102.9.104) 56(84) bytes of data.

--- www.l.google.com ping statistics ---
20 packets transmitted, 19 received, 5% packet loss, time 19017ms
rtt min/avg/max/mdev = 61.825/67.500/84.017/5.392 ms
The code (with some context) to be inserted into scripts/ss_fping.php

Code: Select all

        switch ($ping_type) {
        case "ICMP":
                $method = PING_ICMP;
                break;
        case "TCP":
                $method = PING_TCP;
                break;
        case "UDP":
                $method = PING_UDP;
                break;
        }

        if ( $ping_type == "ICMP" ) {
            $ssping_out = '';
            $ping_cmdline = "/bin/ping -q -c " . ((int) $ping_sweeps)
                            . " -W " . (((float) $ping_timeout)/1000);

            if ( isset($called_by_script_server) ) {
                $ping_cmdline .= " -w " . (((int) $script_timeout)-1);
            }

            $ping_cmdline .= ' ' . escapeshellarg($hostname);
            $result = exec($ping_cmdline, $out);

            if (ereg ("([0-9]+)% packet loss", $out[3], $regs)) {
                $loss = $regs[1];
            }

            $times = explode(" ", $result);
            if ( $times[0] == "rtt" && $times[1] == "min/avg/max/mdev" ) {
                list($min, $avg, $max, $dev) = explode("/", $times[3]);
                return sprintf("min:%0.4f avg:%0.4f max:%0.4f dev:%0.4f loss:%0.4f", $min, $avg, $max, $dev, $loss);
            } else {
                return "loss:100.00";
            }
        }

        $i = 0;
        while ($i < $ping_sweeps) {

jacauc
Posts: 34
Joined: Sun Sep 10, 2006 1:05 am

#324 Post by jacauc » Sat Feb 09, 2008 6:12 am

My links are avg 700Ms.

I keep getting:

Code: Select all

02/09/2008 12:07:35 PM - PHPSVR: Poller[0] ERROR: Input Expected, Script Server Terminating  
02/09/2008 12:07:34 PM - SPINE: Poller[0] ERROR: SS[0] An invalid file descriptor was given in one of the sets.  
02/09/2008 12:07:34 PM - SPINE: Poller[0] ERROR: Spine Timed Out While Processing Hosts Internal  

This is on a Windows 0.8.7a installation.
Spine Poll time is every 20 seconds.
Ping Timeout value is 1000


This is my RRD

Code: Select all

e:/wwwroot/cactireal/rrdtool.exe create \
E:/wwwroot/cactireal/rra/ipaddressHidden_min_62.rrd \
--step 20  \
DS:loss:GAUGE:120:0:100 \
DS:avg:GAUGE:120:0:1500 \
DS:max:GAUGE:120:0:1500 \
DS:dev:GAUGE:120:0:1500 \
DS:min:GAUGE:120:0:1500 \
RRA:AVERAGE:0.5:1:500 \
RRA:MIN:0.5:1:500 \
RRA:MAX:0.5:1:500 \
RRA:LAST:0.5:1:500 \
ICMP ping method
Number of pings = 6

The moment I change the Device to a local LAN ip address, everything starts working fine... it seems the problem is with my high latencies.

Please help! :D

(edited to remove IP address)

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

#325 Post by TheWitness » Sat Feb 09, 2008 6:26 am

This would appear to be a segmentation fault. Run spine for the command line:

./spine --help

Post the version. If not 0.8.7a or 0.8.7b, then upgrade.

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

Life is an adventure, let yours begin with Cacti!

Author of MacTrack, Boost, CLog, SpikeKill, Platform RTM, DSStats, maintainer of Spine, lot's of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Central Plugin Repository
Central Templates Repository


I'm still out there people. Getting excited for Cacti 1.2. I think it will be a great release.

jacauc
Posts: 34
Joined: Sun Sep 10, 2006 1:05 am

#326 Post by jacauc » Sat Feb 09, 2008 7:24 am

Code: Select all

E:\wwwroot\cactireal>spine --help
SPINE 0.8.7a  Copyright 2002-2007 by The Cacti Group
it's 0.8.7a.
Where can I get a hold of a Windows Spine 0.8.7b?

jacauc
Posts: 34
Joined: Sun Sep 10, 2006 1:05 am

#327 Post by jacauc » Sat Feb 09, 2008 7:39 am

When using CMD.PHP this works quite well...
Strange enough, CMD.PHP is quicker:

Code: Select all

02/09/2008 01:36:03 PM - SYSTEM STATS: Time:3.3101 Method:cmd.php Processes:1 Threads:N/A Hosts:10 HostsPerProcess:10 DataSources:31 RRDsProcessed:12  
02/09/2008 01:35:54 PM - SYSTEM STATS: Time:13.8541 Method:spine Processes:1 Threads:3 Hosts:10 HostsPerProcess:10 DataSources:31 RRDsProcessed:12  
Started off at 3.3 secs... now averages around 8 seconds ...still quicker.
Would it hurt to stick with CMD.PHP for now? Otherwise, can I get a copy of the newest Spine Win Binary somewhere?

User avatar
zorrosam
Cacti User
Posts: 244
Joined: Thu May 03, 2007 3:17 pm
Location: Italy

problem again

#328 Post by zorrosam » Thu Feb 14, 2008 6:50 am

nemako wrote:
giulioharding wrote:
I noticed that a lot of people have had this 'Operation not permitted' problem using ICMP pings on Linux - I've had the same problem, and despite a lot of research, couldn't find any suggestions on how to fix it.

The issue, in my case, is that the gateway I wish to ping, to monitor our internet link, only responds to ICMP pings - there are no TCP/UDP ports open for me to use, so that rules out using those protocols as a work-around. I need ICMP, therefore, cacti needs elevated priveleges somehow.

I don't want to run cacti in it's entirety as root, so in the absence of any other ideas, or knowledge of the cacti script mechanism, or PHP, I hacked up a little modification to the ss_fping.php script, using sudo to give it elevated privileges :)

It's ugly, but it works - in case anyone else might find this handy, here's the summary of the changes I made: (Cacti 0.8.6g, up-to-date Fedora Core 4 install)

1.) Install sudo if you haven't got it already, and add the following lines to /etc/sudoers: (you may need to change 'cacti' to whatever user is running the poller)

# Allow cacti user to run ping script with elevated privileges (so it can send ICMP pings)
cacti ALL=NOPASSWD: /usr/bin/php /var/www/cacti/scripts/ss_fping_exec.php [0-9a-zA-Z]*

Hi all,

The simplest way I find to continue to use the cactiuser for the poller is to modify the cmd.php file.

1. Add the following line in /etc/sudoers. Note that it is recommanded to use visudo to edit it:
cactiuser ALL=NOPASSWD: /usr/bin/php

2. Then modify the cmd.php file line 130 as following. I just add the sudo word before read_config_option.
$cactiphp = proc_open("sudo ".read_config_option("path_php_binary") . " -q " . $config["base_path"] . "/script_server.php cmd", $cactides, $pipes);


I now it's a bit awfull, but it is the only php script I used so....

Now everything works well under cactiuser :)

++
I made all these changes but the graphs have 100% packet lost again.

Logged like cacti user if i launch this command i have no problem :

sudo php -q ss_fping.php circe 20 ICMP

but even sudo nothing to do.

In data input i have added sudo at start of the line in command :

<path_cacti>/scripts/sudo ss_fping.php <hostname> <attempts> <protocol> <port>

but no ping succesfully in my graph.

why?

if i change the crontab and execute the poller with root all the new rrd are created with ownership root .... maybe is a problem for my system?

Jey
Posts: 41
Joined: Wed Aug 22, 2007 8:01 am

#329 Post by Jey » Thu Feb 28, 2008 7:50 am

Hello,

This plug is used for (example) monitor the "quality" of link to Internet ? (the load)

hellofox
Posts: 13
Joined: Wed Oct 31, 2007 12:45 am

I can get nothing but only 100% packet loss by Advanced Ping

#330 Post by hellofox » Thu Feb 28, 2008 10:25 am

Today I tried to install Advanced ping 1.3 on 0.8.7. I had read the articles at very beginning pages of this topic, and I was sure I followed the suggested steps to install this templates. Everything looked so smoothly, but what's frustrating was that no correct info was displayed by the graph.
But I had checked the script ss_fping.php, it could be run normally under CLI, my test command was like that:

<cacti directory>/scripts/ss_fping.php ss_fping 10.104.1.21 20 ICMP

and I got a very good result:
min:0.2700 avg:0.3455 max:0.6200 dev:0.0858 loss:0.0000

but why I could only get 100% packet loss. Is there anything I possibly had not thought of?

A confused Tiger

Post Reply