Is it possible to automate the creation of applications and components with the Orion API ?

Hey,

I have a lot of monitors to set up since I'm migrating everything from old software to Solarwinds and I'd like to know if it's possible to automate this with a PS script that would retrieve the old monitors to create and set them up in Solarwinds.

I watched the orion API videos on YT but it's talk about the SWQL Studio not really the API.

Parents
  • Looks like it's possible if you're willing to do the leg work.

    SWQL Studio can help you understand the API. Perfect example, looking at the Application entity in SWIS via SWQL Studio (Orion.APM.Application), I'm able to see that the Orion.APM.Application entity has a "CreateApplication" verb attached to it.

    Expanding on the verb, looks like you would need to supply a number of variables to do so.

    You'll want to get the SwisPowershell module, it's installed as part of the OrionSDK with SWQL Studio but can find it separately if needed on powershell gallery: https://www.powershellgallery.com/packages/SwisPowerShell/ 

    You can find SWQL Studio here: https://github.com/solarwinds/OrionSDK/releases 

    I haven't tested this, but this should be how to get an application created via the verb in powershell. I'm using dummy values, so you'll need to ensure appropriate values for your nodeId, applicationTemplateId, and credentialSetId.

    Import-Module -Name "SwisPowerShell"
    
    $swis = Connect-Swis -Trusted -Hostname "mySolarWindsServer"
    
    $nodeId = 20
    $applicationTemplateId = 900
    $credentialSetId = 2
    $skipIfDuplicate = $true
    
    $xmlconfig = @"
        <ArrayOfint xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
            <int>$nodeId</int>
        </ArrayOfint>
    "@
    
    $config = ([xml]$xmlconfig).DocumentElement
    
    Invoke-SwisVerb -SwisConnection $swis -EntityName 'Orion.APM.Application' -Verb 'CreateApplication' -Arguments @($nodeId, $applicationTemplateId, $credentialSetId, $skipIfDuplicate, $config)

    Good luck and hope this helps.

Reply
  • Looks like it's possible if you're willing to do the leg work.

    SWQL Studio can help you understand the API. Perfect example, looking at the Application entity in SWIS via SWQL Studio (Orion.APM.Application), I'm able to see that the Orion.APM.Application entity has a "CreateApplication" verb attached to it.

    Expanding on the verb, looks like you would need to supply a number of variables to do so.

    You'll want to get the SwisPowershell module, it's installed as part of the OrionSDK with SWQL Studio but can find it separately if needed on powershell gallery: https://www.powershellgallery.com/packages/SwisPowerShell/ 

    You can find SWQL Studio here: https://github.com/solarwinds/OrionSDK/releases 

    I haven't tested this, but this should be how to get an application created via the verb in powershell. I'm using dummy values, so you'll need to ensure appropriate values for your nodeId, applicationTemplateId, and credentialSetId.

    Import-Module -Name "SwisPowerShell"
    
    $swis = Connect-Swis -Trusted -Hostname "mySolarWindsServer"
    
    $nodeId = 20
    $applicationTemplateId = 900
    $credentialSetId = 2
    $skipIfDuplicate = $true
    
    $xmlconfig = @"
        <ArrayOfint xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
            <int>$nodeId</int>
        </ArrayOfint>
    "@
    
    $config = ([xml]$xmlconfig).DocumentElement
    
    Invoke-SwisVerb -SwisConnection $swis -EntityName 'Orion.APM.Application' -Verb 'CreateApplication' -Arguments @($nodeId, $applicationTemplateId, $credentialSetId, $skipIfDuplicate, $config)

    Good luck and hope this helps.

Children
No Data