This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Silence Group of Nodes

Hello!

  I have a number of servers in various locations that get updates on a regular basis.  When this happens, the application monitors we have set up go haywire and send out all sorts of unnecessary alerts.  The person who does these updates is not someone who has access to Solarwinds, and therefore he does not silence the nodes while he does his updates.  We would like to come up with an easy solution for this guy to just click something and silence these alerts for the hour or so it takes him to push out the updates and then set them back to alerting.  I have been told that this is not something that we can do through existing methods on Solarwinds, but that I should use the SDK to accomplish our goal.  Has anyone done anything similar?  Is there a good starting point for learning about the SDK?  I'm finding the documentation a bit thin.

Thanks

  • Does your server engineer plan for these updates somewhere?

    We put in an integration between our change management system where the assets dates and times are pushed into Solarwinds node table to unmanage them.

  • He doesn't have a plan for it, so far as I can tell. He just does it when his schedule allows, which is why we'd like to have him do the silencing.

  • If you want to whip up some sort of app or script for this guy to unmanage some nodes, that is pretty straightforward with the Orion API. There's an example in PowerShell here: https://github.com/solarwinds/OrionSDK/wiki/PowerShell#invoke-swisverb. If you want a sample in a different language, let me know.

  • A powershell script can easily ask your engineer for the the start and end times then for the path to a list file as inputs. If this file is a list of server names or IP's then you could execute an unmanage sdk call.

    thwack.solarwinds.com/.../224972

    Bonus points for making it a function.

  • Yes! These have me pointed in the right direction. Will need to tweak it a bit to specify our particular groups, and we use a custom property to silence nodes rather than completely unmanaging them, but now I’m definitely on the right track. Thank you tdanner and bluefunelemental for the help.

  • I'm starting to get the hang of this, and was able to run a script for a single node.  I am running into a small problem when I try to loop through a group of nodes, though.  Here's what I've written:

    Add-PSSnapin SwisSnapin

    $creds = Get-Credential

    $swis = Connect-Swis -Hostname ourserver -Credential $creds

    $now = [DateTime]::UtcNow

    $later = $now.AddMinutes(1)

    $groupid = Get-SwisData $swis "SELECT ContainerID FROM Orion.ContainerMembers WHERE Name LIKE 'test'"

    $nodeid = @(Get-SwisData $swis "SELECT MemberPrimaryID FROM Orion.ContainerMembers WHERE ContainerID LIKE '$groupid'");

    foreach ($nodeid in $groupid) {

      Invoke-SwisVerb $swis Orion.Nodes Unmanage @("N: $nodeid ", $now ,$later , "false")

    }

    When I run it, I get the following error:

    Invoke-SwisVerb : no viable alternative at input '<EOF>' in Where clause

    At C:\unmanage_group.ps1:11 char:17

    +     Invoke-SwisVerb <<<<  $swis Orion.Nodes Unmanage @("N: $nodeid ", $now ,$later , "false")

        + CategoryInfo          : InvalidOperation: (:) [Invoke-SwisVerb], FaultException`1

        + FullyQualifiedErrorId : SwisError,SwisPowerShell.InvokeSwisVerb

    Does anyone see where I've gone wrong?

    Thanks

  • Try for each $node in $nodeid.

    As it is this is only pulling the one group ID on the loop

  • Hurray!  That worked great.  I have one last obstacle. 

    I used Invoke-SwisVerb $swis Orion.Nodes Unmanage @("N: $nodeid ", $now ,$later , "false") in the example above.  Is there a SwisVerb that could be used to change a custom property instead?  From Orion.NodesCustomProperties we have a property set up called MonitoringState, which can be set to Alerting or Silenced.  Ideally, I'd like to set up the script to change this property rather than unmanage the entire node.

  • To set a custom property:

    $uri = Get-SwisData $swis "SELECT Uri FROM Orion.NodesCustomProperties WHERE NodeID=@nodeid" @{nodeid=$nodeid}

    Set-SwisObject $swis $uri @{MonitoringState="Silenced"}