This functionality is not provided natively out of the box but can be accomplished using PowerShell. The link below provides a working example of what this might look like. Note it will need to be adapted to support SAMs script output format, but otherwise it should get the job done. You may even be able to find someone in the Script Lab willing to help adapt the script to SAMs output format.
Scripts Must Report Status Through Exit Codes
Scripts must report their status by exiting with the appropriate exit code:
Exit Code | Meaning |
0 | Up |
1 | Down |
2 | Warning |
3 | Critical |
Any other value | Unknown |
Scripts report additional details by sending text to the script’s standard output.
In APM 4.0.2 and earlier, each line of output contained a single detail in the following format:
Message: The directory contains too many files.
While this is still true, SAM now supports multiple values returned by a script using the following format.
Statistic.Name1: x
Message.Name1: abc
Statistic.Name2: y
Message.Name2: abc
Statistic.Name1: 123 Statistic.Name2: 456 | ||
An error or information message to be displayed in the monitor status details. Note: Multi-line messages are supported. To use this functionality print each line using a separate command. For example: Message.Name2: def |