Documentation forServer & Application Monitor

Report status through exit codes in SAM script monitors

As described in Use script component monitors in SAM, scripts should report their status to SAM 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 Orion Web Console.

When an exit code is received, SAM creates an appropriate dynamic evidence table structure and all further exit codes are handled correctly. If the component only returns Down (1) or Unknown (4) on first use, the appropriate dynamic evidence table structure is not created appropriately.

Exit Code Service State

0

Up

1

Down

2

Warning

3 Critical

Any other value

Unknown, for example 4

The following code snippet highlights proper usage of exit codes:

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.