Home Directory Plugins Operating Systems Windows NRPE Windows Failed Service restart batch file

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

Windows Failed Service restart batch file

Rating
0 votes
Favoured:
0
Current Version
1.07
Last Release Date
2010-11-16
Compatible With
  • Nagios 3.x
Owner
License
GPL
Hits
166222
Files:
FileDescription
win_service_restart.zipwin_service_restart.zip Version 1.07
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
Restart Windows Failed Service batch script with log.
File: win_service_restart.cmd
Author: Vadim Zenin http://vadimzenin.blogspot.com
Version: 1.07
Date: 16/11/2010 12:28:45
Windows Failed Service restart batch file for Nagios Event Handler

Copy win_service_restart.cmd to NSClient++scripts folder.

Nagios commands.cfg:
define command{
command_name win_service_restart
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -c win_service_restart -a "$SERVICEDESC$" $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$
}

Nagios template-services_common-win.cfg
define service{
name generic-service-win-wuauserv
service_description wuauserv
display_name Automatic Updates
event_handler win_service_restart
event_handler_enabled 1
check_command check_nt!SERVICESTATE!-d SHOWALL -l $SERVICEDESC$
}

NSCLIENT++ version 0.3.8 NSC.ini:
[Settings]
allowed_hosts=192.168.1.1/32 ; your Nagios server IP
[NRPE]
allow_arguments=1
allow_nasty_meta_chars=1
[Script Wrappings]
cmd=scripts%SCRIPT% %ARGS%
[External Script]
allow_arguments=1
allow_nasty_meta_chars=1
[External Scripts]
command[win_service_restart]=scriptswin_service_restart.cmd "$ARG1$" $ARG2$ $ARG3$ $ARG4$


Additional examples on http://vadimszenins.blogspot.com/2008/12/nagios-restart-windows-failed-services.html

Tested platform:
Windows 2003 R2 x64 SP2, Nagios 3.2.0, NSClient++ 0.3.8.76

Version 1.07 revision:
Description is changed for NSCLIENT++ version 0.3.8 NSC.ini
Version 1.06 revision:
Description is changed for NSCLIENT++ version 0.3.8 NSC.ini
Version 1.05 revision:
Logging changes, stop and start services commands nave changed. Logs examples added.
Version 1.04 revision:
Double restart of the servise is fixed
Version 1.03 revision:
Description is changed
Version 1.02 revision:
@NET changed to @SC
Version 1.01 revision:
Service name's with spase problem is fixed

http://vadimszenins.blogspot.com/2008/12/nagios-restart-windows-failed-services.html

dbf0663a9e6648886eb8015cee8c9ce0 *win_service_restart.zip