[Nagiosplug-devel] check_ntp misunderstandings?
Gerhard Lausser
Gerhard.Lausser at consol.de
Fri Jul 28 11:01:20 CEST 2006
Hi Sean
> perhaps we could throw in a new cmdline switch to have the
> jitter check against the local ntpd instead of the remote one?
Such a pure-local switch would be helpful. It could also save
an extra service which checks if a ntp daemon is running on the
local host.
What comes to my mind is like this:
... in main
case 'l': /* -l check jitter of the local ntpd /*
localntp=1;
break;
case 's':
strictlocal=1; /* -s be strict. critical if no local ntpd /*
break;
... in do_jitter
double jitter_request(const char *host, int *status){
if (localntp) {
strcpy(server_address, "127.0.0.1");
}
my_udp_connect(server_address, 123, &conn);
if (localntp && strictlocal && !conn) {
DBG("no local ntp daemon running")
return -2.0;
}
... in main
if(do_jitter) {
...
} else if(jitter == -1.0 && result == STATE_OK){
/* -1 indicates that we couldn't calculate the
jitter
* Only overrides STATE_OK from the offset */
result = STATE_UNKNOWN;
} else if(jitter == -2.0 && result == STATE_OK) {
/* -2 indicates there is no local ntp daeomon */
/* plus strictlocal is set */
result = STATE_CRITICAL;
... at the end of main
if (do_jitter) {
if (jitter == -2.0) {
printf(", no local ntp daemon running");
} else {
printf(", jitter=%f", jitter);
}
Checking for a running daemon would be very helpful, because it is a
platform-independent replacement for "check_proc -C [ntpd|xntpd|...]"
Greetings from Munich,
Gerhard
More information about the Devel
mailing list