feat(server/grafana,server/prometheus): add prometheus datasource and node exporter config
This commit is contained in:
parent
10661dda3b
commit
7e256c954d
2 changed files with 24 additions and 1 deletions
|
@ -19,7 +19,6 @@ in
|
|||
extraConfig.proxyWebsockets = true;
|
||||
locations."/api/live/" = {
|
||||
proxyPass = "http://${config.system.hostname}:${builtins.toString cfg.port}";
|
||||
proxyWebsockets = true;
|
||||
};
|
||||
});
|
||||
services.grafana = {
|
||||
|
@ -29,6 +28,13 @@ in
|
|||
http_port = cfg.port;
|
||||
http_addr = "0.0.0.0";
|
||||
};
|
||||
provision.datasources.settings.datasources = [
|
||||
{
|
||||
name = "prometheus";
|
||||
type = "Prometheus";
|
||||
url = "http://${config.system.hostname}:${builtins.toString config.server.monitoring.prometheus.port}";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ let
|
|||
inherit (lib) mkEnableOption mkIf;
|
||||
inherit (lib.pantheon) mkPortOption;
|
||||
cfg = config.server.monitoring.prometheus;
|
||||
upstreamCfg = config.services.prometheus;
|
||||
in
|
||||
{
|
||||
options.server.monitoring.prometheus = {
|
||||
|
@ -14,6 +15,22 @@ in
|
|||
services.prometheus = {
|
||||
enable = true;
|
||||
inherit (cfg) port;
|
||||
scrapeConfigs = [
|
||||
{
|
||||
job_name = "chrysalis";
|
||||
static_configs = [
|
||||
{
|
||||
targets = [ "127.0.0.1:${toString upstreamCfg.exporters.node.port}" ];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
|
||||
exporters.node = {
|
||||
enable = true;
|
||||
enabledCollectors = [ "systemd" ];
|
||||
port = 9091;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue