3 Replies Latest reply on May 8, 2017 1:27 PM by nick_scott

    Node Management

    nick_scott

      We have a large environment where over time certain polling engines will aquire more nodes than others.  In the past I have monthly/quartly re-assigned these nodes to their correct polling engines manually via GUI.  Because we use SolarWinds for asset inventory the scan jobs must be up to date.  I only have polling engines scan networks where that polling engines devices live.  This way I don't get a bunch of "changed" notices via discovery.  From my understanding a polling engine during a discovery will think it found new/changed devices even if that device is managed by another polling engine. 

       

      The objective of the script is to place nodes based on their IP to a specific polling engine.  at the end of the script I added a clause that excludes devices who are already on the correct polling engine.  I do not want the app to set the EngineId if already correct (And EngineID <> 2)

       

      If I run the script with the two arguments below (WHERE ip_address LIKE '10.22.%' AND EngineId <> '2'" ) The script does what its suppose to do.  It  only applies the engine change if the queried node is not already on the specified engine.

       

      $uris = Get-SwisData $swis "SELECT uri FROM Orion.Nodes WHERE ip_address LIKE '10.22.%' AND EngineId <> '2'"

       

      As soon as I add another argument such as another IP filter, the script ignores the last argument EngineId <> 2

       

      $uris = Get-SwisData $swis "SELECT uri FROM Orion.Nodes WHERE ip_address LIKE '10.22.%' OR ip_address LIKE '10.210.%' AND EngineId <> '2'"

       

      I'm thinking I am missing a small piece of syntax, any help is greatly appreciated.   As always, a big thanks to the SDK veterans, you really do make all this possible.  Thanks!

       

      Full script below (security removed)

       

      $ErrorActionPreference = 'Stop'

      #Add the snapin
      Add-PSSnapin SwisSnapin

      #create a connection to solarwinds

      #swis = Connect-Swis -Hostanme $hostname -Trusted
      $swis = Connect-Swis -Hostname $hostname -Username $username -Password $password

      $targetEngineId =@{ EngineId = 3; }

      $uris = Get-SwisData $swis "SELECT uri FROM Orion.Nodes WHERE ip_address LIKE '10.22.%' OR ip_address LIKE '10.210.%' AND EngineId <> '2'"

      $uris | Set-SwisObject $swis -properties $targetEngineId

       

       

       

        • Re: Node Management
          tdanner

          You just need some parenthesis in the WHERE clause. If EngineID 2 is supposed to handle 10.22.0.0/16 and 10.210.0.0/16, then you want a WHERE clause like this:

           

          WHERE (ip_address LIKE '10.22.%' OR ip_address LIKE '10.210.%') AND EngineId <> '2'

          1 of 1 people found this helpful
          • Re: Node Management
            nick_scott

            Is there a way to reference another polling engine ?  As an example, I don't want to select any devices where its polling engines are either 2 or 8

             

            WHERE (ip_address LIKE '10.22.%' OR ip_address LIKE '10.210.%') AND EngineId <> 2 OR EngineId <> 8

             

            When I added this additional layer, the query seems to forget everything about the IP filtering  and returns all devices not on the two specified engines.