Search code examples
emailnagiosnrpe

How to configure email notifications for specific services only in nagios or icinga?


I am getting critical and warning email notifications of all services. I want to get the email notifications only of specific services like Disk Usage, Windows Update.

These are my services:

define service{

    hostgroup                       windows
    use                             generic-service         ; Name of service template to use
    service_description             CPU Load
    check_command                   check_windows_cpu!60,90,95

}

define service{

    hostgroup                       windows
    use                             generic-service         ; Name of service template to use
    service_description             Memory Usage
    check_command                   check_windows!MEMUSE

}

define service{

    hostgroup                       windows
    use                             generic-service         ; Name of service template to use
    service_description             C: Disk Space
    check_command                   check_windows_disk

}

define service{

    hostgroup                       windows
    use                             generic-service         ; Name of service template to use
    service_description             Windows Essential Updates
    check_command                   check_win_essential_updates

} define service{

    hostgroup                       windows
    use                             generic-service         ; Name of service template to use
    service_description             Windows Updates
    check_command                   check_available_updates

}

And my contact.cfg is:

define contact{

    contact_name                    root
    alias                           Root
    service_notification_period     24x7
    host_notification_period        24x7
    service_notification_options    c
    host_notification_options       d,r
    service_notification_commands   notify-service-by-email
    host_notification_commands      notify-host-by-email
    email                           [email protected]

}

Any suggestion to get only critical notification from selected services?

Thanks.


Solution

  • See service definition.

    Just add

    notification_options    c
    

    to the service definitions.

    If you do not want to get any emails at all from the other services, add

    notifications_enabled   0
    

    to those services you don't want to get emails from.