check_ntp oddity

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
and1100
Posts: 93
Joined: Mon Mar 25, 2013 8:37 am

check_ntp oddity

Post by and1100 »

Hello,

I'm trying to configure check_ntp to monitor hosts in our environment for sync offset or drift. I have this working via command line:


[root@vmnagios libexec]# ./check_ntp -H x.x.x.x -w 0.5 -c 1
NTP OK: Offset 0.002705574036 secs|offset=0.002706s;0.500000;1.000000;

I set up my config as follows:

#define service{
# use generic-service
# hostgroup_name jpm
# service_description NTP SYNC
# check_command check_ntp!-H 10.8.57.41 -w 0.5 -c 1
# }


and then in the commands.cfg I added:

define command{
command_name check_ntp
command_line $USER1$/check_ntp -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$
}

However, on our Nagios website, I am receiving the following:

Current Status: UNKNOWN (for 0d 0h 0m 5s)
Status Information: WARNING: check_ntp is deprecated. Please use check_ntp_peer or
check_ntp_time instead.
\nUsage:
check_ntp -H <host> [-w <warn>] [-c <crit>] [-j <warn>] [-k <crit>] [-v verbose]
Performance Data:
Current Attempt: 1/3 (SOFT state)
Last Check Time: 11-07-2013 09:42:15
Check Type: ACTIVE
Check Latency / Duration: 2.160 / 0.008 seconds
Next Scheduled Check: 11-07-2013 09:44:15

Am I doing something wrong? Thank you.
cbeattie
Posts: 19
Joined: Fri Oct 04, 2013 7:12 am

Re: check_ntp oddity

Post by cbeattie »

The command directive in your service definition is handing off the arguments incorrectly.

check_command check_ntp!-H 10.8.57.41 -w 0.5 -c 1

This is actually passing "-H 10.8.57.41 -w 0.5 -c 1" as $ARG1$. Try this instead:

check_command check_ntp!0.5!1

This should pass 0.5 as $ARG1$ and 1 as $ARG2$ (notice the extra ! separating the two). You don't need to pass the -H, -w, and -c options in the service definition because they're already in the command definition.

Also, since check_ntp is deprecated, you might want to investigate using check_ntp_peer or check_ntp_time instead. I don't use them, so I can't offer advice as to which would be more appropriate for your setup.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: check_ntp oddity

Post by tmcdonald »

Thank you, cbeattie. and1100, let us know if that fixed your issue.
Former Nagios employee
and1100
Posts: 93
Joined: Mon Mar 25, 2013 8:37 am

Re: check_ntp oddity

Post by and1100 »

Hi cbeattie,

This works beautifully! Thank you very much for your help.

Please close and lock.

Thank you!
Locked