I've been told by that Orion SDK v1.5 support the deployment of application monitors in SAM 5.2 (awesome!), but I don't see any documentation for that. Can anyone provide an example of this or point me to some updated documentation?
Thanks!
Hello,
We are creating sample script for demonstrate this functionality right now. Here is the simple script to demonstrate the creating the application, executing "Poll Now" and deleting the application:
# This sample script demonstrates the use of verbs provided for manipulating
# with applications and templates. The verbs are defined by "Orion.APM.Application"
# entity type.
#
# The script progresses in several steps, it:
# 1. Creating a new application by assigning a template to a node.
# 2. Executing "Poll Now" on an application
# 3. Deleting an application
#
# Please update the hostname and credential setup to match your configuration.
if (! (Get-PSSnapin | where {$_.Name -eq "SwisSnapin"})) {
Add-PSSnapin "SwisSnapin"
}
# Connect to SWIS
$hostname = "localhost"
$username = "admin"
$password = New-Object System.Security.SecureString
$cred = New-Object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
$swis = Connect-Swis -host $hostname -cred $cred
#
# ASSIGNING TEMPLATE TO A NODE
#
# Select the node, application template and credential set and create the application by assigning template to node
# with selected credential set.
#
# Select the node
$ip = '10.140.127.221'
$nodeId = Get-SwisData $swis "SELECT NodeID FROM Orion.Nodes WHERE IP_Address=@ip" @{ip=$ip}
if (!$nodeId) {
Write-Host "Can't find node with IP '$ip'."
exit 1
}
# Select the template
$template = 'Windows Server 2003-2008 Services and Counters'
$applicationTemplateId = Get-SwisData $swis "SELECT ApplicationTemplateID FROM Orion.APM.ApplicationTemplate WHERE Name=@template" @{template=$template}
if (!$applicationTemplateId) {
Write-Host "Can't find template with name '$template'."
exit 1
}
# Select the credential
$credential = 'MyCredential'
$credentialId = Get-SwisData $swis "SELECT ID FROM Orion.Credential WHERE CredentialOwner='APM' AND Name=@credential" @{credential=$credential}
if (!$credentialId) {
Write-Host "Can't find credential with name '$credential'."
exit 1
}
Write-Host "Creating application on node '$nodeId' using template '$applicationTemplateId' and credential '$credentialId'."
# Assign application template to node to create the application
$applicationId = (Invoke-SwisVerb $swis "Orion.APM.Application" "CreateApplication" @(
# Node ID
$nodeId,
# Application Template ID
$applicationTemplateId,
# Credential Set ID
$credentialId,
# Skip if duplicate (in lowercase)
"true"
)).InnerText
# Check if application was created
if ($applicationId -eq -1) {
Write-Host "Application wasn't created. Likely the template is already assigned to node and the skipping of duplications are set to 'true'."
exit 1
}
else {
Write-Host "Application created with ID '$applicationId'."
}
#
# EXECUTING "POLL NOW"
#
# Execute "Poll Now" on created application.
#
Write-Host "Executing Poll Now for application '$applicationId'."
Invoke-SwisVerb $swis "Orion.APM.Application" "PollNow" @($applicationId) | Out-Null
Write-Host "Poll Now for application '$applicationId' was executed."
#
# DELETING APPLICATION
#
# Delete the created application.
#
Write-Host "Deleting application '$applicationId'."
Invoke-SwisVerb $swis "Orion.APM.Application" "DeleteApplication" @($applicationId) | Out-Null
Write-Host "Application '$applicationId' was deleted."
Orion.APM.Application has Unmanage/Remanage verbs. The arguments take the same for as the arguments to Orion.Nodes.Unmanage/Remanage. Net object IDs for applications look like "AA:8".
The product does not support unmanaging individual components. Is that something you are interested in?
I am having some trouble using that Swis verb:
-begin script except-
$AppID = $monitors.ApplicationID
$now = Get-Date
$later = $now.AddDays(1)
Invoke-SwisVerb $swis "Orion.APM.Application" "Unmanage" @("AA:1922", $now, $later, "false")
- end script except -
Script Output:
Invoke-SwisVerb : Could not load type 'SolarWinds.InformationService.Addons.IServiceHost' from assembly 'SolarWinds.InformationService.Addons, Version=2012.1.0.310, Culture=neutral, PublicKeyToken=null'.
At line:30 char:16
+ Invoke-SwisVerb <<<< $swis "Orion.APM.Application" "Unmanage" @("AA:1922", $now, $later, "false")
+ CategoryInfo : InvalidOperation: (:) [Invoke-SwisVerb], FaultException`1
+ FullyQualifiedErrorId : SwisError,SwisPowerShell.InvokeSwisVerb
Following up much later - this is fixed in SAM 6.0 (in beta - http://thwack.solarwinds.com/community/solarwinds-community/product-blog/blog/2013/05/29/server-application-monitor-60-beta-3--introducing-appinsight-for-sql). In that version the verb works properly in SWISv3.
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.