OpsGenie - Solarwinds OEC Connector - Python Updates - Unman and Mute Node Options

This is a walk thru on code I added to the config.json and actionexectutioner.py file for the Solarwinds OEC in order to have the option to unman a node, reman a node, mute a node, and to unmute a node. I will try to answer any questions the best I can. Also please understand that my extent of Python is the 6 hours I had invested in figuring out the code so go easy on me.Lets get started!!

To start I am going of the assumption that you already have your OEC connector for SAM setup and working. If you are unable to ACK an alert then you need to go thru the documentation and ensure this is all setup.

I also recommend that you setup a test Intergration Connector in Opsgenie and a test alert using that API to do testing.

Prerequisites

1. Orion SDK needs to be installed on the OEC server. I used the Orion Python SDK to do my portion of coding. Ensure its installed and working by using the examples in the OrionSDK-Python example folder. Do something simple like unmanage a node.

https://github.com/solarwinds/orionsdk-python

OpsGenie Setup Work

1. Log into the OpsGenie webpage and go to Settings----Configured intergratons----click the Solarwinds intergration you currently have setup

2. Under Alerts, you more than likely have an alert for each of your alerts. (This is a pain in the a$# part as you will have to add the following to each alert. OpsGenie doesn't have a global setting to add these to one and have it run for all) add the following to each:

Actions - These are the actions that OpsGenie will show when you get an alert. Do each exactly as I type them. You should only have {{actions}} unless you added custom actions already. Uppercase and lowercase does matter here

Mute_Node

Remanage_Node

Unmanage_Node

Unmute_Node

It should look like this when done.

adbs98_0-1607373562933.png

Next go to down to "Extra Properties" and add the following:

NodeID:{{NodeID}}

IP_Address:{{IP_Address}}

It will give you two fields. The first just put the name with no : the second field wrap it in {{}}

It should look like this

adbs98_1-1607373758597.png

Once this is complete on all the alerts you choose to set this on, save and close this page.

Solarwinds Alert Addition

We need to add the two variables to the post get open action for alerts. This sets the two variables up so OpsGenie knows what they are. Add this to the end of the "Body to Post"

IP_Addressµ#µ${N=SwisEntity;M=IP_Address}§#§
NodeIDµ#µ${N=SwisEntity;M=NodeID}§#§

It should look like this

adbs98_2-1607374264696.png

This is the hard part completed. Fire off a test alert and if this is all correct you should see your actions (not workable yet) and you should see the IP address of the node and the node ID at the bottom under Extra Properties. If you don't see either one of thes stop and rego thru this.It should look like this towards the bottom of the alert

adbs98_3-1607374536209.png

Last steps..... Replacing ActionExecutioner.py file and reconfiguring config.json

Reconfiguring config.json

You have to replace your config.json with the one provided and reconfigure it with your API info. This JSON has the added action items to make the connection to the ActionExecutioner. Rename the original and then open both and copy the relevant info to the new one

Note: I added a variable for hostname in this file. Put only the hostname of your solarwinds server. This variable is used with swis commands I have in the ActionExecutioner.py

Last Step..... Rename the original ExecutionerApp and then add the new one. I pushed hard so you shouldn't have to mess with any code unless you want to change the default time things stay unmanaged and muted (currently 24 hours)

I know this was kinda a long process but Opsgenie really not the easiest to configure and that is about 90% of the process. Let me know your thoughts, questions, success, issues. I will try to help where I can when i have free time

opsgenie-solarwinds-Updated.zip