Skip to content

SAM Application Monitoring Templates

Pawel Kedzior edited this page Jul 16, 2019 · 28 revisions

Application Monitoring Templates

SolarWinds Server and Application Monitor (SAM) includes a number of Application Monitoring Templates. Templates can be exported and imported to/from a file and customized.

How to list templates

In order to list currently existing Application Monitoring Template, use SELECT ... FROM Orion.APM.ApplicationTemplate query. See Orion.APM.ApplicationTemplate Schema Reference for all the available properties. The following snippet prints a list of all the templates to the console:

$templates = Get-SwisData -SwisConnection $swis -Query "SELECT ApplicationTemplateID, Name, Uri FROM Orion.APM.ApplicationTemplate"
$templates | ForEach-Object { Write-Host "ID:" $_.ApplicationTemplateID; Write-Host "Name: " $_.Name; Write-Host "Uri: " $_.Uri; Write-Host }

How to import a template

Orion SDK has ImportTemplate verb on Orion.APM.ApplicationTemplate entity which allows for automation of the process of importing Application Monitoring Templates to SAM. For example, in order to import a template from MyTemplate.apm-template file invoke the following PowerShell code:

# Load the template to a variable
$template = (Get-Content -Path ".\MyTemplate.apm-template" | Out-String)
# Import template
$result = Invoke-SwisVerb -Swis $swis Orion.APM.ApplicationTemplate ImportTemplate @($template)
$templateId = $result.InnerText
Write-Host "Imported template Id: $templateId"

How to export a template

Similarly, when you know the id of a template, you can export it to a file. The following code exports template of id 1 to MyTemplate.apm-template.

$templateId = 1
# Export the template to a variable
$result = Invoke-SwisVerb -Swis $swis Orion.APM.ApplicationTemplate ExportTemplate @($templateId)
$exportedTemplate = $res.InnerText
# Save the template to a file
$exportedTemplate | Out-File ".\MyTemplate.apm-template"

How to change the name of a template

In order to change the name of a template, you need Uri of the template and then call Set-SwisObject. Uri can be constructed as in the example below (replace hostname with your Orion name) or found by selecting Uri column of ApplicationTemplate entity (see the example above).

$uri = "swis://<hostname>/Orion/Orion.APM.ApplicationTemplate/ApplicationTemplateID=$templateId"
$properties = @{
    Name="My new template";
}
Set-SwisObject $swis -Uri $uri -Properties $properties

How to delete a template

DeleteTemplate verb can be used to delete a template of given id.

Invoke-SwisVerb -swis $swis Orion.Apm.ApplicationTemplate DeleteTemplate @($templateId)
Clone this wiki locally