execute - run external command
- fail_command
- Type:
string
- Required:
false
command to execute when a monitor fails
- success_command
- Type:
string
- Required:
false
command to execute when a montior recovers
- catchup_command
- Type:
string
- Required:
false
command to execute when exiting a time period when the alerter couldn’t fire, a monitor failed during that time, and hasn’t recovered yet. (See the
delayconfiguration option.) If you specify the literal stringfail_command, this will share thefail_commandconfiguration value.
You can specify the following variable inside {curly brackets} to have them substituted when the command is executed:
hostname: the host the monitor is running onname: the monitor’s namedays,hours,minutes, andseconds: the monitor’s downtimefailed_at: the date and time the monitor failedvitual_fail_count: the monitor’s virtual failure count (number of failed checks -tolerance)info: the additional information the monitor recorded about its statusdescription: description of what the monitor is checking
You will probably need to quote parameters to the command. For example:
fail_command=say "Oh no, monitor {name} has failed at {failed_at}"
The commands are executed directly by Python. If you require shell features, such as piping and redirection, you should use something like bash -c "...". For example:
fail_command=/bin/bash -c "/usr/bin/printf \"The simplemonitor for {name} has failed on {hostname}.\n\nTime: {failed_at}\nInfo: {info}\n\" | /usr/bin/mailx -A gmail -s \"PROBLEM: simplemonitor {name} has failed on {hostname}.\" email@address"