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.

Error Updating Properties and Custom Properties of Nodes

Greetings,

I am currently trying to automate the maintenance of the SWQL database using the ORION SDK, SwisSnappin and PowerORION Module for Powershell.

I have been successful in deleting and adding nodes based on data imported from a .csv file.

I keep getting the following error when trying to update node properties/custom properties using the Set-SwisObject cmdlet.

Set-SwisObject : Invalid column name 'SNMPV3Username'.

Invalid column name 'SNMPV3PrivMethod'.

Invalid column name 'SNMPV3PrivKey'.

Invalid column name 'SNMPV3AuthMethod'.

Invalid column name 'SNMPV3AuthKey'.

At C:\Users\welfakir\Documents\Powershell_Scripts\Add-Node\Update-Node.ps1:222 char:102

+ ...  @{IP=$node.IP} | Set-SwisObject -SwisConnection $swis -Properties @{

+                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidOperation: (:) [Set-SwisObject], FaultException`1

    + FullyQualifiedErrorId : SwisError,SwisPowerShell.SetSwisObject

I am running SWQL Studio 2.2.54.0, NPM 12.1, SAM 6.4 (Both Trial as I cannot test on a production server) and PowerShell V5.

On another note, when I create nodes I am using the sample found on git hub : OrionSDK/CRUD.AddNode.ps1 at master · solarwinds/OrionSDK · GitHub

Are there other properties/pollers that need to be added upon creation for successful monitoring?

Thanks,

Will.

  • Which properties are you updating when you receive this error?

    There is a bug in the product and update of some properties (e.g. community) throw similar exception.

  • I am trying to update these Default and Custom Properties.

    Default:

    EngineID

    Caption

    Location

    ObjectSubType

    SNMPVersion

    Custom:

    ServerFunction

    Environment

    DomainName

    Thanks.

  • I am also getting the following error when calling new-swisobject:

    New-SwisObject : Object reference not set to an instance of an object.

    At line:1 char:28

    + ... ewNodeUri = New-SwisObject $swis -EntityType "Orion.Nodes" -Propertie ...

    +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        + CategoryInfo          : NotSpecified: (:) [New-SwisObject], NullReferenceException

        + FullyQualifiedErrorId : System.NullReferenceException,SwisPowerShell.NewSwisObject

    Thanks.

  • Just a guess but try updating only the Custom ones and not the Default ones and see if you get an error. Some of the custom ones appear to be 'locked down' in custom property editor. Such as Location which is typically derived from SNMP.

  • Unfortunately update of properties

    ObjectSubType

    SNMPVersion

    leads to error, this is product bug and we track it under ticket CORE-6263.

    Until the bug will be fixed, it is not possible to update these properties using SDK API :-(.

    Try to remove properties ObjectSubType and SNMPVersion from update call, you should be able to update other properties (caption, location, custom properties).

    Please be aware that you need to use special URI when updating custom properties.

    Example:

    swis.update('swis://localhost/Orion/Orion.Nodes/NodeID=18/CustomProperties', Environment='PROD')

  • Which properties are you setting for new node?

    Could you please paste important part of your script here?

  • FYI I am importing Props from a .csv file and running a for each where

    foreach($node in $csv)

    {

    $newNodeProps = @{

                    nodeID = $node.nodeID;

                   #NODEID was the issue

                    IPAddress = $node.IP; #Imported Ip Address from CSV file.

                    EngineID = $node.EngineID; #Default EngineID

                    Caption = $node.Caption; #Imported Caption from CSV file.

                    #Location = $node.Location;

                    # SNMP v2 specific

                    ObjectSubType = $node.ObjectSubType;

                    SNMPVersion = $node.SNMPVersion;

         $NewNodeUri = New-SwisObject $swis -EntityType "Orion.Nodes" -Properties $NewNodeProps

          $nodeProps = Get-SwisObject $swis -Uri $newNodeUri

       

                    # register specific pollers for the node

                    Write-Verbose 'Registering Pollers'

                    $poller = @{

                    NetObject="N:"+$nodeProps["NodeID"];

                    NetObjectType="N";

                    NetObjectID=$nodeProps["NodeID"];

                    }#$poller

                    # Status

                    $poller["PollerType"]="N.Status.ICMP.Native";

                    $pollerUri = New-SwisObject $swis -EntityType "Orion.Pollers" -Properties $poller

                    # Response time

                    $poller["PollerType"]="N.ResponseTime.ICMP.Native";

                    $pollerUri = New-SwisObject $swis -EntityType "Orion.Pollers" -Properties $poller

                    # Details

                    $poller["PollerType"]="N.Details.SNMP.Generic";

                    $pollerUri = New-SwisObject $swis -EntityType "Orion.Pollers" -Properties $poller

                    # Uptime

                    $poller["PollerType"]="N.Uptime.SNMP.Generic";

                    $pollerUri = New-SwisObject $swis -EntityType "Orion.Pollers" -Properties $poller

                    # CPU

                    $poller["PollerType"]="N.Cpu.SNMP.CiscoGen3";

                    $pollerUri = New-SwisObject $swis -EntityType "Orion.Pollers" -Properties $poller

                    # Memory

                    $poller["PollerType"]="N.Memory.SNMP.CiscoGen3";

                    $pollerUri = New-SwisObject $swis -EntityType "Orion.Pollers" -Properties $poller

                      

                   $customProps = @{

                        ServerFunction = $node.ServerFunction;

                        Environment = $node.EVNT;

                        DomainName = $node.DomainName;

            

                   Get-SwisData $swis "SELECT Nodes.CustomProperties.Uri FROM Orion.Nodes where IP = @IP" @{IP = $node.IP} `

                        |Set-SwisObject $swis  -Properties $customProps -erroraction continue

    }#foreach($node in $csv)

  • I've spent some time working on something similar and although this doesn't include what you mentioned in your example you can probably take this and run with it. This script applies to custom properties, although I suppose you could tweak this to apply to generic properties. I have provided two different ways of doing this, so look at the script, choose which method best fits your needs and edit the script accordingly.

    #Intialize Swis-Snapin

    Add-PSSNapin SwisSnapin 

         

    # Connect to SWIS

    $hostname = "Insert Orion IP"

    $username = "Insert Username"

    $password = "Insert Password" or you can use get-content Insert Path to Password Text Document | convertto-securestring 

    $cred = New-Object -typename System.Management.Automation.PSCredential -argumentlist $username, $password 

    $swis = Connect-Swis -host $hostname -cred $cred

    # This Next Section is Optional if You are Using Traditional SELECT Statements

    $filename = "Insert Path to Txt Doc with IP Addresses"

    $ips = Get-Content $filename

    # prepare a custom property value

    $customProps = @{ 

      Example 1=" "

      Example 2=" "

         

    # Option 1 - If you are using the get-content $filename method

    $uris = Get-SwisData $swis "SELECT Nodes.CustomProperties.Uri FROM Orion.Nodes WHERE IP IN @ips" @{ ips = $ips }

    $uris | Set-SwisObject $swis -Properties $customProps

    # Option 2 - If you are using a traditional SELECT statement

    $uris = Get-SwisData $swis "SELECT Nodes.CustomProperties.Uri FROM Orion.Nodes WHERE IP_Address LIKE 'Insert IP Address(s) Here'"

    $uris | Set-SwisObject $swis -Properties $customProps

  • I can see two bugs in script:

    - nodeId should not be set when node is created, nodeId value will be set by Orion

    - setting of custom properties should be done in following way: Set-SwisObject $swis  -Uri ($NewNodeUri + "/CustomProperties") -Properties $customProps