]>
git.immae.eu Git - perso/Immae/Config/Nix.git/blob - flakes/private/monitoring/plugins/check_last_file_date
11 last_date
=$(find $base_path -mindepth 1 -maxdepth 1 -printf "%T@\n" 2>/dev/null | sort | tail -n 1)
13 if [ -z "$last_date" ]; then
14 echo "UNKNOWN: Could not read folder"
17 LC_ALL
=C last_date
=$(printf "%.*f" 0 $last_date)
18 LC_ALL
=C age
=$(( $(date "+%s") - $last_date))
19 max_age
=$(( $hours * 60 * 60 ))
20 min_date
=$(date -d "$hours hours ago" "+%s")
21 if [ "$min_date" -lt "$last_date" ]; then
22 echo "OK: Last file $(date -d @$last_date) | age=${age}s;;$max_age;;"
25 echo "CRITICAL: Last file $(date -d @$last_date) | age=${age}s;;$max_age;;"