Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: How to Install Nagios 4.3.4 on CentOS  (Read 1706 times)

0 Members and 1 Guest are viewing this topic.

vichithrakumart

  • Guest
How to Install Nagios 4.3.4 on CentOS
« on: August 04, 2018, 08:57:18 am »
Nagios, now known as Nagios Core, is a free and open source computer-software application that monitors systems, networks and infrastructure. Nagios offers monitoring and alerting services for servers, switches, applications and services

Install Required Dependencies

Code: [Select]
# yum install -y httpd httpd-tools php gcc glibc glibc-common gd gd-devel make net-snmp
Create Nagios User and Group
Code: [Select]
# useradd nagios
# groupadd nagcmd

Next, add both the nagios user and the apache user to the nagcmd group.

Code: [Select]
# usermod -G nagcmd nagios
# usermod -G nagcmd apache

Download Nagios Core 4.3.4 and Nagios Plugin 2.2.1

Create a directory for your Nagios installation and all its future downloads.

Code: [Select]
# mkdir /root/nagios
# cd /root/nagios

Now download latest Nagios Core 4.3.4 and Nagios plugins 2.2.1 packages with wget command.

Code: [Select]
#wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.3.4.tar.gz
# wget https://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz

Extract Nagios Core and its Plugins

Code: [Select]
# tar -xvf nagios# tar -xvf nagios-4.3.4.tar.gz-4.3.4.tar.gz
# tar -xvf nagios-plugins-2.2.1.tar.gz

Configure Nagios Core

Code: [Select]
# cd nagios-4.3.4/
# ./configure --with-command-group=nagcmd
# make all
# make install

Following command will install the init scripts for Nagios.

Code: [Select]
# make install-init
To make nagios work from command line we need to install command-mode.

Code: [Select]
# make install-commandmode
Next, install sample nagios files, please run following command.

Code: [Select]
# make install-config
Customizing Nagios Configuratio

Open the “contacts.cfg” file with your choice of editor and set the email address associated with the nagiosadmin contact definition to receiving email alerts.

Code: [Select]
# vi /usr/local/nagios/etc/objects/contacts.cfg
Code: [Select]
Install and Configure Web Interface for Nagios
Code: [Select]
# make install-webconf
In this step, we will be creating a password for “nagiosadmin”. After executing this command, please provide a password twice and keep it remember because this password will be used when you login in the Nagios Web interface

Code: [Select]
# htpasswd -s -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Restart Apache to make the new settings take effect.

Code: [Select]
# service httpd start

Login to the Nagios Web Interface

Your nagios is ready to work, please open it in your browser with “http://Your-server-IP-address/nagios” or “http://FQDN/nagios” and Provide the username “nagiosadmin” and password.