2 Replies Latest reply on Feb 13, 2015 9:50 AM by vozura

    Update node properties

    vozura

      Hi,

       

      I'm in the middle of a Solarwinds migration. Trying to combine 3 solarwinds environments (DBs) into a single environment (DB). I have written a powershell script to synchronize the nodes, properties, custom properties, interfaces, pollers and NCM properties. The script checks if a node already exists or not. If it does it should only update the properties, custom properties, interfaces, pollers and NCM properties, but for some reason it kind of recreates the node. The NodeID is left alone but the interfaces are deleted and re-added (new InterfaceIDs). This is the command I use for updating the node properties and it is definitely causing this side-effect:

       

      Set-SwisObject $target $targetNodeUri -Properties $targetNodeProps


      Is there any way to just update the properties of a node without removing the interfaces? Maybe there is a property that I need to exclude or use a different command? These are the properties I am setting on an existing node:

       

      AgentPort, Allow64BitCounters, BufferBgMissThisHour, BufferBgMissToday, BufferHgMissThisHour, BufferHgMissToday, BufferLgMissThisHour,BufferLgMissToday, BufferMdMissThisHour,

      BufferMdMissToday, BufferNoMemThisHour, BufferNoMemToday, BufferSmMissThisHour, BufferSmMissToday,Caption, ChildStatus, CMTS, Community, Contact, DNS, DynamicIP, External,

      EntityType, GroupStatus, IOSImage, IOSVersion, IPAddress, IPAddressGUID,IPAddressType, LastSystemUpTimePollUtc, Location, MachineType, NodeDescription, ObjectSubType, PollInterval,

      RediscoveryInterval, Severity, SNMPVersion,StatCollection, Status, StatusDescription, StatusLED, SysName, SysObjectID, TotalMemory, Vendor, VendorIcon, RWCommunity,

      Nodes.SNMPv3Credentials.Username AS SNMPV3Username, Nodes.SNMPv3Credentials.Context AS SNMPV3Context, Nodes.SNMPv3Credentials.PrivacyMethod AS SNMPV3PrivMethod,

      Nodes.SNMPv3Credentials.PrivacyKey AS SNMPV3PrivKey, Nodes.SNMPv3Credentials.PrivacyKeyIsPassword AS SNMPV3PrivKeyIsPwd,

      Nodes.SNMPv3Credentials.AuthenticationMethod AS SNMPV3AuthMethod, Nodes.SNMPv3Credentials.AuthenticationKey AS SNMPV3AuthKey,

      Nodes.SNMPv3Credentials.AuthenticationKeyIsPassword AS SNMPV3AuthKeyIsPwd, Nodes.SNMPv3Credentials.RWUsername AS RWSNMPV3Username,

      Nodes.SNMPv3Credentials.RWContext AS RWSNMPV3Context, Nodes.SNMPv3Credentials.RWPrivacyMethod AS RWSNMPV3PrivMethod, Nodes.SNMPv3Credentials.RWPrivacyKey AS RWSNMPV3PrivKey,

      Nodes.SNMPv3Credentials.RWPrivacyKeyIsPassword AS RWSNMPV3PrivKeyIsPwd, Nodes.SNMPv3Credentials.RWAuthenticationMethod AS RWSNMPV3AuthMethod,

      Nodes.SNMPv3Credentials.RWAuthenticationKey AS RWSNMPV3AuthKey, Nodes.SNMPv3Credentials.RWAuthenticationKeyIsPassword AS RWSNMPV3AuthKeyIsPwd

       

      Regards,

      Vladimir

        • Re: Update node properties
          tdanner

          That's definitely not expected behavior. Here's something that would help debug this: diff the properties of the target node before and after the update. Like this:

           

          function DiffProps($oldProps, $newProps) {

              foreach ($key in $oldProps.Keys) {

                  $old = $oldProps[$key]

                  $new = $newProps[$key]

                  if ($old -ne $new) {

                      "$key changed from [$old] to [$new]"

                  }

              }

          }

           

          $targetNodeInitialProps = Get-SwisObject $target $targetNodeUri

          DiffProps $targetNodeInitialProps $targetNodeProps

           

          That will output a line for each property that is actually different.

          1 of 1 people found this helpful
            • Re: Update node properties
              vozura

              I’ve actually used your function and adjusted it to check for differences between the properties on the source and target node. This way I’m only applying the differences instead of every property. It is now working for me.

               

              However, it's still strange that setting all of the above mentioned properties actually re-adds the node preserving only the NodeID.

               

              Thanks for your help.