X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=modules%2Fprivate%2Fmonitoring%2Fplugins%2Fcheck_last_file_date;h=f51a25814c08e3e161842dbb56305a12294de11c;hb=2edbb2d889bd9d1787bc1745a75c1b6969d148ab;hp=df45bbc5f44d6a11789f0638c5a32c7503718508;hpb=9f2025235d888eb4a7822024a5fad2e288388814;p=perso%2FImmae%2FConfig%2FNix.git 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