mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-10-18 18:49:05 +02:00
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>
48 lines
1.7 KiB
Jsonnet
48 lines
1.7 KiB
Jsonnet
{
|
|
local c = self._config,
|
|
local a = (import '../lib/alerts.libsonnet')(c),
|
|
prometheusAlerts+:: {
|
|
groups+: a.group('windows-time', collectors=['time'], rules=[
|
|
{
|
|
alert: 'WindowsClockNotSynchronising',
|
|
expr: |||
|
|
windows_time_ntp_client_time_sources{%(windowsExporterSelector)s} == 0
|
|
||| % c,
|
|
'for': '10m',
|
|
labels: { severity: 'warning' },
|
|
annotations: {
|
|
summary: 'Windows clock has no NTP time source',
|
|
description: 'Windows Time on {{ $labels.instance }} has had no active NTP time source for 10 minutes.',
|
|
},
|
|
state:: true,
|
|
},
|
|
{
|
|
alert: 'WindowsClockSkewDetected',
|
|
expr: |||
|
|
abs(windows_time_computed_time_offset_seconds{%(windowsExporterSelector)s}) > %(clockOffsetThresholdSeconds)g
|
|
||| % c,
|
|
'for': '10m',
|
|
labels: { severity: 'warning' },
|
|
annotations: {
|
|
summary: 'Windows clock offset is high',
|
|
description: 'Windows Time on {{ $labels.instance }} reports a clock offset above %(clockOffsetThresholdSeconds)g seconds for 10 minutes.' % c,
|
|
},
|
|
},
|
|
{
|
|
alert: 'WindowsClockSourceLocal',
|
|
// Covers domain members (NT5DS) too, which the NTP source count misses.
|
|
expr: |||
|
|
windows_time_clock_sync_source{%(windowsExporterSelector)s, type=~"Local CMOS Clock|NoSync"} == 1
|
|
||| % c,
|
|
'for': '10m',
|
|
labels: { severity: 'warning' },
|
|
annotations: {
|
|
summary: 'Windows clock has no external time source',
|
|
description: 'Windows Time on {{ $labels.instance }} has used {{ $labels.type }} as its clock source for 10 minutes.',
|
|
},
|
|
state:: true,
|
|
},
|
|
]),
|
|
},
|
|
}
|