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.

Set Device Template with API/SDK

I'm brand new to Solarwinds and NCM.

My task is to build a powershell script that deploys and configures Palo Alto Firewalls (virtual machines) and then add to NCM as a node.

I have been able to get most of this done, and I found scripts on GitHub to add nodes to Solarwinds.

In the Solarwinds GUI under Edit Node, there is a YES/NO toggle for "Manage node(s) with NCM". I manage to set that to YES with the API

However, below that there are sections for Connection Profile, Communication and CLI Device Template.

Device Template is set to Auto Determine.

I want to set that to "Palo Alto Firewall" with the API. How do I do that?

Same for Connection Profile settings and Communication settings.

Also How do I GET all those properties, assuming I know the nodeID.

thanks

Roger

  • This is how far I got:

    Get-SwisData $swis "SELECT ID,TemplateName FROM Cli.DeviceTemplates WHERE TemplateName = 'Palo Alto Firewall'"

    ID TemplateName

    -- ------------

    77 Palo Alto Firewall

    So the ID is 77.

    $newNodeID = "1823"

    $paTemplateID = '77'

    $templateProps = @{

    TemplateID = $paTemplateID;

    }

    $URI = "swis://localhost/Orion/Cli.DeviceTemplatesNodes/NodeId=$newNodeID"

    Set-SwisObject $swis -Uri $URI -Properties $templateProps

    However this Set-swisObject fails to do anything for node 1823. I even tried putting all the properties in $templateprops.

    When I look at one I set manually, node 1817, I see this:

    Get-SwisData $swis "SELECT TemplateID,NodeID,DisplayName,Description,InstanceType,Uri,InstancesiteID FROM Cli.DeviceTemplatesNodes WHERE nodeid='1817'"

    TemplateID     : 77

    NodeID         : 1817

    DisplayName    :

    Description    :

    InstanceType   : Cli.DeviceTemplatesNodes

    Uri            : swis://myinstance/Orion/Cli.DeviceTemplatesNodes/NodeId=1817

    InstancesiteID : 0

    thanks

  • So I discovered that if the Device Template is set to Auto Determine, then running "Set-SwisObject $swis -Uri $URI -Properties $templateProps" does nothing.

    But if I manually set the device template to something, then this command does work. I can use the command to set it to any template.

    I need to be able to set device template from "Auto Determine" to the one I want, which is ID 77.

    thanks

  • All the while I've been posting to this thread, it hasn't even been approved for posting.

    "Please note: your content was added successfully, but a moderator needs to approve it before it can be posted."

    Anyway, in case it ever does get approved. I solved this issue. Instead of set-swisobject, I need to create the object first with new-swisobject.

    $newNodeID = "1823"

    $paTemplateID = '77'

    $templateProps = @{

    TemplateID = $paTemplateID;

    NodeID = $newNodeID;

    }

    New-SwisObject $swis -Entitytype  'Cli.DeviceTemplatesNodes' -Properties $templateProps

    then to check that it was created:

    PowerCLI C:\kits> Get-SwisData $swis "SELECT TemplateID,NodeID,DisplayName,Description,InstanceType,Uri,InstancesiteID FROM Cli.DeviceTemplatesNodes WHERE nodeid='1823'"

    TemplateID     : 77

    NodeID         : 1823

    DisplayName    :

    Description    :

    InstanceType   : Cli.DeviceTemplatesNodes

    Uri            : swis://localhost/Orion/Cli.DeviceTemplatesNodes/NodeId=1823

    InstancesiteID : 0