Microsoft Windows [Version 10.0.17134.765]
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.
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):
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.
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:
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']:
(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
SolarWinds solutions are rooted in our deep connection to our user base in the THWACK® online community. More than 150,000 members are here to solve problems, share technology and best practices, and directly contribute to our product development process.