I need some GPRINT tricks

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

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

Post by TheWitness »

The ping command is not found by the OS. Please note the following:
ping: not found
ping: not found
U:U
U:U
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?
ariela
Posts: 17
Joined: Thu Feb 19, 2004 12:24 pm

Post by ariela »

yes, thank you,
I've solved the problem about ping.pl, using the full path (/sbin/ping, etc etc).

But I don't know why I've NaN in all rrd file about ping latency.
What I've to do to make troubleshooting?

Thank you for your support
Regards
Andrea
ariela
Posts: 17
Joined: Thu Feb 19, 2004 12:24 pm

please help me :)

Post by ariela »

Well, the ping_latency doesn't work, I see always NaN.

I see in the log:
01/10/2005 01:20:10 PM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/byron_1751_round_trip_78.rrd --template 1105359602:U
ERROR: Not enough arguments

in the script ping_latency.pl I see:

$PLCount = 12;

and in Data Input Methods (/input string):

perl <path_cacti>/scripts/ping_latency.pl <num_times><hostname>

but I've only one input field, that is 'hostname'.

What I've to do?
Thank you very much for your support
Regards
Andrea
cacti_fod
Posts: 14
Joined: Thu Dec 30, 2004 4:54 am

Post by cacti_fod »

Ariela, the problem is exactly as you posted. You aren't supplying the correct input to the script. Change how the data input method works, or the script itself.

raX and company, if you ever workout how to use the graphing source and template I gave you to end up at how the graph should look within the Cacti framework, please update this thread. I've had to turn away from the problem for the time being and do the graphing separately.


Thanks again!!
ariela
Posts: 17
Joined: Thu Feb 19, 2004 12:24 pm

Post by ariela »

I've modify the script, removing $PLCount and using directly -c 12 in the ping command. NOthing, I receive always the same:

01/13/2005 09:05:09 PM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/byron_1751_round_trip_78.rrd --template 1105646702:U
01/13/2005 09:05:09 PM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/byron_1751_round_trip_76.rrd --template 1105646702:U
01/13/2005 09:05:09 PM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/byron_1751_open_files_77.rrd --template open_files 1105646702:U
01/13/2005 09:05:09 PM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/byron_1751_open_files_75.rrd --template open_files 1105646702:U

01/13/2005 09:10:08 PM - CMDPHP: Poller[0] Host[3] CMD: perl /usr/local/share/cacti/scripts/ping_latency.pl 192.168.1.1, output: U
01/13/2005 09:10:08 PM - CMDPHP: Poller[0] Host[3] WARNING: Result from SNMP not valid. Partial Result: No Such Object avail
01/13/2005 09:10:08 PM - CMDPHP: Poller[0] Host[3] SNMP: v2: 192.168.1.1, dsname: open_files, oid: .1.3.6.1.4.1.23.2.28.2.7.0, output: U
01/13/2005 09:10:08 PM - CMDPHP: Poller[0] Host[3] WARNING: Result from CMD not valid. Partial Result:
01/13/2005 09:10:08 PM - CMDPHP: Poller[0] Host[3] CMD: perl /usr/local/share/cacti/scripts/ping_latency.pl 81.174.12.111, output: U

01/13/2005 09:10:08 PM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/byron_1751_round_trip_76.rrd --template 1105647001:U
01/13/2005 09:10:08 PM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/byron_1751_open_files_75.rrd --template open_files 1105647001:U

U, that is NaN in my graphs.
There's someone that has solved this? Could you post a solution?

Thank you for your support
Regards
Andrea
byrons
Posts: 17
Joined: Thu Jan 27, 2005 6:30 am
Contact:

Post by byrons »

Has anyone ever told you, your 'device' has a cool name?
ssams
Cacti User
Posts: 65
Joined: Tue Feb 01, 2005 5:54 pm
Location: Texas
Contact:

Post by ssams »

forgive my ignorance but how does this poll? i see where the command is listed in the html page and i updated the path. i also see the variables but does poller run this? thanks

i have the graph but no data.
User avatar
hbokh
Posts: 40
Joined: Thu Feb 24, 2005 4:29 pm
Location: Groningen, NL

Post by hbokh »

Code: Select all

$Ping = "ping -l 3 -c $PLCount -i .2 -w 2 $Target |";
Judging from the "-i" AND "-w" parameters the ping_latency.pl-script is Redhat Linux-specific...
It works on an old version of RH 6.2, but not on Debian 3.0 nor FreeBSD 4.X :(
This is my sick nature...
paddy
Posts: 14
Joined: Thu Jul 15, 2004 9:34 am
Location: Stockholm, Sweden

Post by paddy »

aculy -i works on FreeBSD but -w must be changed to -t insted.. atleast the script itself works but I've got some other wierd errors with the template.. havent got far enough to say what yet ;)
User avatar
hbokh
Posts: 40
Joined: Thu Feb 24, 2005 4:29 pm
Location: Groningen, NL

Post by hbokh »

Thanks Paddy! I feel a little stupid now... :oops:
This is my sick nature...
User avatar
hbokh
Posts: 40
Joined: Thu Feb 24, 2005 4:29 pm
Location: Groningen, NL

Post by hbokh »

cacti_fod wrote:Change how the data input method works, or the script itself.
Maybe for the less talented users someone could post a working Perl-script AND XML-export... TIA!

So far I got the script working on FreeBSD (with PLCount=12 and the target as argument), the graph showed up, but -like Ariela- with NaN-data and some extra "open file" RRA-file created. I've deleted these all for obvious reasons.

In the meantime I've managed to get "Smoke Ping" do more or less the same. My French is better than my Perl :roll:
See http://forums.cacti.net/viewtopic.php?p=28709
This is my sick nature...
mazaj
Posts: 13
Joined: Wed Mar 23, 2005 6:01 am

Post by mazaj »

also i guess very important to change the ping command from

$Ping = "ping -l 3 -c $PLCount -i .2 -w 2 $Target |";

to

$Ping = "ping -l 3 -c $PLCount -i .2 -W 2 $Target |";

the difference between these two 'w' is that

w - Specify a timeout, in seconds, before ping exits regardless of how many packets have been sent or received.

W - Time to wait for a response, in seconds.

W is more gracefull for last packets. i prefer to incerease -l to smth like 10 and give W for about 2 secs.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Perhaps fping would do better as it allows for faster pinging ...
Reinhard
mazaj
Posts: 13
Joined: Wed Mar 23, 2005 6:01 am

Post by mazaj »

lvm wrote:Perhaps fping would do better as it allows for faster pinging ...
Reinhard
what do you mean "faster"?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

From man fping
NAME
fping - send ICMP ECHO_REQUEST packets to network hosts
SYNOPSIS
fping [ options ] [ systems... ]
DESCRIPTION

fping is a like program which uses the Internet Control Message Protocol (ICMP) echo request to determine if a target host is responding. fping differs from ping in that you can specify any number of targets on the command line, or specify a file containing the lists of targets to ping. Instead of sending to one target until it times out or replies, fping will send out a ping packet and move on to the next target in a round-robin fashion.

In the default mode, if a target replies, it is noted and removed from the list of targets to check; if a target does not respond within a certain time limit and/or retry limit it is designated as unreachable. fping also supports sending a specified number of pings to a target, or looping indefinitely (as in ping ).

Unlike ping , fping is meant to be used in scripts, so its output is designed to be easy to parse.
OPTIONS

-a
Show systems that are alive.
-A
Display targets by address rather than DNS name.
-bn
Number of bytes of ping data to send. The minimum size (normally 12) allows room for the data that fping needs to do its work (sequence number, timestamp). The reported received data size includes the IP header (normally 20 bytes) and ICMP header (8 bytes), so the minimum total size is 40 bytes. Default is 56, as in ping. Maximum is the theoretical maximum IP datagram size (64K), though most systems limit this to a smaller, system-dependent number.
-Bn
In the default mode, fping sends several requests to a target before giving up, waiting longer for a reply on each successive request. This parameter is the value by which the wait time is multiplied on each successive request; it must be entered as a floating-point number (x.y). The default is 1.5.
-c
Number of request packets to send to each target. In this mode, a line is displayed for each received response (this can suppressed with -q or -Q). Also, statistics about responses for each target are displayed when all requests have been sent (or when interrupted).
-C
Similar to -c, but the per-target statistics are displayed in a format designed for automated response-time statistics gathering. For example: % fping -C 5 -q somehost somehost : 91.7 37.0 29.2 - 36.8 shows the response time in milliseconds for each of the five requests, with the "-" indicating that no response was received to the fourth request.
-d
Use DNS to lookup address of return ping packet. This allows you to give fping a list of IP addresses as input and print hostnames in the output.
-e
Show elapsed (round-trip) time of packets.
-f
Read list of targets from a file. This option can only be used by the root user. Regular users should pipe in the file via stdin: % fping < targets_file
-g
Generate a target list from a supplied IP netmask, or a starting and ending IP. Specify the netmask or start/end in the targets portion of the command line. ex. To ping the class C 192.168.1.x, the specified command line could look like either: fping -g 192.168.1.0/24 or fping -g 192.168.1.0 192.168.1.255
-h
Print usage message.
-in
The minimum amount of time (in milliseconds) between sending a ping packet to any target (default is 25).
-l
Loop sending packets to each target indefinitely. Can be interrupted with ctl-C; statistics about responses for each target are then displayed.
-m
Send pings to each of a target host's multiple interfaces.
-n
Same as -d.
-p
In looping or counting modes (-l, -c, or -C), this parameter sets the time in milliseconds that fping waits between successive packets to an individual target. Default is 1000.
-q
Quiet. Don't show per-target results, just set final exit status.
-Qn
Like -q, but show summary results every n seconds.
-rn
Retry limit (default 3). This is the number of times an attempt at pinging a target will be made, not including the first try.
-s
Print cumulative statistics upon exit.
-tn
Initial target timeout in milliseconds (default 500). In the default mode, this is the amount of time that fping waits for a response to its first request. Successive timeouts are multiplied by the backoff factor.
-u
Show targets that are unreachable.
-v
Print fping version information.


EXAMPLES
The following perl script will check a list of hosts and send mail if any are unreachable. It uses the open2 function which allows a program to be opened for reading and writing. fping does not start pinging the list of systems until it reads EOF, which it gets after INPUT is closed. Sure the open2 usage is not needed in this example, but it's a good open2 example none the less.

#!/usr/bin/perl
require 'open2.pl';

$MAILTO = "root";

$pid = &open2("OUTPUT","INPUT","/usr/local/bin/fping -u");

@check=("slapshot","foo","foobar");

foreach(@check) { print INPUT "$_\n"; }
close(INPUT);
@output=<OUTPUT>;

if ($#output != -1) {
chop($date=`date`);
open(MAIL,"|mail -s 'unreachable systems' $MAILTO");
print MAIL "\nThe following systems are unreachable as of: $date\n\n";
print MAIL @output;
close MAIL;
}

Another good example is when you want to perform an action only on hosts
that are currently reachable.

#!/usr/bin/perl

$hosts_to_backup = `cat /etc/hosts.backup | fping -a`;

foreach $host (split(/\n/,$hosts_to_backup)) {
# do it
}




AUTHORS

Roland J. Schemers III, Stanford University, concept and versions 1.x
RL "Bob" Morgan, Stanford University, versions 2.x
David Papp, versions 2.3x and up,
fping website: http://www.fping.com


DIAGNOSTICS
Exit status is 0 if all the hosts are reachable, 1 if some hosts were unreachable, 2 if any IP addresses were not found, 3 for invalid command line arguments, and 4 for a system call failure.
BUGS
Ha! If we knew of any we would have fixed them!
RESTRICTIONS
If certain options are used (i.e, a low value for -i and -t, and a high value for -r) it is possible to flood the network. This program must be installed as setuid root in order to open up a raw socket, or must be run by root. In order to stop mere mortals from hosing the network (when fping is installed setuid root) , normal users can't specify the following:

-i n where n < 10 msec
-r n where n > 20
-t n where n < 250 msec



SEE ALSO
netstat(1), ping(8), ifconfig(8c)
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests