diff options
Diffstat (limited to 'modules/private/monitoring')
-rw-r--r-- | modules/private/monitoring/default.nix | 6 | ||||
-rw-r--r-- | modules/private/monitoring/objects_common.nix | 2 | ||||
-rw-r--r-- | modules/private/monitoring/objects_monitoring-1.nix | 24 | ||||
-rwxr-xr-x | modules/private/monitoring/plugins/check_maison_bbc | 41 | ||||
-rwxr-xr-x | modules/private/monitoring/plugins/notify_maison_bbc_by_email | 27 |
5 files changed, 0 insertions, 100 deletions
diff --git a/modules/private/monitoring/default.nix b/modules/private/monitoring/default.nix index 0586567..349ba8a 100644 --- a/modules/private/monitoring/default.nix +++ b/modules/private/monitoring/default.nix | |||
@@ -26,9 +26,6 @@ let | |||
26 | wrapProgram $out/send_nrdp.sh --prefix PATH : ${lib.makeBinPath [ | 26 | wrapProgram $out/send_nrdp.sh --prefix PATH : ${lib.makeBinPath [ |
27 | pkgs.curl pkgs.jq | 27 | pkgs.curl pkgs.jq |
28 | ]} | 28 | ]} |
29 | wrapProgram $out/check_maison_bbc --prefix PATH : ${lib.makeBinPath [ | ||
30 | pkgs.curl pkgs.jq | ||
31 | ]} | ||
32 | wrapProgram $out/check_mem.sh --prefix PATH : ${lib.makeBinPath [ | 29 | wrapProgram $out/check_mem.sh --prefix PATH : ${lib.makeBinPath [ |
33 | pkgs.gnugrep pkgs.gawk pkgs.procps-ng | 30 | pkgs.gnugrep pkgs.gawk pkgs.procps-ng |
34 | ]} | 31 | ]} |
@@ -61,9 +58,6 @@ let | |||
61 | wrapProgram $out/check_eriomem --prefix PATH : ${lib.makeBinPath [ | 58 | wrapProgram $out/check_eriomem --prefix PATH : ${lib.makeBinPath [ |
62 | pkgs.s3cmd pkgs.python3 | 59 | pkgs.s3cmd pkgs.python3 |
63 | ]} | 60 | ]} |
64 | wrapProgram $out/notify_maison_bbc_by_email --prefix PATH : ${lib.makeBinPath [ | ||
65 | pkgs.mailutils pkgs.gawk | ||
66 | ]} | ||
67 | wrapProgram $out/notify_by_email --prefix PATH : ${lib.makeBinPath [ | 61 | wrapProgram $out/notify_by_email --prefix PATH : ${lib.makeBinPath [ |
68 | pkgs.mailutils | 62 | pkgs.mailutils |
69 | ]} | 63 | ]} |
diff --git a/modules/private/monitoring/objects_common.nix b/modules/private/monitoring/objects_common.nix index e21f9d0..e9b1b51 100644 --- a/modules/private/monitoring/objects_common.nix +++ b/modules/private/monitoring/objects_common.nix | |||
@@ -113,7 +113,6 @@ in | |||
113 | check_command_status = "$USER2$/check_command -c \"$ARG1$\" -s \"$ARG2$\" $ARG3$"; | 113 | check_command_status = "$USER2$/check_command -c \"$ARG1$\" -s \"$ARG2$\" $ARG3$"; |
114 | check_ntp = "$USER1$/check_ntp_time -t 30 -q -H 0.arch.pool.ntp.org"; | 114 | check_ntp = "$USER1$/check_ntp_time -t 30 -q -H 0.arch.pool.ntp.org"; |
115 | check_mailq = "$USER1$/check_mailq -s -w 1 -c 2"; | 115 | check_mailq = "$USER1$/check_mailq -s -w 1 -c 2"; |
116 | check_maison_bbc = "$USER2$/check_maison_bbc"; | ||
117 | check_mysql_replication = "${sudo} -u mysql $USER2$/check_mysql_replication \"$ARG1$\" \"$ARG2$\""; | 116 | check_mysql_replication = "${sudo} -u mysql $USER2$/check_mysql_replication \"$ARG1$\" \"$ARG2$\""; |
118 | check_postgresql_replication = "${sudo} -u postgres $USER2$/check_postgres_replication \"$ARG1$\" \"$ARG2$\" \"$ARG3$\""; | 117 | check_postgresql_replication = "${sudo} -u postgres $USER2$/check_postgres_replication \"$ARG1$\" \"$ARG2$\" \"$ARG3$\""; |
119 | check_openldap_replication = "${sudo} -u openldap $USER2$/check_openldap_replication \"$ARG1$\" \"$ARG2$\" \"$ARG3$\" \"$ARG4$\" \"$ARG5$\""; | 118 | check_openldap_replication = "${sudo} -u openldap $USER2$/check_openldap_replication \"$ARG1$\" \"$ARG2$\" \"$ARG3$\" \"$ARG4$\" \"$ARG5$\""; |
@@ -132,7 +131,6 @@ in | |||
132 | notify-host-by-email = "ADMINEMAIL=\"$ADMINEMAIL$\" SERVICENOTIFICATIONID=\"$SERVICENOTIFICATIONID$\" HOSTSTATE=\"$HOSTSTATE$\" HOSTOUTPUT=\"$HOSTOUTPUT$\" $USER2$/notify_by_email host \"$NOTIFICATIONTYPE$\" \"$HOSTALIAS$\" \"$LONGDATETIME$\" \"$CONTACTEMAIL$\" $OVE"; | 131 | notify-host-by-email = "ADMINEMAIL=\"$ADMINEMAIL$\" SERVICENOTIFICATIONID=\"$SERVICENOTIFICATIONID$\" HOSTSTATE=\"$HOSTSTATE$\" HOSTOUTPUT=\"$HOSTOUTPUT$\" $USER2$/notify_by_email host \"$NOTIFICATIONTYPE$\" \"$HOSTALIAS$\" \"$LONGDATETIME$\" \"$CONTACTEMAIL$\" $OVE"; |
133 | # $OVE is to force naemon to run via shell instead of execve which fails here | 132 | # $OVE is to force naemon to run via shell instead of execve which fails here |
134 | notify-service-by-email = "ADMINEMAIL=\"$ADMINEMAIL$\" SERVICENOTIFICATIONID=\"$SERVICENOTIFICATIONID$\" SERVICEDESC=\"$SERVICEDESC$\" SERVICESTATE=\"$SERVICESTATE$\" SERVICEOUTPUT=\"$SERVICEOUTPUT$\" $USER2$/notify_by_email service \"$NOTIFICATIONTYPE$\" \"$HOSTALIAS$\" \"$LONGDATETIME$\" \"$CONTACTEMAIL$\" $OVE"; | 133 | notify-service-by-email = "ADMINEMAIL=\"$ADMINEMAIL$\" SERVICENOTIFICATIONID=\"$SERVICENOTIFICATIONID$\" SERVICEDESC=\"$SERVICEDESC$\" SERVICESTATE=\"$SERVICESTATE$\" SERVICEOUTPUT=\"$SERVICEOUTPUT$\" $USER2$/notify_by_email service \"$NOTIFICATIONTYPE$\" \"$HOSTALIAS$\" \"$LONGDATETIME$\" \"$CONTACTEMAIL$\" $OVE"; |
135 | notify-maison-bbc-by-email = "ADMINEMAIL=\"$ADMINEMAIL$\" SERVICENOTIFICATIONID=\"$SERVICENOTIFICATIONID$\" SERVICEDESC=\"$SERVICEDESC$\" SERVICESTATE=\"$SERVICESTATE$\" SERVICEOUTPUT=\"$SERVICEOUTPUT$\" $USER2$/notify_maison_bbc_by_email service \"$NOTIFICATIONTYPE$\" \"$HOSTALIAS$\" \"$LONGDATETIME$\" \"$CONTACTEMAIL$\" $OVE"; | ||
136 | notify-by-slack = "HOST=\"$HOSTALIAS$\" SERVICESTATE=\"$SERVICESTATE$\" SERVICEDESC=\"$SERVICEDESC$\" SERVICEOUTPUT=\"$SERVICEOUTPUT$\" $USER2$/notify_by_slack \"$ARG1$\" \"$ARG2$\""; | 134 | notify-by-slack = "HOST=\"$HOSTALIAS$\" SERVICESTATE=\"$SERVICESTATE$\" SERVICEDESC=\"$SERVICEDESC$\" SERVICEOUTPUT=\"$SERVICEOUTPUT$\" $USER2$/notify_by_slack \"$ARG1$\" \"$ARG2$\""; |
137 | 135 | ||
138 | notify-master = "$USER2$/send_nrdp.sh -u \"$USER200$\" -t \"$USER201$\" -H \"$HOSTADDRESS$\" -s \"$SERVICEDESC$\" -S \"$SERVICESTATEID$\" -o \"$SERVICEOUTPUT$\""; | 136 | notify-master = "$USER2$/send_nrdp.sh -u \"$USER200$\" -t \"$USER201$\" -H \"$HOSTADDRESS$\" -s \"$SERVICEDESC$\" -S \"$SERVICESTATEID$\" -o \"$SERVICEOUTPUT$\""; |
diff --git a/modules/private/monitoring/objects_monitoring-1.nix b/modules/private/monitoring/objects_monitoring-1.nix index 46916f4..ec6fdce 100644 --- a/modules/private/monitoring/objects_monitoring-1.nix +++ b/modules/private/monitoring/objects_monitoring-1.nix | |||
@@ -643,24 +643,6 @@ | |||
643 | _webstatus_url = "https://www.sandetludo.com/"; | 643 | _webstatus_url = "https://www.sandetludo.com/"; |
644 | } | 644 | } |
645 | 645 | ||
646 | { | ||
647 | service_description = "Maison bbc accepts add requests on http"; | ||
648 | host_name = "eldiron.immae.eu"; | ||
649 | use = "external-web-service"; | ||
650 | check_command = [ "check_http" "maison.bbc.bouya.org" "/add.php" "^$"]; | ||
651 | } | ||
652 | |||
653 | { | ||
654 | service_description = "Maison bbc has up to date data"; | ||
655 | host_name = "eldiron.immae.eu"; | ||
656 | use = "generic-service"; | ||
657 | contact_groups = "maison-bbc"; | ||
658 | notification_interval = "1440"; | ||
659 | check_command = "check_maison_bbc"; | ||
660 | flap_detection_enabled = "0"; | ||
661 | max_check_attempts = "1"; | ||
662 | } | ||
663 | |||
664 | # SSL | 646 | # SSL |
665 | { | 647 | { |
666 | service_description = "ldap SSL is up to date"; | 648 | service_description = "ldap SSL is up to date"; |
@@ -678,14 +660,8 @@ | |||
678 | use = "generic-contact"; | 660 | use = "generic-contact"; |
679 | contactgroups = "telio-tortay"; | 661 | contactgroups = "telio-tortay"; |
680 | }; | 662 | }; |
681 | papa = config.myEnv.monitoring.contacts.papa // { | ||
682 | use = "generic-contact"; | ||
683 | contactgroups = "maison-bbc"; | ||
684 | service_notification_commands = "notify-maison-bbc-by-email"; | ||
685 | }; | ||
686 | }; | 663 | }; |
687 | contactgroup = { | 664 | contactgroup = { |
688 | maison-bbc = { alias = "Maison BBC"; }; | ||
689 | telio-tortay = { alias = "Telio Tortay"; members = "immae"; }; | 665 | telio-tortay = { alias = "Telio Tortay"; members = "immae"; }; |
690 | }; | 666 | }; |
691 | } | 667 | } |
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 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
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 | ||
5 | |||
6 | alert=$(date +"%F %H:%M:%S" -d "3 hours ago") | ||
7 | res=$(curl https://maison.bbc.bouya.org/stats.php) | ||
8 | |||
9 | ignored_text="Exterieure Soufflage Mezzanine" | ||
10 | |||
11 | ignored_bat="^(Temp_Nord|Exterieure|Soufflage|Mezzanine)$" | ||
12 | ignored="^(th_hr Exterieure|th_hr Soufflage|th_hr Mezzanine)$" | ||
13 | |||
14 | missing() { | ||
15 | echo "to_entries|[.[]|select(.value < \"$alert\" and .key != \"bat\" $1)|.key + \": \" + .value]|join(\" ; \")" | ||
16 | } | ||
17 | |||
18 | missing_check=$(echo "$res" | jq -r "$(missing "and (.key | test(\"$ignored\") | not)")") | ||
19 | missing_show=$(echo "$res" | jq -r "$(missing "")") | ||
20 | |||
21 | battery() { | ||
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(\" ; \")" | ||
23 | } | ||
24 | |||
25 | bat_check=$(echo "$res" | jq -r "$(battery "and (.key | test(\"$ignored_bat\") | not)")") | ||
26 | bat_show=$(echo "$res" | jq -r "$(battery "")") | ||
27 | |||
28 | if [ -n "$missing_check" -o -n "$bat_check" ]; then | ||
29 | text="" | ||
30 | if [ -n "$missing_show" ]; then | ||
31 | text="$text - Dernières dates: $missing_show" | ||
32 | fi | ||
33 | if [ -n "$bat_show" ]; then | ||
34 | text="$text - Batteries: $bat_show" | ||
35 | fi | ||
36 | echo "Zibase CRITICAL$text" | ||
37 | exit 2 | ||
38 | else | ||
39 | echo "Zibase OK - Derniers événements il y a moins de 3h (ignorés : $ignored_text)" | ||
40 | exit 0 | ||
41 | fi | ||
diff --git a/modules/private/monitoring/plugins/notify_maison_bbc_by_email b/modules/private/monitoring/plugins/notify_maison_bbc_by_email deleted file mode 100755 index 84958b8..0000000 --- a/modules/private/monitoring/plugins/notify_maison_bbc_by_email +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
3 | # $1 = service/host | ||
4 | |||
5 | # $2 = type (PROBLEM RECOVERY ACKNOWLEDGEMENT FLAPPINGSTART FLAPPINGSTOP FLAPPINGDISABLED DOWNTIMESTART DOWNTIMESTOP DOWNTIMECANCELLED) | ||
6 | # http://www.naemon.org/documentation/usersguide/macrolist.html#notificationtype | ||
7 | |||
8 | # $3 = host alias | ||
9 | |||
10 | # $4 = date (YYYY-MM-DDTHH:MM:SS) | ||
11 | |||
12 | # $5 = E-mail | ||
13 | |||
14 | NOTIFICATION_TYPE="$2" | ||
15 | DATE="$4" | ||
16 | CONTACT="$5" | ||
17 | |||
18 | output=$(echo "$SERVICEOUTPUT" | awk '{gsub(" - ", "\n\n", $0); gsub (" (;|:) ", "\n ", $0); gsub(" dates: ", " dates:\n ", $0); gsub("Batteries: ", "Batteries:\n ", $0); print $0}') | ||
19 | if [ "$NOTIFICATION_TYPE" = "RECOVERY" ]; then | ||
20 | subject="Fin d'alerte Maison BBC Zibase" | ||
21 | message=$(printf "%b" "Alerte terminée le $DATE.\nInformations:\n$output") | ||
22 | else | ||
23 | subject="Alerte Maison BBC Zibase" | ||
24 | message=$(printf "%b" "Alerte lancée le $DATE.\nInformations:\n$output") | ||
25 | fi | ||
26 | |||
27 | echo "$message" | MAILRC=/dev/null mail -r "$ADMINEMAIL" -n -s "$subject" "$CONTACT" | ||