X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FConfig%2FNix.git;a=blobdiff_plain;f=modules%2Fprivate%2Fmonitoring%2Fplugins%2Fcheck_last_file_date;h=f51a25814c08e3e161842dbb56305a12294de11c;hp=df45bbc5f44d6a11789f0638c5a32c7503718508;hb=a97118c489a59d723538292214efaa10dfcb96df;hpb=b1b8a5623d22a7ee4301afe4e7b9d368ef7ded8f diff --git a/modules/private/monitoring/plugins/check_last_file_date b/modules/private/monitoring/plugins/check_last_file_date index df45bbc..f51a258 100755 --- a/modules/private/monitoring/plugins/check_last_file_date +++ b/modules/private/monitoring/plugins/check_last_file_date @@ -15,12 +15,14 @@ if [ -z "$last_date" ]; then exit $STATE_UNKNOWN else LC_ALL=C last_date=$(printf "%.*f" 0 $last_date) + LC_ALL=C age=$(( $(date "+%s") - $last_date)) + max_age=$(( $hours * 60 * 60 )) min_date=$(date -d "$hours hours ago" "+%s") if [ "$min_date" -lt "$last_date" ]; then - echo "OK: Last file $(date -d @$last_date)" + echo "OK: Last file $(date -d @$last_date) | age=${age}s;;$max_age;;" exit $STATE_OK else - echo "CRITICAL: Last file $(date -d @$last_date)" + echo "CRITICAL: Last file $(date -d @$last_date) | age=${age}s;;$max_age;;" exit $STATE_CRITICAL fi fi