Properly Setting the Exit Codes When Configuring the Command Line Monitor

How to properly set the exit codes when configuring the Command Line Monitor with Monitoring Studio.

Related Topics


When configuring a Command Line Monitor in Monitoring Studio, you can indicate if the command is successful or failed when a specific exit code is found. Before configuring the Command Line Monitor, it is therefore important to:

  1. Decide which command you would like to run
  2. List the possible exit codes for this command
  3. Select the exit codes that should be associated to a successful/failed command execution.
When a command is considered as failed, all its **Content-Parsing Monitors** (String Search, Numeric Value Extraction, Value Map, etc) are NOT processed.


In our example, we will run a curl command for which we know that these exit codes may occur:

  • CURLE_OK (0)
  • etc.

Imagine that we want to perform a health check of a specific URL and alert when it cannot be reached (the curl command then returns the exit code 7).

  1. Before configuring the Command Line Monitor, we first:

    • Define the Host to be monitored
    • Create our Template
    • Apply our Template to our specific Host.
    For more information, refer to the Hosts and Templates documentation.
  2. Then, we edit our Template to add a Command Line Monitor:

Adding the Command Line Monitor

  1. In the Command Line field, we enter the command to be run. In our example: http://myintranet:8200/v1/sys/health

Configuring the commmand to be run

  1. We then indicate the credentials to be used to run the command and whether it will be run on the Monitored Host or on the Agent system. In our example, it is on the Monitored Host.

  2. In the Execution Validation section, we indicate the conditions to validate the command. In our example, the Failed Exit Code is 7.

Configuring the commmand to be run

If we would have wanted Content-Parsing Monitors (String Search, Numeric Value Extraction, Value Map, etc) to be processed when the exit code is 7, we should then have selected Successful Exit Codes: instead Failed Exit Codes:.
  1. Finally, we click Create.