Instructions to Configure Nagios XI for Controlling Windows Services
1. Install NSClient++ on the Windows Machine
1. Download the NSClient++ installer from the official NSClient++ site: https://nsclient.org/.
2. Install NSClient++ on the Windows machine (10.5.0.78):
- Choose "Generic" during installation.
- Enable the NRPE and NSCA modules during installation.
- Set a secure password when prompted.
2. Configure NSClient++
Locate the nsclient.ini file (usually in C:\Program Files\NSClient++) and update it as
follows:
[/settings/default]
password = YourPasswordHere
[/modules]
CheckExternalScripts = enabled
NRPEListener = enabled
[/settings/NRPE/server]
allow arguments = true
allowed hosts = 10.5.0.82
[/settings/external scripts/scripts]
start_service = cmd /c net start "Siemens License Server"
stop_service = cmd /c net stop "Siemens License Server"
check_service = cmd /c sc query "Siemens License Server" | find "RUNNING"
- Replace YourPasswordHere with the password you set during installation.
- Ensure 10.5.0.82 matches the IP of your Nagios XI server.
Restart the NSClient++ service using the following commands:
net stop nscp
net start nscp
3. Verify NSClient++ on Nagios XI
On your Nagios XI server, test connectivity to the NSClient++:
/usr/local/nagios/libexec/check_nrpe -H 10.5.0.78
If check_nrpe is missing, install it using:
yum install -y nagios-plugins-nrpe
4. Configure Nagios XI Commands
Add custom commands in Nagios XI for starting, stopping, and checking the service:
1. Log in to the Nagios XI web interface.
2. Go to Configuration > Commands > Add New Command.
Start Command:
Command Name: start_service
Command Line: $USER1$/check_nrpe -H $HOSTADDRESS$ -c start_service
Stop Command:
Command Name: stop_service
Command Line: $USER1$/check_nrpe -H $HOSTADDRESS$ -c stop_service
Check Command:
Command Name: check_service
Command Line: $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_service
5. Assign Commands to the Host
1. Go to Configuration > Services > Add New Service.
2. Create services for start_service, stop_service, and check_service:
- Service Name: Start Siemens License Server
- Check Command: start_service
- Service Name: Stop Siemens License Server
- Check Command: stop_service
- Service Name: Check Siemens License Server
- Check Command: check_service
6. Apply Configuration
1. Save all changes in Nagios XI.
2. Apply the configuration.
3. Test the service commands through Nagios XI’s web interface.
7. Optional Troubleshooting
If commands do not work:
- Check the Nagios XI logs: /usr/local/nagios/var/nagios.log.
- Check the Windows event logs for NSClient++ errors.