Files
windows_exporter/contrib/mixin/alerts/system.libsonnet
T
Jan-Otto Kröpke 51a579e031 mixin: one alert file per collector with plain PromQL
Split alerts/alerts.libsonnet into one file per collector under alerts/,
like kubernetes-mixin. Each rule is a plain Prometheus alerting rule with
the PromQL written out in an expr block and %(name)s placeholders for the
_config values; lib/alerts.libsonnet keeps the collector and per-alert
gating and keep_firing_for. The pagefile, diskdrive and license alerts
get groups of their own so that one file is one group. The rendered
default rules are unchanged apart from expr block scalars.

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2026-10-17 14:53:14 +00:00

26 lines
1.0 KiB
Jsonnet

{
local c = self._config,
local a = (import '../lib/alerts.libsonnet')(c),
prometheusAlerts+:: {
groups+: a.group('windows-system', collectors=['system'], rules=[
{
alert: 'WindowsHostRebooted',
// Fires once per reboot: for the first ten minutes after the boot,
// and only on a host that was monitored before it. The exporter is
// down while the host reboots, so the second operand takes the last
// boot time of the hour before, not the sample of ten minutes ago.
expr: |||
(time() - windows_system_boot_time_timestamp{%(windowsExporterSelector)s}) < 600
and (time() - last_over_time(windows_system_boot_time_timestamp{%(windowsExporterSelector)s}[1h] offset 10m)) > 600
||| % c,
labels: { severity: c.infoSeverity },
annotations: {
summary: 'Windows host has rebooted',
description: '{{ $labels.instance }} rebooted {{ $value | humanizeDuration }} ago.',
},
state:: true,
},
]),
},
}