I currently have two monit checks for each host I have running HTTPS:
check host www-example-https with address www.example.org if failed port 443 protocol https then alert check host www-example-certificate with address www.example.org every "25 10 * * *" if failed port 443 protocol https and certificate valid > 30 days then alert
The first one warns me of a failure to connect at all, and runs every 2 minutes, whereas the second reminds me that a certificate has fewer that 30 days until expiry and only runs once a day.
At the moment both checks result in a similar alert message, which means that a certificate nearing expiry looks like a complete failure of HTTPS. I’d therefore like to override the default mail options on a per-alert basis.
I know I can do this with
set mail-format if I want to change all alerts, but I can’t figure out the syntax for a single alert if I’m using an
if failed ... then alert block, and I can’t find any examples of this specific use case in the manual.
Is it possible to override
mail-format on a per-alert basis for the types of alerts I’ve defined above?