mixin: add alerts for the opt-in collectors

Every optional collector of the mixin now has alerts, generated only with
that collector enabled in _config.collectors: clock source, disk drive
status, page file usage, license status, scheduled task results, pending
updates, Hyper-V WMI and replication health, failover cluster nodes,
resources, groups and shared volumes, Storage Spaces pool and virtual disk
health, DHCP scope exhaustion and DNS zone transfer failures. The alerts
of the pagefile, diskdrive and license collectors join the memory, disk
and system groups; the other collectors get a group of their own.

New knobs: taskSelector, sharedVolumeSelector, pagefileUsageThreshold,
dhcpScopeFreeWarningThreshold, dhcpScopeFreeCriticalThreshold and
updatePendingDuration. The test configuration enables every optional
collector and tests/optional.test.yaml covers the new alerts.

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
Jan-Otto Kröpke
2026-10-17 02:28:35 +00:00
committed by Claude
parent d6afd48819
commit d819362150
24 changed files with 1688 additions and 11 deletions
@@ -0,0 +1,51 @@
---
title: WindowsScheduledTaskFailed
---
## Meaning
The last run of the scheduled task `task` ended with the result `unknown` or
`terminated`, and the task has not completed successfully since for one hour.
The alert needs the `scheduled_task` collector. `terminated` means the run was
stopped by a user or by the scheduler's time limit. `unknown` is every result
code without a named status, which includes the exit code of the task's
program and the error codes of the Task Scheduler; the documentation of the
collector lists the named codes. A program that exits with a code other than
zero on success raises this alert on every run; exclude such tasks with
`taskSelector` or with the include and exclude flags of the collector. A
disabled task keeps its last result but does not raise the alert.
## Impact
The work of the task did not happen: backups, cleanups, reports, certificate
renewals or synchronizations that are scheduled on this host. The impact
depends on the task.
## Diagnosis
1. Inspect `windows_scheduled_task_last_result_status` for the task and
`windows_scheduled_task_state` to see whether the task is still enabled
and queued.
2. On the host, read the last result and the history:
```powershell
Get-ScheduledTaskInfo -TaskName '<name>' -TaskPath '<folder>'
Get-WinEvent -LogName Microsoft-Windows-TaskScheduler/Operational -MaxEvents 50 | Where-Object Message -like '*<name>*'
```
The history log is off by default; enable it with
`wevtutil set-log Microsoft-Windows-TaskScheduler/Operational /enabled:true`.
3. Translate the result code: `0x1` is a generic failure of the program, `0x2`
a missing file, `0x80070005` an access denied, and codes of the form
`0x8xxxxxxx` are HRESULTs of the scheduler or of the program. The other
codes between `0x41300` and `0x41325` are named statuses, such as `ready`
or `running`, and do not raise this alert.
4. Run the program by hand under the task's account to reproduce the failure.
## Mitigation
Fix the program, its arguments, its working directory or the permissions of
the account the task runs as. Start the task once with `Start-ScheduledTask`
and confirm the result turns to `success`. Disable or delete tasks that are
not needed anymore instead of leaving them failing; disabling a task clears
the alert.