summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b19f070)
raw | patch | inline | side by side (parent: b19f070)
author | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | |
Wed, 4 Apr 2007 20:08:59 +0000 (20:08 +0000) | ||
committer | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | |
Wed, 4 Apr 2007 20:08:59 +0000 (20:08 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1676 f882894a-f735-0410-b71e-b25c423dba1c
plugins/check_ntp.c | patch | blob | history |
diff --git a/plugins/check_ntp.c b/plugins/check_ntp.c
index 30e589006c6ea04c31a9d529ad207e40bf880f7e..185711847e0369285961b9dd1ea2e8f14971b94e 100644 (file)
--- a/plugins/check_ntp.c
+++ b/plugins/check_ntp.c
int peers_size=0, peer_offset=0;
ntp_assoc_status_pair *peers=NULL;
ntp_control_message req;
+ const char *getvar = "jitter";
double rval = 0.0, jitter = -1.0;
char *startofvalue=NULL, *nptr=NULL;
void *tmp;
* thus reducing net traffic, guaranteeing us only a single
* datagram in reply, and making intepretation much simpler
*/
- strncpy(req.data, "jitter", 6);
- req.count = htons(6);
+ /* Older servers doesn't know what jitter is, so if we get an
+ * error on the first pass we redo it with "dispersion" */
+ strncpy(req.data, getvar, MAX_CM_SIZE-1);
+ req.count = htons(strlen(getvar));
DBG(printf("sending READVAR request...\n"));
write(conn, &req, SIZEOF_NTPCM(req));
DBG(print_ntp_control_message(&req));
read(conn, &req, SIZEOF_NTPCM(req));
DBG(print_ntp_control_message(&req));
+ if(req.op&REM_ERROR && strstr(getvar, "jitter")) {
+ if(verbose) printf("The 'jitter' command failed (old ntp server?)\nRestarting with 'dispersion'...\n");
+ getvar = "dispersion";
+ num_selected--;
+ i--;
+ continue;
+ }
+
/* get to the float value */
if(verbose) {
printf("parsing jitter from peer %.2x: ", ntohs(peers[i].assoc));