Learn Configure Nagios on Ubuntu: Part 2 – Remote Host

March 3, 2020

Table of Contents

This article is part of a 2-part series about installing and configuring Nagios on Ubuntu 14.04.

https://www.itweb.services/tutorials/linux-guides/configure-nagios-on-ubuntu-part-1-nagios-server”>Part 1: Nagios Server

https://www.itweb.services/tutorials/linux-guides/configure-nagios-on-ubuntu-part-2-remote-host”>Part 2: Remote Host

Adding remote hosts

In the previous part of this tutorial, we configured a Nagios server. Now that Nagios is installed and running, it’s time to configure a remote host that will be monitored by Nagios. SSH into any remote host that you want to be monitored.

Step 1: Installing prerequisites

To monitor hosts, we need to add them to Nagios. By default, Nagios only monitors localhost (the server it’s running on). We’re going to add hosts that are part of our network to gain even more control. You will need to use the following instructions on all hosts that you want to monitor.

First, install nagios-plugins and nagios-nrpe-server:

apt-get install nagios-plugins nagios-nrpe-server

Step 2: Configuring NRPE

Next, open the /etc/nagios/nrpe.cfg file. Replace the value of allowed_hosts with, replacing the second IP with the IP address of the Nagios server.

We will now open the file /etc/nagios/nrpe.cfg and replace a couple of values.

  • Replace the value of server_address to the private IP address of the host.
  • Set allowed_hosts to the private IP address of your Nagios server.
  • Execute df -h /, copy the output, and put that as the value of command. It indicates your root file system.

Save the file when you are finished.

Now restart NRPE:

service nagios-nrpe-server restart

Step 3: Adding the host to Nagios

Now that we’ve configured the host we’re going to monitor, we need to switch back to our Nagios server and add the host to it. Open the following file with your favorite editor:


Use the following block as a template. Replace host with an appropriate name for your remote host, and update the host_name, alias, and address values accordingly.

define host {
        use                             linux-server
        host_name                       yourhost
        alias                           My first Apache server
        max_check_attempts              5
        check_period                    24x7
        notification_interval           30
        notification_period             24x7

This will allow you to simply monitor whether the server is up or down. Now reload Nagios:

service nagios reload

Congratulations, you have completed a very basic Nagios setup for monitoring your servers. Now you can log into the Nagios web panel to view the status of your servers.

Need help?

Do you need help setting up this on your own service?
Please contact us and we’ll provide you the best possible quote!