X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=modules%2Fprivate%2Fmonitoring%2Fplugins%2Fcheck_maison_bbc;fp=modules%2Fprivate%2Fmonitoring%2Fplugins%2Fcheck_maison_bbc;h=0000000000000000000000000000000000000000;hb=8b2f048bed8d081f18d9ba7bc1cce16c28670217;hp=4a2f7991c80f3729b49257820d7a2a24e952ddf4;hpb=169805b9ed11733ffb0a320a93831f903bbe0002;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/modules/private/monitoring/plugins/check_maison_bbc b/modules/private/monitoring/plugins/check_maison_bbc deleted file mode 100755 index 4a2f799..0000000 --- a/modules/private/monitoring/plugins/check_maison_bbc +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash - -# kw, kwh, th_hr Bureau, th_hr Chambre_RDC, th_hr Exterieure, th_hr -# Garage, th_hr Mezzanine, th_hr Sejour, th_hr Soufflage - -alert=$(date +"%F %H:%M:%S" -d "3 hours ago") -res=$(curl https://maison.bbc.bouya.org/stats.php) - -ignored_text="Exterieure Soufflage Mezzanine" - -ignored_bat="^(Temp_Nord|Exterieure|Soufflage|Mezzanine)$" -ignored="^(th_hr Exterieure|th_hr Soufflage|th_hr Mezzanine)$" - -missing() { - echo "to_entries|[.[]|select(.value < \"$alert\" and .key != \"bat\" $1)|.key + \": \" + .value]|join(\" ; \")" -} - -missing_check=$(echo "$res" | jq -r "$(missing "and (.key | test(\"$ignored\") | not)")") -missing_show=$(echo "$res" | jq -r "$(missing "")") - -battery() { - echo ".bat|to_entries|[.[]|select((.value[0] < \"$alert\" or (.value[1] | test(\"^0|1|2$\") | not)) $1)|.key + \": \" + .value[0] + \" bat \" + .value[1]]|join(\" ; \")" -} - -bat_check=$(echo "$res" | jq -r "$(battery "and (.key | test(\"$ignored_bat\") | not)")") -bat_show=$(echo "$res" | jq -r "$(battery "")") - -if [ -n "$missing_check" -o -n "$bat_check" ]; then - text="" - if [ -n "$missing_show" ]; then - text="$text - Dernières dates: $missing_show" - fi - if [ -n "$bat_show" ]; then - text="$text - Batteries: $bat_show" - fi - echo "Zibase CRITICAL$text" - exit 2 -else - echo "Zibase OK - Derniers événements il y a moins de 3h (ignorés : $ignored_text)" - exit 0 -fi