From 393546fe015cf9d6bf9722d57dfa742230b01816 Mon Sep 17 00:00:00 2001 From: Rahman Mousavian Date: Sat, 17 Jul 2021 21:11:59 +1000 Subject: [PATCH] Added doc for Scheduled Task collector Signed-off-by: Rahman Mousavian --- docs/README.md | 1 + docs/collector.scheduled_task.md | 67 ++++++++++++++++++++++++++++++++ docs/example_config.yml | 2 + 3 files changed, 70 insertions(+) create mode 100644 docs/collector.scheduled_task.md diff --git a/docs/README.md b/docs/README.md index 08526d9a..7f53c93d 100644 --- a/docs/README.md +++ b/docs/README.md @@ -28,6 +28,7 @@ This directory contains documentation of the collectors in the windows_exporter, - [`os`](collector.os.md) - [`process`](collector.process.md) - [`remote_fx`](collector.remote_fx.md) +- [`scheduled_task`](collector.scheduled_task.md) - [`service`](collector.service.md) - [`smtp`](collector.smtp.md) - [`system`](collector.system.md) diff --git a/docs/collector.scheduled_task.md b/docs/collector.scheduled_task.md new file mode 100644 index 00000000..5c42d7bb --- /dev/null +++ b/docs/collector.scheduled_task.md @@ -0,0 +1,67 @@ +# scheduled_task collector + +The scheduled_task collector exposes metrics about Windows Task Scheduler + +||| +-|- +Metric name prefix | `scheduled_task` +Data source | OLE +Enabled by default? | No + +## Flags + +### `--collector.scheduled_task.whitelist` + +If given, the path of the task needs to match the whitelist regexp in order for the corresponding metrics to be reported. + +### `--collector.scheduled_task.blacklist` + +If given, the path of the task needs to *not* match the blacklist regexp in order for the corresponding metrics to be reported. + +## Metrics + +Name | Description | Type | Labels +-----|-------------|------|------- +`windows_scheduled_task_last_result` | The result that was returned the last time the registered task was run | gauge | task +`windows_scheduled_task_missed_runs` | The number of times the registered task missed a scheduled run | gauge | task +`windows_scheduled_task_state` | The current state of a scheduled task | gauge | task, state + +For the values of the `state` label, see below. + +### State + +A task can be in the following states: +- `disabled` +- `queued` +- `ready` +- `running` +- `unknown` + + +### Example metric + +``` +windows_scheduled_task_last_result{task="/Microsoft/Windows/Chkdsk/SyspartRepair"} 1 +windows_scheduled_task_missed_runs{task="/Microsoft/Windows/Chkdsk/SyspartRepair"} 0 +windows_scheduled_task_state{state="disabled",task="/Microsoft/Windows/Chkdsk/SyspartRepair"} 1 +windows_scheduled_task_state{state="queued",task="/Microsoft/Windows/Chkdsk/SyspartRepair"} 0 +windows_scheduled_task_state{state="ready",task="/Microsoft/Windows/Chkdsk/SyspartRepair"} 0 +windows_scheduled_task_state{state="running",task="/Microsoft/Windows/Chkdsk/SyspartRepair"} 0 +windows_scheduled_task_state{state="unknown",task="/Microsoft/Windows/Chkdsk/SyspartRepair"} 0 +``` + +## Useful queries +_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ + +## Alerting examples +**prometheus.rules** +```yaml + - alert: "WindowsScheduledTaskFailure" + expr: "windows_scheduled_task_last_result == 0" + for: "1d" + labels: + severity: "high" + annotations: + summary: "Scheduled Task Failed" + description: "Scheduled task '{{ $labels.task }}' failed for 1 day" +``` diff --git a/docs/example_config.yml b/docs/example_config.yml index f3a3e186..20dec2c5 100644 --- a/docs/example_config.yml +++ b/docs/example_config.yml @@ -5,6 +5,8 @@ collectors: collector: service: services-where: Name='windows_exporter' + scheduled_task: + blacklist: /Microsoft/.+ log: level: debug scrape: