Nagios Configuration

Nagios configuration:-

Nagios is a powerful monitoring tool for server.Nagios offers monitoring and alerting for servers, switches, applications, and services. It alerts users when things go wrong and alerts them a second time when the problem has been resolved.Nagios can send this alerts by email and SMS notifications.

NRPE ( Nagios Remote plugin executor) allows you to remotely execute Nagios plugins on other Linux/Unix machines. This allows you to monitor remote machine’s disk usage, CPU load, memory etc.

Client-side config:-

# wget

# rpm -ivh epel-release-6-8.noarch.rpm

# yum install -y nrpe nagios-plugins-all openssl

# vim /etc/nagios/nrpe.cfg


# /etc/init.d/nrpe restart

Server-side config:-

# rpm -Uvh

# yum -y install nagios nagios-plugins-all nagios-plugins-nrpe nrpe php httpd

# chkconfig nagios on

# service nagios start

htpasswd -c /etc/nagios/passwd nagiosadmin

Now we are going to add client (which system we want to monitor)

vim /etc/nagios/nagios.cfg
## Line 52 – Uncomment ##

# mkdir /etc/nagios/servers

# vim /etc/nagios/servers/clients.cfg

define host{
use                             linux-server
host_name                       client
alias                           client

define service{
use                                 generic-service
host_name                   client
service_description   PING
check_command        check_ping!100.0,20%!500.0,60%

define service{
use                                    generic-service
host_name                      client
service_description      current Load
check_command           check_nrpe!check_load

define service{
use                                   generic-service
host_name                     client
service_description     Total Processes
check_command          check_nrpe!check_users

vim /etc/nagios/objects/commands.cfg

define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$

# /etc/init.d/nagios restart
# /etc/init.d/nrpe restart
# /etc/init.d/httpd restart

call in browser  ” http://server-ip-address/nagios

Nagios tuning:-

Send Mail notification:-

# vim /etc/nagios/objects/contacts.cfg

define contact{
contact_name          admin
use                             generic-contact
alias                           linuxserver

define contactgroup{
contactgroup_name       admins
alias                                  Nagios Admin
members                          admin

If we want to change check interval time, notification type then do the following files to change highlighted lines

# vim /etc/nagios/objects/templates.cfg

define service{
name                                           generic-service         ; The ‘name’ of this service template
active_checks_enabled            1                       ; Active service checks are enabled
passive_checks_enabled          1                       ; Passive service checks are enabled/accepted
parallelize_check                       1                       ; Active service checks should be parallelized
obsess_over_service                  1                       ; We should obsess over this service (if necessary)
check_freshness                          0                       ; Default is to NOT check service ‘freshness’
notifications_enabled                1                       ; Service notifications are enabled
event_handler_enabled             1                       ; Service event handler is enabled
flap_detection_enabled             1                       ; Flap detection is enabled
failure_prediction_enabled       1                       ; Failure prediction is enabled
process_perf_data                        1                       ; Process performance data
retain_status_information          1                       ; Retain status information across program restarts
retain_nonstatus_information   1                       ; Retain non-status information across program restarts
is_volatile                                     0                       ; The service is not volatile
check_period                            24×7                    ; The service can be checked at any time of the day
max_check_attempts                   3             ; Re-check the service up to 3 times in order to determine its final (hard) state
normal_check_interval              10                      ; Check the service every 10 minutes under normal conditions
retry_check_interval                    2                       ; Re-check the service every two minutes until a hard state can be determined
contact_groups                        admins                  ; Notifications get sent out to everyone in the ‘admins’ group
notification_options                 w,u,c,r                 ; Send notifications about warning, unknown, critical, and recovery events
notification_interval                   60                      ; Re-notify about service problems every hour
notification_period                   24×7                    ; Notifications can be sent out at any time

Restart nagios services using below command.

# /etc/init.d/nagios restart


===============================> Blass <==================================



Leave a Reply

Your email address will not be published. Required fields are marked *