Nagios monitoring

From Ever changing code
Jump to navigation Jump to search

Installation Nagios on EC2 Ami instance and monitor a generic host on Internet.

Installation

Install Nagios core package

sudo yum install nagios

Install plugins. Without the plugins you will not be able to monitor even localhost.

sudo yum install nagios nagios-plugins-all

Install SNMP

yum install net-snmp-utils net-snmp

Post installation configuration

Set up user name and password. A default username is nagiosadmin

sudo htpasswd -c -b  /etc/nagios/passwd nagiosadmin nagiospassword

Adding host to monitor

Create new object to monitor

sudo vi /etc/nagios/objects/o2box.cfg

Paste below standard minimum config

# Define a host for the local machine

define host{
        use                     linux-server            ; Name of host template to use
                                                        ; This host definition will inherit all variables that are defined
                                                        ; in (or inherited by) the linux-server host template definition.
        host_name               google.com
        alias                   google.com
        address                 www.google.com
        }

###############################################################################
###############################################################################
#
# SERVICE DEFINITIONS
#
###############################################################################
###############################################################################

# Define a service to "ping" the local machine

define service{
        use                             generic-service         ; Name of service template to use
        host_name                       google.com
        service_description             PING
        check_command                   check_ping!100.0,20%!500.0,60%
        }

# Define a service to check HTTP on the local machine.
# Disable notifications for this service by default, as not all users may have HTTP enabled.

define service{
        use                             generic-service         ; Name of service template to use
        host_name                       google.com
        service_description             HTTP
        check_command                   check_http
        notifications_enabled           0
        }

add to /etc/nagios/nagios.cfg follwoing lines in aappropiate sections:

cfg_file=/etc/nagios/objects/o2box.cfg

Restart Nagios

sudo service nagios restart

Comment: google host is not responding... wip

References