fix: alerting
This commit is contained in:
@@ -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 = [];
|
||||
|
||||
Reference in New Issue
Block a user