Hi, I have been using monit for quite a while now, and have been wondering
if there is any way for rules to have state which affects the behaviour of
other rules. In my case, I have a log file (the logging from a streaming
music player) and I have a rule that if no updates happen to the file in a
period of time, it can be assumed that the player died somehow and needs to
be restarted. This part is fairly straightforward. My problem is that
sometimes the player prints a buffer-stalled warning, which it may or may
not recover from. If it does recover, a message is printed to the log and
playback continues, but if it doesn't, no further messages are printed.
Eventually this will trigger the timeout rule, but in this case if, when
monit sees the buffer stalled message, it could switch to a much shorter
timeout, it would greatly improve the system. once the recovery message is
printed it would need to go back to the longer timeout.
I have tried to implement this with target actions which start and stop
services on the same log, but this is unreliable.