Advance

How To Install Nagios Monitoring on Ubuntu 20.10

Richard 14 Min Read
How To Install Nagios Monitoring on Ubuntu 20.10

In the Following of monitoring tools tutorials, we are going to present the Nagios installation guide. On any Linux operating system, you can run this open-source network monitoring system. Since the Nagios provides an overview of the critical parameters, it is not different you prefer to work in the command-line interface or web-based graphical interface. Administrators would receive emails and text messages as alert notifications, once a critical level is identified to be able to fix the detected network or server problems. Prepare your own Linux VPS and continue with us to learn how to Install Nagios Monitoring on Ubuntu 20.10 Server.

To let this tutorial work better, please consider the below Prerequisites:
A non-root user with sudo privileges.

Recommended Article: How to install Laravel on Ubuntu 20.04 LTS [complete]

Tutorial Install Nagios Monitoring on Ubuntu 20.10

To maintain the security and availability of your system and service, you need the help of a monitoring tool to prevent any negative impact on your business. Using the TCP port, SMTP, POP3, HTTP, NNTP, PING, etc Nagios is able to keep tabs on network details. After preparing an Ubuntu VPS you are ready to download and install Nagios. Let’s go through the steps of this guide to learn and finish it.

How To Update Your System

Due to some security considerations, it is better to update your system:

sudo apt-get update

Note: In case you have installed the Ubuntu system recently, you need Apache and PHP. Run the following command to install them:

sudo apt-get install wget build-essential unzip openssl libssl-dev
sudo apt-get install apache2 php libapache2-mod-php php-gd libgd-dev

How To Create A Nagios User

One step before the installation is to create a new user account for Nagios in your system. Use the command below to create one in your system:

sudo adduser nagios

To add your created user to a group, you need to create a group for Nagios setup ”nagcmd” first. Then, add your ”nagios” user to the Apache group.

sudo groupadd nagcmd
sudo usermod -a -G nagcmd nagios
sudo usermod -a -G nagcmd www-data

How To Install Nagios Core Service

It is time to install the Nagios core. You can receive the latest version of Nagios core from the official site for free.

cd /opt/
wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.5.tar.gz

Then, to move the files to your chosen location, extract the files by running:

tar xzf nagios-4.4.5.tar.gz

Once the extract is finished, use the commands below to navigate to the ”nagios” source directory and install. In this way, you can compile Nagios with Ubuntu.

cd nagios-4.4.5
sudo ./configure --with-command-group=
sudo make all
sudo make install
sudo make install-init
sudo make install-daemoninit
sudo make install-config
sudo make install-commandmode
sudo make install-exfoliation

To make multiple event triggers for your Nagios web interface, copy event handlers scripts under libexec directory.

How To Setup Apache with Authentication

To create an Apache configuration file for your Nagios server, run:

sudo vi /etc/apache2/conf-available/nagios.conf

To prevent more changes in configuration, setup apache authentication for user nagiosadmin:

htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Then, to make the new settings take effect enable Apache configuration and restart Apache service:

sudo a2enconf nagios
sudo a2enmod cgi rewrite
sudo service apache2 restart

How To Update Your Email Address

you just need to run the following command to let you edit the file of ”contacts.cfg” which is located in the directory usr/local/nagios/etc/objects, to include the email address where we want to receive notifications.

sudo gedit /usr/local/nagios/etc/objects/contacts.cfg
Recommended Article: How To Install Nagios Monitoring on Ubuntu 20.10

How To Install Nagios Plugins

In this step, you should download the latest nagios-plugins source and install. To do this run:

cd /opt
wget http://www.nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz/pre>
tar xzf nagios-plugins-2.2.1.tar.gz/pre>
cd nagios-plugins-2.2.1

And to compile and install Nagios plugins, type:

sudo ./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl/pre>
sudo make/pre>
sudo make install

How To Verify Settings

To verify the Nagios installation and configuration file, run the following commands, and then you are ready to start the Nagios core service.

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
service nagios start

To let Nagios start on your system boot automatically, configure Nagios by running the following command:

sudo systemctl enable nagios

How To Use Nagios On Ubuntu

You can ensure that  the configuration was properly seen or not by running the command below:

sudo /usr/local/nagios/bin/nagios -v

How To Access Nagios Web Interface

You can access your nagios setup if you access the nagios server. To do this, you need to use hostname or ip address followed by /nagios.

http://eldernode.example.net/nagios/

In this way, you have authenticated Apache. The username could be nagiosadmin and the password is the one you created when you were setting up Apache with the Authentication step.

Login page

 

Once you log in, you can view the Nagios interface as below. Also to see hosts, services, and alerts use the sidebar button.

The Dashboard of Nagios

 

 

Conclusion

In this article, you learned How To Install Nagios Monitoring on Ubuntu 20.10. From now on you are ready to use this most popular tool and monitor and troubleshoot your server performance issues. In case you are interested in learning more, find the related article on Introducing Nagios Monitoring System for Linux.

View More Posts
Richard
Eldernode Writer
We Are Waiting for your valuable comments and you can be sure that it will be answered in the shortest possible time.

Leave a Reply

Your email address will not be published. Required fields are marked *

We are by your side every step of the way

Think about developing your online business; We will protect it compassionately

We are by your side every step of the way

+8595670151

7 days a week, 24 hours a day