solarwinds / OrionSDK

SDK for the SolarWinds Orion platform, including tools, documentation, and samples in PowerShell, C#, Go, Perl, and Java.
https://thwack.com/OrionSDK
Apache License 2.0
397 stars 138 forks source link

OrionSDK can not permanently set a node's interface status #225

Open bmmarugg opened 4 years ago

bmmarugg commented 4 years ago

Ever since upgrading to 2019.4, my Python script that sets interfaces on a node that are in the "Down" state to the "Unplugged" state isn't working. The script will run and the Down interfaces will be transitioned to the Unplugged state, but will immediately transition back to the Down state after only a few seconds. Node_int_failure Node_int_Working sw_unplugged_script.txt

kmsigma commented 3 years ago

Note: I'm not overly familiar with python, but I think I found the issue. Interfaces now have a field called UnPluggable which controls if it should be 'down' or 'unplugged.' If you leave Unpluggable as 'false' then at the next polling, the correctly interpreted status (Down) is assigned.

What you need to do is flip the UnPluggable to 'true' (meaning: this interface should be shown as unplugged). Then you can flip the status if you like or just wait for the next polling to do it for you.

You might also be able to run a faster query: "SELECT InterfaceID, UnPluggable, Caption, Status, InterfaceAlias FROM Orion.NPM.Interfaces WHERE Status = 2 AND UnPluggable = 'false' AND NodeID = {node_choice}"