]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/monitoring/plugins/check_last_file_date
Add status engine website
[perso/Immae/Config/Nix.git] / modules / private / monitoring / plugins / check_last_file_date
index df45bbc5f44d6a11789f0638c5a32c7503718508..f51a25814c08e3e161842dbb56305a12294de11c 100755 (executable)
@@ -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