How to Install Nagios 4.3.4 on CentOS 7 / RHEL 7

Nagios is the most widely used open source monitoring tools which help us to monitor the services and application that run’s on Windows, Linux, Routers and other network devices.
With the help of Nagios, you can monitor basic services and attributes. We can access the Nagios using web interface coming with the bundle and configuration need to be done on the file level.

What’s New

  • Core Workers are the lightweight process whose job is to perform checks, due to this they do perform checks much more quickly than the old process.
  • Nagios Core process using in-memory techniques, eliminating the disk I/O latencies that could previously slow things down in a large installation.
  • Each configuration item is verified only once.
  • The host address attribute is now optional.
  • Bothe hosts and services now support an hourly value attribute.
More feature can be found here.

Services List

This Tutorial describes how you can monitor “private” services and attributes of Linux/UNIX servers, such as:

Attributes

  • CPU load
  • Memory usage
  • Disk usage
  • Logged in users
  • Running processes
  • etc.

Private Services

  • HTTP
  • FTP
  • SSH
  • SMTP
  • etc

Prerequisites

Before installing the Nagios, the system needs to meet the requirements for installing Nagios. So install the Web Server (httpd), PHP, compilers and development libraries.
Install all packages in a single command.
yum -y install httpd php gcc glibc glibc-common wget perl gd gd-devel unzip zip
Create a nagios user and nagcmd group for allowing the external commands to be executed through the web interface, add the nagios and apache user to be a part of the nagcmd group.
useradd nagios
groupadd nagcmd
usermod -a -G nagcmd nagios
usermod -a -G nagcmd apache
Download latest Nagios Core.
cd /tmp/
wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.3.4.tar.gz
tar -zxvf /tmp/nagios-4.*.tar.gz
cd /tmp/nagios-4.*
Compile and Install Nagios.
./configure --with-nagios-group=nagios --with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode

Install & Configure Nagios Web Interface

Install the Nagios web configuration using the following command.
make install-webconf
Run the following command to install a Nagios exfoliation theme
make install-exfoliation
Create a user account (nagiosadmin) for logging into the Nagios web interface. Remember the password that you assign to this user – you’ll need it later.
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Restart Apache web server to make the new settings take effect.
systemctl restart httpd.service
systemctl enable httpd.service

Configure Nagios

Sample configuration files have now been installed in the /usr/local/nagios/etc directory. These sample files should work fine for getting started with Nagios. You’ll need to make just one change before you proceed…
Edit the /usr/local/nagios/etc/objects/contacts.cfg config file with your favorite editor and change the email address associated with the nagiosadmin contact definition to the address you’d like to use for receiving alerts.
vi /usr/local/nagios/etc/objects/contacts.cfg
Change the Email address field to receive the notification.
define contact{
        contact_name                    nagiosadmin             ; Short name of user
        use                             generic-contact         ; Inherit default values from generic-contact template (defined above)
        alias                           Nagios Admin            ; Full name of user

        email                           admin@itzgeek.com       ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
        }

Download and Install Nagios Plugins

Download Nagios Plugins to /tmp directory.
cd /tmp
wget https://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz
tar -zxvf /tmp/nagios-plugins-*.tar.gz
cd /tmp/nagios-plugins-*/
Compile and install the Nagios plugins.
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install

Start Nagios Server

Verify the sample Nagios configuration files.
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
If there are no errors, then start the Nagios service.
service nagios start
Start Nagios on system startup.
chkconfig nagios on

SELinux

See if SELinux is in Enforcing mode.
getenforce
Put SELinux in Permissive mode or Disable it.
setenforce 0
To make this change permanent, you’ll have to modify the settings in /etc/selinux/config and reboot.

Iptables

Make sure to allow web server access through the firewall.
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --reload

Access Web Interface

Now access the Nagios web interface using the following URL. You’ll be prompted for the username (nagiosadmin) and password you specified earlier.
http://your-ip-add-ress/nagios/
Install Nagios 4.3.4 on CentOS 7 - Nagios Login Screen
Install Nagios 4.3.4 on CentOS 7 – Nagios Login Screen
Nagios console will look like below.
Install Nagios 4.3.4 on CentOS 7 - Nagios Home Page
Install Nagios 4.3.4 on CentOS 7 – Nagios Home Page
Click on Hosts in the left pane to get a list of systems being monitored by Nagios. We have not added any host to Nagios, So it simply monitors the localhost itself. To monitor a remote Linux system,
Install Nagios 4.3.4 on CentOS 7 - Nagios Hosts List
Install Nagios 4.3.4 on CentOS 7 – Nagios Hosts List
Click on Service in the left pane to get the status of any services that is being monitored with Nagios.
Install Nagios 4.3.4 on CentOS 7 - Monitoring Services with Nagios
Install Nagios 4.3.4 on CentOS 7 – Monitoring Services with Nagios

Sem comentários:

Enviar um comentário

glpi updates, correcção de erros

#Erros/alertas #1-Web server root directory configuration is not safe as it permits access to non-public files. See installation documentati...