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.

bulk mgmt ip node change

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?

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

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

    }

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

    }

  • That looks like it could work, but I would strongly recommend previewing the output of that query to make sure it is what you expect before committing the changes with the Set-SwisObject calls.