feat: Durnitisp network quality monitoring
This commit is contained in:
parent
5d221bfdfe
commit
d94b62e4ee
@ -40,6 +40,7 @@
|
||||
};
|
||||
};
|
||||
|
||||
services.durnitisp.enable = true;
|
||||
services.node-exporter.enable = true;
|
||||
services.prometheus.enable = true;
|
||||
services.heracles.enable = true;
|
||||
@ -90,6 +91,38 @@
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
title = "Network Quality";
|
||||
query_type = "Range";
|
||||
d3_tick_format = "~s";
|
||||
yaxes = [
|
||||
{
|
||||
anchor = "y";
|
||||
}
|
||||
];
|
||||
plots = [
|
||||
{
|
||||
source = "http://${config.services.prometheus.listen}";
|
||||
query = ''
|
||||
stun_attempt_latency_ms
|
||||
'';
|
||||
meta = {
|
||||
name_format = "`UDP \${labels.domain} latency`";
|
||||
yaxis = "y";
|
||||
};
|
||||
}
|
||||
{
|
||||
source = "http://${config.services.prometheus.listen}";
|
||||
query = ''
|
||||
ping_latency
|
||||
'';
|
||||
meta = {
|
||||
name_format = "`Ping \${labels.device} latency`";
|
||||
yaxis = "y";
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
title = "Network Traffic Bytes";
|
||||
query_type = "Range";
|
||||
@ -122,38 +155,6 @@
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
title = "Network problems";
|
||||
query_type = "Range";
|
||||
d3_tick_format = "~s";
|
||||
yaxes = [
|
||||
{
|
||||
anchor = "y";
|
||||
}
|
||||
];
|
||||
plots = [
|
||||
{
|
||||
source = "http://${config.services.prometheus.listen}";
|
||||
query = ''
|
||||
irate(node_network_transmit_errs_total{device=~'(lo|en).*'}[5m]) / irate(node_network_transmit_packets_total{device=~'(lo|en).*'}[5m])
|
||||
'';
|
||||
meta = {
|
||||
name_format = "`\${labels.device} Tx Err rate`";
|
||||
yaxis = "y";
|
||||
};
|
||||
}
|
||||
{
|
||||
source = "http://${config.services.prometheus.listen}";
|
||||
query = ''
|
||||
irate(node_network_receive_drop_total{device=~'(lo|en).*'}[5m]) / irate(node_network_receive_packets_total{device=~'(lo|en).*'}[5m])
|
||||
'';
|
||||
meta = {
|
||||
name_format = "`\${labels.device} Rx drop rate`";
|
||||
yaxis = "y";
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
|
@ -191,6 +191,7 @@ EOF";
|
||||
lua-language-server
|
||||
rust-analyzer
|
||||
omnisharp-roslyn
|
||||
dbeaver
|
||||
]);
|
||||
};
|
||||
};
|
||||
@ -219,6 +220,7 @@ EOF";
|
||||
# This is needed because the ccache used by lean4Pkg is broken
|
||||
ccache = prev.ccache.override { doCheck = false; };
|
||||
heracles = heracles-flake.packages."${system}".default;
|
||||
durnitisp = durnitisp;
|
||||
})
|
||||
rust-overlay
|
||||
];
|
||||
|
@ -24,6 +24,15 @@ with lib;
|
||||
defaultText = "[]";
|
||||
};
|
||||
};
|
||||
|
||||
options.services.durnitisp = {
|
||||
enable = mkEnableOption "Enable the heracles server";
|
||||
listen = mkOption {
|
||||
description = "[host]:port to listen on for the durnitisp metrics server";
|
||||
default = "localhost:9002";
|
||||
defaultText = "localhost:9002";
|
||||
};
|
||||
};
|
||||
|
||||
options.services.prometheus = {
|
||||
enable = lib.mkEnableOption "Enable the prometheus server";
|
||||
@ -48,6 +57,18 @@ with lib;
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
job_name = "network_quality";
|
||||
scrape_interval = "30s";
|
||||
metrics_path = "/";
|
||||
static_configs = [
|
||||
{
|
||||
targets = [
|
||||
"${config.services.durnitisp.listen}"
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
defaultText = ''{
|
||||
@ -109,6 +130,18 @@ with lib;
|
||||
RunAtLoad = true;
|
||||
};
|
||||
};
|
||||
|
||||
launchd.daemons.durnitisp = mkIf config.services.durnitisp.enable {
|
||||
serviceConfig = {
|
||||
ProgramArguments = [
|
||||
"${pkgs.durnitisp}/bin/durnitisp"
|
||||
"--listenHost=${config.services.durnitisp.listen}"
|
||||
];
|
||||
|
||||
KeepAlive = true;
|
||||
RunAtLoad = true;
|
||||
};
|
||||
};
|
||||
|
||||
launchd.user.agents.prometheus = mkIf config.services.prometheus.enable {
|
||||
serviceConfig = {
|
||||
@ -121,6 +154,9 @@ with lib;
|
||||
StandardOutPath = "${config.services.prometheus.dataPath}/prometheus-out.log";
|
||||
StandardErrorPath = "${config.services.prometheus.dataPath}/prometheus-err.log";
|
||||
WorkingDirectory=config.services.prometheus.dataPath;
|
||||
WatchPaths = [
|
||||
"/etc/${config.environment.etc."prometheus.yaml".target}"
|
||||
];
|
||||
KeepAlive = true;
|
||||
RunAtLoad = true;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user