3 Replies Latest reply on Nov 8, 2013 9:37 AM by hilbertd21

    How to change multiple IP's in Orion without changing hostname or custom properties

    hilbertd21

      Working with an existing implementation of Orion, where devices are largely individually added/removed/updated. I have a requirement as part of a data center move, to update new IP addresses for about 320 of our devices already in Orion, without changing hostname, custom property information, or resource selection (volumes selected/interfaces/hardware health/ect). Some are SNMP, some are ICMP only. The cutover for when the devices IP addresses will change is over a 48 hour period, so manually updating 320 devices after those device IP's are updated, then manually rediscovering them isn't efficient and will take too long. Any suggestions or recommendations on how best to do an import on the IP's for these while retaining custom property details and resource selections. We are not running a regularly scheduled discovery on our devices.

        • Re: How to change multiple IP's in Orion without changing hostname or custom properties
          RichardLetts

          I'd write a small perl or powershell script using the API to update the value

           

          Here is an (untested) perl version, takes an input file of nodeid and ip addresses (note the use of ip2guid to set that as well otherwise things will not work as you expect )

           

          #!/usr/bin/perl
          
          use SOAP::Transport::HTTP;
          use XML::Simple;
          use SW::Orion;
          use SW::InformationService;
          
          use strict;
          
          my $nodeid;
          my $ip;
          
          my $hostname = 'hostname'; # fill in a hostname
          my $username = 'username';
          my $password = 'password';
          my $endpoint = "https://$hostname:17778/SolarWinds/InformationService/OrionBasic";
          
          my $xs = XML::Simple->new();
          my $swis = SW::InformationService->new();
          $swis->outputxml('true');
          $swis->proxy($endpoint);
          $swis->proxy->http_request->authorization_basic($username, $password);
          
          while ( <> ) {
             my ($nodeid, $ip) = split;
             &propUpdate( $nodeid,'IPAddress', $ip);
             &propUpdate( $nodeid,'IPAddressguid', &ip2guid($ip));
          
          }
          
          exit 0;
          ############################
          
          sub propUpdate {
             my $nodeID=shift;
             my $prop=shift;
             my $newprop=shift;
          
             print "$nodeID, {$prop=>$newprop}\n";
             my $response = $swis->Update("swis://localhost/Orion/Orion.Nodes/NodeID=$nodeID",  {$prop=>$newprop});
          
           return if ($response eq '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><log xmlns="http://schemas.solarwinds.com/2007/08/informationservice"/></s:Header><s:Body><UpdateResponse xmlns="http://schemas.solarwinds.com/2007/08/informationservice"/></s:Body></s:Envelope>');
             print $response;
          }
          
          

          /RjL

           

          perl api

          1 of 1 people found this helpful