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>
27 lines
1.1 KiB
Jsonnet
27 lines
1.1 KiB
Jsonnet
{
|
|
local c = self._config,
|
|
local a = (import '../lib/alerts.libsonnet')(c),
|
|
prometheusAlerts+:: {
|
|
groups+: a.group('windows-scheduled-task', collectors=['scheduled_task'], rules=[
|
|
{
|
|
alert: 'WindowsScheduledTaskFailed',
|
|
// unknown is any result code without a named status, including the
|
|
// exit codes of the task's program.
|
|
// A disabled task keeps its last result, so disabling a broken task
|
|
// clears the alert.
|
|
expr: |||
|
|
windows_scheduled_task_last_result_status{%(windowsExporterSelector)s, %(taskSelector)s, status=~"unknown|terminated"} == 1
|
|
unless ignoring (status, state) (windows_scheduled_task_state{%(windowsExporterSelector)s, %(taskSelector)s, state="disabled"} == 1)
|
|
||| % c,
|
|
'for': '1h',
|
|
labels: { severity: 'warning' },
|
|
annotations: {
|
|
summary: 'Windows scheduled task did not succeed',
|
|
description: 'The last run of task {{ $labels.task }} on {{ $labels.instance }} ended with result {{ $labels.status }}, and the task has not succeeded in the hour since.',
|
|
},
|
|
state:: true,
|
|
},
|
|
]),
|
|
},
|
|
}
|