SF.net SVN: nagiosplug: [1911] nagiosplug/trunk

[email protected]
Newsgroups gmane.network.nagios.plugins.cvs
Message-ID <[email protected]>
Revision: 1911
          http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=1911&view=rev
Author:   dermoth
Date:     2008-01-29 02:27:06 -0800 (Tue, 29 Jan 2008)

Log Message:
-----------
check_ntp_peer now checks for the LI_ALARM flag

Modified Paths:
--------------
    nagiosplug/trunk/NEWS
    nagiosplug/trunk/plugins/check_ntp_peer.c

Modified: nagiosplug/trunk/NEWS
===================================================================
--- nagiosplug/trunk/NEWS	2008-01-29 08:55:50 UTC (rev 1910)
+++ nagiosplug/trunk/NEWS	2008-01-29 10:27:06 UTC (rev 1911)
@@ -9,6 +9,7 @@
 	Fixed check_disk disk usage calculation when using --group=NAME (related to bug #1348746)
 	Fix help text of check_ntp* (Bug #1880095)
 	Fix bugs and flaws in best offset server selection of check_ntp_time and (deprecated) check_ntp
+	check_ntp_peer now checks for the LI_ALARM flag
 
 1.4.11 13th December 2007
 	Fixed check_http regression in 1.4.10 where following redirects to

Modified: nagiosplug/trunk/plugins/check_ntp_peer.c
===================================================================
--- nagiosplug/trunk/plugins/check_ntp_peer.c	2008-01-29 08:55:50 UTC (rev 1910)
+++ nagiosplug/trunk/plugins/check_ntp_peer.c	2008-01-29 10:27:06 UTC (rev 1911)
@@ -63,6 +63,7 @@
 static char *jwarn="-1:5000";
 static char *jcrit="-1:10000";
 static int syncsource_found=0;
+static int li_alarm=0;
 
 int process_arguments (int, char **);
 thresholds *offset_thresholds = NULL;
@@ -267,6 +268,7 @@
 		if(read(conn, &req, SIZEOF_NTPCM(req)) == -1)
 			die(STATE_CRITICAL, "NTP CRITICAL: No response from NTP server\n");
 		DBG(print_ntp_control_message(&req));
+		if (LI(req.flags) == LI_ALARM) li_alarm = 1;
 		/* Each peer identifier is 4 bytes in the data section, which
 	 	 * we represent as a ntp_assoc_status_pair datatype.
 	 	 */
@@ -297,6 +299,10 @@
 		status = STATE_WARNING;
 		if(verbose) printf("warning: no synchronization source found\n");
 	}
+	if(li_alarm){
+		status = STATE_WARNING;
+		if(verbose) printf("warning: LI_ALARM bit is set\n");
+	}
 
 
 	for (i = 0; i < npeers; i++){
@@ -597,7 +603,9 @@
 	}
 	if(!syncsource_found)
 		asprintf(&result_line, "%s %s,", result_line, _("Server not synchronized"));
-
+	else if(li_alarm)
+		asprintf(&result_line, "%s %s,", result_line, _("Server has the LI_ALARM bit set"));
+ 
 	if(offset_result == STATE_UNKNOWN){
 		asprintf(&result_line, "%s %s", result_line, _("Offset unknown"));
 		asprintf(&perfdata_line, "");


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.