diff options
| author | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-09-30 00:03:24 +0200 |
|---|---|---|
| committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-09-30 00:03:24 +0200 |
| commit | 0b6423f9c99d9edf8c96fefd0f6c453859395aa1 (patch) | |
| tree | 1c2b6b21704a294940f87c7892676998d8371707 /web/attachments/246468-check_ntp_flags.patch | |
| download | site-0b6423f9c99d9edf8c96fefd0f6c453859395aa1.tar.gz | |
Import Nagios Plugins site
Import the Nagios Plugins web site, Cronjobs, infrastructure scripts,
and configuration files.
Diffstat (limited to 'web/attachments/246468-check_ntp_flags.patch')
| -rw-r--r-- | web/attachments/246468-check_ntp_flags.patch | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/web/attachments/246468-check_ntp_flags.patch b/web/attachments/246468-check_ntp_flags.patch new file mode 100644 index 0000000..e659ec5 --- /dev/null +++ b/web/attachments/246468-check_ntp_flags.patch | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | *** nagios-plugins-1.4.9/plugins/check_ntp.c 2007-04-10 09:17:18.000000000 +0200 | ||
| 2 | --- nagios-plugins-1.4.9_flags/plugins/check_ntp.c 2007-09-20 15:14:54.000000000 +0200 | ||
| 3 | *************** | ||
| 4 | *** 86,91 **** | ||
| 5 | --- 86,92 ---- | ||
| 6 | double rtdelay; /* converted from the ntp_message */ | ||
| 7 | double rtdisp; /* converted from the ntp_message */ | ||
| 8 | double offset[AVG_NUM]; /* offsets from each response */ | ||
| 9 | + uint8_t flags; /* byte with leapindicator,vers,mode. see macros */ | ||
| 10 | } ntp_server_results; | ||
| 11 | |||
| 12 | /* this structure holds everything in an ntp control message as per rfc1305 */ | ||
| 13 | *************** | ||
| 14 | *** 302,307 **** | ||
| 15 | --- 303,314 ---- | ||
| 16 | |||
| 17 | /* for each server */ | ||
| 18 | for(cserver=0; cserver<nservers; cserver++){ | ||
| 19 | + /* sort out servers with error flags */ | ||
| 20 | + if ( LI(slist[cserver].flags) != LI_NOWARNING ){ | ||
| 21 | + if (verbose) printf("discarding peer id %d: flags=%d\n", cserver, LI(slist[cserver].flags)); | ||
| 22 | + break; | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | /* compare it to each of the servers already in the candidate list */ | ||
| 26 | for(i=0; i<csize; i++){ | ||
| 27 | /* does it have an equal or better stratum? */ | ||
| 28 | *************** | ||
| 29 | *** 450,455 **** | ||
| 30 | --- 457,463 ---- | ||
| 31 | servers[i].rtdisp=NTP32asDOUBLE(req[i].rtdisp); | ||
| 32 | servers[i].rtdelay=NTP32asDOUBLE(req[i].rtdelay); | ||
| 33 | servers[i].waiting=0; | ||
| 34 | + servers[i].flags=req[i].flags; | ||
| 35 | servers_readable--; | ||
| 36 | one_read = 1; | ||
| 37 | if(servers[i].num_responses==AVG_NUM) servers_completed++; | ||
| 38 | *************** | ||
| 39 | *** 808,813 **** | ||
| 40 | --- 816,822 ---- | ||
| 41 | } | ||
| 42 | if(offset_result==STATE_CRITICAL){ | ||
| 43 | asprintf(&result_line, "%s %s", result_line, _("Offset unknown")); | ||
| 44 | + asprintf(&perfdata_line, "%s", "no perfdata"); | ||
| 45 | } else { | ||
| 46 | if(offset_result==STATE_WARNING){ | ||
| 47 | asprintf(&result_line, "%s %s", result_line, _("Unable to fully sample sync server")); | ||
