diff options
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | THANKS.in | 1 | ||||
-rw-r--r-- | plugins-root/check_icmp.c | 22 |
3 files changed, 19 insertions, 5 deletions
@@ -11,6 +11,7 @@ This file documents the major additions and syntax changes between releases. | |||
11 | Fixed dependency issue on libtap when ./configure --enable-libtap used. Warning: will install libtap | 11 | Fixed dependency issue on libtap when ./configure --enable-libtap used. Warning: will install libtap |
12 | Fixed segfault in extra-opts under some circumstance when reading multiple sections | 12 | Fixed segfault in extra-opts under some circumstance when reading multiple sections |
13 | Fix long options parsing in check_tcp | 13 | Fix long options parsing in check_tcp |
14 | check_icmp now reports min and max round trip time perfdata (Steve Rader) | ||
14 | 15 | ||
15 | 1.4.13 25th Sept 2008 | 16 | 1.4.13 25th Sept 2008 |
16 | Fix Debian bug #460097: check_http --max-age broken (Hilko Bengen) | 17 | Fix Debian bug #460097: check_http --max-age broken (Hilko Bengen) |
@@ -240,3 +240,4 @@ Sven Nierlein | |||
240 | Erik Wasser | 240 | Erik Wasser |
241 | Tilman Koschnick | 241 | Tilman Koschnick |
242 | Olivier 'Babar' Raginel | 242 | Olivier 'Babar' Raginel |
243 | Steve Rader | ||
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c index dff3abb..ff6c73b 100644 --- a/plugins-root/check_icmp.c +++ b/plugins-root/check_icmp.c | |||
@@ -106,6 +106,9 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net"; | |||
106 | # define ICMP_UNREACH_PRECEDENCE_CUTOFF 15 | 106 | # define ICMP_UNREACH_PRECEDENCE_CUTOFF 15 |
107 | #endif | 107 | #endif |
108 | 108 | ||
109 | #ifndef DBL_MAX | ||
110 | # define DBL_MAX 9.9999999999e999 | ||
111 | #endif | ||
109 | 112 | ||
110 | typedef unsigned short range_t; /* type for get_range() -- unimplemented */ | 113 | typedef unsigned short range_t; /* type for get_range() -- unimplemented */ |
111 | 114 | ||
@@ -120,6 +123,8 @@ typedef struct rta_host { | |||
120 | unsigned char icmp_type, icmp_code; /* type and code from errors */ | 123 | unsigned char icmp_type, icmp_code; /* type and code from errors */ |
121 | unsigned short flags; /* control/status flags */ | 124 | unsigned short flags; /* control/status flags */ |
122 | double rta; /* measured RTA */ | 125 | double rta; /* measured RTA */ |
126 | double rtmax; /* max rtt */ | ||
127 | double rtmin; /* min rtt */ | ||
123 | unsigned char pl; /* measured packet loss */ | 128 | unsigned char pl; /* measured packet loss */ |
124 | struct rta_host *next; /* linked list */ | 129 | struct rta_host *next; /* linked list */ |
125 | } rta_host; | 130 | } rta_host; |
@@ -782,11 +787,15 @@ wait_for_reply(int sock, u_int t) | |||
782 | host->time_waited += tdiff; | 787 | host->time_waited += tdiff; |
783 | host->icmp_recv++; | 788 | host->icmp_recv++; |
784 | icmp_recv++; | 789 | icmp_recv++; |
790 | if (tdiff > host->rtmax) | ||
791 | host->rtmax = tdiff; | ||
792 | if (tdiff < host->rtmin) | ||
793 | host->rtmin = tdiff; | ||
785 | 794 | ||
786 | if(debug) { | 795 | if(debug) { |
787 | printf("%0.3f ms rtt from %s, outgoing ttl: %u, incoming ttl: %u\n", | 796 | printf("%0.3f ms rtt from %s, outgoing ttl: %u, incoming ttl: %u, max: %0.3f, min: %0.3f\n", |
788 | (float)tdiff / 1000, inet_ntoa(resp_addr.sin_addr), | 797 | (float)tdiff / 1000, inet_ntoa(resp_addr.sin_addr), |
789 | ttl, ip->ip_ttl); | 798 | ttl, ip->ip_ttl, (float)host->rtmax / 1000, (float)host->rtmin / 1000); |
790 | } | 799 | } |
791 | 800 | ||
792 | /* if we're in hostcheck mode, exit with limited printouts */ | 801 | /* if we're in hostcheck mode, exit with limited printouts */ |
@@ -993,11 +1002,12 @@ finish(int sig) | |||
993 | host = list; | 1002 | host = list; |
994 | while(host) { | 1003 | while(host) { |
995 | if(debug) puts(""); | 1004 | if(debug) puts(""); |
996 | printf("%srta=%0.3fms;%0.3f;%0.3f;0; %spl=%u%%;%u;%u;; ", | 1005 | printf("%srta=%0.3fms;%0.3f;%0.3f;0; %spl=%u%%;%u;%u;; %srtmax=%0.3fms;;;; %srtmin=%0.3fms;;;; ", |
997 | (targets > 1) ? host->name : "", | 1006 | (targets > 1) ? host->name : "", |
998 | host->rta / 1000, (float)warn.rta / 1000, (float)crit.rta / 1000, | 1007 | host->rta / 1000, (float)warn.rta / 1000, (float)crit.rta / 1000, |
999 | (targets > 1) ? host->name : "", | 1008 | (targets > 1) ? host->name : "", host->pl, warn.pl, crit.pl, |
1000 | host->pl, warn.pl, crit.pl); | 1009 | (targets > 1) ? host->name : "", (float)host->rtmax / 1000, |
1010 | (targets > 1) ? host->name : "", (host->rtmin < DBL_MAX) ? (float)host->rtmin / 1000 : (float)0); | ||
1001 | 1011 | ||
1002 | host = host->next; | 1012 | host = host->next; |
1003 | } | 1013 | } |
@@ -1074,6 +1084,8 @@ add_target_ip(char *arg, struct in_addr *in) | |||
1074 | host->saddr_in.sin_family = AF_INET; | 1084 | host->saddr_in.sin_family = AF_INET; |
1075 | host->saddr_in.sin_addr.s_addr = in->s_addr; | 1085 | host->saddr_in.sin_addr.s_addr = in->s_addr; |
1076 | 1086 | ||
1087 | host->rtmin = DBL_MAX; | ||
1088 | |||
1077 | if(!list) list = cursor = host; | 1089 | if(!list) list = cursor = host; |
1078 | else cursor->next = host; | 1090 | else cursor->next = host; |
1079 | 1091 | ||