Psychz - Raviteja
Votes: 0Posted On: Oct 11, 2017 05:16:53
We will surely guide you towards the installation of Nagios on Linux. There are some prerequisites that you need to fulfill before proceeding towards the installation.
Prerequisites
1. Linux Operating System - We have chosen CentOS 7 in this case.
2. A LAMP stack - LAMP is the abbreviation for Linux operating system, with the Apache web server, a MySQL database (using MariaDB), and PHP. They are generally installed together known as the LAMP stack.
Installation
We will install Nagios 4 on our system. You can always check for an updated version in accordance with the time at which you read this article.
Install Build Dependencies
This can be considered a part of the prerequisites. You have to install certain libraries and packages that will help in completing the build.
Please install the following packages.
sudo yum install gcc glibc glibc-common gd gd-devel make net-snmp openssl-devel xinetd unzip
Nagios - User and Group Creation
We will create a user and group for Nagios to operate its process. Here we have created a group "nagcmd" and a user "nagios". We have also added "nagios" to group "nagcmd".
sudo useradd nagios
sudo groupadd nagcmd
sudo usermod -a -G nagcmd nagios
Nagios Core Installation
1. Now we will proceed by installing Nagios Core. Here we are installing Nagios Core version 4.3.4. You can visit the following link to check out your desired version.
https://www.nagios.org/downloads/nagios-core/thanks/?t=1507672361
Download the installation package by using the following command.
1. cd ~
2. curl -L -O https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.3.4.tar.gz
2. Extract the package you have just downloaded by the following command.
tar xvf nagios-*.tar.gz
3. Go to the directory you have just extracted files to.
cd nagios-*
4. Configure Nagios with the help of the following command.
./configure --with-command-group=nagcmd
5. Now you will have to compile Nagios.
make all
6. Now we would have to install some scripts and configuration files along with Nagios.
sudo make install
sudo make install-commandmode
sudo make install-init
sudo make install-config
sudo make install-webconf
Nagios Plugin Installation
1. There are some plugins of Nagios that are very helpful to the users. The latest version of Nagios plugin is 2.1.1. Use the following command to download the Nagios Plugin.
1. cd ~
2. curl -L -O http://nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz
2. Now, this downloaded folder has to be extracted.
tar xvf nagios-plugins-*.tar.gz
3. We will now change the directory to the extracted files.
cd nagios-plugins-*
4. The extracted files have to be configured by the following command.
./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl
5. Next, the Nagios Plugins are compiled.
make
6. The final step left is to install the Nagios plugin.
sudo make install
NRPE Installation (Client Side)
The Nagios Remote Plugin Executor (NRPE) is used to monitor remote hosts and their resources. You need to install NRPE on the server by downloading the package from the website. You can view the latest packages at https://sourceforge.net/projects/nagios/files/nrpe-2.x/
1. We are downloading NRPE 2.15, which is the latest release.
cd ~
curl -L -O http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz
2. Next, we need to extract the NRPE archive with this command.
tar xvf nrpe-*.tar.gz
3. Go to the extracted files.
cd nrpe-*
4. Now we configure NRPE with the help of the following command.
./configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagios --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu
5. We will now have to compile NRPE.
make all
6. Install the initial scripts and then NRPE.
make all
sudo make install
sudo make install-xinetd
sudo make install-daemon-config
7. Once the NRPE is installed, open the following file in any editor of your choice.
sudo vi /etc/xinetd.d/nrpe
(Note: Here we are using vi editor)
8. Modify the "only from" line from the file. Providing a space after the IP address mentioned, type in the IP address of your server. Save the file and exit.
only_from = 127.0.0.1 Your_IP_address.
9. Restart the xinetd service.
sudo service xinetd restart