Re: "REPEAT EVERY" not working as expected with "IF CONTENT"
Lutz Mader <[email protected]> Fri, 3 Oct 2025 14:04:47 +0200
| Newsgroups | gmane.comp.monitoring.monit.general |
|---|---|
| Message-ID | <[email protected]> |
BTW, to handle some glitches you should use a threshold. > CHECK PROGRAM 5g-check WITH PATH "/usr/bin/expect /etc/monit.d/5g-check" > IF CONTENT != "NR5G" THEN EXEC "/usr/bin/expect /etc/monit.d/5g-reboot" > REPEAT EVERY 60 CYCLES > NOT EVERY "* 23,0-6 * * *" CHECK PROGRAM 5g-check WITH PATH "/usr/bin/expect /etc/monit.d/5g-check" IF CONTENT != "NR5G" for 5 times within 15 cycles THEN EXEC "/usr/bin/expect /etc/monit.d/5g-reboot" # REPEAT EVERY 60 CYCLES NOT EVERY "* 23,0-6 * * *" Based on "5 times within 15 cycles" the reboot script will not executed immediately. The content test must match at least 5 times in a periot of 15 cycles. If something is going wrong, the command will not executed until at least 5 cycles have passed. See https://mmonit.com/monit/documentation/monit.html#FAULT-TOLERANCE https://mmonit.com/monit/documentation/monit.html#PROGRAM-OUTPUT-CONTENT-TEST And in addition to my previous suggestion https://mmonit.com/monit/documentation/monit.html#PROGRAM-STATUS-TEST A suggestion based on your sample, Lutz