summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@users.sourceforge.net>2008-01-29 10:27:06 (GMT)
committerThomas Guyot-Sionnest <dermoth@users.sourceforge.net>2008-01-29 10:27:06 (GMT)
commite097ee6953c29a2ec9ddd550f347c74e64c60286 (patch)
tree8ec68fe0ead2727aebdb2adf00866cba7439607a
parent5fcffd79783da265ff9b44f71e0d77c721578890 (diff)
downloadmonitoring-plugins-e097ee6953c29a2ec9ddd550f347c74e64c60286.tar.gz
check_ntp_peer now checks for the LI_ALARM flag
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1911 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r--NEWS1
-rw-r--r--plugins/check_ntp_peer.c10
2 files changed, 10 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 76cd803..35c9d32 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ This file documents the major additions and syntax changes between releases.
9 Fixed check_disk disk usage calculation when using --group=NAME (related to bug #1348746) 9 Fixed check_disk disk usage calculation when using --group=NAME (related to bug #1348746)
10 Fix help text of check_ntp* (Bug #1880095) 10 Fix help text of check_ntp* (Bug #1880095)
11 Fix bugs and flaws in best offset server selection of check_ntp_time and (deprecated) check_ntp 11 Fix bugs and flaws in best offset server selection of check_ntp_time and (deprecated) check_ntp
12 check_ntp_peer now checks for the LI_ALARM flag
12 13
131.4.11 13th December 2007 141.4.11 13th December 2007
14 Fixed check_http regression in 1.4.10 where following redirects to 15 Fixed check_http regression in 1.4.10 where following redirects to
diff --git a/plugins/check_ntp_peer.c b/plugins/check_ntp_peer.c
index d1b8b27..806123b 100644
--- a/plugins/check_ntp_peer.c
+++ b/plugins/check_ntp_peer.c
@@ -63,6 +63,7 @@ static short do_jitter=0;
63static char *jwarn="-1:5000"; 63static char *jwarn="-1:5000";
64static char *jcrit="-1:10000"; 64static char *jcrit="-1:10000";
65static int syncsource_found=0; 65static int syncsource_found=0;
66static int li_alarm=0;
66 67
67int process_arguments (int, char **); 68int process_arguments (int, char **);
68thresholds *offset_thresholds = NULL; 69thresholds *offset_thresholds = NULL;
@@ -267,6 +268,7 @@ int ntp_request(const char *host, double *offset, int *offset_result, double *ji
267 if(read(conn, &req, SIZEOF_NTPCM(req)) == -1) 268 if(read(conn, &req, SIZEOF_NTPCM(req)) == -1)
268 die(STATE_CRITICAL, "NTP CRITICAL: No response from NTP server\n"); 269 die(STATE_CRITICAL, "NTP CRITICAL: No response from NTP server\n");
269 DBG(print_ntp_control_message(&req)); 270 DBG(print_ntp_control_message(&req));
271 if (LI(req.flags) == LI_ALARM) li_alarm = 1;
270 /* Each peer identifier is 4 bytes in the data section, which 272 /* Each peer identifier is 4 bytes in the data section, which
271 * we represent as a ntp_assoc_status_pair datatype. 273 * we represent as a ntp_assoc_status_pair datatype.
272 */ 274 */
@@ -297,6 +299,10 @@ int ntp_request(const char *host, double *offset, int *offset_result, double *ji
297 status = STATE_WARNING; 299 status = STATE_WARNING;
298 if(verbose) printf("warning: no synchronization source found\n"); 300 if(verbose) printf("warning: no synchronization source found\n");
299 } 301 }
302 if(li_alarm){
303 status = STATE_WARNING;
304 if(verbose) printf("warning: LI_ALARM bit is set\n");
305 }
300 306
301 307
302 for (i = 0; i < npeers; i++){ 308 for (i = 0; i < npeers; i++){
@@ -597,7 +603,9 @@ int main(int argc, char *argv[]){
597 } 603 }
598 if(!syncsource_found) 604 if(!syncsource_found)
599 asprintf(&result_line, "%s %s,", result_line, _("Server not synchronized")); 605 asprintf(&result_line, "%s %s,", result_line, _("Server not synchronized"));
600 606 else if(li_alarm)
607 asprintf(&result_line, "%s %s,", result_line, _("Server has the LI_ALARM bit set"));
608
601 if(offset_result == STATE_UNKNOWN){ 609 if(offset_result == STATE_UNKNOWN){
602 asprintf(&result_line, "%s %s", result_line, _("Offset unknown")); 610 asprintf(&result_line, "%s %s", result_line, _("Offset unknown"));
603 asprintf(&perfdata_line, ""); 611 asprintf(&perfdata_line, "");