Adding emails alerts to additional email addresses for specific services or hosts

From Notes_Wiki

Home > CentOS > CentOS 6.x > Monitoring tools > Nagios configuration > Adding emails alerts to additional email addresses for specific services or hosts

It may be desired to send nagios alerts for specific services to different email IDs. To achieve that edit '/etc/nagios/objects/contacts.cfg' file to create new contact and contactgroup. Example configuration is:

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 logs@admin.sbarjatiya.com
        }

define contact{
        contact_name                    softwareengineer                ; Short name of user
        use                             generic-contact         ; Inherit default values from generic-contact template (defined above)
        alias                           Software Engineer          ; Full name of user
        email se@admin.sbarjatiya.com
        }


define contactgroup{
        contactgroup_name       admins
        alias                   Nagios Administrators
        members                 nagiosadmin
        }

define contactgroup{
        contactgroup_name       engineers
        alias                   Software engineers and administrators
        members                 nagiosadmin, softwareengineer
        }

Then for any of the services use "contact_groups <group-name>" configuration to send emails to alternate group:

define service{
   use generic-service;
   host_name qaweb
   service_description Disk space
   check_command check_nrpe!check_disk
   notifications_enabled 1
   contact_groups  engineers
}


Home > CentOS > CentOS 6.x > Monitoring tools > Nagios configuration > Adding emails alerts to additional email addresses for specific services or hosts