mirror of
https://codeberg.org/muon/home.git
synced 2025-12-05 23:57:46 +00:00
54 lines
1.1 KiB
Nix
54 lines
1.1 KiB
Nix
{ pkgs, lib, config, ... }:
|
|
let
|
|
cfg = config.mods.server;
|
|
port = cfg.nginx.ports.dash;
|
|
in with lib; {
|
|
options.mods.server = {
|
|
dash = {
|
|
enable = mkEnableOption {
|
|
default = false;
|
|
description = "enables metrics dashboard";
|
|
};
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.dash.enable {
|
|
services.grafana = {
|
|
enable = true;
|
|
domain = "dash.muon.host";
|
|
addr = "0.0.0.0";
|
|
|
|
provision.datasources.settings.datasources = [{
|
|
name = "Prometheus";
|
|
type = "Prometheus";
|
|
url = "http://localhost:${toString config.services.prometheus.port}";
|
|
}];
|
|
|
|
inherit port;
|
|
};
|
|
|
|
services.prometheus = {
|
|
enable = true;
|
|
port = 9001;
|
|
|
|
exporters = {
|
|
node = {
|
|
enable = true;
|
|
enabledCollectors = [ "systemd" ];
|
|
port = 9002;
|
|
};
|
|
};
|
|
|
|
scrapeConfigs = [{
|
|
job_name = "muho";
|
|
static_configs = [{
|
|
targets = [
|
|
"127.0.0.1:${
|
|
toString config.services.prometheus.exporters.node.port
|
|
}"
|
|
];
|
|
}];
|
|
}];
|
|
};
|
|
};
|
|
}
|