Documentation forServer & Application Monitor
Monitoring your applications and environment is a key capability of SolarWinds Observability Self-Hosted (formerly Hybrid Cloud Observability) and is available in the Essentials edition. Server & Application Monitor (SAM) is also available in a standalone module.

Scripts with text output

As described in Use script monitors in SAM, SAM looks for two main things when a script return values for target servers:

  • An exit code that indicates if the script ran successfully. That value is used to report the status of the monitor in the SolarWinds Platform Web Console. See Report status through exit codes in SAM script monitors.
  • Script output consists of returned metrics that generate an output, which is then displayed in the SolarWinds Platform Web Console.

Scripts can also report additional details by sending text to the script’s standard output, such as informational text or error details. Depending on your needs, you can create different If/Then/Else statements for the statistic value that each have a different Message format so you know what your script is doing.

Want to see how other SolarWinds customers work with scripts? Visit the Server & Application Monitor forum in THWACK.

Note the following details about text output:

  • There is a limit of ten Statistic and Message pairs per script. Each Statistic is a numeric value; each Message is readable text.
  • Statistic and Message pairs can be placed anywhere in the script output.
  • The Statistic and Message names you give must contain valid letters and/or numbers.
  • Named pairs can be dynamically defined in the code, but SAM expects the output to remain consistent.

Additionally, the Message variable use the same value as your Statistic variable (for example, Statistic.value1 and Message.value1, Statistic.value2 and Message.value2). If your Message.<name> does not match your Statistic.<name>, then SAM will throw an error.

Detail Type Required Meaning

Statistic

Yes

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

Message

No

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

Sample output:

# Script comment: This shows two pairs. Ten pairs are possible.
Statistic.CPU: 31.08Message.CPU: svchost.exe cpu usage
Statistic.RAM: 1234.56Message.RAM: svchost.exe ram usage