naparuba / check-linux-by-ssh

Shinken checks designed to be run without installing something on the distant linux (aside ssh keys of course!)
MIT License
43 stars 48 forks source link

seconds vs milliseconds in check_ntp_sync_by_ssh.py #16

Closed Marc3001 closed 10 years ago

Marc3001 commented 10 years ago

Hi,

In check_ntp_sync_by_ssh.py script, you're checking "ntpq -p" result and considering values unit in this result is second.

But on my systems (and blogs I saw on the web), all values unit is millisecond.

Also in comments in your script you say :

# We are looking for a line like 
#     remote           refid      st t when poll reach   delay   offset  jitter
    #==============================================================================
#127.127.1.0     .LOCL.          10 l   53   64  377    0.000    0.000   0.001
# *blabla   blabla                 3 u  909 1024  377    0.366   -3.200   5.268

On my systems I got :

root@server21:~# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+z.bsod.fr       138.195.130.62   3 u   71 1024  377  306.726   33.223 187.520
+midir.legt.fr   88.190.16.19     3 u 1016 1024  373  123.219  -33.260 109.214
*ns1.admincmd.co 145.238.203.14   2 u  147 1024  377  279.106  -122.38  43.577

I have to use ntpdc -p to get milliseconds values :

root@server21:~# ntpdc -p
     remote           local      st poll reach  delay   offset    disp
=======================================================================
=midir.legt.fr   192.168.1.21     3 1024  367 0.12321 -0.033260 0.22052
=78.193.216.180  192.168.1.21     3 1024  277 0.05621  0.049200 0.27524
*ns1.admincmd.co 192.168.1.21     2 1024  377 0.27910 -0.122388 0.12825
=z.bsod.fr       192.168.1.21     3 1024  377 0.30672  0.033223 0.18507

For information, all my systems are Debian 7 (jessie) with ntpq 4.2.6p5.

See below correction (quite simple ;-)) I made to use milliseconds.

root@server24:/var/lib/shinken/libexec# diff check_ntp_sync_by_ssh.py
check_ntp_sync_by_ssh.py.ori
95c95
<     return ref_delay/1000

---
>     return ref_delay

Regards, Marc CESARINE

Marc3001 commented 10 years ago

Sorry I edited my issue content as I didn't really know Markdown until 5 minutes ago ;-)

naparuba commented 10 years ago

Thanks :)