Use script component monitors in SAM

Script component monitors give you limitless options for monitoring and returning metrics for targeted servers. Each monitor has different options to execute the script, enter credentials, set working directories, and generate and display returned metrics as output.

SAM's Component Monitor Library includes the following script monitors, and you can also write your own.

For details on creating script monitors, see:

SolarWinds fully supports scripts written and provided by the company; however, we do not provide support for custom scripts written by outside sources.

Writing scripts

Every script monitor accepts code through the Script Body field. Develop code against the target system directly in the SAM script monitor or using your preferred scripting environment and programming language. For example, Microsoft provides a Windows PowerShell Integrated Scripting Environment (ISE). Programming environments and applications give you script libraries and color-coded source code, sometimes easier to code with than the SAM script window.

Write or copy and paste script code into the Script Body field. Each script monitor includes additional fields and options that may be required to run the scripts. For example, PowerShell includes an arguments field and Nagios includes a command line field. Depending on the programming language and script monitor, you may need to enter the following:

  • Credentials
  • Hostname and target server information
  • Arguments and variables

When ready, test the script to verify credentials and target server access and to generate the outputs.

Sample script monitors are available in this default directory: C:\Program Files (x86)\SolarWinds\Orion\APM\Sample-Script Monitors.

Returned metrics and output

SAM does not support ${item} or other responses. SAM expects 1 to a maximum of 10 metrics returned with a string of Statistic and a numerical value and an optional Message. When returning multiple metrics, you can add descriptive label to the returned statistics, for example Statistic.FileSize, Statistic,MailboxCount, and Statistic.Name.

If using labels, make sure not to use spaces.

SAM supports multiple values returned by a script using the following format.

Statistic.Name1: xMessage.Name1: abc

Statistic.Name2: yMessage.Name2: abc

Detail Type Required Meaning



A numeric value used to determine how the monitor compares to its set thresholds. This must be an integer value, (negative numbers are supported).

Statistic.Name1: 123
Statistic.Name2: 456



An error or information message to be displayed in the monitor status details. Multi-line messages are supported. To use this functionality, print each line using a separate command.

For example:
Message.Name1: abc

Message.Name2: def

Use a write command according to the used programming language to report back data to SAM, such as:

  • For PowerShell scripts, use the Write-Host command.
  • For Python, use the Print command.
  • For Bash/Shell, use the Echo command.

Each returned metric generates an output. You can customize the display name and thresholds as needed. If you delete the output, the metric does not display. SAM still pulls and saves the metric to the Orion SQL database.

For best system performance, create fewer calls by pulling multiple metrics per script. Depending on the load of the calls, you may need to divide the scripts and returned metrics across multiple script monitors.