Report status through exit codes

Scripts in component monitors must report their status by exiting with the appropriate exit code. The exit code is used to report the status of the monitor, which is seen by the user through the interface

A script should return an exit code which results in an Up (0), Warning (2), or Critical (3) status. When one of these exit codes is received the appropriate dynamic evidence table structure is created 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, meaning either one or the other will be triggered based on a certain outcome.

  • 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 to inform SolarWinds SAM that a PowerShell script reports an Up status, you would exit the script using Exit 0.