How to send alert in nagios for particular service to particular mail id

0

Let i have configured one host in nagios and i have also configured contact for mails and that is also working, now the challenge is all alerts for any host going to mail id defined in contacts.cfg but and I want to send alerts related to network team, alerts related to space should goto storage team etc.

Like i have written below two command one for ping and one for swap. So for ping alerts it should go to network@example.com and for swap it should goto storage@example.com.

define service{ use generic-service ; Name of service template to use host_name Host-1 service_description PING check_command check_nrpe!check_ping }

define service{ use generic-service ; Name of service template to use host_name Host-1 service_description Swap check_command check_nrpe!check_swap }

If i add any mail id in contacts.cfg, it will send all alerts to all mail id if defined in host file. So i want to send alert for a single host, different alert to different mail id, instead of all alerts to single or multiple id.

Avkash

Posted 2017-07-10T06:10:02.383

Reputation: 21

Answers

0

In define service add contacts directive and name of that contact and that contact must be defined in contacts.cfg file.

define service{
    use                             generic-service
    host_name                       Host-1
    service_description             PING
    contacts                        user
    check_command                   check_nrpe!check_ping
    }

Here groups can also be used as:

define service{
    use                             generic-service
    host_name                       Host-1
    service_description             PING
    contact_groups                  admins
    check_command                   check_nrpe!check_ping
    }

Avkash

Posted 2017-07-10T06:10:02.383

Reputation: 21