Enable dalinar monitoring with prometheus and grafana

This commit is contained in:
Johannes Rothe 2025-03-17 22:02:49 +01:00
parent fd85cc1d47
commit 471a94d3e5

View File

@ -30,6 +30,9 @@
networking.firewall = {
enable = true;
allowedUDPPorts = [ 53 ];
allowedTCPPorts = [
config.services.grafana.settings.server.http_port
];
};
networking.useNetworkd = true;
services.resolved = {
@ -100,7 +103,7 @@
enable = true;
settings = {
upstreams.groups.default = [
"127.0.0.1:${builtins.toString config.services.unbound.settings.server.port}"
"127.0.0.1:${toString config.services.unbound.settings.server.port}"
];
blocking = {
denylists.ads = [
@ -128,6 +131,47 @@
# TODO set data dir
};
services.prometheus = {
enable = true;
retentionTime = "60d";
globalConfig.scrape_interval = "15s";
scrapeConfigs = [
{
job_name = "node";
static_configs = [{
targets = [ "localhost:${toString config.services.prometheus.exporters.node.port}" ];
}];
}
{
job_name = "blocky";
static_configs = [{
targets = [ "localhost:${toString config.services.blocky.settings.ports.http}" ];
}];
}
];
exporters.node = {
enable = true;
enabledCollectors = [
"systemd"
];
disabledCollectors = [
"textfile"
];
port = 9100;
};
};
services.grafana = {
enable = true;
settings = {
server = {
http_addr = "0.0.0.0";
http_port = 3000;
domain = "dalinar";
};
};
};
# This option defines the first version of NixOS you have installed on this particular machine,
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
#