I want to update the Device Template of CLI Device Template of a NCM node. Is there any way using python sdk?
I am able to configure all the other parameters while adding a ncm node but not able to do so using python.
I want to update the Device Template of CLI Device Template of a NCM node. Is there any way using python sdk?
I am able to configure all the other parameters while adding a ncm node but not able to do so using python.
enzamambashar, so you have to do a create to "assign" a device template. Here's a link that demonstrates how to do a create within Python, and the following script is a PowerShell script specifically written to assign device templates to a node. This should be enough to get you started, if you need any other assistance let me know.
$query = "SELECT TOP 1 ID FROM Cli.DeviceTemplates WHERE TemplateName = '$TemplateName'" $Script:TemplateID = Get-SwisData $SwisConnect $query $TemplateID = Get-SwisData $Swis $query #Insert query to translate template Name to TemplateID Here if($TemplateID){}else{$Exception = New-Object System.Exception ("Unable to locate a device template based on the template name provided.");throw $Exception} $CliTemplate = @{ TemplateId = $TemplateID NodeID = $NodeID } New-SwisObject -swisconnection $swis -EntityType 'Cli.DeviceTemplatesNodes' -Properties $CliTemplate $result= Get-SwisData $swis "Select top 1 Nodeid from cli.devicetemplatesNodes where nodeid = '$nodeid'" if ($result.count -eq 1) { Write-Output "Success" }
Thank you for your reply, Yes I am creating the nodes using python. Is that possible to translate this code to python? i am not good a PowerShell scripts.
enzamambashar, im not good at python but i'd imagine that the meat of what you'd need to get this to work is below.
props = { 'TemplateID': <DESIRED TEMPLATE ID>, 'NodeID': <DESIRED NODE ID>, } results = swis.create('Cli.DeviceTemplatesNodes', **props)
enzamambashar, im not good at python but i'd imagine that the meat of what you'd need to get this to work is below.
props = { 'TemplateID': <DESIRED TEMPLATE ID>, 'NodeID': <DESIRED NODE ID>, } results = swis.create('Cli.DeviceTemplatesNodes', **props)
Thank you so much. That makes sense now. I will let you know the update after testing.
Thank you. It worked.
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.