NAGIOS_ (NAGIOS_HOSTNAME, NAGIOS_SERVICEDESC, NAGIOS_NOTIFICATIONTYPE and so on). A script pushes that content to Flashduty in the Standard Alert Event format: problem notifications trigger alerts and recovery notifications close them.
In Flashduty On-call
Get an integration push URL in either of the two ways below. Choose the Standard Alert Event integration type in both, not Opsview.
Use a dedicated integration
- In the Flashduty console, go to Channels and open a channel
- Go to Settings → Integrations → Dedicated integrations and click Add an integration
- Select Standard Alert Event and click Save
- Open the generated integration card and copy the Push URL, in the form
https://api.flashcat.cloud/event/push/alert/standard?integration_key=<integration key>
Use a shared integration
- In the Flashduty console, go to Integration Center → Alert Events
- Select Standard Alert Event 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 in Opsview
Step 1: Create the notification script
On the Opsview Orchestrator server, create a script namednotify_by_flashduty and make it executable (chmod +x). The script uses curl; if the notification method runs on a Collector, that Collector also needs curl and access to api.flashcat.cloud. The push URL is passed as the script’s first argument instead of being written into the script.
Step 2: Install and test the script
On the Orchestrator, import the script as theopsview user:
test_notifications tool that simulates the environment variables Nagios Core sets at notification time; use it to test the script (replace <push URL> with the address copied in Step 1):
If the notification method is set to run on a Collector, test the script on the Collector servers as well.
Step 3: Add the notification method
- Go to Configuration → Apply Changes to finish installing the script
- Go to Configuration → Notification Methods and click Add New
- Enter
FlashdutyasName, tickEnable, and choose whetherRun onis the Orchestrator or the Collector - Enter
notify_by_flashduty <push URL>asCommand(scripts are read from/opt/opsview/monitoringscripts/notificationsby default, and arguments follow the script name) - After saving, go to Configuration → Apply Changes again to activate the new notification method
Step 4: Add the method to a notification profile
Opsview notifications are driven by each user’s Notification Profile, so every user who should receive Flashduty notifications must select this method:- Go to Configuration → Users and Roles → Users and edit the user (or open My Profile from your username at the top right), open the Notification Profiles tab and click Add New
- Select
Flashdutyunder Alert me by and the active time period under During - Under Host and Services, select the host groups and service checks to notify about and tick the states to notify on; include both the problem states and the recovery states, otherwise Flashduty receives no recovery notification
- Click Update, then Submit Changes, and finally go to Configuration → Apply Changes to make it live
Recovery and deduplication
- A host or service always uses the same Alert Key, so repeated problem notifications (for example from Opsview’s re-notification interval) only update the same alert, and the
RECOVERYnotification recovers it - When a service goes from WARNING to CRITICAL, the severity is updated on the same alert
- Acknowledgement (
ACKNOWLEDGEMENT), flapping (FLAPPING*) and downtime (DOWNTIME*) notifications are ignored by the script and produce no event in Flashduty
Troubleshooting
- No alert arrives: confirm the Notification Profile selects
Flashdutyand Apply Changes was run; check in Opsview’s Notifications View whether the notification was sent; test the script on its own withtest_notifications - The test works but real alerts are not pushed: in a real notification the script reads the environment variables Opsview passes; add
{ date; echo "Called with $@"; env; echo; } >> /tmp/env.txtto the top of the script (the debugging method given in the Opsview documentation) to see what it actually receives - The alert does not recover: confirm the Notification Profile ticks the recovery states; Nagios only sends a recovery notification after a problem notification was sent
- Flashduty returns a parameter error: confirm the push URL in
Commandis complete, includingintegration_key