How To Install Nagios On Ubuntu 20.04 Apr 28, 2020 Raj 4 min read CONTENTS Prerequisites Install Nagios Core Download Nagios Compile Nagios Configure Nagios Install Nagios Web Interface Install Nagios Plugins Start Nagios Access Nagios Web Interface Conclusion SHARE THIS DOCUMENT IS ALSO AVAILABLE FOR CentOS 8 CentOS 7 Debian 10 Debian 9 Linux Mint 19 Ubuntu 18.04 Ubuntu 16.04 Nagios is one of the most widely used open-source monitoring tools for monitoring the services and applications that run on Windows and Linux operating systems. With the help of Nagios, you can monitor basic services such as HTTP, FTP, SSH, SMTP, etc., and attributes such as CPU load, memory, disk usage, logged in users, running processes, etc. Nagios can also monitor routers and other network devices. Here, we will see how to install Nagios on Ubuntu 20.04. Prerequisites Nagios doesn’t come in .deb package format. So, we need to compile it from the source. Install the below packages for compiling Nagios. sudo apt update sudo apt install -y build-essential apache2 php openssl perl make php-gd libgd-dev libapache2-mod-php libperl-dev libssl-dev daemon wget apache2-utils unzip Create a user and group for Nagios. Then add the nagios and apache user (www-data) to the part of the nagcmd group that allows the external commands to be executed through the Nagios web interface. sudo useradd nagios sudo groupadd nagcmd sudo usermod -a -G nagcmd nagios sudo usermod -a -G nagcmd www-data Install Nagios Core Download Nagios Download the Nagios core (v4.4.5) tarball using the terminal with wget command. Else, you can visit the official website to download the latest version of Nagios core. cd /tmp wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.5.tar.gz tar -zxvf /tmp/nagios-4.4.5.tar.gz cd /tmp/nagios-4.4.5/ Compile Nagios Execute below commands to compile the Nagios from the source code. sudo ./configure --with-nagios-group=nagios --with-command-group=nagcmd --with-httpd_conf=/etc/apache2/sites-enabled/ sudo make all sudo make install sudo make install-init sudo make install-config sudo make install-commandmode Configure Nagios Nagios places configuration files in the /usr/local/nagios/etc directory. These default configuration files should work fine. Edit the /usr/local/nagios/etc/objects/contacts.cfg file and change the email address associated with the nagiosadmin contact definition to the email address you would like to use for receiving alert notification. sudo nano /usr/local/nagios/etc/objects/contacts.cfg Change the email address field to receive the alerts. define contact{ contact_name nagiosadmin ; Short name of user use generic-contact ; Inherit default values from generic-contact template (defined above) alias Nagios Admin ; Full name of user email [email protected] ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ****** } Install Nagios Web Interface Install the Nagios web interface with the below command sudo make install-webconf Create a user account (nagiosadmin) to access the Nagios web interface. Remember the password you assign to this account – you will need it later. sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin Run the following command. sudo a2enmod cgi Restart Apache webserver. sudo systemctl restart apache2 Install Nagios Plugins Download the Nagios plugins for monitoring the system services. Place it into /tmp directory. cd /tmp wget https://nagios-plugins.org/download/nagios-plugins-2.3.3.tar.gz tar -zxvf /tmp/nagios-plugins-2.3.3.tar.gz cd /tmp/nagios-plugins-2.3.3/ Compile and install the plugins. sudo ./configure --with-nagios-user=nagios --with-nagios-group=nagios sudo make sudo make install Start Nagios Verify the sample Nagios configuration files before starting it. sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg Output: Nagios Core 4.4.5 Copyright (c) 2009-present Nagios Core Development Team and Community Contributors Copyright (c) 1999-2009 Ethan Galstad Last Modified: 2019-08-20 License: GPL Website: https://www.nagios.org Reading configuration data... Read main config file okay... Read object config files okay... Running pre-flight check on configuration data... Checking objects... Checked 8 services. Checked 1 hosts. Checked 1 host groups. Checked 0 service groups. Checked 1 contacts. Checked 1 contact groups. Checked 24 commands. Checked 5 time periods. Checked 0 host escalations. Checked 0 service escalations. Checking for circular paths... Checked 1 hosts Checked 0 service dependencies Checked 0 host dependencies Checked 5 timeperiods Checking global event handlers... Checking obsessive compulsive processor commands... Checking misc settings... Total Warnings: 0 Total Errors: 0 Things look okay - No serious problems were detected during the pre-flight check Enable Nagios service to start automatically at system startup. sudo systemctl enable nagios Now, start the Nagios service. sudo systemctl start nagios Access Nagios Web Interface Now access the Nagios web interface by going following URL in your web browser. http://ip-add-re-ss/nagios/ Enter the username (nagiosadmin) and password you specified earlier. Nagios Login Upon successful login, you would get the Nagios’s home page. Nagios Tool Home Page Click on Hosts to see the servers that are being monitored. By default, Nagios can monitor only the localhost, i.e., Nagios server. So, if you want to monitor remote machines, then you need to use the NRPE plugin on the remote hosts. READ: How To Monitot Remote Linux Host With Nagios Hosts Monitored By Nagios Clicking on Services in the left pane to services being monitored by Nagios. Services Monitored By Nagios Conclusion That’s All. I hope, by now, you have Nagios up and running on your Ubuntu 20.04. You might want to read how to monitor remote Linux machines with the NRPE plugin. Please share your feedback in the comments section. ubuntu-20.04 monitoring-tools nagios Prev Post How To Install Pip On Ubuntu 20.04 Next Post How To Install VirtualBox Guest Additions On Ubuntu 20.04 RELATED POSTS How To Upgrade To Ubuntu 20.04 From Ubuntu 18.04 / Ubuntu 19.10 [Detailed Guide] How To Install Pip On Ubuntu 20.04 How To Install Java On Ubuntu 20.04 How To Install MariaDB on Ubuntu 20.04 How To Install Ubuntu 20.04 Alongside With Windows 10 in Dual Boot How To Install Linux, Nginx, MariaDB, PHP (LEMP Stack) in Ubuntu 20.04 Please enable JavaScript to view the comments powered by Disqus. comments powered by Disqus RECENT POSTS How To Install VirtualBox On Linux Mint 20 How To Backup and Restore Ubuntu & Linux Mint With Timeshift How To Upgrade To Linux Mint 20 From Linux Mint 19 [Detailed Guide] How To Install KVM On Ubuntu 20.04 / Linux Mint 20 How To Install Plex Media Server On Ubuntu 20.04 / Linux Mint 20 How To Install Android Studio on Ubuntu 20.04 TOP POSTS Install xrdp on CentOS 7 / RHEL 7 Install Gnome GUI on CentOS 7 / RHEL 7 Change default network name (ens33) to old “eth0” on Ubuntu… Install μTorrent (uTorrent) on Ubuntu 14.04 How To Configure High-Availability Cluster on CentOS 7 /… How To Install and Configure VNC Server in CentOS 7 / RHEL 7