checking local host time

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
localit
Posts: 40
Joined: Thu Oct 29, 2020 12:50 pm

checking local host time

Post by localit »

my goal is to check the time of a windows machine and compare it to domain controller or ntp server.

- if the difference is greater then 2mins i would like for it to alert me.

is this possible without adding bat file or ps script to every single host that i am trying to check.
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: checking local host time

Post by gsmith »

Hi

If you install samba on your XI server you can run the command "net time -S xxx.xxx.xxx.xxx
to get the time on a remote Windows machine.

Code: Select all

[root@gs-cent8-23-82 libexec]# date; net time -S 192.168.23.96
Tue Feb 22 14:33:43 CST 2022
Tue Feb 22 12:33:34 2022
You can use that command as part of a custom plugin to check time vs. a time server.

Here's a Linux command to get the time from NIST:

Code: Select all

[root@gs-cent8-23-82 libexec]# cat </dev/tcp/time.nist.gov/13

59632 22-02-22 20:47:47 00 0 0 695.9 UTC(NIST) *
[root@gs-cent8-23-82 libexec]#
Thanks
Locked