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}
}
SolarWinds solutions are rooted in our deep connection to our user base in the THWACK® online community. More than 195,000 members are here to solve problems, share technology and best practices, and directly contribute to our product development process.