NTP Time Sync Monitoring Specified NTP Source In Windows with Nagios
NTP stands for Network Time Protocol, Used to sync all the servers time exact as main time server. All the servers time should be in equal if not they we may see problems in synchronization of Active Directories / User access. So CRITICAL part is if we miss time sync with actual NTP server then we may get lot many errors in environment, even we can’t analyze logs based on time stamp. Here in this article we are going to talk about NTP time sync Monitoring Specified NTP source in Windows using Nagios Server.
Windows time sync monitoring plugin is available in Nagios Exchange Just Download
NTP Time Sync Monitoring Configuration in Nagios Core / Nagios XI
This plugin works for windows only. After downloading the plugin just login to your Nagios client machine and paste the plugin in path as mentioned below
We have to Edit NSC.ini configuration File to add external commands
un-comment below configuration line to allow arguments from Nagios Server
;# COMMAND ARGUMENT PROCESSING
; This option determines whether or not the NRPE daemon will allow clients to specify arguments to commands that are executed.
allow_arguments=1
Add External scripts as shown below
[External Scripts]
;check_es_long=scripts\long.bat
;check_es_ok=scripts\ok.bat
;check_es_nok=scripts\nok.bat
;check_vbs_sample=cscript.exe //T:30 //NoLogo scripts\check_vb.vbs
;check_powershell_warn=cmd /c echo scripts\powershell.ps1 | powershell.exe -command -
check_windows_time=scripts\check_windows_time.bat time.windows.com 30 10
Then un-comment CheckExternalScripts.dll entry or else you may receive UNKNOWN: No handler for that command” error
; Script to check external scripts and/or internal aliases. CheckExternalScripts.dll
Save Configuration file and restart NsClient++ Service
Before going back to your Nagios Server just execute and check whether .bat script is working or not
Nagios Core Procedure
Now go back to your Nagios Server. manually call windows command using check_nrpe plugin if it is working fine then go ahead and write command in commands.cfg file.
[root@Ark-NagiosServ ~]# cd /usr/local/nagios/libexec/ [root@Ark-NagiosServ libexec]# ./check_nrpe -H 192.168.2.10 -p 5666 -c check_windows_time 3 1 OK: Time is +00.5859296s from time.windows.com|'Offset'=00s;30;10;0
Edit commands.cfg file and add below command OR custom command as you like
define command { command_name check_time command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$ $ARG2$ $ARG3$ }
Open Host configuration file and add service definition
define service { host_name windows-ad.arkit.co.in service_description Time Check check_command check_time!check_windows_time!30!10!!!!! max_check_attempts 5 check_interval 5 retry_interval 1 check_period xi_timeperiod_24x7 notification_interval 0 notification_period xi_timeperiod_24x7 notifications_enabled 1 contacts nagiosadmin contact_groups Windowsadmins }
Save config file and restart Nagios Service.
That’s it NTP time sync monitoring is in place. It will send you an alert when NTP is not in sync for 30 seconds.
Related Articles
Time Server installation and Configuration Step by Step guide in RHEL7
Monitoring Windows any Service Using NAgios Guide
Monitoring Linux Server Using Nagios
Thanks for your wonderful Support and Encouragement