Notification with Director

Hi again,

at first some Information:

  • Director version: V1.10.0
  • Icinga Web 2 version and modules: v2.11.2
  • Icinga 2 version: r2.13.4-1
  • Operating System and version:
    Platform: Ubuntu
    Platform version: 20.04.4 LTS (Focal Fossa)
  • PHP version used: 7.4

So at the Moment i have some trouble with the Notifications in Icinga. I configured it i the Director and installed postfix on our Ubuntu Server. From the shell i could send a test-mail via postfix, so this is working.
But Icinga don´t send any notification to our Mailbox. Can anybody help me, that it works?

This is the Config in the director:

zones.d/director-global/timeperiods.conf
object TimePeriod "24x7-Timeintervall" {
    import "legacy-timeperiod"
    ranges = {
        "friday"	= "00:00-24:00"
        "monday"	= "00:00-24:00"
        "saturday"	= "00:00-24:00"
        "sunday"	= "00:00-24:00"
        "thursday"	= "00:00-24:00"
        "tuesday"	= "00:00-24:00"
        "wednesday"	= "00:00-24:00"
    }
}
zones.d/SRV-0069/usergroups.conf
object UserGroup "it-service" {
}
zones.d/director-global/user_templates.conf
template User "Mail to Group" {
    enable_notifications = true
    states = [ Critical, Down, OK, Up, Warning ]
    types = [
        Acknowledgement,
        DowntimeEnd,
        DowntimeStart,
        FlappingEnd,
        FlappingStart,
        Problem,
        Recovery
    ]
}
zones.d/SRV-0069/users.conf
object User "itservice" {
    import "Mail to Group"

    display_name = "IT-Service"
    email = "itservice@icinga.com"
    period = "24x7-Timeintervall"
    states = [ Critical, Down, OK, Up, Warning ]
    types = [
        Acknowledgement,
        DowntimeEnd,
        DowntimeStart,
        Problem,
        Recovery
    ]
    groups = [ "it-service" ]
}
zones.d/SRV-0069/notification_apply.conf
apply Notification "Mail-ITService-Host" to Host {
    import "mail-Icinga-host"

    interval = 5m
    period = "24x7-Timeintervall"
    assign where !("xxxxxxxx-SRV" in host.groups) && !("xxxxxxx" in host.groups)
    states = [ Down, Up ]
    types = [
        Acknowledgement,
        FlappingEnd,
        FlappingStart,
        Problem,
        Recovery
    ]
    user_groups = [ "it-service" ]
    users = [ "itservice" ]
}
zones.d/SRV-0069/notification_apply.conf
apply Notification "Mail-ITService-Service" to Service {
    import "mail-Icinga-service"

    interval = 5m
    period = "24x7-Timeintervall"
    assign where !("xxxxxxxxx" in service.groups) && !("xxxxxx" in service.groups) && !("xxxxxx" in service.groups)
    states = [ Critical, OK, Warning ]
    types = [
        Acknowledgement,
        Custom,
        FlappingEnd,
        FlappingStart,
        Problem,
        Recovery
    ]
    user_groups = [ "it-service" ]
    users = [ "itservice" ]
}

Greetings Sennin

Is the feature notification enabled? Check it with

icinga2 feature list

Yes it is:
image

I’d recommend to check icinga2.log and if it does not provide enough information, enable debuglog und checkit as well.

The Icinga2.log list this:

It says, that an Parameter is missing. I think after the first, the other required Parameters will miss to, after fixing “LONGDATETIME”

Where do i set this Parameters?
In the Argument Area of the Commando?

Greetings Sennin

So i did set up the required Parameters for the commando.

zones.d/director-global/commands.conf
object NotificationCommand "mail-host-notification" {
    import "plugin-notification-command"
    command = [ "/etc/icinga2/scripts/mail-host-notification.sh" ]
    arguments += {
        "-4" = "$address$"
        "-b" = "$notification.author$"
        "-c" = "$notification.comment$"
        "-d" = "$icinga.long_date_time$"
        "-l" = "$host.name$"
        "-n" = "$host.display_name$"
        "-o" = "$host.output$"
        "-r" = "$user.email$"
        "-s" = "$host.state$"
        "-t" = "$notification.type$"
    }
}

And in the log i found this:

So for now i will see, if the Mails apear in our Ticketsystem.

Thank you for your advice.

Greetings Sennin

1 Like