Tuesday, 8 March 2016

Configure Email Alert In Nagios

vim /usr/local/nagios/etc/objects/contacts.cfg

# Just one contact defined by default - the Nagios admin (that's you)
# This contact definition inherits a lot of default values from the 'generic-contact'
# template which is defined elsewhere.

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                           root@localhost    ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
        }

define contact{
        contact_name                    username             ; Short name of user
        use                             generic-contact         ; Inherit default values from generic-contact template (defined above)
        alias                           Nagios Admin            ; Full name of user

        email                           prashant@example.com  ; <-- CHANGE THIS TO YOUR EMAIL ADDRESS ******
        }

define contact{
        contact_name                    username             ; Short name of user
        use                             generic-contact         ; Inherit default values from generic-contact template (defined above)
        alias                           Nagios Admin            ; Full name of user

        email                           mail@example.com  ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
        }










Now Create Groups:

##################
CONTACT GROUPS

##################
##################

# We only have one contact in this simple configuration file, so there is
# no need to create more than one contact group.

define contactgroup{
        contactgroup_name       admins
        alias                   Nagios Administrators
    members        nagiosadmin,prashant,username
        }

define contactgroup{
        contactgroup_name       awsexample
        alias                   exam Administrators
        members         prashant,atuldeokar,dimplep
        }

define contactgroup{
        contactgroup_name       swlayer
        alias                   Softlayer Administrators
        members         khemunad
        }



Now Define In Server config File :



define service{

use generic-service

host_name server-name

normal_check_interval 30

service_description PROCESSES

check_command check_nrpe!check_total_procs

contact_groups     admins,prashant

}





No comments: