How to Add Windows and Linux host to Nagios Server for Monitoring

In the previous article, we demonstrated how to install Nagios Core on CentOS 8 / RHEL 8 server. In this guide, we will dive deeper and add Linux and Windows hosts to the Nagios Core server for monitoring.


Adding a Remote Windows Host to Nagios Server

In this section, you will learn how to add a Windows host system to the Nagios server. For this to be possible, you need to install NSClient++ agent on the Windows Host system. In this guide, we are going to install the NSClient++ on a Windows Server 2019 Datacenter edition.

On the Windows host system, head out to the download link as specified and download NSClient ++ agent.

Once downloaded, double click on the downloaded installation file to launch the installation wizard.


On the first step on the installation procedure click ‘Next


In the next section, check off the ‘I accept the terms in the license Agreement’ checkbox and click ‘Next


Next, click on the ‘Typical’ option from the list of options and click ‘Next


In the next step, leave the default settings as they are and click ‘Next’.


On the next page, specify your Nagios Server core’s IP address and tick off all the modules and click ‘Next’ as shown below.


Next, click on the ‘Install’ option to commence the installation process.Click-install-to-being-the-installation-NSClient

The installation process will start and will take a couple of seconds to complete. On the last step. Click ‘Finish’ to complete the installation and exit the Wizard.

READ:  Subdomains Explained: Definition, Uses & Setup - FastComet


To start the NSClient service, click on the Start menu and click on the ‘Start NSClient ++’ option.

To confirm that indeed the service is running, press Windows Key + R, type services.msc and hit ENTER. Scroll and search for the NSClient service and ensure it’s running


At this point, we have successfully installed NSClient++ on Windows Server 2019 host and verified that it’s running.

Configure Nagios Server to monitor Windows host

After the successful installation of the NSClient ++ on the Windows host PC, log in to the Nagios server Core system and configure it to monitor the Windows host system.

Open the windows.cfg file using your favorite text editor

# vim /usr/local/nagios/etc/objects/windows.cfg

In the configuration file, ensure that the host_name attribute matches the hostname of your Windows client system. In our case, the hostname for the Windows server PC is windows-server. This hostname should apply for all the host_name attributes.

For the address attribute, specify your Windows host IP address. , In our case, this was


After you are done, save the changes and exit the text editor.

Next, open the Nagios configuration file.

# vim /usr/local/nagios/etc/nagios.cfg

Uncomment the line below and save the changes.


Finally, to verify that Nagios configuration is free from any errors, run the command:

# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg



As you can see from the output, there are no warnings or errors.

Now browse your Nagios Server IP address, log in and click on Hosts. Your Windows hostname, in this case, windows-server will appear on the dashboard.


Adding a remote Linux Host to Nagios Server

Having added a Windows host to the Nagios server, let’s add a Linux host system. In our case, we are going to add a Ubuntu 18.04 LTS to the Nagios monitoring server. To monitor a Linux host, we need to install an agent on the remote Linux system called NRPE. NRPE is short for Nagios Remote Plugin Executor. This is the plugin that will allow you to monitor Linux host systems. It allows you to monitor resources such as Swap, memory usage, and CPU load to mention a few on remote Linux hosts. So the first step is to install NRPE on Ubuntu 18.04 LTS remote system.

READ:  Programming WCF Services, 3rd Edition by Juval Lowy

But first, update Ubuntu system

# sudo apt update

Next, install Nagios NRPE by running the command as shown:

# sudo apt install nagios-nrpe-server nagios-plugins


After the successful installation of NRPE and Nagios plugins, configure NRPE by opening its configuration file in /etc/nagios/nrpe.cfg

# vim /etc/nagios/nrpe.cfg

Append the Linux host IP address to the server_address attribute. In this case, is the IP address of the Ubuntu 18.04 LTS system.


Next, add Nagios server IP address in the ‘allowed_hosts’ attribute, in this case,


Save and exit the configuration file.

Next, restart NRPE service and verify its status

# systemctl restart nagios-nrpe-server # systemctl enable nagios-nrpe-server # systemctl status nagios-nrpe-server


Configure Nagios Server to monitor Linux host

Having successfully installed NRPE and nagios plugins on the remote linux server, log in to Nagios Server and install EPEL (Extra packages for Enterprise Linux) package.

# dnf install

Next, install NRPE plugin on the server

# dnf install nagios-plugins-nrpe -y

After the installation of the NRPE plugin, open the Nagios configuration file “/usr/local/nagios/etc/nagios.cfg”

# vim /usr/local/nagios/etc/nagios.cfg

Next, uncomment the line below in the configuration file



Next, create a configuration directory

# mkdir /usr/local/nagios/etc/servers

Then create client configuration file

# vim /usr/local/nagios/etc/servers/ubuntu-host.cfg

Copy and paste the configuration below to the file. This configuration monitors swap space, system load, total processes, logged in users, and disk usage.

READ:  Unlimited Storage: Hosting Plans, How Much Disk Space You Need

define host{ use linux-server host_name ubuntu-nagios-client alias ubuntu-nagios-client address } define hostgroup{ hostgroup_name linux-server alias Linux Servers members ubuntu-nagios-client } define service{ use local-service host_name ubuntu-nagios-client service_description SWAP Usage check_command check_nrpe!check_swap } define service{ use local-service host_name ubuntu-nagios-client service_description Root / Partition check_command check_nrpe!check_root } define service{ use local-service host_name ubuntu-nagios-client service_description Current Users check_command check_nrpe!check_users } define service{ use local-service host_name ubuntu-nagios-client service_description Total Processes check_command check_nrpe!check_total_procs } define service{ use local-service host_name ubuntu-nagios-client service_description Current Load check_command check_nrpe!check_load }

Save and exit the configuration file.

Next, verify that there are no errors in Nagios configuration

# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Now restart Nagios service and ensure that it is up and running.

# systemctl restart nagios

Remember to open port 5666 which is used by NRPE plugin on the firewall of the Nagios server.

# firewall-cmd -permanent -add-port=5666/tcp # firewall-cmd -reload

Likewise, head out to your Linux host (Ubuntu 18.04 LTS) and allow the port on UFW firewall

# ufw allow 5666/tcp # ufw reload


Finally, head out to the Nagios Server’s URL and click on ‘Hosts’. Your Ubuntu system will be displayed on the dashboard alongside the Windows host machine we added earlier on.


And this wraps up our 2-part series on Nagios installation and adding remote hosts. Feel free to get back to us with your feedback.

Also Read : How to Install Zabbix Monitoring Tool on CentOS 8/RHEL 8