Merge pull request #146653 from DarkDNA/nixos/fix-systemd-exporter/extraFlags
nixos/prometheus/systemd: Implement the extraFlags config option.
This commit is contained in:
commit
06c57317c2
2 changed files with 10 additions and 1 deletions
|
@ -11,7 +11,7 @@ in {
|
|||
serviceConfig = {
|
||||
ExecStart = ''
|
||||
${pkgs.prometheus-systemd-exporter}/bin/systemd_exporter \
|
||||
--web.listen-address ${cfg.listenAddress}:${toString cfg.port}
|
||||
--web.listen-address ${cfg.listenAddress}:${toString cfg.port} ${concatStringsSep " " cfg.extraFlags}
|
||||
'';
|
||||
RestrictAddressFamilies = [
|
||||
# Need AF_UNIX to collect data
|
||||
|
|
|
@ -1156,6 +1156,10 @@ let
|
|||
systemd = {
|
||||
exporterConfig = {
|
||||
enable = true;
|
||||
|
||||
extraFlags = [
|
||||
"--collector.enable-restart-count"
|
||||
];
|
||||
};
|
||||
metricProvider = { };
|
||||
exporterTest = ''
|
||||
|
@ -1166,6 +1170,11 @@ let
|
|||
'systemd_unit_state{name="basic.target",state="active",type="target"} 1'
|
||||
)
|
||||
)
|
||||
succeed(
|
||||
"curl -sSf localhost:9558/metrics | grep '{}'".format(
|
||||
'systemd_service_restart_total{state="prometheus-systemd-exporter.service"} 0'
|
||||
)
|
||||
)
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue