Installing and configuring Nagios can be a complex process, but I can provide you with a general guide for installing and configuring Nagios on a Linux system. However, for detailed information, it's always best to refer to the official Nagios documentation.
CODE USED FOR INSTALLATION**
Make sure your system meets the following requirements:
1- httpd (brower)
2- php (Dashboard)
3- gcc & gd (compiler to convert)
4- make file ( to build)
5- perl ( script)
Step-1: Install Pre-requisites software you EC2 machine prior to Nagios installation like: Apache, php, gcc compiler and gd development libraries:
sudo su
yum install httpd php
yum install gcc glibc glibc-common
yum install gd gd-devel
Step: 2 Create Account information you need to setup a nagios user Run the following commands.
adduser -m nagios
passwd nagios
Now it ask to enter new passwd give whatever you want ex: 12345
groupadd nagioscmd
usermod -a -G nagioscmd nagios
usermod -a -G nagioscmd apache
Step-3: Download nagios core and plugins, create a directory for storing the downloads.
mkdir ~/downloads
cd ~/downloads
Download the source code tarball of both nagios and nagios plugins.
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.4.10.tar.gz
wget http://nagios-plugins.org/download/nagios-plugins-2.4.6.tar.gz
Step-4: Compile and install Nagios extract the Nagios source code tarball.
tar zxvf nagios-4.4.10.tar.gz
cd nagios-4.4.10
Run the below configuration script with the name of the group which you have created in the above step.
./configure --with-command-group=nagioscmd
Note: if you are getting error after executing the above command:
error:
...
checking for type of socket size... size_t
checking for SSL headers... SSL headers found in /usr
checking for SSL libraries... configure: error: Cannot find ssl libraries
Then install the open ssl-devel then re-execute the above config script
yum install openssl-devel
Compile the nagios source code.
make all
Install binaries, init script, sample config files and set permissions on the external commands directly.
make install
make install-init
make install-config
make install-commandmode
Step-5: Confirgure the web interface.
make install-webconf
Step-6: Create a nagiosadmin account for login into the nagios web interface set the password as well.
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Asking for the password, set a new passwd and keep it memorable.
Restart the service.
service httpd restart
Step-7: Compile and install the nagios and nagios plugins, extract the Nagios plugins source code tarball.
cd ~/downloads
tar zxvf nagios-plugins-2.4.6.tar.gz
cd nagios-plugins-2.4.6
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
Step-8: Start Nagios add Nagios to the list of the system service and have it automatically start when the system boots.
chkconfig --add nagios (if you are not able to add go for next step, no problem)
chkconfig nagios on
Verify the sample Nagios config files-
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Step-9: If there are no errors start the Nagios.
service nagios start
service httpd restart
****************************END OF CODE *******************************
Step-10 : Copy the public IP address of EC2 instance and paste in you local browser in give way.
http://52.15.50.246/nagios/
FIG-1
FIG-2
FIG-3
If you have successfully set up for Nagios and can access the application without any issues, that's great news!
You can give credit and share this with your peers and follow me on LinkedIn for more..