]>
git.immae.eu Git - perso/Immae/Config/Nix.git/blob - modules/private/monitoring/plugins/check_maison_bbc
3 # kw, kwh, th_hr Bureau, th_hr Chambre_RDC, th_hr Exterieure, th_hr
4 # Garage, th_hr Mezzanine, th_hr Sejour, th_hr Soufflage
6 alert
=$(date +"%F %H:%M:%S" -d "3 hours ago")
7 res
=$(curl https://maison.bbc.bouya.org/stats.php)
9 ignored_text
="th_hr Exterieure th_hr Soufflage"
12 ignored
="^(th_hr Exterieure|th_hr Soufflage)$"
15 echo "to_entries|[.[]|select(.value < \"$alert\" and .key != \"bat\" $1)|.key + \": \" + .value]|join(\" ; \")"
18 missing_check
=$(echo "$res" | jq -r "$(missing "and (.key | test(\"$ignored\") | not
)")")
19 missing_show
=$(echo "$res" | jq -r "$(missing "")")
22 echo ".bat
|to_entries
|[.
[]|select((.value
[0] < \"$alert\" or
(.value
[1] | test(\"^
0|1|2$
\") | not
)) $1)|.key
+ \": \" + .value
[0] + \" bat
\" + .value
[1]]|join(\" ; \")"
25 bat_check=$(echo "$res" | jq -r "$(battery "and (.key | test(\"$ignored_bat\") | not)")")
26 bat_show=$(echo "$res" | jq -r "$(battery "")")
28 if [ -n "$missing_check" -o -n "$bat_check" ]; then
30 if [ -n "$missing_show" ]; then
31 text
="$text - Dernières dates: $missing_show"
33 if [ -n "$bat_show" ]; then
34 text
="$text - Batteries: $bat_show"
36 echo "Zibase CRITICAL$text"
39 echo "Zibase OK - Derniers événements il y a moins de 3h (ignorés : $ignored_text)"