update
This commit is contained in:
parent
33ee2f5760
commit
f7afa33a13
14 changed files with 319 additions and 178 deletions
|
|
@ -2,18 +2,16 @@
|
|||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
instanceConfig,
|
||||
instanceConfigs,
|
||||
# inputs,
|
||||
otherNodes,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.xyno.services.monitoring;
|
||||
|
||||
firstInstanceWithPromServer = (builtins.head (
|
||||
builtins.filter (x: x ? prometheusServer && x.prometheusServer) (attrValues instanceConfigs)
|
||||
)).hostName;
|
||||
firstInstanceWithPromServer = if cfg.prometheusServer then config.networking.hostName else (builtins.head (
|
||||
attrValues (filterAttrs (n: v: v.config.xyno.services.monitoring.prometheusServer) (otherNodes))
|
||||
)).config.networking.hostName;
|
||||
vmBasicAuthUsername = "xyno-monitoring";
|
||||
in
|
||||
{
|
||||
|
|
@ -24,6 +22,10 @@ in
|
|||
default = "http://${firstInstanceWithPromServer}.${config.xyno.services.wireguard.monHostsDomain}:8428/api/v1/write";
|
||||
description = "where prometheus metrics should be pushed to";
|
||||
};
|
||||
options.xyno.services.monitoring.prometheusServer = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
};
|
||||
options.xyno.services.monitoring.exporters = mkOption {
|
||||
type = types.attrsOf (types.either types.int types.str);
|
||||
description = "names of exporters and their ports (to open fw and generate prometheus config)";
|
||||
|
|
@ -64,7 +66,7 @@ in
|
|||
};
|
||||
|
||||
})
|
||||
(mkIf (cfg.enable && instanceConfig ? prometheusServer && instanceConfig.prometheusServer) {
|
||||
(mkIf (cfg.enable && cfg.prometheusServer) {
|
||||
xyno.impermanence.directories = [ "/var/lib/${config.services.victoriametrics.stateDir}" ];
|
||||
sops.secrets."victoriametrics/basicAuthPassword" = {
|
||||
reloadUnits = [ "victoriametrics.service" ];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue