fix: alerting

This commit is contained in:
2026-01-05 10:45:38 +01:00
parent ed451e3b95
commit 21c5c6dbd5
6 changed files with 32 additions and 31 deletions

View File

@@ -1,6 +1,9 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.victoriametrics;
serviceRegex = concatStringsSep "|" cfg.monitoredServices;
configure_prom = builtins.toFile "prometheus.yml" ''
scrape_configs:
# System metrics
@@ -27,13 +30,20 @@ let
regex: 'node_systemd_unit_state'
action: keep
- source_labels: [name]
regex: '(container@git|microvm@git-runner-|postfix|dovecot|openldap|wireguard-wg_cloonar).*\.service'
regex: '(${serviceRegex}).*\.service'
action: keep
${concatStringsSep "\n" config.services.victoriametrics.extraScrapeConfigs}
${concatStringsSep "\n" cfg.extraScrapeConfigs}
'';
in {
options.services.victoriametrics = {
monitoredServices = mkOption {
type = types.listOf types.str;
default = [];
description = "List of systemd service name patterns to monitor (without .service suffix)";
example = [ "mysql" "nginx" "phpfpm-.*" ];
};
extraScrapeConfigs = mkOption {
type = types.listOf types.str;
default = [];