1 of 1 people found this helpful
Yes. You can use the Orion.Nodes.Unmanage verb to do this. In PowerShell it looks like this:
$swis = Connect-Swis ... # your connection details here $nodeId = 123 # Get the NodeID from somewhere, possibly a query $start = [DateTime]::UtcNow $end = $start.AddMinutes(30) Invoke-SwisVerb $swis Orion.Nodes Unmanage @($nodeId, $start, $end, $false)
1 of 1 people found this helpful
If it helps...and it probably doesn't....
For this part: "$nodeId = 123 # Get the NodeID from somewhere, possibly a query"
I'm pulling the NodeId from a query in perl using the SDK. Here's what I chose to do, with the perl-ese ripped out
The query I'm using is:
Caption = '<the node caption in Orion>'
I chose "Caption" and not some other node property relating to the host name to get the ID because of many reasons:
1. Sometimes I cannot pull the host name from the device (like a ping only device)
2. Sometimes people will put the "real name" in the device, then *everyone* else refers to it as another, more proper name.
3. Sometimes the real name the device reports is not the name in DNS for the device (see #2)
4. Orion puts the "real name" it can pull from the device in the Caption field by default, so it's almost always the correct value.
5. The Caption can be easily changed
If you could get away with using the IP address of the node you'd probably be better off though.
This SWIS query returns the data in an XML format. I'm parsing it using these regex's (yeah, I know I probably should use an XML parser or something. If you're using Powershell like tdanner is using above you have decent XML parsing as a built in. Perl is a little more tricky to choose a good parser module)
NodeID => /\<c0\>(\S+?)\<\/c0\>/g
Caption => /\<c1\>(\S+?)\<\/c1\>/g
Something to note: Since Caption is used, it's possible to return more than 1 row of data from the query. The regex above returns multiple matches if there are multiple rows because of the "/g" which means "global match"
If you are working in Perl, you may find it easier to use the REST endpoint (REST · solarwinds/OrionSDK Wiki · GitHub) and so you can receive JSON and avoid dealing with the SOAP/XML stuff.
For PowerShell, we provide cmdlets that handle all of the XML stuff for you. The query cmdlet (Get-SwisData) returns a collection of objects (one per row returned) with properties that correspond to the columns of your query.
That's good to know. Thanks!
Thanks, I am sure I am going to have to filter my results based on some kind of search criteria so this is helpful as well.
Thanks for the quick response. This looks like just what I needed.
I have a slight correction to this answer.
When I first tried to test this script operation, it kept failing with the following message:
'Invoke-SwisVerb : Only nodes can be unmanaged through this interface. 123 does not refer to a node.'
I had gotten the real ID from a query and confirmed that when I looked up that node in the web interface by the caption name it had the same ID. So I was confused as to why I was getting this message.
Then I looked at the query string of the Node details page and I noticed it ended with ?NetObject=N:123.
So I tried the script again using the string 'N:123' instead of just 123. This worked.
So here are the instructions that worked for me:
- $swis = Connect-Swis -HostName 'myhost' -Trusted # The Trusted switch allows you to connect using the current users windows credentials
- $nodeId = 'N:123' # Where 123 is the node ID
- $start = [DateTime]::UtcNow
- $end = $start.AddMinutes(30)
- Invoke-SwisVerb -SwisConnection $swis -EntityName Orion.Nodes -Verb Unmanage -Arguments @($nodeId, $start, $end, $false)
Would it fill your need for fewer alerts to use the Alert Suppression option based on Groups and Dependencies?
I put the resources being monitored by NPM into a group and build a dependency for that group, and tie it to one resource.
Example: I have a site with 20 switches and a router, and I monitor the state of all the devices with NPM. I know there's no need to get 21 alerts when the WAN or router fails. So I built a dependency in NPM, created a group with all the switches in it, and defined that group as being dependent on the router.
This way I get only one alert that the router is down.
The unreachable devices go yellow, then red, then to an X icon when they become unavailable, and I only get one notification.
But I can still see which devices are unavailable through the dependency since they show as down with an X through their icons.
Better still, if only some switches come back up (let's say their power stayed down when the router's power was restored) their alerts are no longer suppressed; I see them as down and I get alerts for them. That keeps me from assuming everything came back up once the router was available again.
If you'd like more detail, with screen shots on how to build this, please let me know.