prometheus: added but not enabled yet
This commit is contained in:
parent
26cb5919fa
commit
61bbceb2cf
|
@ -55,6 +55,10 @@ in
|
|||
type = types.bool;
|
||||
default = config.profile.services.telemetry.enable;
|
||||
};
|
||||
prometheus.enable = mkOption {
|
||||
type = types.bool;
|
||||
default = config.profile.services.telemetry.enable;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ let
|
|||
cfg = config.profile.services.telemetry.alloy;
|
||||
webguiListenAddress = "0.0.0.0:5319";
|
||||
domain = "alloy.tigor.web.id";
|
||||
inherit (lib.strings) optionalString;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
|
|
|
@ -6,5 +6,6 @@
|
|||
./tempo.nix
|
||||
./alloy.nix
|
||||
./mimir.nix
|
||||
./prometheus.nix
|
||||
];
|
||||
}
|
||||
|
|
50
system/services/telemetry/prometheus.nix
Normal file
50
system/services/telemetry/prometheus.nix
Normal file
|
@ -0,0 +1,50 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.profile.services.telemetry.prometheus;
|
||||
inherit (lib) mkIf;
|
||||
in
|
||||
{
|
||||
config = mkIf cfg.enable {
|
||||
services.prometheus = {
|
||||
enable = false;
|
||||
port = 0; # Random
|
||||
enableAgentMode = true;
|
||||
globalConfig = {
|
||||
external_labels = {
|
||||
instance = "homeserver";
|
||||
};
|
||||
};
|
||||
remoteWrite =
|
||||
let
|
||||
mimirServer = config.services.mimir.configuration.server;
|
||||
in
|
||||
[
|
||||
{
|
||||
url = "http://${mimirServer.http_listen_address}:${toString mimirServer.http_listen_port}/api/v1/push";
|
||||
}
|
||||
];
|
||||
scrapeConfigs = [
|
||||
{
|
||||
job_name = "systemd";
|
||||
static_configs = [{
|
||||
labels = {
|
||||
job = "systemd";
|
||||
};
|
||||
targets =
|
||||
let
|
||||
systemdExporter = config.services.prometheus.exporters.systemd;
|
||||
in
|
||||
[
|
||||
"${systemdExporter.listenAddress}:${toString systemdExporter.port}"
|
||||
];
|
||||
}];
|
||||
}
|
||||
];
|
||||
exporters = {
|
||||
systemd = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue