parent
0eb6953b0d
commit
d74a131529
14 changed files with 259 additions and 67 deletions
|
|
@ -9,21 +9,21 @@ with lib;
|
|||
let
|
||||
cfg = config.xyno.services.monitoring;
|
||||
|
||||
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";
|
||||
# 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
|
||||
{
|
||||
options.xyno.services.monitoring.enable =
|
||||
mkEnableOption "enables monitoring (prometheus exporters and stuff)";
|
||||
options.xyno.services.monitoring.remoteWriteUrl = mkOption {
|
||||
type = types.str;
|
||||
default = "http://${firstInstanceWithPromServer}.${config.xyno.services.wireguard.monHostsDomain}:8428/api/v1/write";
|
||||
default = "https://metrics.xyno.systems/api/v1/write";
|
||||
description = "where prometheus metrics should be pushed to";
|
||||
};
|
||||
options.xyno.services.monitoring.prometheusServer = mkOption {
|
||||
|
|
@ -48,8 +48,9 @@ in
|
|||
enabledCollectors = [ "systemd" ];
|
||||
};
|
||||
xyno.services.monitoring.exporters.node = config.services.prometheus.exporters.node.port;
|
||||
# TODO: oauth2 with client per host -> kanidm -> oauth2-proxy -> victoriametrics server
|
||||
services.vmagent = {
|
||||
remoteWrite.url = cfg.remoteWriteUrl;
|
||||
remoteWrite.url = if cfg.prometheusServer then "http://localhost:8428/api/v1/write" else cfg.remoteWriteUrl;
|
||||
remoteWrite.basicAuthUsername = vmBasicAuthUsername;
|
||||
remoteWrite.basicAuthPasswordFile = config.sops.secrets."victoriametrics/basicAuthPassword".path;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue