cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 7

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?

 

0 Kudos
6 Replies
Level 12

@Barshasree 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!

 

 
0 Kudos

Thanks 🙂 this works perfectly. However, we want to integrate slack using power shell script. Will you be able to help?
0 Kudos

i sure an try. what exactly are you trying to accomplish?

0 Kudos
Level 8

Interested in this thread. Following 🙂

0 Kudos
Level 12

Have you thought about just using Webhooks? that's how we setup our solarwinds/slack integration and it's much easier than using curl IMO.

0 Kudos

How do we do that?
0 Kudos