[Nagiosplug-devel] [ nagiosplug-Bugs-1159828 ] CRITICAL check_ping on FC3
SourceForge.net
noreply at sourceforge.net
Thu Mar 31 05:17:40 CEST 2005
Bugs item #1159828, was opened at 2005-03-09 13:57
Message generated for change (Comment added) made by jeff_fr
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1159828&group_id=29880
Category: None
Group: None
Status: Open
Resolution: None
Priority: 9
Submitted By: PiTsA (pitsa)
Assigned to: Nobody/Anonymous (nobody)
Summary: CRITICAL check_ping on FC3
Initial Comment:
The ping verification its not working...
[root at infoandre libexec]# ./check_ping -H 192.168.1.4
-w 100.0,0,20% -c 500.0,0,60%
/bin/ping -n -U -w 10 -c 5 192.168.1.4
CRITICAL - Could not interpret output from ping command
[root at infoandre libexec]# /bin/ping -n -U -w 10 -c 5
192.168.1.4
PING 192.168.1.4 (192.168.1.4) 56(84) bytes of data.
64 bytes from 192.168.1.4: icmp_seq=0 ttl=128 time=0.249 ms
64 bytes from 192.168.1.4: icmp_seq=1 ttl=128 time=0.255 ms
64 bytes from 192.168.1.4: icmp_seq=2 ttl=128 time=0.198 ms
64 bytes from 192.168.1.4: icmp_seq=3 ttl=128 time=0.738 ms
64 bytes from 192.168.1.4: icmp_seq=4 ttl=128 time=0.187 ms
--- 192.168.1.4 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time
4006ms
rtt min/avg/max/mdev = 0.187/0.325/0.738/0.208 ms, pipe 2
[root at infoandre libexec]#
----------------------------------------------------------------------
Comment By: jeff_fr (jeff_fr)
Date: 2005-03-31 13:14
Message:
Logged In: YES
user_id=1250267
you must modifiy chech_ping line 74 and add :
setlocale (LC_ALL, "C");
instead of :
setlocale (LC_ALL, "");
recompile ... in nagios it will be state ok in console mode
you will get something like :
PING CRITICAL - PAcket loss= 0%, TA= 1 ms
----------------------------------------------------------------------
Comment By: Bastien (dro0p)
Date: 2005-03-11 10:29
Message:
Logged In: YES
user_id=1237097
Hi,
Same problem here on a redhat 7.3. For me this problem is
due to the local used. In fact my local (french) used , as
float separator instead of . (us or english local). So the
scanf function is unable to read float from the command ping
(wich sort float using .). I made a small patch (it has a
bad quality but it works). I post it here :
-----
--- check_ping.c Fri Mar 11 10:13:08 2005
+++ check_ping.c Fri Mar 11 10:09:50 2005
@@ -401,6 +401,7 @@
{
char buf[MAX_INPUT_BUFFER];
int result = STATE_UNKNOWN;
+ int i;
if ((child_process = spopen (cmd)) == NULL)
die (STATE_UNKNOWN, _("Could not open pipe: %s\n"), cmd);
@@ -421,9 +422,19 @@
sscanf(buf,"%*d packets transmitted, %*d received, %d%%
packet loss, time", &pl)==1 ||
sscanf(buf,"%*d packets transmitted, %*d received,
+%*d errors, %d%% packet loss", &pl) == 1)
continue;
-
/* get the round trip average */
else
+ {
+ if ((buf[0] == 'r') && (buf[1] == 't') && (buf[2] == 't'))
+ {
+ //fix for locales who uses , as float delimiter
+ for (i = 3 ; buf[i] != 0 ; i++)
+ {
+ if (buf[i] == '.')
+ buf[i] = ',';
+ }
+ }
+
if(sscanf(buf,"round-trip min/avg/max =
%*f/%f/%*f",&rta)==1 ||
sscanf(buf,"round-trip min/avg/max/mdev =
%*f/%f/%*f/%*f",&rta)==1 ||
sscanf(buf,"round-trip min/avg/max/sdev =
%*f/%f/%*f/%*f",&rta)==1 ||
@@ -432,7 +443,8 @@
sscanf(buf,"round-trip (ms) min/avg/max =
%*f/%f/%*f",&rta)==1 ||
sscanf(buf,"round-trip (ms) min/avg/max/stddev =
%*f/%f/%*f/%*f",&rta)==1 ||
sscanf(buf,"rtt min/avg/max/mdev = %*f/%f/%*f/%*f
ms",&rta)==1)
- continue;
+ continue;
+ }
}
/* this is needed because there is no rta if all packets
are lost */
----
----------------------------------------------------------------------
Comment By: PiTsA (pitsa)
Date: 2005-03-09 14:00
Message:
Logged In: YES
user_id=1235741
nagios-plugins Version 1.4
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1159828&group_id=29880
More information about the Devel
mailing list