4 Replies Latest reply on Aug 31, 2015 3:46 PM by tdanner

    bulk mgmt ip node change

    dragec

      I need to change mgmt ip of my nodes for 700 nodes. Each node has two IPs, and I need to change mgmt ip from first to second one. So ... how to do it using SWQL?

        • Re: bulk mgmt ip node change
          tdanner

          You can change the IP address Orion uses to monitor a node by updating the "IP" property. In PowerShell, that looks like this:

           

          $swis = Connect-Swis # your connection details here

          $uri = 'swis://server/Orion/Orion.Nodes/NodeID=1'  # Get the node's Uri from somewhere, maybe a query

          $newip = '10.1.2.3'  # get the new monitoring IP from somewhere

          Set-SwisObject $swis $uri @{IP=$newip}

           

          If you want to use Orion's data to find which IP address to use, you can query Orion.NodeIPAddresses to see what IPs a node has.

            • Re: bulk mgmt ip node change
              dragec

              so .... will this work?

               

              Add-PSSnapin SwisSnapin

              Set-ExecutionPolicy RemoteSigned

              $creds = Get-Credential

              $swis = connect-swis -Credential $creds -Hostname host

              swis1 = $swis

              get-SwisData $swis "SELECT N.uri, I.IPAddress FROM Orion.NodeIPAddresses I 

              INNER JOIN Orion.Nodes As N  on I.nodeid = N.nodeid

              WHERE N.Caption like 'some%' AND I.IPAddress not like '5.5%''"

               

              foreach ($node in $swis){

               

                 Set-SwisObject $swis1 $node.uri @{IP=$node.IPAddress}

              }

                • Re: bulk mgmt ip node change
                  dragec

                  hmm ... this should be better code

                   

                  Add-PSSnapin SwisSnapin

                  Set-ExecutionPolicy RemoteSigned

                  $creds = Get-Credential

                  $swis = connect-swis -Credential $creds -Hostname host

                  swis1 = $swis

                  $temp = get-SwisData $swis "SELECT N.uri, I.IPAddress FROM Orion.NodeIPAddresses I 

                  INNER JOIN Orion.Nodes As N  on I.nodeid = N.nodeid

                  WHERE N.Caption like 'some%' AND I.IPAddress not like '5.5%''"

                   

                  foreach ($n in $temp){

                   

                     Set-SwisObject $swis1 $n.uri @{IP=$n.IPAddress}

                  }