NotificationCommand builds a JSON body from runtime macros with Icinga 2’s own Json.encode and posts it to Flashduty with curl. Each Icinga 2 host or service maps to one Flashduty alert: it triggers when a problem occurs and closes automatically on recovery.
In Flashduty On-call
You can get the integration push URL in either of the following ways.
Use a dedicated integration
- In the Flashduty console, select Channel and open a channel
- Select Configuration → Integrations → Private integration, then click Add an integration
- Select Icinga and click Save
- Open the new integration card and copy the Push URL
Use a shared integration
- In the Flashduty console, select Integration Center → Alert Events
- Select Icinga and enter an integration name
- Configure the default route and select a channel. You can add more rules under Routes after creation
- Click Save and copy the generated Push URL
Configure Icinga 2
The configuration below works with Icinga 2.11 and later. The notification command only needs
curl, installed on the Icinga 2 node that runs notifications, and that node must be able to reach the Flashduty push URL.
1
Add the Flashduty configuration
On the Icinga 2 master, create the file Notes:
/etc/icinga2/conf.d/flashduty.conf with the following content, and replace vars.flashduty_push_url with the push URL you copied:- Icinga 2 runs the notification command directly, without a shell, so quotes or line breaks in plugin output cannot break the JSON
macrois first assigned to the local variableresolve: callingmacrodirectly inside the{ }dictionary fails, the Icinga 2 log showsArgument is not a callable object, and no notification is sent- In a host notification the
service.*macros have no value and are sent asnull; Flashduty uses this to recognize a host notification assign where truesends every host and service. To send only some objects, replace it with your own condition, for exampleassign where host.vars.flashduty == true- If
curlis not at/usr/bin/curl, use the path thatwhich curlprints
In distributed monitoring, notifications run in the master zone, so the configuration file and
curl only need to be on the master nodes. If you manage configuration with Icinga Director, you can still place this file in the master’s conf.d directory, next to the objects Director deploys.2
Check and reload the configuration
icinga2 daemon -C reports no errors.3
Verify the lifecycle
In Icinga Web, open a service, choose Process check result, and submit a
CRITICAL result. Confirm that Flashduty receives an active alert. Then submit an OK result and confirm that the alert closes. Icinga 2 sends a problem notification only when the object enters a HARD state, which takes max_check_attempts consecutive non-OK results (5 in the sample generic-service template). So submit CRITICAL repeatedly until the state type shows HARD.You can also choose Send custom notification on the service page to check connectivity. The custom notification (CUSTOM) reaches Flashduty and gets a success response, but it does not create an alert.Alert Key
Flashduty computes the Alert Key from the host name
host_name and the service name service_name. Host notifications use an empty service name. Icinga 2 names a service object host name!service name, and a service name is unique within its host, so problem and recovery notifications for the same host or service land on the same alert.
Changes to the state, plugin output, display names, host address, or groups do not change the Alert Key. Renaming a host or service produces a new alert; close any alert left open under the old name by hand.
Flashduty rejects a request that lacks host_name or notification_type, a host notification that lacks host_state, and a service notification that lacks service_state.
Alert lifecycle
Icinga 2 sends a recovery notification only after it has sent a problem notification. An alert opened from an acknowledgement, downtime, flapping, or custom notification might never get a recovery notification to close it. So only problem notifications open alerts, and Flashduty handles each notification type
notification_type as follows:
While a problem lasts, Icinga 2 resends the
PROBLEM notification every 30 minutes by default (the Notification interval), and these notifications update the same alert. To turn this off, add interval = 0 to both apply Notification rules.
The apply Notification rules above set no types or states, so Icinga 2 sends every notification type. When a downtime is removed, Icinga 2 sends the type DOWNTIMECANCELLED. Ignored notifications get a success response.
Severity
Severity comes from the current state:
service_state for service notifications and host_state for host notifications.
A recovery event takes its severity from the state before the recovery (
service_last_state or host_last_state).
Alert content
- Title:
<service display name> on <host display name>for service notifications,Host <host display name>for host notifications. Object names are used when no display name is set - Description: the plugin output
service_outputorhost_output - Labels:
host,resource(host name),service,check(service name, service notifications only),notification_type,state,host_display_name,host_address,host_groups,service_display_nameandservice_groups(service notifications only). Multiple groups are joined with commas
Troubleshooting
- No notification is sent: check the object’s notification history in Icinga Web, confirm the
flashdutynotification objects exist (runicinga2 daemon -C --dump-objectsto write the object cache, thenicinga2 object list --type Notification --name '*flashduty'), and confirm notifications are not disabled on the host or service - The Icinga 2 log shows
exit code 22:curlgot an HTTP 4xx/5xx response. Confirm thatvars.flashduty_push_urlis the full push URL and includesintegration_key - The Icinga 2 log shows
exit code 6,7, or28: the node that runs notifications cannot resolve, connect to, or reach the push URL within 10 seconds. Check DNS, the firewall, and proxies - The same notification is pushed several times: the
apply Notificationrules have several users. Keep onlyflashduty - A service turned CRITICAL but nothing was pushed: the object is still in a SOFT state. Notifications are sent only after
max_check_attemptsresults, when it enters a HARD state - The alert does not recover: confirm that the object has really returned to
OKorUP, and that notypesfilter on the Notification or on theflashdutyuser excludesRecovery