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

How do I pull in data from most recent "down" node?

Current Versions:

Microsoft Windows [Version 10.0.17134.765]

Python 3.7.3

I am just starting out using different API's to make work a little bit easier. I have been tasked with helping the network department on a project. What they use for keeping track of what nodes are online/offline is SolarWinds, I am completely new to SolarWinds and am looking for guidance. What I am trying to do is for example when Node X goes down, it initiates my python script, then the script will get Node X's details from the database that's connected. I've looked through the github repo for the OrionSDK but I don't really know how to use what they are saying.

If someone could help get me connected to the Orion database then just pull in the most current node that is "down" that would be great. If I could just get that data from the node, I have everything else figured out. Apologies if this is a duplicate question.

Tags (2)
0 Kudos
7 Replies
Level 8

I'm very new to python, but I hope I can help at least a bit.

You'll want to install this python client for interacting with the API:  GitHub - solarwinds/orionsdk-python: Python client for interacting with the SolarWinds Orion API

Then, you can connect to the SolarWinds Information Service (swis):

import orionsdk

swis = orionsdk.SwisClient("server", "username", "password")

Now, you can query the database for any information you need:

response = swis.query("SELECT NodeID, IPAddress, Caption, Status FROM Orion.Nodes WHERE NodeID = ##")

Here, ## would be the ID of the node that went down

Awesome thank you! I tried reaching our server but it timed out because it couldn't connect properly. Would i need admin rights to access the server this way? Because I'm trying to use my individual user/pass that was assigned to me but I can't connect to the server.

0 Kudos

I figured it out, I was having firewall issues.

You may also be interested in inspecting alerts to identify what needs attention.  You can find details about using the Orion SDK to interact with alerts here:

Alerts · solarwinds/OrionSDK Wiki · GitHub

So I am now able to pull Node Data but I still don't know how to get the most recently downed node. I'm querying like this.

query = "SELECT Caption, Status FROM Orion.Nodes WHERE Status = 2"

results = swis.query(query)

for row in results['results']:


this outputs:



(So it ouputs the caption name, then the status which is 2 which means down.

Except TEST-B went down first and TEST-A went down second, unless the output is based on what went down first. Example if I had a third test machine that was named TEST-C and it went down would the output be as follows:




Test C being the most recently downed Node. Is that how the format follows for querying? Unless there is any easier way to get the most recently downed node.

Any help would be awesome

0 Kudos

You probably want information from the Orion.Events table.  See this for an example query:

Node Downtime with Duration and Minimum Length Filtering

0 Kudos

Thank you! I'm still trying to figure out how to connect properly, if I have more questions after that I will reply!

0 Kudos