- changed status to closed
File content match not alerting
Issue #404
closed
I have a results file that contains 0
or some other exit status. However the following config does not alert when the file content changes:
check file s3-backup.service path /etc/monit/results/s3-backup.service.result if content != "^0" then alert if timestamp > 32 hour then alert if does not exist then alert
Comments (2)
-
repo owner -
reporter Thanks, and sorry for the bother. I completely glossed over that section of the docs. (May I suggest moving those sentences up to the intro, or prefacing with NB.)
I've updated the script to explicitly write a new file and append a second newline, and it now works:
rm -f s3-backup.service.result; echo $EXIT_STATUS | (cat -; echo -n -e '\n') > s3-backup.service.result
- Log in to comment
Hello,
the problem is most probably caused by the content ... monit remembers the position between cycles and resets it only under certain conditions, manual snip:
If you don't append to that file, but rewrite it, then monit the file size must change in order to catch the change (also the line has to be NL terminated).