diff options
author | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2007-12-11 13:31:22 (GMT) |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2007-12-11 13:31:22 (GMT) |
commit | 8cb50065632541ea83097d02182385910ee37a8c (patch) | |
tree | 5c78dfd1f2d853fe8acd7712433273bc4f21b05f | |
parent | ba6b4cab4125b5f07f6e37c8504824850425267f (diff) | |
download | monitoring-plugins-8cb50065632541ea83097d02182385910ee37a8c.tar.gz |
- Fix check_ntp_peer returning misleading information when an ICMP message came back
- Try to fix some servers apparently exanding the ~ in threshold ranges in t/check_ntp.t
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1864 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r-- | plugins/check_ntp_peer.c | 3 | ||||
-rw-r--r-- | plugins/t/check_ntp.t | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/plugins/check_ntp_peer.c b/plugins/check_ntp_peer.c index b5551ba..3e518bc 100644 --- a/plugins/check_ntp_peer.c +++ b/plugins/check_ntp_peer.c | |||
@@ -264,7 +264,8 @@ int ntp_request(const char *host, double *offset, int *offset_result, double *ji | |||
264 | /* Attempt to read the largest size packet possible */ | 264 | /* Attempt to read the largest size packet possible */ |
265 | req.count=htons(MAX_CM_SIZE); | 265 | req.count=htons(MAX_CM_SIZE); |
266 | DBG(printf("recieving READSTAT response")) | 266 | DBG(printf("recieving READSTAT response")) |
267 | read(conn, &req, SIZEOF_NTPCM(req)); | 267 | if(read(conn, &req, SIZEOF_NTPCM(req)) == -1) |
268 | die(STATE_CRITICAL, "NTP CRITICAL: No response from NTP server\n"); | ||
268 | DBG(print_ntp_control_message(&req)); | 269 | DBG(print_ntp_control_message(&req)); |
269 | /* Each peer identifier is 4 bytes in the data section, which | 270 | /* Each peer identifier is 4 bytes in the data section, which |
270 | * we represent as a ntp_assoc_status_pair datatype. | 271 | * we represent as a ntp_assoc_status_pair datatype. |
diff --git a/plugins/t/check_ntp.t b/plugins/t/check_ntp.t index ae7f036..01a890e 100644 --- a/plugins/t/check_ntp.t +++ b/plugins/t/check_ntp.t | |||
@@ -97,13 +97,13 @@ foreach my $plugin (@PLUGINS2) { | |||
97 | like( $res->output, $ntp_okmatch2, "$plugin: Output match OK with jitter and stratum" ); | 97 | like( $res->output, $ntp_okmatch2, "$plugin: Output match OK with jitter and stratum" ); |
98 | 98 | ||
99 | $res = NPTest->testCmd( | 99 | $res = NPTest->testCmd( |
100 | "./$plugin -H $ntp_service -w 1000 -c 2000 -W ~:-1 -C 21 -j 100000 -k 200000" | 100 | "./$plugin -H $ntp_service -w 1000 -c 2000 -W \~:-1 -C 21 -j 100000 -k 200000" |
101 | ); | 101 | ); |
102 | cmp_ok( $res->return_code, '==', 1, "$plugin: Warning NTP result with jitter and stratum check" ); | 102 | cmp_ok( $res->return_code, '==', 1, "$plugin: Warning NTP result with jitter and stratum check" ); |
103 | like( $res->output, $ntp_warnmatch2, "$plugin: Output match WARNING with jitter and stratum" ); | 103 | like( $res->output, $ntp_warnmatch2, "$plugin: Output match WARNING with jitter and stratum" ); |
104 | 104 | ||
105 | $res = NPTest->testCmd( | 105 | $res = NPTest->testCmd( |
106 | "./$plugin -H $ntp_service -w 1000 -c 2000 -W 20 -C 21 -j 100000 -k ~:-1" | 106 | "./$plugin -H $ntp_service -w 1000 -c 2000 -W 20 -C 21 -j 100000 -k \~:-1" |
107 | ); | 107 | ); |
108 | cmp_ok( $res->return_code, '==', 2, "$plugin: Critical NTP result with jitter and stratum check" ); | 108 | cmp_ok( $res->return_code, '==', 2, "$plugin: Critical NTP result with jitter and stratum check" ); |
109 | like( $res->output, $ntp_critmatch2, "$plugin: Output match CRITICAL with jitter and stratum" ); | 109 | like( $res->output, $ntp_critmatch2, "$plugin: Output match CRITICAL with jitter and stratum" ); |