monitower

nimble and trivial monitoring suite
Log | Files | Refs

commit 22e8d78c6e2c740d5bc34f922ffd203a03a0e4d5
parent 768d089b7ff6546d0cda001df257f1cbee90b43d
Author: Josuah Demangeon <me@josuah.net>
Date:   Mon, 26 Oct 2020 03:29:31 +0100

only print output when something went wrong

This will produce nice reports in cron(8)

Diffstat:
Mmonitower-run | 14+++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/monitower-run b/monitower-run @@ -8,21 +8,21 @@ # check() { set -u +e - local state level "$@" + local state "$@" mkdir -p "$MONITOWER_SPOOL/$host" "$cmd" "$@" >/dev/null 2>&1 case $? in - (0) state=ok level=debug ;; - (*) state=err ;; + (0) state=ok ;; + (*) state=err + logger -cs -p "$MONITOWER_FACILITY.${level:-alert}" \ + -t monitower time="$NOW" state="$state" "$@" + ;; esac - logger -cs -t monitower -p "$MONITOWER_FACILITY.${level:-alert}" \ - time="$NOW" state="$state" "$@" - - echo "time=$NOW state=$state $*" >>$MONITOWER_SPOOL/$host/$name.log + echo time="$NOW" state="$state" "$@" >>$MONITOWER_SPOOL/$host/$name.log } : ${MONITOWER_SPOOL:=/var/spool/monitower}