Problems with perl script (ping)

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

Moderators: Developers, Moderators

Post Reply
Deefje
Posts: 8
Joined: Thu Nov 20, 2003 4:15 am
Location: Holland
Contact:

Problems with perl script (ping)

Post by Deefje »

Hello,

Today I upgrade from 0.85a to 0.86 and I still have problems with the perl script ping.pl.

In 0.85a it doesn't work but now in 0.86 it give the following error when I run poller.php

-----------------------8<-------------------------------
Usage: ping [-LRUbdfnqrvVaA] [-c count] [-i interval] [-w deadline]
[-p pattern] [-s packetsize] [-t ttl] [-I interface or address]
[-M mtu discovery hint] [-S sndbuf]
[ -T timestamp option ] [ -Q tos ] [hop1 ...] destination
-----------------------8<-------------------------------

What I think that's the problem is, is that the <ip> variable what is given by data_input-methods (perl <path_cacti>/scripts/ping.pl <ip>) not is given to the ping.pl script.

When I start the ping.pl script on the shell-prompt it works correctly.

Is this a known problem?

Dave
Deefje
Posts: 8
Joined: Thu Nov 20, 2003 4:15 am
Location: Holland
Contact:

Post by Deefje »

Hello,
Today i downloaded cacti-0.8.6b and installed it on a Suse 9.1 Linux system.

On this server I got the same problem with the Unixping script.

When I start poller.php:

php /home/websites/www.deefje.net/html/beheer/cacti-0.8.6b/poller.php
Usage: ping [-LRUbdfnqrvVaA] [-c count] [-i interval] [-w deadline]
[-p pattern] [-s packetsize] [-t ttl] [-I interface or address]
[-M mtu discovery hint] [-S sndbuf]
[ -T timestamp option ] [ -Q tos ] [hop1 ...] destination
OK u:0.00 s:0.00 r:1.02
OK u:0.00 s:0.00 r:1.02
OK u:0.00 s:0.00 r:1.02
etc...


I think the variable is not comming with the command.

Does someone else has this problem.

Dave
Deefje
Posts: 8
Joined: Thu Nov 20, 2003 4:15 am
Location: Holland
Contact:

Post by Deefje »

Hey,

Here I am again :(

By input string: perl <path_cacti>/scripts/ping.pl <ip> the variable <ip> isn't working.

It is a standard cacti install (0.8.6a)
Attachments
ping.jpg
ping.jpg (54.55 KiB) Viewed 8560 times
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

Deefje wrote:By input string: perl <path_cacti>/scripts/ping.pl <ip> the variable <ip> isn't working.
You can confirm that suspicion. Open up the poller cache by going to System Utilities -> View Poller Cache. Now search in your browser for "ping.pl". You should see the specific item being executed by the poller including the full script patch with arguments. Report back what the script path says and we can work from there.

-Ian
Deefje
Posts: 8
Joined: Thu Nov 20, 2003 4:15 am
Location: Holland
Contact:

Post by Deefje »

Rax,

This is what I saw in the poller cache:

----------------------------8<------------------------------------------
Data Source: Core-2 - Ping Host
RRD: /usr/local/httpd/htdocs/cacti-0.8.6a/rra/core2_ping_145.rrd
Action: 1, Script: perl /usr/local/httpd/htdocs/cacti-0.8.6a/scripts/ping.pl
----------------------------8<------------------------------------------

Dave
BWare
Posts: 33
Joined: Thu Jun 12, 2003 4:57 am
Location: Amsterdam
Contact:

Post by BWare »

It looks as if the parameter is not passed to the script.


Could you modify it to output the value that is passed to the script?

Code: Select all

#!/usr/bin/perl

print $ARGV[0] . "\n";

$ping = `ping -c 1 $ARGV[0] | grep icmp_seq`;
$ping =~ m/(.*time=)(.*) (ms|usec)/;

print $2;
And post the debug output ?
--
Regardz,
BWare
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

Also if you used the "Unix - Ping Host" graph template to create this graph, you can see exactly which IP address should be passed to the script. Go to Data Sources, select the device in question and choose the data source with a template name of "Unix - Ping Host". What is listed for the "IP Address" under "Custom Data"?

-Ian
Deefje
Posts: 8
Joined: Thu Nov 20, 2003 4:15 am
Location: Holland
Contact:

Post by Deefje »

The field IP Address (Custom Data) is empty.

Do I have to fill in the IP address there when I add a device or does it have to be there automaticly when I created that device?

Dave
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

Looks like I made a mistake when creating the "Unix - Ping Host" data template. The IP address is supposed to be derived from the device. To fix, go to "Data Templates", select "Unix - Ping Host", and uncheck "Use Per-Data Source Value" for the "IP Address" field. Now when you create a new ping graph through "New Graphs", this field will be handled automatically.

I also corrected the problem in the default template that will be included in the cacti.sql for subsequent versions of Cacti.

-Ian
User avatar
Morgan
Cacti User
Posts: 187
Joined: Wed Feb 25, 2004 3:38 am

Post by Morgan »

bump.

this check on the data template is still being distributed.

Morgan
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

Sorry about slipping on this, I posted the fix to the 0.8.6 branch in CVS. It will make its way into the 0.8.7 release as well.

Thanks for the reminder.

-Ian
User avatar
Morgan
Cacti User
Posts: 187
Joined: Wed Feb 25, 2004 3:38 am

Post by Morgan »

you're welcome
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests