Custom Alert Actions are another way Opsgenie allows users to quickly and effectively react to Alerts. Paired with Opsgenie's integration capabilities, Custom Actions include anything relevant such as Ping, Trace Route, or Create ticket. For a single alert you can define up to 10 custom actions. Executing a custom action is an opportunity for an initial, collaborative investigation into the issue.
To set up a Custom Action:
Access your integration from the side collapsable menu.
In the settings page that follows, under Alert Fields, access the input box for Actions. If the Actions box isn't there, toggle the Advanced switch located at the top of the page.
- Enter in Action name that corresponds with defined groovy script. For multiple actions, enter in the action name, then click inside the text box again until you see the action become it's own block with edit and delete icons.
To pass the information to your system, OpsGenie supports callbacks for Alert activity. OpsGenie can call an HTTP endpoint (webhook) and pass the information that a user executed an action on an Alert. OpsGenie also provides the Marid utility that subscribes to OpsGenie alerts and can execute a groovy script for Alert Actions. So combining custom alert actions with Marid, we can enable the user to execute a Custom Action such as "Ping" from a mobile device.
- User executes Ping action from OpsGenie app
- Marid gets the user and the Alert data, then executes the groovy script associated with the ping action (by default ping.groovy)
- Groovy script executes ping command, captures the output and adds to the Alert as a note