Nagios
Nagios (also known as Nagios Core) is a free and open source application which can be used for monitoring Linux or Windows servers, network infrastructures and applications. When properly configured it will alert you when something on your server goes wrong and then notify you again once the problem has been resolved. In this tutorial, we will show you how to install and configure the latest Nagios Core version on a CentOS 7.
Lets start to configure Nagios:-
Step:1 Install LAMP
[root@server ~]# yum install httpd mariadb-server php php-mysql
[root@server ~]# mysql_secure_installation
[root@server ~]# systemctl enable httpd.service
[root@server ~]# systemctl enable mariadb.service
Step:2 Install the required packages
[root@server ~]# yum install gcc glibc glibc-common wget gd gd-devel perl postfix
Step:3 Download and Install, Configure Nagios Core
[root@server ~]# cd /tmp
[root@server ~]# wget -O nagioscore.tar.gz https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.4.2.tar.gz
[root@server ~]# tar xzf nagioscore.tar.gz
[root@server ~]# cd /tmp/nagioscore-nagios-4.4.2
[root@server ~]# ./configure
# After the configuration is completed, you can now compile Nagios Core by execution the following command.
[root@server ~]# make all
You also need to run the following commands to create the nagios user and group and add apache to the nagios group.
[root@server ~]# make install-groups-users
[root@server ~]# usermod -a -G nagios apache
Now, you can finally run the following command in order to install Nagios Core.
[root@server ~]# make install
[root@server ~]# make install-daemoninit
[root@server ~]# make install-config
[root@server ~]# make install-commandmode
[root@server ~]# make install-webconf
[root@server ~]# systemctl restart httpd
Step:4 Create nagiosadmin User Account
[root@server ~]# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Step:5 Install Nagios Plugins
[root@server ~]# yum install gcc glibc glibc-common make gettext automake autoconf wget openssl-devel net-snmp net-snmp-utils epel-release perl-Net-SNMP
[root@server ~]# cd /tmp
[root@server ~]# wget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugins/nagios-plugins/archive/release-2.2.1.tar.gz
[root@server ~]# tar zxf nagios-plugins.tar.gz
# Once the Nagios Plugins archive is extracted, run the following commands to compile and install the Nagios Plugins on your server
[root@server ~]# cd /tmp/nagios-plugins-release-2.2.1/
[root@server ~]# ./tools/setup
[root@server ~]# ./configure
[root@server ~]# make
[root@server ~]# make install
6. Accessing Nagios Core
[root@server ~]# systemctl start nagios
To access Nagios Core, open your browser and navigate to http://YOUR-IP-ADDRESS/nagios and log in using the nagiosadmin user account which you have created in one of the previous steps in this tutorial.
After you have successfully logged in, you will be presented with the Nagios Core home screen.
Now, You are ready to use Nagios!