Files
windows_exporter/contrib/mixin/alerts/hyperv.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

48 lines
1.7 KiB
Jsonnet

{
local c = self._config,
local a = (import '../lib/alerts.libsonnet')(c),
prometheusAlerts+:: {
groups+: a.group('windows-hyperv', collectors=['hyperv'], rules=[
{
alert: 'WindowsHyperVWMIUnhealthy',
expr: |||
windows_hyperv_wmi_health{%(windowsExporterSelector)s} == 0
||| % c,
'for': '10m',
labels: { severity: 'warning' },
annotations: {
summary: 'Hyper-V WMI namespace is not responding',
description: 'The Hyper-V WMI namespace on {{ $labels.instance }} has not responded for 10 minutes; Hyper-V metrics are missing.',
},
state:: true,
},
{
alert: 'WindowsHyperVReplicationCritical',
expr: |||
windows_hyperv_replica_vm_health{%(windowsExporterSelector)s} == 3
||| % c,
'for': '5m',
labels: { severity: c.criticalSeverity },
annotations: {
summary: 'Hyper-V replication is critical',
description: 'Replication of virtual machine {{ $labels.vm }} ({{ $labels.relationship }}) on {{ $labels.instance }} has been in critical health for 5 minutes.',
},
state:: true,
},
{
alert: 'WindowsHyperVReplicationWarning',
expr: |||
windows_hyperv_replica_vm_health{%(windowsExporterSelector)s} == 2
||| % c,
'for': '15m',
labels: { severity: 'warning' },
annotations: {
summary: 'Hyper-V replication has a warning',
description: 'Replication of virtual machine {{ $labels.vm }} ({{ $labels.relationship }}) on {{ $labels.instance }} has been in warning health for 15 minutes.',
},
state:: true,
},
]),
},
}