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.
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
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.
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.
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
How To Install Nagios Plugins
In this step, you should download the latest nagios-plugins source and install. To do this run:
tar xzf nagios-plugins-2.2.1.tar.gz/pre>
And to compile and install Nagios plugins, type:
sudo ./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl/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.
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.
Once you log in, you can view the Nagios interface as below. Also to see hosts, services, and alerts use the sidebar button.
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.