NotificationCommand to icingaweb display

Hi folks,
I’m implementing a new icinga2 setup and in the notificationcommand I’d like to pass an env variable that will allow me to generate icingaweb2 url direct to the notification.

In icingaweb2 if I choose “History” > “Notifications” I get a list of all notifications. To view one I click on it and the url shown is:
/icingaweb2/monitoring/event/show?id=21905&type=notify

So the id is specific to this notification. Where/how do I get that ID and pass it in my NotificationCommand as I cannot find it in an environmental variable or value that I’ve searched for?

i.e. I want to add it to:

env = {
NOTIFICATIONTYPE = “$notification.type$”
SERVICEDESC = “$service.name$”
HOSTNAME = “$host.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$”
NOTES = “$service.notes$”
}

Thank you

Hi @andyb2000,

For that you can use something like this:

# Host:
var host_name_with_link = "<" + icinga2_base_url + "/monitoring/host/show?host=" + host_name + "|" + host_display_name + ">"
# Service: 

service_name_with_link = "<" + icinga2_base_url + "/monitoring/service/show?host=" + host_name + "&service=" + service_name + "|" + service_display_name + ">"

#Where: 
var service_display_name = macro("$service.display_name$")

Stolen from:

Hope it will help you in good direction :slight_smile: