From 7bdd17ff928d1ee7008a5b8b636b4b7df859768e Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 6 Jan 2022 20:53:52 +0100 Subject: vidhar: prometheus: ... --- hosts/vidhar/prometheus/default.nix | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'hosts') diff --git a/hosts/vidhar/prometheus/default.nix b/hosts/vidhar/prometheus/default.nix index 3fd07bbe..31bc6b07 100644 --- a/hosts/vidhar/prometheus/default.nix +++ b/hosts/vidhar/prometheus/default.nix @@ -182,6 +182,29 @@ in { scrape_interval = "1s"; } ]; + + rules = [ + (generators.toYAML { + groups = [ + { name = "systemd-starts"; + rules = [ + { record = "systemd_unit_runtime_seconds"; + expr = "timestamp(systemd_unit_start_time_seconds) - (systemd_unit_start_time_seconds > 0)"; + } + { record = "systemd_unit_runtime_seconds:resets_per_hour"; + expr = "resets(systemd_unit_start_time_seconds:uptime[1h])"; + } + { record = "systemd_unit_runtime_seconds:resets_per_day"; + expr = "resets(systemd_unit_start_time_seconds:uptime[1d])"; + } + { record = "systemd_unit_runtime_seconds:resets_per_week"; + expr = "resets(systemd_unit_start_time_seconds:uptime[1w])"; + } + ]; + } + ]; + }) + ]; }; users.users.${config.services.prometheus.exporters.unbound.user} = { description = "Prometheus unbound exporter service user"; -- cgit v1.2.3