Am Tue, 9 Dec 2025 22:03:10 +0100
schrieb Lutz Mader <[email protected]>:

Hello Lutz,

> if status > 2 then exec "/usr/local/etc/monit/scripts/zexec.sh 'Error'"
> if status = 2 then exec "/usr/local/etc/monit/scripts/zexec.sh 'Warning'"
> if status > 1 then exec "/usr/local/etc/monit/scripts/zexec.sh 'Info'"
>    else if succeeded then exec "/usr/local/etc/monit/scripts/
> zexec.sh 'OK'"
> 
> The script handle the message and will end with a proper return code.
> The command output is available in the "last output".
> 
>   last exit value              2
>   last output                  WARN: tank/syncoid/[long path] newest
> daily snapshot is 4d 2h 27m 6s old (should be < 2d 12h 0m 0s)
> 
> A suggestion only,

Thanks for the explanations and the suggestions. This looks very useful,
it should be possible to write some simple script to cover my use case.
Before, I was thinking about trying to set an explicit reminder with a
longer cycles number ("alert [email protected] with reminder on 120 cycles" or
similar), but the scripted solution looks cleaner and more flexible.

What I do not understand completely yet from your example is how you split
the actual check and the message generation. How does your actual check
statement look like in that case (is that still a direct call to sanoid
--monitor-snapshots, or also a script call?), and how does monit process
the generated output from the exec script (not being in an check
statement)?


cu
  Gerrit

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to