summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Beutner <gunnar@beutner.name>2014-04-21 11:29:45 +0200
committerHolger Weiss <holger@zedat.fu-berlin.de>2014-04-27 19:59:06 +0200
commite0af39d7e9fcd084cf7d2d8a57d07ab1f8038150 (patch)
treef6eee031831451476795e139b6ceb33298b1155d
parentd00efeb872c968824879614c848cead71452cbfd (diff)
downloadmonitoring-plugins-e0af39d7e9fcd084cf7d2d8a57d07ab1f8038150.tar.gz
Make check_ping work on Windows.
-rw-r--r--configure.ac16
-rw-r--r--plugins/check_ping.c7
2 files changed, 19 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac
index d73ac545..f405cce7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -90,6 +90,7 @@ ac_cv_uname_m=`uname -m`
90ac_cv_uname_s=`uname -s` 90ac_cv_uname_s=`uname -s`
91ac_cv_uname_r=`uname -r` 91ac_cv_uname_r=`uname -r`
92ac_cv_uname_v=`uname -v` 92ac_cv_uname_v=`uname -v`
93ac_cv_uname_o=`uname -o`
93 94
94PKG_ARCH=`uname -p` 95PKG_ARCH=`uname -p`
95REV_DATESTAMP=`date '+%Y.%m.%d.%H.%M'` 96REV_DATESTAMP=`date '+%Y.%m.%d.%H.%M'`
@@ -1011,6 +1012,13 @@ then
1011 ac_cv_ping_packets_first=yes 1012 ac_cv_ping_packets_first=yes
1012 fi 1013 fi
1013 1014
1015elif [[ "z$ac_cv_uname_o" = "zCygwin" ]]
1016then
1017 with_ping_command="$PATH_TO_PING -n %d -w %d000 %s"
1018 ac_cv_ping_packets_first=yes
1019 ac_cv_ping_has_timeout=yes
1020 AC_MSG_RESULT([$with_ping_command])
1021
1014elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \ 1022elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1015 $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \ 1023 $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
1016 egrep -i "^round-trip|^rtt" >/dev/null 1024 egrep -i "^round-trip|^rtt" >/dev/null
@@ -1024,7 +1032,7 @@ elif $PATH_TO_PING -n -U -w 10 -c 1 127.0.0.1 2>/dev/null | \
1024then 1032then
1025 with_ping_command="$PATH_TO_PING -n -U -w %d -c %d %s" 1033 with_ping_command="$PATH_TO_PING -n -U -w %d -c %d %s"
1026 ac_cv_ping_packets_first=yes 1034 ac_cv_ping_packets_first=yes
1027 ac_cv_ping_has_timeout=yes 1035 ac_cv_ping_has_timeout=yes
1028 AC_MSG_RESULT([$with_ping_command]) 1036 AC_MSG_RESULT([$with_ping_command])
1029 1037
1030elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \ 1038elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \
@@ -1121,7 +1129,11 @@ then
1121 then 1129 then
1122 ac_cv_ping6_packets_first=yes 1130 ac_cv_ping6_packets_first=yes
1123 fi 1131 fi
1124 1132elif [[ "z$ac_cv_uname_o" = "zCygwin" -a "x$PATH_TO_PING" != "x" ]]; then
1133 with_ping6_command="$PATH_TO_PING -6 -n %d -w %d000 %s"
1134 ac_cv_ping6_packets_first=yes
1135 ac_cv_ping_has_timeout=yes
1136 AC_MSG_RESULT([$with_ping6_command])
1125elif test "x$PATH_TO_PING6" != "x"; then 1137elif test "x$PATH_TO_PING6" != "x"; then
1126 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \ 1138 if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
1127 $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \ 1139 $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
diff --git a/plugins/check_ping.c b/plugins/check_ping.c
index 95ac7b44..dbc5c3e4 100644
--- a/plugins/check_ping.c
+++ b/plugins/check_ping.c
@@ -458,7 +458,8 @@ run_ping (const char *cmd, const char *addr)
458 (sscanf(buf,"%*d packets transmitted, %*d received, %d%% loss, time%n",&pl,&match) && match) || 458 (sscanf(buf,"%*d packets transmitted, %*d received, %d%% loss, time%n",&pl,&match) && match) ||
459 (sscanf(buf,"%*d packets transmitted, %*d received, %d%% packet loss, time%n",&pl,&match) && match) || 459 (sscanf(buf,"%*d packets transmitted, %*d received, %d%% packet loss, time%n",&pl,&match) && match) ||
460 (sscanf(buf,"%*d packets transmitted, %*d received, +%*d errors, %d%% packet loss%n",&pl,&match) && match) || 460 (sscanf(buf,"%*d packets transmitted, %*d received, +%*d errors, %d%% packet loss%n",&pl,&match) && match) ||
461 (sscanf(buf,"%*d packets transmitted %*d received, +%*d errors, %d%% packet loss%n",&pl,&match) && match) 461 (sscanf(buf,"%*d packets transmitted %*d received, +%*d errors, %d%% packet loss%n",&pl,&match) && match) ||
462 (sscanf(buf,"%*[^(](%d%% %*[^)])%n",&pl,&match) && match)
462 ) 463 )
463 continue; 464 continue;
464 465
@@ -471,7 +472,9 @@ run_ping (const char *cmd, const char *addr)
471 (sscanf(buf,"round-trip min/avg/max/std-dev = %*f/%f/%*f/%*f%n",&rta,&match) && match) || 472 (sscanf(buf,"round-trip min/avg/max/std-dev = %*f/%f/%*f/%*f%n",&rta,&match) && match) ||
472 (sscanf(buf,"round-trip (ms) min/avg/max = %*f/%f/%*f%n",&rta,&match) && match) || 473 (sscanf(buf,"round-trip (ms) min/avg/max = %*f/%f/%*f%n",&rta,&match) && match) ||
473 (sscanf(buf,"round-trip (ms) min/avg/max/stddev = %*f/%f/%*f/%*f%n",&rta,&match) && match) || 474 (sscanf(buf,"round-trip (ms) min/avg/max/stddev = %*f/%f/%*f/%*f%n",&rta,&match) && match) ||
474 (sscanf(buf,"rtt min/avg/max/mdev = %*f/%f/%*f/%*f ms%n",&rta,&match) && match)) 475 (sscanf(buf,"rtt min/avg/max/mdev = %*f/%f/%*f/%*f ms%n",&rta,&match) && match) ||
476 (sscanf(buf, "%*[^=] = %*fms, %*[^=] = %*fms, %*[^=] = %fms%n", &rta, &match) && match)
477 )
475 continue; 478 continue;
476 } 479 }
477 480