From fe46163e586b2b19126fffd1a7710e1b61349389 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 13 Feb 2017 14:32:00 +0100 Subject: l 2 monitoring: add monit-alarms --- lass/2configs/monitoring/monit-alarms.nix | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 lass/2configs/monitoring/monit-alarms.nix (limited to 'lass/2configs/monitoring') diff --git a/lass/2configs/monitoring/monit-alarms.nix b/lass/2configs/monitoring/monit-alarms.nix new file mode 100644 index 000000000..a85738538 --- /dev/null +++ b/lass/2configs/monitoring/monit-alarms.nix @@ -0,0 +1,34 @@ +{pkgs, config, ...}: +with import ; +let + echoToIrc = msg: + pkgs.writeDash "echo_irc" '' + set -euf + export LOGNAME=prism-alarm + ${pkgs.irc-announce}/bin/irc-announce \ + ni.r 6667 prism-alarm \#retiolum "${msg}" >/dev/null + ''; + +in { + krebs.monit = { + enable = true; + http.enable = true; + alarms.nirwanabluete = { + test = "${pkgs.curl}/bin/curl -sf 'https://nirwanabluete.de/'"; + alarm = echoToIrc "test nirwanabluete failed"; + }; + alarms.ubik = { + test = "${pkgs.curl}/bin/curl -sf 'https://ubikmedia.de'"; + alarm = echoToIrc "test ubik failed"; + }; + alarms.hfos = { + test = "${pkgs.curl}/bin/curl -sf --insecure 'https://hfos.hackerfleet.de'"; + alarm = echoToIrc "test hfos failed"; + }; + alarms.cac-panel = { + test = "${pkgs.curl}/bin/curl -sf 'https://panel.cloudatcost.com/login.php'"; + alarm = echoToIrc "test cac-panel failed"; + }; + }; +} + -- cgit v1.2.3 From 6dabaf5afef5767eedbaadcba8e3e06e46c645a4 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 13 Feb 2017 20:56:34 +0100 Subject: l 2 monit: add radio test --- lass/2configs/monitoring/monit-alarms.nix | 40 +++++++++++++++++++------------ 1 file changed, 25 insertions(+), 15 deletions(-) (limited to 'lass/2configs/monitoring') diff --git a/lass/2configs/monitoring/monit-alarms.nix b/lass/2configs/monitoring/monit-alarms.nix index a85738538..d14275c17 100644 --- a/lass/2configs/monitoring/monit-alarms.nix +++ b/lass/2configs/monitoring/monit-alarms.nix @@ -13,21 +13,31 @@ in { krebs.monit = { enable = true; http.enable = true; - alarms.nirwanabluete = { - test = "${pkgs.curl}/bin/curl -sf 'https://nirwanabluete.de/'"; - alarm = echoToIrc "test nirwanabluete failed"; - }; - alarms.ubik = { - test = "${pkgs.curl}/bin/curl -sf 'https://ubikmedia.de'"; - alarm = echoToIrc "test ubik failed"; - }; - alarms.hfos = { - test = "${pkgs.curl}/bin/curl -sf --insecure 'https://hfos.hackerfleet.de'"; - alarm = echoToIrc "test hfos failed"; - }; - alarms.cac-panel = { - test = "${pkgs.curl}/bin/curl -sf 'https://panel.cloudatcost.com/login.php'"; - alarm = echoToIrc "test cac-panel failed"; + alarms = { + nirwanabluete = { + test = "${pkgs.curl}/bin/curl -sf 'https://nirwanabluete.de/'"; + alarm = echoToIrc "test nirwanabluete failed"; + }; + ubik = { + test = "${pkgs.curl}/bin/curl -sf 'https://ubikmedia.de'"; + alarm = echoToIrc "test ubik failed"; + }; + hfos = { + test = "${pkgs.curl}/bin/curl -sf --insecure 'https://hfos.hackerfleet.de'"; + alarm = echoToIrc "test hfos failed"; + }; + cac-panel = { + test = "${pkgs.curl}/bin/curl -sf 'https://panel.cloudatcost.com/login.php'"; + alarm = echoToIrc "test cac-panel failed"; + }; + radio = { + test = pkgs.writeBash "check_stream" '' + ${pkgs.curl}/bin/curl -sif http://lassul.us:8000/radio.ogg \ + | ${pkgs.gawk}/bin/awk '/^\r$/{exit}{print $0}' \ + | ${pkgs.gnugrep}/bin/grep -q "200 OK" || exit "''${PIPESTATUS[0]}" + ''; + alarm = echoToIrc "test radio failed"; + }; }; }; } -- cgit v1.2.3 From e7f12c4d865c5556b408a8301de6e2eabb39165b Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 13 Feb 2017 20:58:29 +0100 Subject: l 2 monit: open monit port to retiolum --- lass/2configs/monitoring/monit-alarms.nix | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lass/2configs/monitoring') diff --git a/lass/2configs/monitoring/monit-alarms.nix b/lass/2configs/monitoring/monit-alarms.nix index d14275c17..063fadb1b 100644 --- a/lass/2configs/monitoring/monit-alarms.nix +++ b/lass/2configs/monitoring/monit-alarms.nix @@ -40,5 +40,9 @@ in { }; }; }; + + krebs.iptables.tables.filter.INPUT.rules = [ + { predicate = "-p tcp -i retiolum --dport 9093"; target = "ACCEPT"; } + ]; } -- cgit v1.2.3 From 47a4df4558803937823e3c671153bda372d60de5 Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 16 Feb 2017 00:06:15 +0100 Subject: l 2: use #noise on ni for noisy stuff --- lass/2configs/monitoring/monit-alarms.nix | 2 +- lass/2configs/monitoring/server.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lass/2configs/monitoring') diff --git a/lass/2configs/monitoring/monit-alarms.nix b/lass/2configs/monitoring/monit-alarms.nix index 063fadb1b..05d64c049 100644 --- a/lass/2configs/monitoring/monit-alarms.nix +++ b/lass/2configs/monitoring/monit-alarms.nix @@ -6,7 +6,7 @@ let set -euf export LOGNAME=prism-alarm ${pkgs.irc-announce}/bin/irc-announce \ - ni.r 6667 prism-alarm \#retiolum "${msg}" >/dev/null + ni.r 6667 prism-alarm \#noise "${msg}" >/dev/null ''; in { diff --git a/lass/2configs/monitoring/server.nix b/lass/2configs/monitoring/server.nix index bbae4511e..b6ccf9cc1 100644 --- a/lass/2configs/monitoring/server.nix +++ b/lass/2configs/monitoring/server.nix @@ -29,7 +29,7 @@ with import ; data="$(${pkgs.jq}/bin/jq -r .message)" export LOGNAME=prism-alarm ${pkgs.irc-announce}/bin/irc-announce \ - ni.r 6667 prism-alarm \#retiolum "$data" >/dev/null + ni.r 6667 prism-alarm \#noise "$data" >/dev/null ''; in { enable = true; -- cgit v1.2.3 From af93c8cba606813007bab84e8d1d8d822764333a Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 21 Feb 2017 14:31:15 +0100 Subject: l 2 monitoring monit: use hostname in irc alarm --- lass/2configs/monitoring/monit-alarms.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lass/2configs/monitoring') diff --git a/lass/2configs/monitoring/monit-alarms.nix b/lass/2configs/monitoring/monit-alarms.nix index 05d64c049..9333ef9d2 100644 --- a/lass/2configs/monitoring/monit-alarms.nix +++ b/lass/2configs/monitoring/monit-alarms.nix @@ -6,7 +6,7 @@ let set -euf export LOGNAME=prism-alarm ${pkgs.irc-announce}/bin/irc-announce \ - ni.r 6667 prism-alarm \#noise "${msg}" >/dev/null + ni.r 6667 ${config.networking.hostName}-alarm \#noise "${msg}" >/dev/null ''; in { -- cgit v1.2.3 From 5b3b825a520a13052f39ab209234a7451c8f8539 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 21 Feb 2017 14:31:49 +0100 Subject: l 2 monitoring monit: remove hfos test --- lass/2configs/monitoring/monit-alarms.nix | 4 ---- 1 file changed, 4 deletions(-) (limited to 'lass/2configs/monitoring') diff --git a/lass/2configs/monitoring/monit-alarms.nix b/lass/2configs/monitoring/monit-alarms.nix index 9333ef9d2..65b91a745 100644 --- a/lass/2configs/monitoring/monit-alarms.nix +++ b/lass/2configs/monitoring/monit-alarms.nix @@ -22,10 +22,6 @@ in { test = "${pkgs.curl}/bin/curl -sf 'https://ubikmedia.de'"; alarm = echoToIrc "test ubik failed"; }; - hfos = { - test = "${pkgs.curl}/bin/curl -sf --insecure 'https://hfos.hackerfleet.de'"; - alarm = echoToIrc "test hfos failed"; - }; cac-panel = { test = "${pkgs.curl}/bin/curl -sf 'https://panel.cloudatcost.com/login.php'"; alarm = echoToIrc "test cac-panel failed"; -- cgit v1.2.3