monit icon indicating copy to clipboard operation
monit copied to clipboard

[Feature request] add math operators to File Content Test

Open eoli3n opened this issue 2 years ago • 0 comments

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

eoli3n avatar Dec 14 '21 13:12 eoli3n