Installing Nagios
- Update the system:
sudo apt-get update && sudo apt-get upgrade
- Install the dependencies:
sudo apt-get install autoconf gcc libc6 make wget unzip apache2 php libapache2-mod-php libgd-dev libsasl2-modules mailutils -y
- Change the directory to your home directory:
cd ~
- Download the nagios 4 source codes:
wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.6.tar.gz
- Extract the downloaded source codes:
tar xzf nagios-4.4.6.tar.gz
- Change to the directory of the newly extracted source codes:
cd nagios-4.4.6
- Run the configure script with integration to apache2:
./configure --with-httpd-conf=/etc/apache2/sites-enabled
- Compile the source:
sudo make all
- Install the nagios user and group:
sudo make install-groups-users
- Make nagios user a member of the www-data group:
sudo usermod -aG nagios www-data
- Install nagios.
sudo make install
- Install the init script:
sudo make install-init
- Initialize the init script:
sudo make install-daemoninit
- Install and configures permissions on the directory for holding the external command:
sudo make install-commandmode
- Install the sample config files on the /usr/local/nagios/etc directory:
sudo make install-config
- Install the nagios config file to apache2:
sudo make install-webconf
- Update the SUID of the ping command:
sudo chmod 4755 /bin/ping
Installing the Nagios Plugins
- Run the following command:
sudo apt install nagios-plugins
- Update the $USER1$ property in the /usr/local/nagios/etc/resource.cfg file to have /usr/lib/nagios/plugins like as follows:
$USER1$=/usr/lib/nagios/plugins
Configuring Apache2 Web Server
- Enable the rewrite module:
sudo a2enmod rewrite
- Enable the CGI module:
sudo a2enmod cgi
- Create nagiosadmin as a nagios web user:
sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Assign a strong password
- Restart the apache2 service:
sudo systemctl restart apache2
Related Post
Configuring NRPE 4 Daemon and Plugin to Ubuntu 20.04
Compiling NRPE 4 Plugin to Tinkerboard
Leave a Reply