monit
monit copied to clipboard
[Feature request] add math operators to File Content Test
From https://www.mmonit.com/monit/documentation/monit.html#FILE-CONTENT-TEST
operator is either a "=" for match or "!=" for no-match.
I would be able to use math operator to check for upgrades like
check program updates with path "/usr/bin/awk '/packages to be upgraded/ {print $NF}' /tmp/check-updates" # it prints a number
if content > 5 then alert
I workarounded it with a awk test.
check program updates with path "/usr/bin/awk '/packages to be upgraded/ {v+=$NF}END{print v;if (v>=5) exit 1}' /tmp/check-updates"
if status == 1 then alert