This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Facing issues in Solarwinds - Slack Integration using Curl

I have trying to integrate slack with solarwinds (using cURL) and facing issues.

I have watched the lab episode 40.

For now I have tried two scripts:

One for Interface down for a particular node.

Curl Path-X POST --data-urlencode “payload= {\“channel\”: \”#it-solarwinds\”, \“username\“: \“OrionBot\“, \“text\“:\“Alert - Interface: ${N=SwisEntity;M=Caption} status changed to ${N=SwisEntity;M=Down}\nView: <${N=Alerting;M=AlertDetailsUrl}|Details>, <${N=SwisEntity;M=Node.DetailsUrl}|Node>\nTo acknowledge click <${N=Alerting;M=AcknowledgeUrl}|here>\“}” Slack incoming webhook URL

And the other for interface admin down for a particular node.

Curl path X POST --data-urlencode “payload= {\“channel\”: \”#it-solarwinds\”,

\“username\“: \“OrionBot\“, \“text\“: \“Alert - Interface: ${N=SwisEntity;M=InterfaceName} on node ${N=SwisEntity;M=Node.Caption} has status of ADMIN DOWN. \nView: <${N=Alerting;M=AlertDetailsUrl}|Details>, <${N=SwisEntity;M=Node.DetailsUrl}|Node>\nTo acknowledge click <${N=Alerting;M=AcknowledgeUrl}|here>\“}” Slack incoming webhook URL

When I test the alert it says execution successful, however don't receive an alert in Slack. 

Can someone please help?

Parents
  •  you can read up on Slack Webhooks here: https://api.slack.com/messaging/webhooks

    Once you have your webhook URL, select the "Send a GET Or POST Request To A Web Server" alert trigger action:

    action.PNG

    Paste in your URL, Select POST, and paste in your JSON payload:

     

    trigger.PNG

     
     

    The above JSON payload would be a simple example for a node down alert, but you can really use any Orion variable you want in there (you can also use emojis in the payload!).

    You can also make your Slack message as pretty as you want. I like to use the Slack Message Builder to format my messages.

    To test your alert, i would create a dedicated Test Slack Channel to make sure your message looks the way you want it to. an easy way to test is to just use the "simulate" function. once you've tested the alert and it looks the way you like, you can just point it to your "production" channel.

    The only thing is that backslash (\) is an escape character in Slack, which makes it tricky for volumes. I use this custom variable to handle the volume name: ${SQL: SELECT REPLACE(Caption, '\', '\\') FROM Volumes WHERE VolumeID = ${VolumeID}} 

     

    I hope this helps! let me know if you have any other questions!

     
Reply
  •  you can read up on Slack Webhooks here: https://api.slack.com/messaging/webhooks

    Once you have your webhook URL, select the "Send a GET Or POST Request To A Web Server" alert trigger action:

    action.PNG

    Paste in your URL, Select POST, and paste in your JSON payload:

     

    trigger.PNG

     
     

    The above JSON payload would be a simple example for a node down alert, but you can really use any Orion variable you want in there (you can also use emojis in the payload!).

    You can also make your Slack message as pretty as you want. I like to use the Slack Message Builder to format my messages.

    To test your alert, i would create a dedicated Test Slack Channel to make sure your message looks the way you want it to. an easy way to test is to just use the "simulate" function. once you've tested the alert and it looks the way you like, you can just point it to your "production" channel.

    The only thing is that backslash (\) is an escape character in Slack, which makes it tricky for volumes. I use this custom variable to handle the volume name: ${SQL: SELECT REPLACE(Caption, '\', '\\') FROM Volumes WHERE VolumeID = ${VolumeID}} 

     

    I hope this helps! let me know if you have any other questions!

     
Children