...
Click the switch to "Activate Incoming Webhooks":
Click "Add New Webhook to Workspace" at the bottom of the page:
...
- /usr/local/nmis9 is replaced with your NMIS path.
- SERVER is replaced with the IP or domain of your server (eg. 192.168.1024.10185, or nmis-01.mydomain.net).
- WEBHOOK is replaced with the webhook we copied in the last step.
When complete this should look like the following:
Then click the Validate button. If you see a 'Syntax OK' prompt, proceed to click Save. You can also click Save and this will also check the syntax is OK.
...
You can now call the script through opEvents with the command:
script.slacker()
How you do this exactly is going to vary depending on how you want the end result to work. For example, let's add a call to the script when a node goes down. To do this, scroll down in your Event Actions until you find the line that readsThis would look like the following:
Code Block |
---|
"30" : { "BREAK" : "false", "IF" : "event.event eq \"Node Down\"", "THEN" : [ "tag.isbroken(nodedown)", "tag.verybad(42)", "script.slacker()" ] } |
and add the call inside the square brackets. The end result should look something like this:
After modifying the Event Actions to suit your needs, you can then proceed to press the Save button, and verify the Syntax is OK. Once confirmed, you will then need to restart the opEvents daemon (opeventsd).
Testing the integration
If you have applied the integration to an event that may not occur on a regular occurrence, you can also run the following command to simulate the event and verify your integration works:
Code Block |
---|
/usr/local/omk/bin/opevents-cli.pl act=create-event node=DC-A-RTR-01 state=down event="Node Down" stateful="Node" |
Troubleshooting
exec failed: Permission denied
In the Event Context of a Event where you have included the script, you see the following in the Scripts section under slacker:
...
You will need to restart the opeventsd opEvents daemon once after making this change.
Slack push notifications - This content can't be displayed.
You may find that Slack push notifications display a "This content can't be displayed" message on some operating systems. A quick modification to your slack_messages.pl will resolve this. Locate the following lines:
Code Block |
---|
\"username\": \"$server opEvents Notifier\",\n |
Then underneath both of these (there should be two lines), add the following. Below is an example, but you can modify as you see necessary. Ensure to verify your formatting once changes have been made.
Code Block |
---|
\"text\": \"$node - $event - Priority: $prioritynum\", |