Skip to content

[Feature request] add math operators to File Content Test #29

@eoli3n

Description

@eoli3n

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions