Icinga2: Send E-Mail on Host/Service Down

25,506

You did not define any notification objects, referenced to host/service objects and linked to users and notification commands.

The sample configuration in conf.d/notifications.conf already provide an insight, although you should consider writing your own notification apply rules for hosts and services based on your notification type - be it mail, sms, etc. See using apply notification.

Verify notification objects bring added by invoking:

icinga2 object list --type Notification 

after config validation.

Share:
25,506

Related videos on Youtube

MyFault
Author by

MyFault

Updated on September 18, 2022

Comments

  • MyFault
    MyFault almost 2 years

    I installed and configured Icinga2 with icingaweb2.

    I added a test-host with a test-service: Let's call it "example.com".

    This is the test-host:

    /etc/icinga2/conf.d/hosts/example-com:

    object Host "example-com" {
            //Importiert die generische Host-Vorlage aus der template.conf
            import "generic-host"
            //IPv4 Adresse
            address = "2xx.2xx.2xx.2xx"
    
            //Angabe des Betriebssystemtyps
            vars.os = "Linux OS"
            vars.sla = "24x7"
    }
    

    Okay, then we have the service-configuration:

    /etc/icinga2/conf.d/hosts/example-com/http.conf

    object Service "http" {
        import "generic-service"
        host_name = "example-com"
        check_command = "http"
        vars.sla = "24x7"
    }
    

    Of course I added a new user group to /etc/icinga2/conf.d/users.conf

    /**
     * The example user 'icingaadmin' and the example
     * group 'icingaadmins'.
     */
    
    object User "icingaadmin" {
      import "generic-user"
    
      display_name = "Icinga 2 Admin"
      groups = [ "icingaadmins", "linux-admins" ]
    
      email = "[email protected]"
    }
    
    object UserGroup "icingaadmins" {
      display_name = "Icinga 2 Admin Group"
    }
    
    object UserGroup "linux-admins" {
      display_name = "Linux-Administrators"
    }
    

    Now I think I have to add the contact_groups to the host. But if I do that the config-check fails :-(

    Thanks for your help :-)

  • MyFault
    MyFault about 9 years
    Hm, I read this - but I did not find the error in my conf.
  • lazyfrosch
    lazyfrosch about 9 years
    Well you said you tried to add contact_group to your host, that is wrong - you need to create/apply a Notification to tell Icinga 2 how to notify whom for what object and event.