hosts/monitoring-3: move to blackbox monitoring
This commit is contained in:
parent
eefd8af665
commit
be5b1c1baf
@ -123,6 +123,7 @@
|
||||
enable = true;
|
||||
id = "101";
|
||||
pubkey = "H9Pvx/BzwEMM7acT9mioT8zBD2Yn13L82EKKqdAfeGM=";
|
||||
blackbox = true;
|
||||
};
|
||||
|
||||
system.stateVersion = "21.03";
|
||||
|
@ -29,6 +29,14 @@ let
|
||||
attrByPath ["clerie" "monitoring" "bird"] false host.config)
|
||||
monitoringHosts);
|
||||
|
||||
blackboxMonitoringTargets = mapAttrsToList (name: host:
|
||||
"${host.config.networking.hostName}.mon.clerie.de:9115")
|
||||
(filterAttrs (name: host:
|
||||
attrByPath ["clerie" "monitoring" "blackbox"] false host.config)
|
||||
monitoringHosts);
|
||||
|
||||
eachWithEachOther = (f: x: y: lib.lists.flatten (lib.lists.forEach x (a: lib.lists.forEach y (b: f a b))));
|
||||
|
||||
in {
|
||||
imports =
|
||||
[
|
||||
@ -68,19 +76,6 @@ in {
|
||||
networking.firewall.allowedUDPPorts = [ 54523 ];
|
||||
|
||||
services.prometheus.exporters.node.enable = true;
|
||||
services.prometheus.exporters.smokeping = {
|
||||
enable = true;
|
||||
listenAddress = "[::1]";
|
||||
port = 9374;
|
||||
hosts = [
|
||||
"clerie.de"
|
||||
"fluorine.net.clerie.de"
|
||||
"www.fem.tu-ilmenau.de"
|
||||
"www.heise.de"
|
||||
"212.218.154.100" # ie10-ffm1
|
||||
"matrix.bau-ha.us"
|
||||
];
|
||||
};
|
||||
|
||||
services.prometheus.xmpp-alerts = {
|
||||
enable = true;
|
||||
@ -163,6 +158,93 @@ in {
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
job_name = "blackbox_icmp6";
|
||||
scrape_interval = "20s";
|
||||
metrics_path = "/probe";
|
||||
params = {
|
||||
module = [ "icmp6" ];
|
||||
};
|
||||
static_configs = [
|
||||
{
|
||||
targets = eachWithEachOther (instance: target: "${instance};${target}") blackboxMonitoringTargets [
|
||||
"clerie.de"
|
||||
"tagesschau.de"
|
||||
"google.com"
|
||||
"achtbaan.nikhef.nl"
|
||||
"fluorine.net.clerie.de"
|
||||
"www.fem.tu-ilmenau.de"
|
||||
"www.heise.de"
|
||||
];
|
||||
}
|
||||
];
|
||||
relabel_configs = [
|
||||
{
|
||||
source_labels = [ "__address__" ];
|
||||
regex = "(.+);(.+)";
|
||||
target_label = "__param_target";
|
||||
replacement = "\${2}";
|
||||
}
|
||||
{
|
||||
source_labels = [ "__param_target" ];
|
||||
target_label = "target";
|
||||
}
|
||||
{
|
||||
source_labels = [ "__address__" ];
|
||||
regex = "(.+);(.+)";
|
||||
target_label = "__address__";
|
||||
replacement = "\${1}";
|
||||
}
|
||||
{
|
||||
source_labels = [ "__address__" ];
|
||||
target_label = "instance";
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
job_name = "blackbox_icmp4";
|
||||
scrape_interval = "20s";
|
||||
metrics_path = "/probe";
|
||||
params = {
|
||||
module = [ "icmp4" ];
|
||||
};
|
||||
static_configs = [
|
||||
{
|
||||
targets = eachWithEachOther (instance: target: "${instance};${target}") blackboxMonitoringTargets [
|
||||
"clerie.de"
|
||||
"tagesschau.de"
|
||||
"google.com"
|
||||
"achtbaan.nikhef.nl"
|
||||
"www.fem.tu-ilmenau.de"
|
||||
"www.heise.de"
|
||||
"ie10-ffm2.nodes.nethinks.com"
|
||||
"matrix.bau-ha.us"
|
||||
];
|
||||
}
|
||||
];
|
||||
relabel_configs = [
|
||||
{
|
||||
source_labels = [ "__address__" ];
|
||||
regex = "(.+);(.+)";
|
||||
target_label = "__param_target";
|
||||
replacement = "\${2}";
|
||||
}
|
||||
{
|
||||
source_labels = [ "__param_target" ];
|
||||
target_label = "target";
|
||||
}
|
||||
{
|
||||
source_labels = [ "__address__" ];
|
||||
regex = "(.+);(.+)";
|
||||
target_label = "__address__";
|
||||
replacement = "\${1}";
|
||||
}
|
||||
{
|
||||
source_labels = [ "__address__" ];
|
||||
target_label = "instance";
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
job_name = "zimmer-temp";
|
||||
scrape_interval = "20s";
|
||||
@ -200,17 +282,6 @@ in {
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
job_name = "smokeping";
|
||||
scrape_interval = "20s";
|
||||
static_configs = [
|
||||
{
|
||||
targets = [
|
||||
"monitoring-3.mon.clerie.de:9374"
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
alertmanagers = [
|
||||
{
|
||||
|
@ -58,6 +58,7 @@
|
||||
enable = true;
|
||||
id = "102";
|
||||
pubkey = "+mJN+ustPo2ehP0wqajYs3nTdJ0SPuIDyiZQSHFIK3o=";
|
||||
blackbox = true;
|
||||
};
|
||||
|
||||
system.stateVersion = "21.03";
|
||||
|
@ -22,6 +22,7 @@ in
|
||||
description = "Public Key of the monitoring wireguard interface of this host";
|
||||
};
|
||||
bird = mkEnableOption "Monitor bird";
|
||||
blackbox = mkEnableOption "Monitor blackbox";
|
||||
};
|
||||
};
|
||||
|
||||
@ -54,5 +55,24 @@ in
|
||||
openFirewall = true;
|
||||
firewallFilter = "-i wg-monitoring -p tcp -m tcp --dport 9324";
|
||||
};
|
||||
|
||||
services.prometheus.exporters.blackbox = mkIf cfg.blackbox {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
firewallFilter = "-i wg-monitoring -p tcp -m tcp --dport 9115";
|
||||
configFile = pkgs.writeText "blackbox.yml" ''
|
||||
modules:
|
||||
icmp6:
|
||||
prober: icmp
|
||||
icmp:
|
||||
preferred_ip_protocol: ip6
|
||||
ip_protocol_fallback: false
|
||||
icmp4:
|
||||
prober: icmp
|
||||
icmp:
|
||||
preferred_ip_protocol: ip4
|
||||
ip_protocol_fallback: false
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user