summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cf0dee6)
raw | patch | inline | side by side (parent: cf0dee6)
author | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | |
Thu, 25 Oct 2007 21:06:08 +0000 (21:06 +0000) | ||
committer | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | |
Thu, 25 Oct 2007 21:06:08 +0000 (21:06 +0000) |
unavailable. If no offset threshold is specified and
the offset is unavailable, will return UNKNOWN as well.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1811 f882894a-f735-0410-b71e-b25c423dba1c
the offset is unavailable, will return UNKNOWN as well.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1811 f882894a-f735-0410-b71e-b25c423dba1c
NEWS | patch | blob | history | |
plugins/check_ntp.c | patch | blob | history |
index 361443b431de8defbbbcd77892dece6ec814043e..99739a701b4c8dc425edad369d74dfb913c9207d 100644 (file)
--- a/NEWS
+++ b/NEWS
Fix check_http regression in 1.4.10 where following redirects to
relative URLs on virtual hosts failed if both "-H" and "-I" were used
Add stratum thresholds support to check_ntp (feature request #1703823)
+ check_ntp now return UNKNOWN instead of WARNING if jitter is unavailable (jitter=-1.000000)
+ as long as the thresholds range inculde -1. If no offset threshold is specified
+ and the offset is unavailable, will return UNKNOWN as well.
+ NOTE: If jitter thresholds are specified integers it will return CRITICAL if jitter
+ is "-1" as the default range starts at 0. See Examples in --help output.
1.4.10 28th September 2007
Fix check_http buffer overflow vulnerability when following HTTP redirects
diff --git a/plugins/check_ntp.c b/plugins/check_ntp.c
index 12334f777adbaa9adc07583100bd67b9d9f2f22d..df6e02f851a3c81faf65e636e0e87940fd8a6a7e 100644 (file)
--- a/plugins/check_ntp.c
+++ b/plugins/check_ntp.c
static char *server_address=NULL;
static int verbose=0;
+static short do_offset=0;
static char *owarn="60";
static char *ocrit="120";
static short do_stratum=0;
/* now, pick the best server from the list */
best_index=best_offset_server(servers, num_hosts);
if(best_index < 0){
- *status=STATE_CRITICAL;
+ *status=STATE_UNKNOWN;
} else {
/* finally, calculate the average offset */
for(i=0; i<servers[best_index].num_responses;i++){
if(verbose) printf("%d candiate peers available\n", num_candidates);
if(verbose && syncsource_found) printf("synchronization source found\n");
if(! syncsource_found){
- *status = STATE_WARNING;
+ *status = STATE_UNKNOWN;
if(verbose) printf("warning: no synchronization source found\n");
}
}
if(startofvalue == NULL || startofvalue==nptr){
printf("warning: unable to read server jitter response.\n");
- *status = STATE_WARNING;
+ *status = STATE_UNKNOWN;
} else {
if(verbose) printf("%g\n", jitter);
num_valid++;
verbose++;
break;
case 'w':
+ do_offset=1;
owarn = optarg;
break;
case 'c':
+ do_offset=1;
ocrit = optarg;
break;
case 'W':
double offset=0, jitter=0;
char *result_line, *perfdata_line;
- result = offset_result = jitter_result= STATE_UNKNOWN;
+ result = offset_result = jitter_result = STATE_OK;
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
alarm (socket_timeout);
offset = offset_request(server_address, &stratum, &offset_result);
- result = get_status(fabs(offset), offset_thresholds);
+ if (do_offset && offset_result == STATE_UNKNOWN) {
+ result = STATE_CRITICAL;
+ } else {
+ result = get_status(fabs(offset), offset_thresholds);
+ }
result = max_state(result, offset_result);
if(do_stratum)
result = max_state(result, get_status(stratum, stratum_thresholds));
asprintf(&result_line, "NTP UNKNOWN:");
break;
}
- if(offset_result==STATE_CRITICAL){
+ if(offset_result == STATE_UNKNOWN){
asprintf(&result_line, "%s %s", result_line, _("Offset unknown"));
asprintf(&perfdata_line, "");
} else {
+#if 0 /* 2007-10-25 This can't happen. Leftovers or uninplemented? */
if(offset_result==STATE_WARNING){
asprintf(&result_line, "%s %s", result_line, _("Unable to fully sample sync server"));
}
+#endif
asprintf(&result_line, "%s Offset %.10g secs", result_line, offset);
asprintf(&perfdata_line, "%s", perfd_offset(offset));
}
printf(" %s\n", ("http://nagiosplug.sourceforge.net/developer-guidelines.html#THRESHOLDFORMAT"));
printf(" %s\n", _("for THRESHOLD format and examples."));
+ printf("\n");
+ printf("%s\n", _("Examples:"));
+ printf(" %s\n", _("Normal offset check:"));
+ printf(" %s\n", ("./check_ntp -H ntpserv -w 0.5 -c 1"));
+ printf(" %s\n", _("Check jitter too, avoiding critical notifications if jitter isn't available"));
+ printf(" %s\n", _("(See Notes above for more details on thresholds formats):"));
+ printf(" %s\n", ("./check_ntp -H ntpserv -w 0.5 -c 1 -j -1:100 -k -1:200"));
+ printf(" %s\n", _("Check only stratum:"));
+ printf(" %s\n", ("./check_ntp -H ntpserv -W 4 -C 6"));
+
printf (_(UT_SUPPORT));
}