theoberlin
Goto Top

Icinga2 Mail Notification

Hallo zusammen,

ich habe ein Problem mit der Einrichtung der Notifications bei Icinga2. Vielleicht hat jemand eine Idee.

Mail ist grundsätzlich eingerichtet. Icinga Benachrichtigungen kommen aber nicht an. Weder automatisch noch manuell.

echo "test" | mail -s "bla" blabla.blabla@blablabla.de kommt die Testmail an. Fetaures-Enabled ist auch Notifications enabled.

In der Icingaconfig ist in der users.conf folgendes eingetragen:

object User "icingaadmin" {  
  import "generic-user"  

  display_name = "ICH"  
  enable_notifications=true
  groups = [ "icingaadmins" ]  
  email = "bla@blabla.de"  
  period = "24x7"  
  states = [OK, Warning, Critical, Unknown ]
  types = [Problem, Recovery]
}

object UserGroup "icingaadmins" {  
  display_name = "Icinga 2 Admin Group"  
}

In der notifications.conf:

apply Notification "mail-icingaadmin" to Host {  
  import "mail-host-notification"  
 // user_groups = ["icingaadmins"] 
 // users = ["icingaadmin"] 
 user_groups = host.vars.notification.mail.groups
 users = host.vars.notification.mail.users

  interval = 30s
  period = "24x7"  
  //vars.notification_logtosyslog = true

  assign where host.vars.notification.mail
}

apply Notification "mail-icingaadmin" to Service {  
  import "mail-service-notification"  
 // user_groups = ["icingaadmins"] 
  user_groups = host.vars.notification.mail.groups
  users = host.vars.notification.mail.users

  interval = 1h
  period = "24x7"  
  //vars.notification_logtosyslog = true

  assign where host.vars.notification.mail
}

Auch wenn ich die Gruppe direkt zuweise und nicht vom Host hole läuft es nicht.

und in bspw. einem Host:

object Host "Wlan AP 3.1"{  
import "generic-host"  
address = "xx.xx.xx.xx"  
vars.sla = "24x7"  
vars.os = "linux"  
vars.notification["mail"] = {  
    /* The UserGroup `icingaadmins` is defined in `users.conf`. */
    groups = [ "icingaadmins" ]  
  }
}

lg
Theo

Content-Key: 1796260360

Url: https://administrator.de/contentid/1796260360

Printed on: April 24, 2024 at 05:04 o'clock

Mitglied: 150345
150345 Feb 01, 2022 updated at 13:08:02 (UTC)
Goto Top
Hallo,

vorweg sei gesagt, dass es bei mir schon länger her ist, als ich zuletzt Icinga2 verwendet habe.
Aber eventuell kann ich dir dennoch helfen.

Wie werden bei dir die Mails verschickt? Läuft ein Postfix auf deinen Server?
Wenn ja, wie ist dieser konfiguriert?

Bitte poste mal den Notification Command:
https://icinga.com/docs/icinga-2/latest/doc/03-monitoring-basics/#notifi ...

MfG
Member: theoberlin
theoberlin Feb 01, 2022 at 13:27:18 (UTC)
Goto Top
Hallo Brieftaube,

auf dem Debian ist msmtp installiert, was mit oben genanntem Befehl auch wunderbar funktioniert. Die Mails werden an einen internen connector am Exchange gesendet, der für freigegebene IP's keine Anmeldung oder Verschlüsselung benötigt.

Hier sind die Noifications Commands:

object NotificationCommand "mail-host-notification" {  
  import "plugin-notification-command"  

  command = [ SysconfDir + "/icinga2/scripts/mail-host-notification.sh" ]  

  env = {
    NOTIFICATIONTYPE = "$notification.type$"  
    HOSTALIAS = "$host.display_name$"  
    HOSTADDRESS = "$address$"  
    HOSTSTATE = "$host.state$"  
    LONGDATETIME = "$icinga.long_date_time$"  
    HOSTOUTPUT = "$host.output$"  
    NOTIFICATIONAUTHORNAME = "$notification.author$"  
    NOTIFICATIONCOMMENT = "$notification.comment$"  
    HOSTDISPLAYNAME = "$host.display_name$"  
    USEREMAIL = "$user.email$"  
  }
}

object NotificationCommand "mail-service-notification" {  
  import "plugin-notification-command"  

  command = [ SysconfDir + "/icinga2/scripts/mail-service-notification.sh" ]  

  env = {
    NOTIFICATIONTYPE = "$notification.type$"  
    SERVICEDESC = "$service.name$"  
    HOSTALIAS = "$host.display_name$"  
    HOSTADDRESS = "$address$"  
    SERVICESTATE = "$service.state$"  
    LONGDATETIME = "$icinga.long_date_time$"  
    SERVICEOUTPUT = "$service.output$"  
    NOTIFICATIONAUTHORNAME = "$notification.author$"  
    NOTIFICATIONCOMMENT = "$notification.comment$"  
    HOSTDISPLAYNAME = "$host.display_name$"  
    SERVICEDISPLAYNAME = "$service.display_name$"  
    USEREMAIL = "$user.email$"  
  }
}

Es müsste irgendwie an der Mail Konfig liegen. Die reinen Icinga config Files sind von einer anderen installation kopiert. Da lief das Benachrichtigungssystem schonmal.
Member: theoberlin
theoberlin Mar 28, 2022 at 13:18:03 (UTC)
Goto Top
Kleine Nachfrage hier:

Irgendjemand eine Idee?

lg
Theo