How to Add Windows Host to Nagios Monitoring Server

Hello Dev, are you struggling to add a Windows host to your Nagios monitoring server? Fret no more! In this article, we will guide you through the entire process with easy-to-follow steps and screenshots to make it as simple as possible. Without further ado, let’s begin.

Preparations

Before we begin, there are a few things that you need to have in place:

Requirement
Description
Nagios Core
You must have Nagios Core installed on your monitoring server.
NSClient++
You need to install NSClient++ on your Windows host machine.
Admin Credentials
You should have administrative credentials for both the monitoring server and Windows host.

Step-by-Step Guide

Step 1: Install NSClient++ on Windows Host

The first step is to install NSClient++ on your Windows host. You can download the latest version from the official website (https://docs.nsclient.org/installing/). Follow the instructions to install it and select the appropriate options. After installation, make sure that the NSClient++ service is running on your Windows host.

Step 2: Edit NSClient++ Configuration

Now, we need to configure NSClient++. Locate the NSC.ini file under the NSClient++ installation directory. Open it with your favorite text editor and make the following changes:

  1. Uncomment the following line to allow remote access allowed_hosts=127.0.0.1,192.168.1.10
  2. Add your monitoring server IP address to the allowed_hosts list
  3. Add the following line to enable NRPE server nrpe_port=5666

Save the file and restart the NSClient++ service.

Step 3: Install NRPE Plugin on Monitoring Server

The next step is to install the NRPE plugin on your monitoring server. The easiest way to do this is to download it from the official Nagios Exchange website (https://exchange.nagios.org/directory/Plugins/Operating-Systems/Windows/check_nrpe-2Epl/details). Extract the plugin to the Nagios plugins directory (/usr/local/nagios/libexec/ for Linux or C:\Program Files\Nagios\plugins\ for Windows).

Step 4: Define Windows Host in Nagios Configuration

Now, we need to define the Windows host in the Nagios configuration. Open the hosts.cfg file under the Nagios configuration directory (/usr/local/nagios/etc/objects/ for Linux or C:\Program Files\Nagios\etc\objects\ for Windows). Add the following code:

define host{usewindows-serverhost_namewindows-hostaliasWindows Hostaddress192.168.1.20}

Make sure to replace the values with your own. The use directive specifies the host template to use. If you don’t have one, you can create it in the templates.cfg file. The host_name is an arbitrary name for the host, the alias is a friendly name for display purposes, and the address is the IP address of your Windows host.

Step 5: Define Service Checks for Windows Host

The final step is to define the service checks for your Windows host. Open the services.cfg file under the Nagios configuration directory and add the following code:

define service{usegeneric-servicehost_namewindows-hostservice_descriptionC:\ Drive Free Spacecheck_commandcheck_nrpe!check_drive_size!-d C: -w 80% -c 90%}

Again, make sure to replace the values with your own. The use directive specifies the service template to use. If you don’t have one, you can create it in the templates.cfg file. The service_description is an arbitrary name for the service, and the check_command specifies the NRPE command to run on the Windows host.

READ ALSO  V Rising Host Own Server

FAQ

What if I don’t have administrative credentials for the Windows host?

You need administrative credentials to install and configure NSClient++ on the Windows host. If you don’t have them, you should contact the owner or IT department responsible for the machine.

What if I have multiple Windows hosts to monitor?

You can repeat the entire process for each Windows host and define them in the Nagios configuration.

What if the NRPE plugin doesn’t work?

Make sure that you have configured NSClient++ correctly and that the NRPE plugin is in the correct directory. You can also check the NRPE log file for any errors or issues.

Is there an easier way to monitor Windows hosts with Nagios?

Yes, you can use a third-party plugin like Winrpe or check_wmi_plus that uses WMI instead of NRPE.

Congratulations! You have successfully added a Windows host to your Nagios monitoring server. We hope this article has been helpful to you. If you have any issues or questions, feel free to leave a comment below.