Nagios is an open-source software tool that can be used for monitoring servers, networks, and applications. It can alert administrators when it detects problems and can also provide historical data about system performance. Nagios can monitor various services, including HTTP, SMTP, and SSH, and can also monitor host resources such as CPU and disk usage. It is a widely used monitoring tool in IT operations, as it is flexible and can be easily configured to suit different environments.
- Root permission access.
- Basic knowledge of linux commands.
In this post, We will install and configure Nagios Core on ubuntu 16.04/18.04 LTS
Step 1: Install Required Packages
On server side installation and configuration, You need to install all dependencies for nagios-core in your ubuntu 16.04 machine by the following commands, before installation of we need update the repository first as a root user.
apt-get install build-essential openssl unzip apache2 php perl make php-gd libgd-dev libapache2-mod-php libperl-dev libssl-dev daemon wget apache2-utils nagios-nrpe-plugin -y
Step 2: Add Nagios User and Group
You need to create user and group to allow to executite to commands from web user-interfaces, We create nagios user and nagcmd group also need to associate the nagios user with apache user to the part of the nagcmd group by the following commands.
useradd nagios && groupadd nagcmd
usermod -a -G nagcmd nagios && usermod -a -G nagcmd www-data
Step 3: Download Nagios 4.4.3
Now you need to download the nagios-core’ tar files to compile by following the commands.
tar -zxvf /tmp/nagios-4.4.3.tar.gz
Step 4: Nagios Compile
You need to compile the nagios core by using the followin g commands.
./configure --with-nagios-group=nagios --with-command-group=nagcmd --with-httpd_conf=/etc/apache2/sites-enabled/
Step 5: Nagios username and password
After this You need to create basic authentication using htaccess of nagios web user-interfaces using the commands, put your password to access the nagios web interface.
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Step 6: Enable Apache2 modules
After this you need to install apache modules cgi by following the commands and restart the apache2 services to get effect.
a2enmod cgi && systemctl restart apache2
Step 7 : Downloading and compile nagios plugin
After that, You need to download and compile the nagios plugin for monitoring the service by following the commands.
tar -zxvf /tmp/nagios-plugins-2.2.1.tar.gz
./configure --with-nagios-user=nagios --with-nagios-group=nagios
Step 8: Verifying nagios configuration cfg file
Now you need to check the nagios configuration by following the commands.
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Step 9: On boot enable nagios service and start the nagios process
After this, You need to enable to nagios service to auto start on system boot time and You need to start the nagios services by using following commands.
systemctl start nagios && systemctl enable nagios
Now it’s time to open the browser and open the nagios web url like :-
You will be asked for username password, You need to put the nagiosadmin for username and password you have set for htaccess.
In this article, we have performed Creating nagios client and gathering, downloading Nagios Core, accumulating and introducing nagios, Installing apache setup records, Downloading and introducing Nagios center modules, verify,start and empower Nagios administration, Accessing nagios web interface.