Documentation forServer & Application Monitor
Monitoring your applications and environment is a key capability of Hybrid Cloud Observability and is also available in a standalone module, Server & Application Monitor (SAM). Hybrid Cloud Observability and SAM are built on the self-hosted SolarWinds Platform.

Report status through exit codes in SAM script monitors

Per Use script monitors in SAM, scripts should report their status by exiting with the appropriate exit code which results in an Up (0), Warning (2), or Critical (3) status. The exit code determines what appears for the component in the SolarWinds Platform Web Console.

Exit code Service state

0

Up

1

Down

2

Warning

3 Critical

Any other value

Unknown, for example 4

When SAM receives an exit code, it creates an appropriate dynamic evidence table structure to handle future exit codes. However, if a component only returns Down (1) or Unknown (4) on first use, a related dynamic evidence table structure may not be created appropriately.

The following code snippet highlights proper usage of exit codes:

In this example, the Write-Host message is intended for customer debugging purposes.

The two exit codes in this example are conditional:

  • When Exit 0; (status of Up) is reported, the message and statistic are displayed and the monitor shows a status of Up.
  • When Exit 1; (status of Down) is reported, the message and statistic are not displayed and a status of Down is reported.

For example, if you want a script to inform SAM that a PowerShell script reports an Up status, exit the script using Exit 0.