Send Icinga2 Notifications to a Rest API

Hello,

it is possible to send Icinga2 notification to a Rest Api interface? Specifically i want to send the notifications to Operations Bridge Manager from MicroFocus.
Maybe someone has a information where i can find a script or how to implement it.
Thank you

Hi & welcome,

Yes, you simply need a script that is able to send notifications to that API and define it as NotificationCommand.

1 Like
  1. write a script that created the webrequest to an external service
  2. you could create a Notification command eg. in icinga director that creates a curl/wget request using the curl/wget binary on your system

I think, it can also be done directly in the icinga DSL.
Maybe you could use the Teams integration via Webhook as inspiration.

Hi, i have do it on that way.
I create a own script and an command.
But i have a new question. Maybe you or @rsx or someone can help.
I need a alert_id for my notification. I wanted to extract the id at the same way like $host_name$ or $service.name$ to give it to a argument of the notification script.
But i don’t find anything in the documentation and $alert_id$,$host.alert_id$ and $service.alert_id$ don’t work.
How i can get the notification or alert id to give it to the notification script ?
Thank you

Why do you need an alertid?

For matching the critical/warning event and later the ok event in the Operations Bridge Manager together. So the ticket can be closed automatically. It would be the easiest way for the matching

We have something similar: Defined a event_id for every service object which is handover to the notification command and the plugin.

But is this event_id the same for a service witch a critical state and a later ok state for example ? And if so, how can i get the event_id ?

In our case yes, but you could add state to your alert_id in any way you like.

We define it at every service object e.g.

apply Service "ping" {
...
   vars.eventid = 1
...

Hello, we have created an integration for SIGNL4 alerting using bash scripts. You can find it here:

The idea is to send an HTTP request to a REST API. Maybe this helps you.