Submit a ticketCall us

Webinar: Web Help Desk for HR, Facilities and Accounting Departments
This webinar will focus on use cases for HR, Facilities and Accounting.

Having a unified ticketing and asset management system for all the departments in your company can provide end-users with a seamless experience and make things easier for your IT team. Yet, with different business tasks and objectives, many departments don’t fully understand the capabilities of Web Help Desk and how the software can be customized for effective use in their departments.
Register Now.

Home > Success Center > Server & Application Monitor (SAM) > SAM Custom Template Guide > Create Scripts for SAM Script Monitors

Create Scripts for SAM Script Monitors

Script component monitors in SAM 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 includes the following script monitors:

For details on creating scripts, see the following:

For additional examples, see Manage application monitor templates and component monitors.

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, you must test the script through SAM to verify credentials and target server access and to generate the outputs.

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.

Last modified
12:33, 9 May 2017