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

Parents
  • 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

Reply Children
  • 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"}