Compare commits

..

261 Commits

Author SHA1 Message Date
Dominik Eisenberg
56c29a6280 mscluster: Add virtual disk metrics sub-collector (#2296)
Signed-off-by: Dominik Eisenberg <d.business@outlook.de>
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
Signed-off-by: EisenbergD <dominik.eisenberg@beiersdorf.com>
Co-authored-by: Jan-Otto Kröpke <mail@jkroepke.de>
Co-authored-by: EisenbergD <dominik.eisenberg@beiersdorf.com>
2026-02-08 21:01:53 +01:00
Dominik Eisenberg
78395afc67 mscluster: add shared volumes collector and update documentation (#2301)
Signed-off-by: EisenbergD <dominik.eisenberg@beiersdorf.com>
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
Co-authored-by: EisenbergD <dominik.eisenberg@beiersdorf.com>
Co-authored-by: Jan-Otto Kröpke <mail@jkroepke.de>
2026-02-08 12:53:40 +00:00
Dominik Eisenberg
e951e516de docs: add alerting examples for CPU and CSV (#2317)
Signed-off-by: EisenbergD <dominik.eisenberg@beiersdorf.com>
Co-authored-by: EisenbergD <dominik.eisenberg@beiersdorf.com>
2026-02-08 13:46:02 +01:00
Dominik Eisenberg
ec6f705410 os: rename install_time_timestamp to install_time_timestamp_seconds (#2315)
Co-authored-by: EisenbergD <dominik.eisenberg@beiersdorf.com>
2026-02-04 13:23:28 +01:00
renovate[bot]
7119da5cf5 fix(deps): update golang.org/x/ (#2311)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-30 16:14:03 +00:00
renovate[bot]
856c108e7f fix(deps): update module github.com/bmatcuk/doublestar/v4 to v4.10.0 (#2312)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-30 16:10:39 +00:00
renovate[bot]
eaecea7797 chore(deps): update module github.com/coreos/go-systemd/v22 to v22.7.0 (#2310)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-30 17:07:14 +01:00
renovate[bot]
a95df3d6f2 chore(deps): update module github.com/golang-jwt/jwt/v5 to v5.3.1 (#2308)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-30 16:54:30 +01:00
renovate[bot]
3fcdaca34a chore(deps): update github actions (#2307)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-30 16:54:18 +01:00
Calle Pettersson
2a3f0ff9d9 Formalize retirement (#2303) 2026-01-27 12:05:07 +01:00
Jan-Otto Kröpke
7dcf0d3137 gpu: skip Microsoft Basic Render Driver metrics (#2275)
Co-authored-by: Elliot Nevills <elliotnev27@users.noreply.github.com>
2026-01-17 12:32:31 +01:00
renovate[bot]
b584539387 chore(deps): update actions/setup-go action to v6.2.0 (#2298)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-16 20:33:48 +01:00
renovate[bot]
7cec563af2 fix(deps): update module github.com/bmatcuk/doublestar/v4 to v4.9.2 (#2297)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-16 20:33:36 +01:00
renovate[bot]
f0d5fd9ba0 fix(deps): update module github.com/prometheus/exporter-toolkit to v0.15.1 (#2295)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-10 20:03:30 +01:00
renovate[bot]
2efe98d8ec fix(deps): update module github.com/prometheus/common to v0.67.5 (#2294)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-10 13:31:12 +01:00
Corporte Gadfly
5ab9019509 chore: Add sample dashboard (#2255) 2026-01-06 13:20:13 +00:00
renovate[bot]
2b4576ecd4 chore(deps): update github actions (major) (#2289)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-02 21:16:51 +01:00
Dominik Eisenberg
9a666ace81 cpu: add example query for Task Manager-style CPU utilization (#2286)
Co-authored-by: EisenbergD <dominik.eisenberg@beiersdorf.com>
2025-12-30 16:00:24 +01:00
Dominik Eisenberg
27186f7e78 os: add system installation date to metrics (#2284)
Co-authored-by: EisenbergD <dominik.eisenberg@beiersdorf.com>
2025-12-29 20:23:02 +01:00
PrometheusBot
0c1336b845 Synchronize common files from prometheus/prometheus (#2279) 2025-12-24 09:40:03 +00:00
PrometheusBot
f3e50f4db4 Synchronize common files from prometheus/prometheus (#2278) 2025-12-21 20:52:20 +00:00
renovate[bot]
04714a3fbd chore(deps): update docker/setup-buildx-action action to v3.12.0 (#2276)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-19 18:02:20 +01:00
renovate[bot]
43bd352cfd fix(deps): update golang.org/x/ (#2277)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-19 18:01:20 +01:00
renovate[bot]
6e831b0176 chore(deps): update module google.golang.org/protobuf to v1.36.11 (#2273)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-17 20:59:05 +01:00
renovate[bot]
84dc1977de chore(deps): update dependency golangci/golangci-lint to v2.7.2 (#2272)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-17 20:59:00 +01:00
renovate[bot]
a944cd02a8 chore(deps): update dependency golangci/golangci-lint to v2.7.1 (#2269)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-06 10:04:32 +01:00
renovate[bot]
65ac3585a3 chore(deps): update github actions (#2268)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-06 10:04:25 +01:00
renovate[bot]
0dbea50704 chore(deps): update docker/metadata-action action to v5.10.0 (#2264)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-28 18:27:51 +01:00
renovate[bot]
7585044277 chore(deps): update github actions (major) (#2265)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-28 18:27:40 +01:00
renovate[bot]
aaf22e7322 chore(deps): update module golang.org/x/oauth2 to v0.33.0 (#2262)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-21 15:34:20 +00:00
renovate[bot]
7671e42c70 fix(deps): update module github.com/prometheus/common to v0.67.4 (#2261)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-21 16:33:50 +01:00
renovate[bot]
1e16767afb chore(deps): update module golang.org/x/crypto to v0.45.0 [security] (#2257)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-21 16:30:00 +01:00
renovate[bot]
81ff006f08 chore(deps): update dependency golangci/golangci-lint to v2.6.2 (#2259)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-21 16:29:56 +01:00
renovate[bot]
7c586b204d chore(deps): update github actions (#2260)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-21 16:29:50 +01:00
buckleyGI
5351641287 docs: Fix metric name for Windows Disk Alerts (#2254) 2025-11-12 14:54:33 +01:00
renovate[bot]
462a495514 chore(deps): update docker/metadata-action action to v5.9.0 (#2253)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-07 18:59:17 +01:00
renovate[bot]
16ee024a1b chore(deps): update dependency golangci/golangci-lint to v2.6.1 (#2252)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-07 18:58:28 +01:00
PrometheusBot
afe1bfc29d Synchronize common files from prometheus/prometheus (#2251) 2025-11-06 18:35:21 +00:00
Szilard Parrag
ebbad8943b collector: fix race condition in Build() (#2250)
Co-authored-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-11-06 02:33:05 +00:00
renovate[bot]
3d0587d28c chore(deps): update dependency golangci/golangci-lint to v2.6.0 (#2246)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-11-02 19:41:27 +01:00
renovate[bot]
a523ef69fd chore(deps): update module github.com/prometheus/procfs to v0.19.2 (#2247)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-02 18:50:59 +01:00
Jan-Otto Kröpke
cd088325ef installer: remove repair option (#2243) 2025-11-02 17:40:39 +00:00
renovate[bot]
8fe118bff9 chore(deps): update github actions (major) (#2249)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-02 18:38:10 +01:00
Jan-Otto Kröpke
81051791e2 filetime: replace collector with file (#2244) 2025-11-02 18:38:01 +01:00
renovate[bot]
4fc7402985 chore(deps): update module golang.org/x/time to v0.14.0 (#2248)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-02 18:37:49 +01:00
renovate[bot]
52efb1c61c fix(deps): update module github.com/prometheus/common to v0.67.2 (#2245)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-02 18:37:38 +01:00
xieshujian
3a9e227bd9 file: add file collector to scrape file size and file modify time which can replace filetime collector (#2205)
Co-authored-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-11-02 18:27:34 +01:00
Johan Thomsen
ed11d8e8fa netframework: add process_id label to clrmemory (#2242) 2025-11-02 18:26:55 +01:00
renovate[bot]
402eb6ef4e chore(deps): update module github.com/prometheus/procfs to v0.18.0 (#2238)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-24 13:24:57 +00:00
renovate[bot]
767367edc4 fix(deps): update module github.com/prometheus/exporter-toolkit to v0.15.0 (#2239)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-24 15:20:30 +02:00
Jan-Otto Kröpke
370a42b79a Update documentation for collector update flags (#2235) 2025-10-17 22:46:45 +02:00
renovate[bot]
ccd977177c fix(deps): update module github.com/prometheus/common to v0.67.1 (#2228)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-10 15:34:29 +02:00
renovate[bot]
33fe157545 fix(deps): update golang.org/x/ (#2227)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-10 15:34:22 +02:00
renovate[bot]
9e32f62ca4 chore(deps): update dependency golangci/golangci-lint to v2.5.0 (#2220)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-10-06 03:30:11 +02:00
Jan-Otto Kröpke
c26c27a7f4 Fix collector flag names in documentation (#2225) 2025-10-05 15:26:29 +00:00
renovate[bot]
1f43ca4d8f chore(deps): update module google.golang.org/protobuf to v1.36.10 (#2223)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-05 17:01:42 +02:00
renovate[bot]
d818d96e07 chore(deps): update github actions (#2224) 2025-10-04 20:39:49 +02:00
Jan-Otto Kröpke
7c108ea5be thermalzone: deprecate collector (#2201) 2025-09-26 10:29:55 +00:00
Jan-Otto Kröpke
bbe0d1aba7 os: include installation type in Windows version retrieval (#2217) 2025-09-26 10:27:31 +00:00
Jan-Otto Kröpke
1394f2399d Update renovate.json (#2219) 2025-09-20 20:41:05 +02:00
PrometheusBot
f4d77803ea Synchronize common files from prometheus/prometheus (#2218) 2025-09-20 20:40:16 +02:00
renovate[bot]
a19af1b695 chore(deps): update github actions (major) (#2215)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-09-19 20:39:10 +02:00
renovate[bot]
95bf157049 fix(deps): update golang.org/x/ (#2214)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-09-19 20:39:02 +02:00
Jan-Otto Kröpke
9969618026 Update renovate.json (#2213) 2025-09-19 19:55:26 +02:00
PrometheusBot
f2e62c6f53 Synchronize common files from prometheus/prometheus (#2212) 2025-09-19 19:53:50 +02:00
renovate[bot]
a9b42ab3a4 fix(deps): update module github.com/prometheus/exporter-toolkit to v0.14.1 (#2210)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-09-19 14:23:10 +00:00
renovate[bot]
e778eea250 chore(deps): update actions/checkout action to v4.3.0 (#2211)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-09-19 14:22:56 +00:00
renovate[bot]
c0eb53812d chore(deps): update module google.golang.org/protobuf to v1.36.9 (#2209)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-09-19 16:19:18 +02:00
renovate[bot]
21d9fb057d chore(deps): update module go.yaml.in/yaml/v2 to v2.4.3 (#2208)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-09-19 16:19:10 +02:00
Jan-Otto Kröpke
f1772a742f pdh: added logging, if PDH CStatus is not valid (#2203) 2025-09-07 13:31:29 +02:00
renovate[bot]
fcf21bb600 fix(deps): update module github.com/prometheus/client_golang to v1.23.1 (#2199)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-09-05 21:37:06 +00:00
renovate[bot]
cd5f136079 chore(deps): update module google.golang.org/protobuf to v1.36.8 (#2198)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-09-05 18:52:32 +02:00
Jan-Otto Kröpke
4171ec17a5 chore: switch to go.yaml.in/yaml/v3 (#2196) 2025-09-04 23:50:27 +02:00
Karthik Panjaje
6289499dee docs: Fixed HTTP request metrics documentation (#2192) 2025-08-31 14:41:40 +00:00
Jan-Otto Kröpke
79917893d1 installer: set failureflag for Windows service (#2191) 2025-08-29 21:57:28 +02:00
Jan-Otto Kröpke
0b8a257b31 gpu: add device id label (#2186) 2025-08-28 06:36:10 +02:00
Jan-Otto Kröpke
71cedbc4d0 mi: remove callbacks (#2188) 2025-08-26 21:04:56 +02:00
Jan-Otto Kröpke
c8a4cb3806 mssql: expose correct patch level without restart (#2187) 2025-08-26 20:52:09 +02:00
Jan-Otto Kröpke
558629dff5 chore: update to go 1.25 (#2185) 2025-08-24 14:27:00 +02:00
Jan-Otto Kröpke
5a8ebf0c44 collector: support sub-second timeout values. (#2181) 2025-08-15 23:55:24 +02:00
PrometheusBot
acbabb926d Synchronize common files from prometheus/prometheus (#2180) 2025-08-15 20:34:45 +02:00
renovate[bot]
e37392c00b chore(deps): update dependency golangci/golangci-lint to v2.4.0 (#2179)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-15 16:43:04 +02:00
renovate[bot]
00d86ba792 chore(deps): update actions/checkout action to v4.3.0 (#2178)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-15 16:42:52 +02:00
renovate[bot]
691f64f5cc fix(deps): update golang.org/x/ (#2170)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-10 15:39:40 +02:00
renovate[bot]
19999dea49 chore(deps): update docker/login-action action to v3.5.0 (#2169)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-10 15:39:24 +02:00
renovate[bot]
c2df4d7514 chore(deps): update actions/download-artifact action to v5 (#2171)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-08 15:48:04 +02:00
renovate[bot]
8937a5ac91 chore(deps): update module google.golang.org/protobuf to v1.36.7 (#2168)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-08 15:30:46 +02:00
Jan-Otto Kröpke
930130f58a collector: Add disable flag (#2165)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-07 08:58:29 +02:00
Jan-Otto Kröpke
0e85959a4d installer: do not fail, if service can't be started. (#2163) 2025-08-03 20:11:57 +02:00
Jan-Otto Kröpke
6253bf812d process: Add flag to control the export of the process cmdline (#2153) 2025-08-03 20:09:03 +02:00
Jan-Otto Kröpke
6c2380bd04 installer: disable config file creation, if CONFIG_FILE is set to a non default location. (#2162) 2025-08-03 20:08:13 +02:00
Jan-Otto Kröpke
5266f9ebfe installer: add quote to avoid argument splitting (#2161) 2025-08-03 19:39:59 +02:00
renovate[bot]
6c9a5b66e2 chore(deps): update dependency golangci/golangci-lint to v2.3.1 (#2158)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-08-03 04:27:21 +02:00
renovate[bot]
c4ab8cb8a5 chore(deps): update docker/metadata-action action to v5.8.0 (#2159)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-01 21:01:20 +02:00
renovate[bot]
7bcaf81d26 fix(deps): update module github.com/prometheus/client_golang to v1.23.0 (#2160)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-01 20:49:03 +02:00
renovate[bot]
5f6ba2c6e7 fix(deps): update module github.com/bmatcuk/doublestar/v4 to v4.9.1 (#2157)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-01 15:47:11 +02:00
Jan-Otto Kröpke
75c85fbde1 docs: add note about property preferences (#2155) 2025-07-29 20:53:50 +02:00
Jan-Otto Kröpke
120c244313 docs: Update example_config.yml (#2152) 2025-07-28 22:53:13 +02:00
Jan-Otto Kröpke
0e2d78affe docs: allow backport PR title prefix. (#2142) 2025-07-20 02:30:42 +02:00
Jan-Otto Kröpke
f0591d85cd process: fix windows_process_start_time_seconds_timestamp return relative time on Windows Server 2019 (#2137) 2025-07-20 02:14:17 +02:00
Jan-Otto Kröpke
255b01f610 container: fix network metrics (#2136) 2025-07-17 21:07:55 +02:00
Jan-Otto Kröpke
ab7db07836 filetime: support windows paths (#2118) 2025-07-13 02:01:44 +02:00
Jan-Otto Kröpke
52056a5cd9 filetime: support case insensitive matching (#2132) 2025-07-12 23:51:40 +00:00
Jan-Otto Kröpke
524fea08c4 gpu: fix windows_gpu_info metric (#2130) 2025-07-13 01:05:59 +02:00
Jan-Otto Kröpke
6b8c895a68 container: fix memory leaks (#2129) 2025-07-11 20:10:45 +02:00
Jan-Otto Kröpke
eade0da514 config: fix lists (#2124) 2025-07-11 19:50:58 +02:00
renovate[bot]
b07e866b4a chore(deps): update dependency golangci/golangci-lint to v2.2.2 (#2126)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-07-11 19:50:19 +02:00
renovate[bot]
98618408ce fix(deps): update golang.org/x/ (#2127)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-07-11 18:33:04 +02:00
Jan-Otto Kröpke
56b9f7fd27 docs: strip readme to avoid dockerhub limitations (#2123) 2025-07-09 20:17:26 +02:00
Jan-Otto Kröpke
8d267336c1 Update README.md (#2121) 2025-07-08 18:17:07 +02:00
Jan-Otto Kröpke
fd7070354a cs: remove deprecated cs collector (#2115) 2025-07-05 15:47:57 +02:00
Jan-Otto Kröpke
373d741260 os: remove deprecated metrics (#2116) 2025-07-05 15:44:57 +02:00
Jan-Otto Kröpke
ed15b3c671 system: remove windows_system_boot_time_timestamp_seconds (#2112) 2025-07-05 15:40:09 +02:00
Jan-Otto Kröpke
f8805932b2 logon: remove logon collector. Use terminal_services instead. (#2114) 2025-07-05 15:34:04 +02:00
Jan-Otto Kröpke
4fd26fa0fa update: remove deprecated flags (#2113) 2025-07-05 15:32:59 +02:00
Jan-Otto Kröpke
bf722630d6 mssql: fix ratio based counter (#2096) 2025-07-05 00:20:28 +02:00
renovate[bot]
9320e992cc chore(deps): update dependency golangci/golangci-lint to v2.2.1 (#2110)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-07-05 00:08:07 +02:00
renovate[bot]
7a4e92a473 chore(deps): update module github.com/prometheus/procfs to v0.17.0 (#2111)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-07-04 21:51:47 +02:00
Szymon Sobocki
02b9ab4058 mssql: fix incorrect patch version in windows_mssql_instance_info (#2109) 2025-07-04 09:42:26 +00:00
Jan-Otto Kröpke
c3043693df fix: add missing concurrency lock (#2098) 2025-07-04 11:14:49 +02:00
Jan-Otto Kröpke
7377d48f07 iis: missing metrics if app-include is set. (#2103) 2025-07-02 16:32:29 +02:00
Jan-Otto Kröpke
d64f1316ca os: missing deprecated metric windows_os_processes (#2104) 2025-07-02 00:50:03 +02:00
Jan-Otto Kröpke
492f3af317 diskdrive: fix not exposing state "Pred Fail" (#2101) 2025-06-30 19:55:45 +02:00
nbav12
116203fd19 Update collector.mscluster.md (#2099) 2025-06-30 11:54:41 +02:00
Jan-Otto Kröpke
66751baef6 process: do not fail, if collector.process.iis is enabled and WMI WebAdministration is not present. (#2082) 2025-06-29 14:12:56 +02:00
renovate[bot]
b02bddd38e fix(deps): update module github.com/prometheus/common to v0.65.0 (#2095)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-27 15:30:59 +00:00
Jan-Otto Kröpke
3dbc19e18b docs: add note about Server 2012 (#2093) 2025-06-21 11:28:58 +02:00
renovate[bot]
be481e8776 chore(deps): update docker/setup-buildx-action action to v3.11.1 (#2088)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-20 15:40:55 +02:00
Jan-Otto Kröpke
aea5c5a2fb docs: Clearify Windows Server 2012R2 support (#2087) 2025-06-20 15:33:34 +02:00
Lapo Luchini
59ac3072b1 feat: increase time resolution when possible (collectors: os, system, time) (#2047) 2025-06-20 13:12:26 +02:00
Jan-Otto Kröpke
66cd489c4a dhcp: fix log level for dhcp server, if not present (#2086) 2025-06-20 10:15:14 +02:00
Jan-Otto Kröpke
4891e23d29 fix: added count checks (#2083) 2025-06-19 16:59:19 +02:00
Nic Jansma
f285c3d1e2 logical_disk: skip unmounted volumes (#2084) 2025-06-18 07:59:50 +02:00
Jan-Otto Kröpke
90dac66bf5 config: fix validation error with empty config files (#2080) 2025-06-16 19:53:14 +02:00
Jan-Otto Kröpke
34cfda306b logical_disk: add bitlocker status sub-collector (#2077) 2025-06-16 12:48:23 +02:00
Sanjeevi Subramani
3e8693f1e3 iis: Add HTTP Service Request Queues (#1948)
Co-authored-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-06-15 07:40:21 +02:00
renovate[bot]
036c858355 chore(deps): update golang.org/x/ (#2078)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-13 16:38:52 +02:00
Sam DeHaan
a69720ae1d docs: fix typo in dns docs subcollector name (#2073) 2025-06-05 01:14:51 +02:00
Jan-Otto Kröpke
55c877f536 gpu: add info metric about devices (#2070) 2025-06-04 22:49:59 +02:00
小荣
dcf85032ca gpu: add metrics collector and related types (#2052) (#2059) 2025-06-02 19:45:18 +02:00
Jan-Otto Kröpke
e673f192d2 process: add collector.process.counter-version CLI parameter (#2064) 2025-05-31 08:46:30 +02:00
Jan-Otto Kröpke
298d820bd6 time: expose clock source sync (#2058) 2025-05-30 19:52:27 +02:00
Jan-Otto Kröpke
89ac99e6a2 chore: Update renovate.json (#2069) 2025-05-29 22:09:05 +02:00
renovate[bot]
3e58d0e568 chore(deps): update docker/build-push-action action to v6.18.0 (#2067)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-29 22:05:57 +02:00
Jan-Otto Kröpke
5cf1f7e623 chore: Update renovate.json (#2068) 2025-05-29 22:05:47 +02:00
Jan-Otto Kröpke
0580b330a5 fix: Avoid COINIT_MULTITHREADED in CoInitializeEx (#2066) 2025-05-29 21:58:42 +02:00
PrometheusBot
25915bb289 Synchronize common files from prometheus/prometheus (#2061) 2025-05-26 22:23:17 +02:00
Jan-Otto Kröpke
5e1a802237 container: fix collector (#2057) 2025-05-24 11:29:52 +02:00
Jan-Otto Kröpke
6dd21a8e00 update: expose publish date of updates (#2050) 2025-05-23 21:18:29 +02:00
Jan-Otto Kröpke
92f213ca7c chore: fix test (#2055) 2025-05-23 08:12:25 +02:00
Jan-Otto Kröpke
ecd7dcfb0d service: report invalid parameter errors as debug (#2051) 2025-05-22 19:19:19 +02:00
Karl Persson
87d76b18e9 update: export properties so that they can be read from yaml file (#2053) 2025-05-22 16:22:06 +02:00
Jan-Otto Kröpke
068bcb7237 tcp: relax metrics collectos on error (#2041) 2025-05-20 15:37:01 +02:00
Jan-Otto Kröpke
898e16bcb1 container: support hostprocess containers and expose kubernetes labels (#1911) 2025-05-18 09:39:52 +02:00
Martin Costello
6b87441729 docs: Fix typo (#2042) 2025-05-18 07:50:31 +02:00
renovate[bot]
d31f21d5c6 fix(deps): update module github.com/microsoft/hcsshim to v0.13.0 (#2036)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-17 14:13:34 +02:00
renovate[bot]
c9fc0ee851 chore(deps): update github actions (#2034)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-17 14:10:45 +02:00
renovate[bot]
23894e0ac8 fix(deps): update golang.org/x/ (#2035)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-17 14:10:32 +02:00
renovate[bot]
36c68320e5 fix(deps): update module github.com/prometheus/common to v0.64.0 (#2037)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-17 14:10:24 +02:00
renovate[bot]
931754b39d chore(deps): update google.golang.org/genproto/googleapis/rpc digest to 5a2f75b (#2032)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-16 16:11:37 +00:00
renovate[bot]
c3739886d1 chore(deps): update module google.golang.org/grpc to v1.72.1 (#2033)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-16 18:03:01 +02:00
Jan-Otto Kröpke
9b41c805a5 docs: Remove CLI flag telemetry.max-requests and hardcoded to 1. (#2030) 2025-05-14 18:52:05 +00:00
Jan-Otto Kröpke
48d29d8563 terminal_services: Expose disconnected sessions agains (#2026) 2025-05-14 20:46:56 +02:00
Jan-Otto Kröpke
d899ae7e24 docs: add example about add cmdline to process metrics. (#2029) 2025-05-14 09:03:28 +00:00
renovate[bot]
bebc44c948 chore(config): migrate renovate config (#2027)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-13 23:12:46 +02:00
renovate[bot]
bd536e61cc chore(deps): update dependency golangci/golangci-lint to v2.1.6 (#2023)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-09 14:54:50 +02:00
renovate[bot]
ebc60503ae chore(deps): update google.golang.org/genproto/googleapis/rpc digest to f936aa4 (#2022)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-09 14:54:42 +02:00
renovate[bot]
055f4a56df chore(deps): update github actions (major) (#2017)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-05 09:23:36 +02:00
renovate[bot]
fd92bfc1c8 chore(deps): update google.golang.org/genproto/googleapis/rpc digest to 10db94c (#2012)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-01 22:27:18 +02:00
renovate[bot]
e584adaf7e chore(deps): update github actions (#2015)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-01 22:01:47 +02:00
renovate[bot]
2d31d604fb chore(deps): update dependency golangci/golangci-lint to v2.1.5 (#2013)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-01 22:01:40 +02:00
renovate[bot]
4d73502752 chore(deps): update module github.com/prometheus/procfs to v0.16.1 (#2014)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-01 22:01:30 +02:00
renovate[bot]
090eed2959 chore(deps): update module google.golang.org/grpc to v1.72.0 (#2016)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-01 22:01:15 +02:00
Jan-Otto Kröpke
769363d157 feat: Add config file validation (#2011) 2025-04-24 23:45:21 +02:00
Jan-Otto Kröpke
554607fee2 chore: Remove copyright dates (#2010) 2025-04-24 22:17:16 +02:00
Jan-Otto Kröpke
256399f25d service: fix inconsistent values for windows_service_start_mode (#2007) 2025-04-24 10:37:06 +02:00
renovate[bot]
4dcfb77587 chore(deps): update dependency golangci/golangci-lint to v2.1.2 (#2003)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-04-19 00:53:40 +02:00
rjb003
c47f32fb1f docs: fix metric name in example in collector.memory.md (#2004) 2025-04-18 20:20:44 +02:00
renovate[bot]
17f1f98179 chore(deps): update google.golang.org/genproto/googleapis/rpc digest to 207652e (#2002)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-18 18:32:15 +02:00
Matthew Wimpelberg
f0d5267874 dns: add enhanced metrics (#1999)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-04-18 13:25:05 +02:00
Jan-Otto Kröpke
85455bd04d exchange: fix The specified counter could not be found (#1994) 2025-04-14 17:34:20 +02:00
Jan-Otto Kröpke
f1f763bc79 docs: remove config.file.insecure-skip-verify (#1997) 2025-04-14 14:18:21 +02:00
renovate[bot]
c0af21eb1c fix(deps): update module github.com/prometheus/client_model to v0.6.2 (#1993)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-11 15:59:17 +02:00
renovate[bot]
eed95100ec chore(deps): update google.golang.org/genproto/googleapis/rpc digest to de1ac95 (#1992)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-11 15:58:49 +02:00
renovate[bot]
896c9439d5 fix(deps): update module github.com/prometheus/client_golang to v1.22.0 (#1988)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-10 01:04:51 +02:00
renovate[bot]
e00a3916b8 chore(deps): update module golang.org/x/net to v0.39.0 (#1987)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-10 01:04:40 +02:00
Melo
5294b61339 update: fix naming flags (renamed --collector.updates.* to --collector.update.*) (click PR number for more information) (#1986)
Signed-off-by: Melody Sofia Eroshevich <se@cloudeteer.de>
2025-04-10 00:38:52 +02:00
Melo
415c134f70 docs: Fix incorrect metric prefix in update collector documentation (#1985)
Signed-off-by: Melody Sofia Eroshevich <se@cloudeteer.de>
2025-04-09 16:49:40 +02:00
renovate[bot]
cb1769cacc chore(deps): update golang.org/x/ (#1982)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-06 21:51:45 +02:00
Jan-Otto Kröpke
ba605cffcc system: Metric windows_system_boot_time_timestamp returns a UNIX timestamp again. (#1967)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
Signed-off-by: Jan-Otto Kröpke <github@jkroepke.de>
2025-04-06 11:57:14 +02:00
Jan-Otto Kröpke
bf56e99ad2 chore: Update Copyright (#1981)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-04-06 11:26:56 +02:00
Jan-Otto Kröpke
9db4318ea9 fix: windows_cpu_processor_utility_total is always 0 (#1966)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-04-05 22:20:07 +02:00
renovate[bot]
ef46cd1dbe fix(deps): update golang.org/x/ (#1980) 2025-04-05 20:54:52 +02:00
Yariv Amar
36b6afe4bb docs: update for #1964 (#1979)
Signed-off-by: Yariv Amar <yariv.amar@gmail.com>
2025-04-05 17:25:49 +02:00
renovate[bot]
6471f3985a chore(deps): update golangci/golangci-lint-action action to v7 (#1976)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-04-05 11:55:10 +02:00
Jan-Otto Kröpke
ecc805f0fa memory: fix panics if metrics does not exists (#1960)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-04-04 23:21:26 +02:00
renovate[bot]
88c929ac6f chore(deps): update module google.golang.org/protobuf to v1.36.6 (#1972)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-04 22:34:22 +02:00
renovate[bot]
c3dfd7f960 chore(deps): update google.golang.org/genproto/googleapis/rpc digest to ee84b53 (#1970)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-04 22:34:11 +02:00
renovate[bot]
a3e840f960 chore(deps): update module github.com/prometheus/procfs to v0.16.0 (#1973)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-04 22:33:43 +02:00
renovate[bot]
53849a3500 chore(deps): update github actions (#1969)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-04 22:33:25 +02:00
renovate[bot]
970976c61d chore(deps): update module google.golang.org/grpc to v1.71.1 (#1971)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-04 22:33:16 +02:00
renovate[bot]
26893d22df chore(deps): update module golang.org/x/net to v0.38.0 (#1974)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-04 22:33:06 +02:00
Jan-Otto Kröpke
5fcaa56a9c chore: Update renovate.json (#1968)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-04-04 20:59:58 +02:00
Jan-Otto Kröpke
0846c2805f logon: deprecate collector. Use terminal_services instead (#1957)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-04-04 20:20:08 +02:00
Jan-Otto Kröpke
fa8af098c8 mssql: support initial non default instances names (#1958) 2025-03-31 22:20:26 +02:00
Jan-Otto Kröpke
ad98d11326 net: expose operation status of nic (#1956)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-03-28 15:18:17 +01:00
Jan-Otto Kröpke
63efa92be7 service: fix windows.EnumServicesStatusEx reports buffer too small (#1954)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-03-27 07:26:51 +01:00
renovate[bot]
4c7df1ccaf chore(deps): update github actions (#1944)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-20 19:24:27 +01:00
PrometheusBot
19ccdc5731 Synchronize common files from prometheus/prometheus (#1949)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2025-03-20 18:04:26 +00:00
Jan-Otto Kröpke
2c548b8675 chore: Update question issue template (#1945)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-03-20 16:35:13 +01:00
Jan-Otto Kröpke
fdc79f675d chore: Add quay.io readme (#1946)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-03-20 16:33:15 +01:00
Jan-Otto Kröpke
041c2cd170 fix: return Windows 11 as product name, if build number is >= 22000 (#1935)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-03-19 22:50:54 +01:00
renovate[bot]
29307eb2b2 chore(deps): update dependency golangci/golangci-lint to v1.64.8 (#1943)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-18 20:46:10 +01:00
renovate[bot]
73ef2d9824 chore(deps): update github actions (#1942)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-18 20:11:56 +01:00
Jan-Otto Kröpke
d5112d7766 net: move net IP addresses from windows_net_nic_info to windows_net_nic_address_info and introduce mac addresses (#1940)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-03-15 13:27:19 +01:00
Jan-Otto Kröpke
bc1b40c679 hyperv: fix Windows Server 2016 compatibility (#1925)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-03-14 19:28:48 +01:00
Jan-Otto Kröpke
d58f8c59c6 chore: Update renovate.json (#1939)
Signed-off-by: Jan-Otto Kröpke <github@jkroepke.de>
2025-03-14 12:02:33 +01:00
renovate[bot]
53a4e76a4b chore(deps): update docker/login-action digest to 74a5d14 (#1938)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-14 11:59:40 +01:00
Jan-Otto Kröpke
eecc6ce574 fix: buffer length panic (#1936)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-03-14 10:57:47 +01:00
Jan-Otto Kröpke
221cfec732 chore(deps): update dependency go to v1.24.1 (#1937)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-14 10:05:40 +01:00
Jan-Otto Kröpke
fce1e71cac chore: add quay.io registry (#1934)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-03-14 08:43:55 +01:00
renovate[bot]
2b96dd5c61 chore(deps): pin dependencies (#1930)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-14 08:42:38 +01:00
renovate[bot]
a5cbfefc24 chore(deps): update dependency windows to v2022 (#1933)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-14 08:40:40 +01:00
renovate[bot]
c14af0ab20 fix(deps): update module github.com/prometheus/common to v0.63.0 (#1932)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-14 08:39:36 +01:00
Jan-Otto Kröpke
4a67810832 chore: add renovate (#1928)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-03-14 08:31:23 +01:00
Jan-Otto Kröpke
eceec10237 config: remove remote config files (#1877)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
Signed-off-by: Jan-Otto Kröpke <github@jkroepke.de>
2025-03-13 16:45:39 +01:00
Jan-Otto Kröpke
3f2633d0b0 fix: Support running as Windows Service within containers (#1907)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-03-12 08:46:41 +01:00
Jan-Otto Kröpke
5114a5466a process: rename windows_process_start_time -> windows_process_start_time_seconds_timestamp (#1858)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-03-12 08:45:40 +01:00
Jan-Otto Kröpke
d6196c5c6b time: windows_time_clock_frequency_adjustment_ppb_total -> windows_time_clock_frequency_adjustment_ppb and add windows_time_clock_frequency_adjustment metric for Win2016 (#1910)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
Signed-off-by: Jan-Otto Kröpke <github@jkroepke.de>
2025-03-12 08:28:30 +01:00
Jan-Otto Kröpke
0c44a934f4 fix: update dependencies (#1920)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-03-11 10:46:14 +01:00
dependabot[bot]
d1151e91f3 chore(deps): bump github.com/prometheus/client_golang from 1.21.0 to 1.21.1 (#1919)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-10 15:52:45 +01:00
Jan-Otto Kröpke
cbe94c1ea5 netframework: fix metric names (re-add the collector sub-type to metrics) (#1908)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-03-01 17:22:59 +01:00
Jan-Otto Kröpke
b809f5a8ee docs: added examples for alternative installer dir (#1909)
Signed-off-by: Jan-Otto Kröpke <github@jkroepke.de>
2025-03-01 00:17:48 +01:00
dependabot[bot]
756d9c160d chore(deps): bump github.com/prometheus/client_golang from 1.21.0-rc.0 to 1.21.0 (#1899)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-01 00:09:41 +01:00
Jan-Otto Kröpke
a0e132b30e terminal_services: fix panic in collect (#1906) 2025-02-28 07:53:23 +01:00
Jan-Otto Kröpke
d645e89be9 ci: fix checksum (#1905) 2025-02-28 07:53:10 +01:00
Jan-Otto Kröpke
a73a08d704 fix: log to the Windows temp directory if of service detection failures. (#1890) 2025-02-28 01:35:41 +01:00
Jan-Otto Kröpke
228164765b docs: fix physical_disk docs (#1897) 2025-02-22 08:29:52 +00:00
Jan-Otto Kröpke
4c9c78c599 time: fix panic if counters aren't present (#1898) 2025-02-22 09:29:02 +01:00
Jan-Otto Kröpke
4b3c154049 docs: add disk activity query. (#1889)
Signed-off-by: Jan-Otto Kröpke <github@jkroepke.de>
2025-02-18 13:41:26 +01:00
Jan-Otto Kröpke
be0037eda5 ci: pin wix toolset version to avoid installing incompatible extensions (#1885)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-02-13 20:56:44 +01:00
Jan-Otto Kröpke
367fae95c4 mscluster: restore support for Windows Server 2016-2019 (#1882)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-02-12 21:03:24 +01:00
Jan-Otto Kröpke
96ffc3bf3f config: multiple web.listen-address args results into an error, if --config.file is defined. (#1876)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-02-12 20:30:12 +01:00
Jan-Otto Kröpke
285c4cc5ea feat: windows_exporter uses own event log source to correctly format messages. (#1873)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
Signed-off-by: Jan-Otto Kröpke <github@jkroepke.de>
2025-02-10 18:57:31 +01:00
Jan-Otto Kröpke
f07aceb0dd cs: fix metric description (#1881)
Signed-off-by: Jan-Otto Kröpke <github@jkroepke.de>
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-02-10 18:23:35 +01:00
Jan-Otto Kröpke
dcacce4577 fix: sign binaries (#1878)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-02-09 22:34:55 +01:00
Jan-Otto Kröpke
fc5b3051fa feat: sign binaries (#1875)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-02-08 20:04:37 +01:00
Jan-Otto Kröpke
1b2958a7cc fix: slow stop if run as service (#1870)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-02-07 22:26:09 +01:00
Jan-Otto Kröpke
a20e1854d1 netframework: fix MI_RESULT_INVALID_QUERY (#1862)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-02-02 09:14:56 +01:00
Jan-Otto Kröpke
fe21cb44f6 installer: add validation for EXTRA_FLAGS (#1867)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-02-02 09:14:45 +01:00
Jan-Otto Kröpke
71ec0bd6a3 process: negative values with windows_process_start_time (#1857)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-01-30 20:30:08 +01:00
dependabot[bot]
8bff623393 chore(deps): bump actions/stale from 9.0.0 to 9.1.0 (#1860) 2025-01-27 20:14:42 +01:00
dependabot[bot]
3eabd0a00c chore(deps): bump github.com/bmatcuk/doublestar/v4 from 4.8.0 to 4.8.1 (#1859) 2025-01-27 20:14:07 +01:00
Jan-Otto Kröpke
73186cde48 installer: force close application on uninstall (#1854)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-01-23 16:43:36 +01:00
Jan-Otto Kröpke
25e04fc947 service: re-use buffer for return all services (#1853)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-01-23 16:43:17 +01:00
Jan-Otto Kröpke
6b7201856c fix: process priority setting (#1852)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-01-23 14:56:49 +01:00
Jan-Otto Kröpke
608b83cfd8 config: deprecate remote http configuration (#1849)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-01-21 08:59:08 +01:00
Hamed Mansouri
40a42ca457 docs: fix typo in README.md (#1844)
Signed-off-by: Hamed Mansouri <hamed0381@gmail.com>
2025-01-21 00:47:03 +01:00
dependabot[bot]
423c8a787e chore(deps): bump golang.org/x/net from 0.32.0 to 0.33.0 (#1848)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-20 14:41:21 +00:00
dependabot[bot]
6cefbed7f7 chore(deps): bump github.com/bmatcuk/doublestar/v4 from 4.7.1 to 4.8.0 (#1846)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-20 15:35:43 +01:00
Jan-Otto Kröpke
5836a7dbf2 dhcp: add dhcp scope stats (#1840)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-01-20 12:03:03 +01:00
355 changed files with 15145 additions and 4549 deletions

View File

@@ -11,6 +11,9 @@ tab_width = 4
indent_style = space indent_style = space
indent_size = 4 indent_size = 4
[renovate.json]
indent_size = 2
[*.{yml,yaml}] [*.{yml,yaml}]
indent_style = space indent_style = space
indent_size = 2 indent_size = 2

View File

@@ -4,7 +4,11 @@ labels: [ 🐞 bug ]
body: body:
- type: markdown - type: markdown
attributes: attributes:
value: Thanks for taking the time to fill out this bug report! value: |-
> [!NOTE]
> Windows Server 2012 and Windows Server 2012 R2 are no longer supported by the windows_exporter project.
Thanks for taking the time to fill out this bug report!
- type: markdown - type: markdown
attributes: attributes:

View File

@@ -2,6 +2,28 @@ name: ❓ Question
description: Something is not clear. description: Something is not clear.
labels: [ ❓ question ] labels: [ ❓ question ]
body: body:
- type: markdown
attributes:
value: |-
> [!NOTE]
> If you encounter "Counter not found" issues, try to re-build the performance counter first.
```
PS C:\WINDOWS\system32> cd c:\windows\system32
PS C:\windows\system32> lodctr /R
Error: Unable to rebuild performance counter setting from system backup store, error code is 2
PS C:\windows\system32> cd ..
PS C:\windows> cd syswow64
PS C:\windows\syswow64> lodctr /R
Info: Successfully rebuilt performance counter setting from system backup store
PS C:\windows\syswow64> winmgmt.exe /RESYNCPERF
```
----
- type: textarea - type: textarea
attributes: attributes:
label: Problem Statement label: Problem Statement

View File

@@ -1,3 +1,5 @@
<!-- <!--
Please give your PR a title in the form "area: short description". For example "cpu: reduce usage by 95%" or "docs: fix typo in installation.md". Please give your PR a title in the form "area: short description". For example "cpu: reduce usage by 95%" or "docs: fix typo in installation.md".

View File

@@ -1,15 +0,0 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
labels:
- "🛠️ dependencies"
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"
labels:
- "🛠️ dependencies"

View File

@@ -18,7 +18,9 @@ jobs:
if: github.repository_owner == 'prometheus' || github.repository_owner == 'prometheus-community' # Don't run this workflow on forks. if: github.repository_owner == 'prometheus' || github.repository_owner == 'prometheus-community' # Don't run this workflow on forks.
steps: steps:
- name: git checkout - name: git checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
- name: Set docker hub repo name - name: Set docker hub repo name
run: echo "DOCKER_REPO_NAME=$(make docker-repo-name)" >> $GITHUB_ENV run: echo "DOCKER_REPO_NAME=$(make docker-repo-name)" >> $GITHUB_ENV
- name: Push README to Dockerhub - name: Push README to Dockerhub
@@ -33,3 +35,27 @@ jobs:
# Empty string results in README-containers.md being pushed if it # Empty string results in README-containers.md being pushed if it
# exists. Otherwise, README.md is pushed. # exists. Otherwise, README.md is pushed.
readme_file: '' readme_file: ''
PushQuayIoReadme:
runs-on: ubuntu-latest
name: Push README to quay.io
if: github.repository_owner == 'prometheus' || github.repository_owner == 'prometheus-community' # Don't run this workflow on forks.
steps:
- name: git checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
- name: Set quay.io org name
run: echo "DOCKER_REPO=$(echo quay.io/${GITHUB_REPOSITORY_OWNER} | tr -d '-')" >> $GITHUB_ENV
- name: Set quay.io repo name
run: echo "DOCKER_REPO_NAME=$(make docker-repo-name)" >> $GITHUB_ENV
- name: Push README to quay.io
uses: christian-korneck/update-container-description-action@d36005551adeaba9698d8d67a296bd16fa91f8e8 # v1
env:
DOCKER_APIKEY: ${{ secrets.QUAY_IO_API_TOKEN }}
with:
destination_container_repo: ${{ env.DOCKER_REPO_NAME }}
provider: quay
# Empty string results in README-containers.md being pushed if it
# exists. Otherwise, README.md is pushed.
readme_file: ''

View File

@@ -4,27 +4,13 @@ name: Linting
# have been changed. # have been changed.
on: on:
push: push:
paths:
- "go.mod"
- "go.sum"
- "**.go"
- ".github/workflows/lint.yml"
- "tools/e2e-output.txt"
branches: branches:
- master - master
- next - next
- main - main
- "0.*"
- "1.*"
pull_request: pull_request:
paths:
- "go.mod"
- "go.sum"
- "**.go"
- ".github/workflows/lint.yml"
- "tools/e2e-output.txt"
branches:
- master
- next
- main
env: env:
VERSION_PROMU: '0.14.0' VERSION_PROMU: '0.14.0'
@@ -32,10 +18,10 @@ env:
jobs: jobs:
test: test:
runs-on: windows-2019 runs-on: windows-2025
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-go@v5 - uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
with: with:
go-version-file: 'go.mod' go-version-file: 'go.mod'
@@ -55,10 +41,10 @@ jobs:
run: make e2e-test run: make e2e-test
promtool: promtool:
runs-on: windows-2019 runs-on: windows-2025
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-go@v5 - uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
with: with:
go-version-file: 'go.mod' go-version-file: 'go.mod'
@@ -79,7 +65,7 @@ jobs:
run: make promtool run: make promtool
- name: Upload windows_exporter.exe - name: Upload windows_exporter.exe
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
if: always() if: always()
with: with:
name: windows_exporter.amd64.exe name: windows_exporter.amd64.exe
@@ -88,7 +74,7 @@ jobs:
if-no-files-found: error if-no-files-found: error
lint: lint:
runs-on: windows-2022 runs-on: windows-2025
steps: steps:
# `gofmt` linter run by golangci-lint fails on CRLF line endings (the default for Windows) # `gofmt` linter run by golangci-lint fails on CRLF line endings (the default for Windows)
- name: Set git to use LF - name: Set git to use LF
@@ -96,13 +82,14 @@ jobs:
git config --global core.autocrlf false git config --global core.autocrlf false
git config --global core.eol lf git config --global core.eol lf
- uses: actions/checkout@v4 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-go@v5 - uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
with: with:
go-version-file: 'go.mod' go-version-file: 'go.mod'
- name: golangci-lint - name: golangci-lint
uses: golangci/golangci-lint-action@v6 uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
with: with:
version: v1.60 # renovate: github=golangci/golangci-lint
version: v2.7.2
args: "--max-same-issues=0" args: "--max-same-issues=0"

View File

@@ -33,11 +33,11 @@ jobs:
name: check title prefix name: check title prefix
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: check - name: check
run: | run: |
PR_TITLE_PREFIX=$(echo "$PR_TITLE" | cut -d':' -f1) PR_TITLE_PREFIX=$(echo "$PR_TITLE" | cut -d':' -f1)
if [[ -d "internal/collector/$PR_TITLE_PREFIX" ]] || [[ -d "internal/$PR_TITLE_PREFIX" ]] || [[ -d "pkg/$PR_TITLE_PREFIX" ]] || [[ -d "$PR_TITLE_PREFIX" ]] || [[ "$PR_TITLE_PREFIX" == "docs" ]] || [[ "$PR_TITLE_PREFIX" == "ci" ]] || [[ "$PR_TITLE_PREFIX" == "revert" ]] || [[ "$PR_TITLE_PREFIX" == "fix" ]] || [[ "$PR_TITLE_PREFIX" == "feat" ]] || [[ "$PR_TITLE_PREFIX" == "chore" ]] || [[ "$PR_TITLE_PREFIX" == "chore(docs)" ]] || [[ "$PR_TITLE_PREFIX" == "chore(deps)" ]] || [[ "$PR_TITLE_PREFIX" == "*" ]] || [[ "$PR_TITLE_PREFIX" == "Synchronize common files from prometheus/prometheus" ]]; then if [[ -d "internal/collector/$PR_TITLE_PREFIX" ]] || [[ -d "internal/$PR_TITLE_PREFIX" ]] || [[ -d "pkg/$PR_TITLE_PREFIX" ]] || [[ -d "$PR_TITLE_PREFIX" ]] || [[ "$PR_TITLE_PREFIX" == "docs" ]] || [[ "$PR_TITLE_PREFIX" == "ci" ]] || [[ "$PR_TITLE_PREFIX" == "revert" ]] || [[ "$PR_TITLE_PREFIX" == "fix" ]] || [[ "$PR_TITLE_PREFIX" == "fix(deps)" ]] || [[ "$PR_TITLE_PREFIX" == "feat" ]] || [[ "$PR_TITLE_PREFIX" == "chore" ]] || [[ "$PR_TITLE_PREFIX" == "chore(docs)" ]] || [[ "$PR_TITLE_PREFIX" == "chore(deps)" ]] || [[ "$PR_TITLE_PREFIX" == "*" ]] || [[ "$PR_TITLE_PREFIX" == "Release"* ]] || [[ "$PR_TITLE_PREFIX" == "Synchronize common files from prometheus/prometheus" ]] || [[ "$PR_TITLE_PREFIX" == "[0."* ]] || [[ "$PR_TITLE_PREFIX" == "[1."* ]]; then
exit 0 exit 0
fi fi

View File

@@ -21,24 +21,26 @@ env:
jobs: jobs:
build: build:
runs-on: windows-2022 runs-on: windows-2025
environment: build
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with: with:
fetch-depth: '0' fetch-depth: '0'
- uses: actions/setup-go@v5 - uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
with: with:
go-version-file: 'go.mod' go-version-file: 'go.mod'
- name: Install WiX - name: Install WiX
run: dotnet tool install --global wix run: |
dotnet tool install --global wix --version 5.0.2
- name: Install WiX extensions - name: Install WiX extensions
run: | run: |
wix extension add -g WixToolset.Util.wixext wix extension add -g WixToolset.Util.wixext/5.0.2
wix extension add -g WixToolset.Ui.wixext wix extension add -g WixToolset.Ui.wixext/5.0.2
wix extension add -g WixToolset.Firewall.wixext wix extension add -g WixToolset.Firewall.wixext/5.0.2
- name: Install Build deps - name: Install Build deps
run: | run: |
@@ -68,6 +70,40 @@ jobs:
Get-ChildItem -Path output Get-ChildItem -Path output
- name: Sign build artifacts
if: ${{ (github.event_name != 'pull_request' && github.repository == 'prometheus-community/windows_exporter') || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'prometheus-community/windows_exporter') }}
run: |
$ErrorActionPreference = "Stop"
$Version = Get-Content VERSION
$b64 = $env:CODE_SIGN_KEY
$filename = 'windows_exporter_CodeSign.pfx'
$bytes = [Convert]::FromBase64String($b64)
[IO.File]::WriteAllBytes($filename, $bytes)
$basePath = "C:\Program Files (x86)\Windows Kits\10\bin"
$latestSigntool = Get-ChildItem -Path $basePath -Directory |
Where-Object { $_.Name -match "^\d+\.\d+\.\d+\.\d+$" } |
Sort-Object { [Version]$_.Name } -Descending |
Select-Object -First 1 |
ForEach-Object { Join-Path $_.FullName "x64\signtool.exe" }
if (Test-Path $latestSigntool) {
Write-Output $latestSigntool
} else {
Write-Output "signtool.exe not found"
}
foreach($Arch in "amd64", "arm64") {
& $latestSigntool sign /v /tr "http://timestamp.digicert.com" /d "Prometheus exporter for Windows machines" /td SHA256 /fd SHA256 /a /f "windows_exporter_CodeSign.pfx" /p $env:CODE_SIGN_PASSWORD "output\windows_exporter-$Version-$Arch.exe"
}
rm windows_exporter_CodeSign.pfx
env:
CODE_SIGN_KEY: ${{ secrets.CODE_SIGN_KEY }}
CODE_SIGN_PASSWORD: ${{ secrets.CODE_SIGN_PASSWORD }}
- name: Build Release Artifacts - name: Build Release Artifacts
run: | run: |
$ErrorActionPreference = "Stop" $ErrorActionPreference = "Stop"
@@ -79,12 +115,49 @@ jobs:
} }
Move-Item installer\*.msi output\ Move-Item installer\*.msi output\
Get-ChildItem -Path output\ Get-ChildItem -Path output\ g
promu checksum output\ - name: Sign installer artifacts
if: ${{ (github.event_name != 'pull_request' && github.repository == 'prometheus-community/windows_exporter') || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'prometheus-community/windows_exporter') }}
run: |
$ErrorActionPreference = "Stop"
$Version = Get-Content VERSION
$b64 = $env:CODE_SIGN_KEY
$filename = 'windows_exporter_CodeSign.pfx'
$bytes = [Convert]::FromBase64String($b64)
[IO.File]::WriteAllBytes($filename, $bytes)
$basePath = "C:\Program Files (x86)\Windows Kits\10\bin"
$latestSigntool = Get-ChildItem -Path $basePath -Directory |
Where-Object { $_.Name -match "^\d+\.\d+\.\d+\.\d+$" } |
Sort-Object { [Version]$_.Name } -Descending |
Select-Object -First 1 |
ForEach-Object { Join-Path $_.FullName "x64\signtool.exe" }
if (Test-Path $latestSigntool) {
Write-Output $latestSigntool
} else {
Write-Output "signtool.exe not found"
}
foreach($Arch in "amd64", "arm64") {
& $latestSigntool sign /v /tr "http://timestamp.digicert.com" /d "Prometheus exporter for Windows machines" /td SHA256 /fd SHA256 /a /f "windows_exporter_CodeSign.pfx" /p $env:CODE_SIGN_PASSWORD "output\windows_exporter-$Version-$Arch.msi"
}
rm windows_exporter_CodeSign.pfx
env:
CODE_SIGN_KEY: ${{ secrets.CODE_SIGN_KEY }}
CODE_SIGN_PASSWORD: ${{ secrets.CODE_SIGN_PASSWORD }}
- name: Generate checksums
run: |
promu checksum output
cat output\sha256sums.txt
- name: Upload Artifacts - name: Upload Artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with: with:
name: windows_exporter_binaries name: windows_exporter_binaries
path: | path: |
@@ -103,34 +176,37 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: needs:
- build - build
env:
DOCKER_BUILD_SUMMARY: false
DOCKER_BUILD_RECORD_UPLOAD: false
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with: with:
fetch-depth: '0' fetch-depth: '0'
- name: Download Artifacts - name: Download Artifacts
uses: actions/download-artifact@v4 uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with: with:
name: windows_exporter_binaries name: windows_exporter_binaries
- name: Login to Docker Hub - name: Login to Docker Hub
if: ${{ github.event_name != 'pull_request' }} if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v3 uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with: with:
username: ${{ secrets.DOCKER_HUB_LOGIN }} username: ${{ secrets.DOCKER_HUB_LOGIN }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }} password: ${{ secrets.DOCKER_HUB_PASSWORD }}
#- name: Login to quay.io - name: Login to quay.io
# if: ${{ github.event_name != 'pull_request' }} if: ${{ github.event_name != 'pull_request' }}
# uses: docker/login-action@v3 uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
# with: with:
# registry: quay.io registry: quay.io
# username: ${{ secrets.QUAY_USER }} username: ${{ secrets.QUAY_IO_LOGIN }}
# password: ${{ secrets.QUAY_PASS }} password: ${{ secrets.QUAY_IO_PASSWORD }}
- name: Login to GitHub container registry - name: Login to GitHub container registry
if: ${{ github.event_name != 'pull_request' }} if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v3 uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
@@ -138,12 +214,12 @@ jobs:
- name: Docker meta - name: Docker meta
id: meta id: meta
uses: docker/metadata-action@v5 uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
with: with:
images: | images: |
ghcr.io/prometheus-community/windows-exporter ghcr.io/prometheus-community/windows-exporter
docker.io/prometheuscommunity/windows-exporter docker.io/prometheuscommunity/windows-exporter
# quay.io/prometheuscommunity/windows-exporter quay.io/prometheuscommunity/windows-exporter
tags: | tags: |
type=semver,pattern={{version}} type=semver,pattern={{version}}
type=ref,event=branch type=ref,event=branch
@@ -155,13 +231,14 @@ jobs:
org.opencontainers.image.licenses=MIT org.opencontainers.image.licenses=MIT
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- name: Build and push - name: Build and push
uses: docker/build-push-action@v6 uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with: with:
context: . context: .
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
platforms: windows/amd64 platforms: windows/amd64
annotations: ${{ steps.meta.outputs.labels }}

View File

@@ -17,7 +17,7 @@ jobs:
name: Check for spelling errors name: Check for spelling errors
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: codespell-project/actions-codespell@master - uses: codespell-project/actions-codespell@master
with: with:
check_filenames: true check_filenames: true

View File

@@ -11,7 +11,7 @@ jobs:
if: github.repository_owner == 'prometheus' || github.repository_owner == 'prometheus-community' # Don't run this workflow on forks. if: github.repository_owner == 'prometheus' || github.repository_owner == 'prometheus-community' # Don't run this workflow on forks.
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0 - uses: actions/stale@997185467fa4f803885201cee163a9f38240193d # v10.1.1
with: with:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
# opt out of defaults to avoid marking issues as stale and closing them # opt out of defaults to avoid marking issues as stale and closing them

View File

@@ -11,7 +11,7 @@ jobs:
if: github.repository_owner == 'prometheus' || github.repository_owner == 'prometheus-community' # Don't run this workflow on forks. if: github.repository_owner == 'prometheus' || github.repository_owner == 'prometheus-community' # Don't run this workflow on forks.
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0 - uses: actions/stale@997185467fa4f803885201cee163a9f38240193d # v10.1.1
with: with:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
# opt out of defaults to avoid marking issues as stale and closing them # opt out of defaults to avoid marking issues as stale and closing them

16
.gitignore vendored
View File

@@ -4,9 +4,21 @@ VERSION
*.un~ *.un~
output/ output/
.vscode .vscode
.idea
*.syso *.syso
installer/*.msi installer/*.msi
installer/*.log
installer/*.wixpdb installer/*.wixpdb
local/ local/
!.idea/inspectionProfiles/Project_Default.xml
/.idea/*
!/.idea/inspectionProfiles/
/.idea/inspectionProfiles/*
!/.idea/inspectionProfiles/Project_Default.xml
!/.idea/dictionaries/
/.idea/dictionaries/*
!/.idea/dictionaries/project.xml
/.idea/copyright/*
!/.idea/copyright/profiles_settings.xml
!/.idea/copyright/windows_exporter.xml
!/.idea/vcs.xml
!/.idea/go.imports.xml

View File

@@ -1,89 +1,146 @@
version: "2"
linters: linters:
enable-all: true default: all
disable: disable:
- cyclop - cyclop
- depguard - depguard
- dogsled
- dupl - dupl
- err113 - err113
- execinquery
- exhaustive - exhaustive
- exhaustruct - exhaustruct
- exportloopref
- fatcontext - fatcontext
- funcorder
- funlen - funlen
- gocognit - gocognit
- goconst - goconst
- gocyclo - gocyclo
- godoclint
- godot - godot
- gomnd
- paralleltest
- lll - lll
- maintidx - maintidx
- mnd - mnd
- noinlineerr
- paralleltest
- tagliatelle
- testpackage - testpackage
- unqueryvet
- varnamelen - varnamelen
- wrapcheck - wrapcheck
- wsl
settings:
forbidigo:
forbid:
- pattern: ^(fmt\.Print(|f|ln)|print|println)$
- pattern: ^syscall\.(.{1,7}|.{7}[^N]|.{9,})$
msg: use golang.org/x/sys/windows instead of syscall
- pattern: ^windows\.NewLazyDLL$
msg: use NewLazySystemDLL instead NewLazyDLL
goheader:
values:
const:
COMPANY: The Prometheus Authors
template: |-
SPDX-License-Identifier: Apache-2.0
run: Copyright {{ COMPANY }}
timeout: 15m Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
output: http://www.apache.org/licenses/LICENSE-2.0
sort-results: true
linters-settings: Unless required by applicable law or agreed to in writing, software
gosec: distributed under the License is distributed on an "AS IS" BASIS,
excludes: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- G101 # Potential hardcoded credentials See the License for the specific language governing permissions and
- G115 # integer overflow conversion limitations under the License.
gomoddirectives:
gci: toolchain-forbidden: true
sections: gosec:
- prefix(github.com/prometheus-community/windows_exporter/internal/windowsservice) excludes:
- standard # Standard section: captures all standard packages. - G101
- default # Default section: contains all imports that could not be matched to another section type. - G115
custom-order: true govet:
tagliatelle: enable-all: true
case: disable:
use-field-name: true - fieldalignment
- shadow
revive:
rules: rules:
# Any struct tag type can be used. - name: var-naming
# Support string case: `camel`, `pascal`, `kebab`, `snake`, `upperSnake`, `goCamel`, `goPascal`, `goKebab`, `goSnake`, `upper`, `lower`, `header` arguments:
json: camel - [ ] # AllowList - do not remove as args for the rule are positional and won't work without lists first
yaml: snake - [ ] # DenyList
forbidigo: - - skip-package-name-checks: true
forbid: sloglint:
- "^(fmt\\.Print(|f|ln)|print|println)$" no-mixed-args: true
- p: "^syscall\\.(.{1,7}|.{7}[^N]|.{9,})$" kv-only: false
msg: use golang.org/x/sys/windows instead of syscall attr-only: true
- p: "^windows\\.NewLazyDLL$" no-global: all
msg: use NewLazySystemDLL instead NewLazyDLL context: scope
sloglint: static-msg: false
no-mixed-args: true no-raw-keys: false
kv-only: false key-naming-case: snake
attr-only: true forbidden-keys:
no-global: "all" - time
context: "scope" - level
static-msg: false - msg
no-raw-keys: false - source
key-naming-case: snake args-on-sep-lines: true
forbidden-keys: staticcheck:
- time checks:
- level - -ST1003
- msg - all
- source tagliatelle:
args-on-sep-lines: true case:
stylecheck: rules:
checks: ["all", "-ST1003"] json: camel
issues: yaml: snake
exclude: use-field-name: true
- don't use underscores in Go names exclusions:
- don't use an underscore in package name generated: lax
- exported type .+ should have comment or be unexported presets:
exclude-rules: - comments
- # Golint has many capitalisation complaints on WMI class names - common-false-positives
text: "`?\\w+`? should be `?\\w+`?" - legacy
linters: - std-error-handling
- revive rules:
- text: "don't use ALL_CAPS in Go names; use CamelCase" - linters:
linters: - revive
- revive text: '`?\w+`? should be `?\w+`?'
- linters:
- revive
text: don't use ALL_CAPS in Go names; use CamelCase
- path: .+\.go$
text: don't use underscores in Go names
- path: .+\.go$
text: don't use an underscore in package name
- path: .+\.go$
text: exported type .+ should have comment or be unexported
- linters:
- staticcheck
text: "ST1003:"
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gci
- gofmt
- gofumpt
- goimports
settings:
gci:
sections:
- prefix(github.com/prometheus-community/windows_exporter/internal/windowsservice)
- standard
- default
custom-order: true
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$

11
.idea/copyright/profiles_settings.xml generated Normal file
View File

@@ -0,0 +1,11 @@
<component name="CopyrightManager">
<settings default="windows_exporter">
<module2copyright>
<element module="All Changed Files" copyright="windows_exporter" />
</module2copyright>
<LanguageOptions name="Go">
<option name="fileTypeOverride" value="3" />
<option name="block" value="false" />
</LanguageOptions>
</settings>
</component>

7
.idea/copyright/windows_exporter.xml generated Normal file
View File

@@ -0,0 +1,7 @@
<component name="CopyrightManager">
<copyright>
<option name="keyword" value="The Prometheus Authors" />
<option name="notice" value="SPDX-License-Identifier: Apache-2.0&#10;&#10;Copyright The Prometheus Authors&#10;Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);&#10;you may not use this file except in compliance with the License.&#10;You may obtain a copy of the License at&#10;&#10;http://www.apache.org/licenses/LICENSE-2.0&#10;&#10;Unless required by applicable law or agreed to in writing, software&#10;distributed under the License is distributed on an &quot;AS IS&quot; BASIS,&#10;WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&#10;See the License for the specific language governing permissions and&#10;limitations under the License." />
<option name="myName" value="windows_exporter" />
</copyright>
</component>

16
.idea/dictionaries/project.xml generated Normal file
View File

@@ -0,0 +1,16 @@
<component name="ProjectDictionaryState">
<dictionary name="project">
<words>
<w>containerd</w>
<w>endpointstats</w>
<w>gochecknoglobals</w>
<w>lpwstr</w>
<w>luid</w>
<w>operationoptions</w>
<w>setupapi</w>
<w>spdx</w>
<w>textfile</w>
<w>vmcompute</w>
</words>
</dictionary>
</component>

11
.idea/go.imports.xml generated Normal file
View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GoImports">
<option name="excludedPackages">
<array>
<option value="github.com/pkg/errors" />
<option value="golang.org/x/net/context" />
</array>
</option>
</component>
</project>

View File

@@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="GoLinter" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>

6
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@@ -1,8 +1,25 @@
<!--
~ SPDX-License-Identifier: Apache-2.0
~
~ Copyright The Prometheus Authors
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="all" type="GoApplicationRunConfiguration" factoryName="Go Application" folderName="run"> <configuration default="false" name="all" type="GoApplicationRunConfiguration" factoryName="Go Application" folderName="run">
<module name="windows_exporter" /> <module name="windows_exporter" />
<working_directory value="$PROJECT_DIR$" /> <working_directory value="$PROJECT_DIR$" />
<parameters value="--web.listen-address=127.0.0.1:9182 --log.level=info --collectors.enabled=ad,adcs,adfs,cache,container,cpu,cpu_info,cs,dfsr,dhcp,diskdrive,dns,exchange,filetime,fsrmquota,hyperv,iis,license,logical_disk,logon,memory,mscluster,msmq,mssql,net,netframework,nps,os,pagefile,performancecounter,physical_disk,printer,process,remote_fx,scheduled_task,service,smb,smbclient,smtp,system,tcp,terminal_services,thermalzone,time,udp,update,vmware,performancecounter --debug.enabled --collector.performancecounter.objects='[{ &quot;name&quot;: &quot;memory&quot;, &quot;type&quot;: &quot;formatted&quot;, &quot;object&quot;: &quot;Memory&quot;, &quot;counters&quot;: [{ &quot;name&quot;:&quot;Cache Faults/sec&quot;, &quot;type&quot;:&quot;counter&quot; }]}]'" /> <parameters value="--web.listen-address=127.0.0.1:9182 --log.level=info --collectors.enabled=ad,adcs,adfs,cache,container,cpu,cpu_info,dfsr,dhcp,diskdrive,dns,exchange,file,fsrmquota,hyperv,iis,license,logical_disk,memory,mscluster,msmq,mssql,net,netframework,nps,os,pagefile,performancecounter,physical_disk,printer,process,remote_fx,scheduled_task,service,smb,smbclient,smtp,system,tcp,terminal_services,thermalzone,time,udp,update,vmware,performancecounter --debug.enabled --collector.performancecounter.objects='[{ &quot;name&quot;: &quot;memory&quot;, &quot;type&quot;: &quot;formatted&quot;, &quot;object&quot;: &quot;Memory&quot;, &quot;counters&quot;: [{ &quot;name&quot;:&quot;Cache Faults/sec&quot;, &quot;type&quot;:&quot;counter&quot; }]}]'" />
<sudo value="true" /> <sudo value="true" />
<kind value="PACKAGE" /> <kind value="PACKAGE" />
<package value="github.com/prometheus-community/windows_exporter/cmd/windows_exporter" /> <package value="github.com/prometheus-community/windows_exporter/cmd/windows_exporter" />

View File

@@ -1,10 +1,11 @@
Maintainers in alphabetical order Maintainers in alphabetical order
* [Ben Reedy](https://github.com/breed808) - breed808@breed808.com * [Ben Reedy](https://github.com/breed808) - breed808@breed808.com
* [Calle Pettersson](https://github.com/carlpett) - calle@cape.nu
* [Jan-Otto Kröpke](https://github.com/jkroepke) - github@jkroepke.de * [Jan-Otto Kröpke](https://github.com/jkroepke) - github@jkroepke.de
Alumni Alumni
* [Brian Brazil](https://github.com/brian-brazil) * [Brian Brazil](https://github.com/brian-brazil)
* [Calle Pettersson](https://github.com/carlpett)
* [Martin Lindhe](https://github.com/martinlindhe) * [Martin Lindhe](https://github.com/martinlindhe)

View File

@@ -29,7 +29,7 @@ test:
go test -v ./... go test -v ./...
bench: bench:
go test -v -bench='benchmarkcollector' ./internal/collectors/{cpu,logical_disk,physical_disk,logon,memory,net,printer,process,service,system,tcp,time} go test -v -bench='benchmarkcollector' ./internal/collectors/{cpu,logical_disk,physical_disk,memory,net,printer,process,service,system,tcp,time}
lint: lint:
golangci-lint -c .golangci.yaml run golangci-lint -c .golangci.yaml run

190
README.md
View File

@@ -12,55 +12,53 @@ A Prometheus exporter for Windows machines.
## Collectors ## Collectors
Name | Description | Enabled by default | Name | Description | Enabled by default |
---------|-------------|-------------------- |------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------|
[ad](docs/collector.ad.md) | Active Directory Domain Services | | [ad](docs/collector.ad.md) | Active Directory Domain Services | |
[adcs](docs/collector.adcs.md) | Active Directory Certificate Services | | [adcs](docs/collector.adcs.md) | Active Directory Certificate Services | |
[adfs](docs/collector.adfs.md) | Active Directory Federation Services | | [adfs](docs/collector.adfs.md) | Active Directory Federation Services | |
[cache](docs/collector.cache.md) | Cache metrics | | [cache](docs/collector.cache.md) | Cache metrics | |
[cpu](docs/collector.cpu.md) | CPU usage | &#10003; | [cpu](docs/collector.cpu.md) | CPU usage | &#10003; |
[cpu_info](docs/collector.cpu_info.md) | CPU Information | | [cpu_info](docs/collector.cpu_info.md) | CPU Information | |
[cs](docs/collector.cs.md) | "Computer System" metrics (system properties, num cpus/total memory) | | [container](docs/collector.container.md) | Container metrics | |
[container](docs/collector.container.md) | Container metrics | | [diskdrive](docs/collector.diskdrive.md) | Diskdrive metrics | |
[diskdrive](docs/collector.diskdrive.md) | Diskdrive metrics | | [dfsr](docs/collector.dfsr.md) | DFSR metrics | |
[dfsr](docs/collector.dfsr.md) | DFSR metrics | | [dhcp](docs/collector.dhcp.md) | DHCP Server | |
[dhcp](docs/collector.dhcp.md) | DHCP Server | | [dns](docs/collector.dns.md) | DNS Server | |
[dns](docs/collector.dns.md) | DNS Server | | [exchange](docs/collector.exchange.md) | Exchange metrics | |
[exchange](docs/collector.exchange.md) | Exchange metrics | | [file](docs/collector.file.md) | File metrics | |
[filetime](docs/collector.filetime.md) | FileTime metrics | | [fsrmquota](docs/collector.fsrmquota.md) | Microsoft File Server Resource Manager (FSRM) Quotas collector | |
[fsrmquota](docs/collector.fsrmquota.md) | Microsoft File Server Resource Manager (FSRM) Quotas collector | | [gpu](docs/collector.gpu.md) | GPU metrics | |
[hyperv](docs/collector.hyperv.md) | Hyper-V hosts | | [hyperv](docs/collector.hyperv.md) | Hyper-V hosts | |
[iis](docs/collector.iis.md) | IIS sites and applications | | [iis](docs/collector.iis.md) | IIS sites and applications | |
[license](docs/collector.license.md) | Windows license status | | [license](docs/collector.license.md) | Windows license status | |
[logical_disk](docs/collector.logical_disk.md) | Logical disks, disk I/O | &#10003; | [logical_disk](docs/collector.logical_disk.md) | Logical disks, disk I/O | &#10003; |
[logon](docs/collector.logon.md) | User logon sessions | | [memory](docs/collector.memory.md) | Memory usage metrics | &#10003; |
[memory](docs/collector.memory.md) | Memory usage metrics | &#10003; | [mscluster](docs/collector.mscluster.md) | MSCluster metrics | |
[mscluster](docs/collector.mscluster.md) | MSCluster metrics | | [msmq](docs/collector.msmq.md) | MSMQ queues | |
[msmq](docs/collector.msmq.md) | MSMQ queues | | [mssql](docs/collector.mssql.md) | [SQL Server Performance Objects](https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/use-sql-server-objects#SQLServerPOs) metrics | |
[mssql](docs/collector.mssql.md) | [SQL Server Performance Objects](https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/use-sql-server-objects#SQLServerPOs) metrics | | [netframework](docs/collector.netframework.md) | .NET Framework metrics | |
[netframework](docs/collector.netframework.md) | .NET Framework metrics | | [net](docs/collector.net.md) | Network interface I/O | &#10003; |
[net](docs/collector.net.md) | Network interface I/O | &#10003; | [os](docs/collector.os.md) | OS metrics (memory, processes, users) | &#10003; |
[os](docs/collector.os.md) | OS metrics (memory, processes, users) | &#10003; | [pagefile](docs/collector.pagefile.md) | pagefile metrics | |
[pagefile](docs/collector.pagefile.md) | pagefile metrics | | [performancecounter](docs/collector.performancecounter.md) | Custom performance counter metrics | |
[performancecounter](docs/collector.performancecounter.md) | Custom performance counter metrics | | [physical_disk](docs/collector.physical_disk.md) | physical disk metrics | &#10003; |
[physical_disk](docs/collector.physical_disk.md) | physical disk metrics | &#10003; | [printer](docs/collector.printer.md) | Printer metrics | |
[printer](docs/collector.printer.md) | Printer metrics | | [process](docs/collector.process.md) | Per-process metrics | |
[process](docs/collector.process.md) | Per-process metrics | | [remote_fx](docs/collector.remote_fx.md) | RemoteFX protocol (RDP) metrics | |
[remote_fx](docs/collector.remote_fx.md) | RemoteFX protocol (RDP) metrics | | [scheduled_task](docs/collector.scheduled_task.md) | Scheduled Tasks metrics | |
[scheduled_task](docs/collector.scheduled_task.md) | Scheduled Tasks metrics | | [service](docs/collector.service.md) | Service state metrics | &#10003; |
[service](docs/collector.service.md) | Service state metrics | &#10003; | [smb](docs/collector.smb.md) | SMB Server | |
[smb](docs/collector.smb.md) | SMB Server | | [smbclient](docs/collector.smbclient.md) | SMB Client | |
[smbclient](docs/collector.smbclient.md) | SMB Client | | [smtp](docs/collector.smtp.md) | IIS SMTP Server | |
[smtp](docs/collector.smtp.md) | IIS SMTP Server | | [system](docs/collector.system.md) | System calls | &#10003; |
[system](docs/collector.system.md) | System calls | &#10003; | [tcp](docs/collector.tcp.md) | TCP connections | |
[tcp](docs/collector.tcp.md) | TCP connections | | [terminal_services](docs/collector.terminal_services.md) | Terminal services (RDS) | |
[terminal_services](docs/collector.terminal_services.md) | Terminal services (RDS) | [textfile](docs/collector.textfile.md) | Read prometheus metrics from a text file | |
[textfile](docs/collector.textfile.md) | Read prometheus metrics from a text file | | [time](docs/collector.time.md) | Windows Time Service | |
[thermalzone](docs/collector.thermalzone.md) | Thermal information | | [udp](docs/collector.udp.md) | UDP connections | |
[time](docs/collector.time.md) | Windows Time Service | | [update](docs/collector.update.md) | Windows Update Service | |
[udp](docs/collector.udp.md) | UDP connections | | [vmware](docs/collector.vmware.md) | Performance counters installed by the Vmware Guest agent | |
[update](docs/collector.update.md) | Windows Update Service |
[vmware](docs/collector.vmware.md) | Performance counters installed by the Vmware Guest agent |
See the linked documentation on each collector for more information on reported metrics, configuration settings and usage examples. See the linked documentation on each collector for more information on reported metrics, configuration settings and usage examples.
@@ -83,23 +81,23 @@ This can be useful for having different Prometheus servers collect specific metr
windows_exporter accepts flags to configure certain behaviours. The ones configuring the global behaviour of the exporter are listed below, while collector-specific ones are documented in the respective collector documentation above. windows_exporter accepts flags to configure certain behaviours. The ones configuring the global behaviour of the exporter are listed below, while collector-specific ones are documented in the respective collector documentation above.
| Flag | Description | Default value | | Flag | Description | Default value |
|--------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------| |---------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
| `--web.listen-address` | host:port for exporter. | `:9182` | | `--web.listen-address` | host:port for exporter. | `:9182` |
| `--telemetry.path` | URL path for surfacing collected metrics. | `/metrics` | | `--telemetry.path` | URL path for surfacing collected metrics. | `/metrics` |
| `--telemetry.max-requests` | Maximum number of concurrent requests. 0 to disable. | `5` | | `--collectors.enabled` | Comma-separated list of collectors to use. Use `[defaults]` as a placeholder which gets expanded containing all the collectors enabled by default. | `[defaults]` |
| `--collectors.enabled` | Comma-separated list of collectors to use. Use `[defaults]` as a placeholder which gets expanded containing all the collectors enabled by default." | `[defaults]` | | `--scrape.timeout-margin` | Seconds to subtract from the timeout allowed by the client. Tune to allow for overhead or high loads. | `0.5` |
| `--collectors.print` | If true, print available collectors and exit. | | | `--web.config.file` | A [web config][web_config] for setting up TLS and Auth | None |
| `--scrape.timeout-margin` | Seconds to subtract from the timeout allowed by the client. Tune to allow for overhead or high loads. | `0.5` | | `--config.file` | [Using a config file](#using-a-configuration-file) from path | None |
| `--web.config.file` | A [web config][web_config] for setting up TLS and Auth | None | | `--log.file` | Output file of log messages. One of [stdout, stderr, eventlog, \<path to log file>]<br>**NOTE:** The MSI installer will add a default argument to the installed service setting this to eventlog | stderr |
| `--config.file` | [Using a config file](#using-a-configuration-file) from path or URL | None |
| `--config.file.insecure-skip-verify` | Skip TLS when loading config file from URL | false |
| `--log.file` | Output file of log messages. One of [stdout, stderr, eventlog, \<path to log file>]<br>**NOTE:** The MSI installer will add a default argument to the installed service setting this to eventlog | stderr |
## Installation ## Installation
The latest release can be downloaded from the [releases page](https://github.com/prometheus-community/windows_exporter/releases). The latest release can be downloaded from the [releases page](https://github.com/prometheus-community/windows_exporter/releases).
All binaries and installation packages are signed with an self-signed certificate. The public key can be found [here](https://github.com/prometheus-community/windows_exporter/blob/master/installer/codesign.cer).
Once import into the trusted root certificate store, the binaries and installation packages will be trusted.
Each release provides a .msi installer. The installer will setup the windows_exporter as a Windows service, as well as create an exception in the Windows Firewall. Each release provides a .msi installer. The installer will setup the windows_exporter as a Windows service, as well as create an exception in the Windows Firewall.
If the installer is run without any parameters, the exporter will run with default settings for enabled collectors, ports, etc. If the installer is run without any parameters, the exporter will run with default settings for enabled collectors, ports, etc.
@@ -113,18 +111,22 @@ The configuration file
The following parameters are available: The following parameters are available:
| Name | Description | | Name | Description |
|----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `ENABLED_COLLECTORS` | As the `--collectors.enabled` flag, provide a comma-separated list of enabled collectors | | `ENABLED_COLLECTORS` | As the `--collectors.enabled` flag, provide a comma-separated list of enabled collectors |
| `CONFIG_FILE` | Use the `--config.file` flag to specify a config file. If empty, no config file will be set. The special value `config.yaml` set the path to the config.yaml at install dir | | | `CONFIG_FILE` | Use the `--config.file` flag to specify a config file. If empty, default config file at install dir will be used. If set, the config file must be exist before the installation is started. | |
| `LISTEN_ADDR` | The IP address to bind to. Defaults to an empty string. (any local address) | | `LISTEN_ADDR` | The IP address to bind to. Defaults to an empty string. (any local address) |
| `LISTEN_PORT` | The port to bind to. Defaults to `9182`. | | `LISTEN_PORT` | The port to bind to. Defaults to `9182`. |
| `METRICS_PATH` | The path at which to serve metrics. Defaults to `/metrics` | | `METRICS_PATH` | The path at which to serve metrics. Defaults to `/metrics` |
| `TEXTFILE_DIRS` | Use the `--collector.textfile.directories` flag to specify one or more directories, separated by commas, where the collector should read text files containing metrics | | `TEXTFILE_DIRS` | Use the `--collector.textfile.directories` flag to specify one or more directories, separated by commas, where the collector should read text files containing metrics |
| `REMOTE_ADDR` | Allows setting comma separated remote IP addresses for the Windows Firewall exception (allow list). Defaults to an empty string (any remote address). | | `REMOTE_ADDR` | Allows setting comma separated remote IP addresses for the Windows Firewall exception (allow list). Defaults to an empty string (any remote address). |
| `EXTRA_FLAGS` | Allows passing full CLI flags. Defaults to an empty string. For `--collectors.enabled` and `--config.file`, use the specialized properties `ENABLED_COLLECTORS` and `CONFIG_FILE` | | `EXTRA_FLAGS` | Allows passing full CLI flags. Defaults to an empty string. For `--collectors.enabled` and `--config.file`, use the specialized properties `ENABLED_COLLECTORS` and `CONFIG_FILE` |
| `ADDLOCAL` | Enables features within the windows_exporter installer. Supported values: `FirewallException` | | `ADDLOCAL` | Enables features within the windows_exporter installer. Supported values: `FirewallException` |
| `REMOVE` | Disables features within the windows_exporter installer. Supported values: `FirewallException` | | `REMOVE` | Disables features within the windows_exporter installer. Supported values: `FirewallException` |
| `APPLICATIONFOLDER` | Directory to install windows_exporter. Defaults to `C:\Program Files\windows_exporter` |
> [!NOTE]
> The installer properties are always preferred over the values defined in the config file. If you prefer to configure via the config file, avoid using any of the properties listed above.
Parameters are sent to the installer via `msiexec`. Parameters are sent to the installer via `msiexec`.
On PowerShell, the `--%` should be passed before defining properties. On PowerShell, the `--%` should be passed before defining properties.
@@ -145,10 +147,15 @@ Define a config file.
msiexec /i <path-to-msi-file> --% CONFIG_FILE="D:\config.yaml" msiexec /i <path-to-msi-file> --% CONFIG_FILE="D:\config.yaml"
``` ```
Alternative install directory
```powershell
msiexec /i <path-to-msi-file> --% ADDLOCAL=FirewallException APPLICATIONFOLDER="F:\Program Files\windows_exporter"
```
On some older versions of Windows, On some older versions of Windows,
you may need to surround parameter values with double quotes to get the installation command parsing properly: you may need to surround parameter values with double quotes to get the installation command parsing properly:
```powershell ```powershell
msiexec /i C:\Users\Administrator\Downloads\windows_exporter.msi --% ENABLED_COLLECTORS="ad,iis,logon,memory,process,tcp,textfile,thermalzone" TEXTFILE_DIRS="C:\custom_metrics\" msiexec /i C:\Users\Administrator\Downloads\windows_exporter.msi --% ENABLED_COLLECTORS="ad,iis,memory,process,tcp,textfile,thermalzone" TEXTFILE_DIRS="C:\custom_metrics\"
``` ```
To install the exporter with creating a firewall exception, use the following command: To install the exporter with creating a firewall exception, use the following command:
@@ -170,15 +177,12 @@ The windows_exporter can be run as a Docker container. The Docker image is avail
* [Docker Hub](https://hub.docker.com/r/prometheuscommunity/windows-exporter): `docker.io/prometheuscommunity/windows-exporter` * [Docker Hub](https://hub.docker.com/r/prometheuscommunity/windows-exporter): `docker.io/prometheuscommunity/windows-exporter`
* [GitHub Container Registry](https://github.com/prometheus-community/windows_exporter/pkgs/container/windows-exporter): `ghcr.io/prometheus-community/windows-exporter` * [GitHub Container Registry](https://github.com/prometheus-community/windows_exporter/pkgs/container/windows-exporter): `ghcr.io/prometheus-community/windows-exporter`
<!-- * [quay.io Registry](https://quay.io/repository/prometheuscommunity/windows-exporter): `quay.io/prometheuscommunity/windows-exporter` --> * [quay.io Registry](https://quay.io/repository/prometheuscommunity/windows-exporter): `quay.io/prometheuscommunity/windows-exporter`
### Tags ### Tags
The Docker image is tagged with the version of the exporter. The `latest` tag is also available and points to the latest release. The Docker image is tagged with the version of the exporter. The `latest` tag is also available and points to the latest release.
Additionally, a flavor `hostprocess` with `-hostprocess` as suffix is based on the https://github.com/microsoft/windows-host-process-containers-base-image
which is designed to run as a Windows host process container. The size of that images is smaller than the default one.
## Kubernetes Implementation ## Kubernetes Implementation
See detailed steps to install on Windows Kubernetes [here](./kubernetes/kubernetes.md). See detailed steps to install on Windows Kubernetes [here](./kubernetes/kubernetes.md).
@@ -187,17 +191,7 @@ See detailed steps to install on Windows Kubernetes [here](./kubernetes/kubernet
`windows_exporter` supports Windows Server versions 2016 and later, and desktop Windows version 10 and 11 (21H2 or later). `windows_exporter` supports Windows Server versions 2016 and later, and desktop Windows version 10 and 11 (21H2 or later).
Windows Server 2012 and 2012R2 are supported as best-effort only, but not guaranteed to work. There are known compatibility issues with Windows Server 2012 R2 and earlier versions.
## Usage
go get -u github.com/prometheus/promu
go get -u github.com/prometheus-community/windows_exporter
cd $env:GOPATH/src/github.com/prometheus-community/windows_exporter
promu build -v
.\windows_exporter.exe
The prometheus metrics will be exposed on [localhost:9182](http://localhost:9182)
### HTTP Endpoints ### HTTP Endpoints
@@ -207,18 +201,6 @@ windows_exporter provides the following HTTP endpoints:
* `/health`: Returns 200 OK when the exporter is running. * `/health`: Returns 200 OK when the exporter is running.
* `/debug/pprof/`: Exposes the [pprof](https://golang.org/pkg/net/http/pprof/) endpoints. Only, if `--debug.enabled` is set. * `/debug/pprof/`: Exposes the [pprof](https://golang.org/pkg/net/http/pprof/) endpoints. Only, if `--debug.enabled` is set.
## Examples
### Enable only service collector and specify a custom query
.\windows_exporter.exe --collectors.enabled "service" --collector.service.include="windows_exporter"
### Enable only process collector and specify a custom query
.\windows_exporter.exe --collectors.enabled "process" --collector.process.include="firefox.+"
When there are multiple processes with the same name, WMI represents those after the first instance as `process-name#index`. So to get them all, rather than just the first one, the [regular expression](https://en.wikipedia.org/wiki/Regular_expression) must use `.+`. See [process](docs/collector.process.md) for more information.
### Using [defaults] with `--collectors.enabled` argument ### Using [defaults] with `--collectors.enabled` argument
Using `[defaults]` with `--collectors.enabled` argument which gets expanded with all default collectors. Using `[defaults]` with `--collectors.enabled` argument which gets expanded with all default collectors.
@@ -231,10 +213,6 @@ This enables the additional process and container collectors on top of the defau
YAML configuration files can be specified with the `--config.file` flag. e.g. `.\windows_exporter.exe --config.file=config.yml`. If you are using the absolute path, make sure to quote the path, e.g. `.\windows_exporter.exe --config.file="C:\Program Files\windows_exporter\config.yml"` YAML configuration files can be specified with the `--config.file` flag. e.g. `.\windows_exporter.exe --config.file=config.yml`. If you are using the absolute path, make sure to quote the path, e.g. `.\windows_exporter.exe --config.file="C:\Program Files\windows_exporter\config.yml"`
It is also possible to load the configuration from a URL. e.g. `.\windows_exporter.exe --config.file="https://example.com/config.yml"`
If you need to skip TLS verification, you can use the `--config.file.insecure-skip-verify` flag. e.g. `.\windows_exporter.exe --config.file="https://example.com/config.yml" --config.file.insecure-skip-verify`
```yaml ```yaml
collectors: collectors:
enabled: cpu,net,service enabled: cpu,net,service
@@ -251,7 +229,7 @@ An example configuration file can be found [here](docs/example_config.yml).
Configuration file values can be mixed with CLI flags. E.G. Configuration file values can be mixed with CLI flags. E.G.
`.\windows_exporter.exe --collectors.enabled=cpu,logon` `.\windows_exporter.exe --collectors.enabled=cpu`
```yaml ```yaml
log: log:

View File

@@ -1,4 +1,6 @@
// Copyright 2025 The Prometheus Authors // SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
@@ -11,11 +13,16 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
//go:build windows
package main package main
import ( import (
"errors"
"fmt" "fmt"
"os" "os"
"strings"
"unsafe"
"golang.org/x/sys/windows" "golang.org/x/sys/windows"
"golang.org/x/sys/windows/svc" "golang.org/x/sys/windows/svc"
@@ -33,6 +40,9 @@ var (
// stopCh is a channel to send a signal to the service manager that the service is stopping. // stopCh is a channel to send a signal to the service manager that the service is stopping.
stopCh = make(chan struct{}) stopCh = make(chan struct{})
// serviceManagerFinishedCh is a channel to send a signal to the main function that the service manager has stopped the service.
serviceManagerFinishedCh = make(chan struct{}, 1)
) )
// IsService variable declaration allows initiating time-sensitive components like registering the Windows service // IsService variable declaration allows initiating time-sensitive components like registering the Windows service
@@ -49,33 +59,37 @@ var (
// //
//nolint:gochecknoglobals //nolint:gochecknoglobals
var IsService = func() bool { var IsService = func() bool {
defer func() {
go func() {
err := svc.Run(serviceName, &windowsExporterService{})
if err == nil {
return
}
_ = logToEventToLog(windows.EVENTLOG_ERROR_TYPE, fmt.Sprintf("failed to start service: %v", err))
}()
}()
var err error var err error
isService, err := svc.IsWindowsService() isService, err := isWindowsService()
if err != nil { if err != nil {
_ = logToEventToLog(windows.EVENTLOG_ERROR_TYPE, fmt.Sprintf("failed to detect service: %v", err)) logToFile(fmt.Sprintf("failed to detect service: %v", err))
exitCodeCh <- 1 return false
} }
if !isService { if !isService {
return false return false
} }
defer func() {
go func() {
err := svc.Run(serviceName, &windowsExporterService{})
if err != nil {
// https://github.com/open-telemetry/opentelemetry-collector/pull/9042
if !errors.Is(err, windows.ERROR_FAILED_SERVICE_CONTROLLER_CONNECT) {
if logErr := logToEventToLog(windows.EVENTLOG_ERROR_TYPE, fmt.Sprintf("failed to start service: %v", err)); logErr != nil {
logToFile(fmt.Sprintf("failed to start service: %v", err))
}
}
}
serviceManagerFinishedCh <- struct{}{}
}()
}()
if err := logToEventToLog(windows.EVENTLOG_INFORMATION_TYPE, "attempting to start exporter service"); err != nil { if err := logToEventToLog(windows.EVENTLOG_INFORMATION_TYPE, "attempting to start exporter service"); err != nil {
//nolint:gosec logToFile(fmt.Sprintf("failed sent log to event log: %v", err))
_ = os.WriteFile("C:\\Program Files\\windows_exporter\\start-service.error.log", []byte(fmt.Sprintf("failed sent log to event log: %v", err)), 0o644)
exitCodeCh <- 2 exitCodeCh <- 2
} }
@@ -88,6 +102,7 @@ type windowsExporterService struct{}
// Execute is the entry point for the Windows service manager. // Execute is the entry point for the Windows service manager.
func (s *windowsExporterService) Execute(_ []string, r <-chan svc.ChangeRequest, changes chan<- svc.Status) (bool, uint32) { func (s *windowsExporterService) Execute(_ []string, r <-chan svc.ChangeRequest, changes chan<- svc.Status) (bool, uint32) {
changes <- svc.Status{State: svc.StartPending} changes <- svc.Status{State: svc.StartPending}
// Send a signal to the main function that the service is running.
changes <- svc.Status{State: svc.Running, Accepts: svc.AcceptStop | svc.AcceptShutdown} changes <- svc.Status{State: svc.Running, Accepts: svc.AcceptStop | svc.AcceptShutdown}
for { for {
@@ -122,7 +137,7 @@ func (s *windowsExporterService) Execute(_ []string, r <-chan svc.ChangeRequest,
// logToEventToLog logs a message to the Windows event log. // logToEventToLog logs a message to the Windows event log.
func logToEventToLog(eType uint16, msg string) error { func logToEventToLog(eType uint16, msg string) error {
eventLog, err := eventlog.Open("windows_exporter") eventLog, err := eventlog.Open(serviceName)
if err != nil { if err != nil {
return fmt.Errorf("failed to open event log: %w", err) return fmt.Errorf("failed to open event log: %w", err)
} }
@@ -130,18 +145,71 @@ func logToEventToLog(eType uint16, msg string) error {
_ = eventLog.Close() _ = eventLog.Close()
}(eventLog) }(eventLog)
p, err := windows.UTF16PtrFromString(msg) switch eType {
if err != nil { case windows.EVENTLOG_ERROR_TYPE:
return fmt.Errorf("error convert string to UTF-16: %w", err) err = eventLog.Error(102, msg)
case windows.EVENTLOG_WARNING_TYPE:
err = eventLog.Warning(101, msg)
case windows.EVENTLOG_INFORMATION_TYPE:
err = eventLog.Info(100, msg)
} }
zero := uint16(0)
ss := []*uint16{p, &zero, &zero, &zero, &zero, &zero, &zero, &zero, &zero}
err = windows.ReportEvent(eventLog.Handle, eType, 0, 3299, 0, 9, 0, &ss[0], nil)
if err != nil { if err != nil {
return fmt.Errorf("error report event: %w", err) return fmt.Errorf("error report event: %w", err)
} }
return nil return nil
} }
func logToFile(msg string) {
if file, err := os.CreateTemp("", "windows_exporter.service.error.log"); err == nil {
_, _ = file.WriteString(msg)
_ = file.Close()
}
}
// isWindowsService is a clone of "golang.org/x/sys/windows/svc:IsWindowsService", but with a fix
// for Windows containers.
// Go cloned the .NET implementation of this function, which has since
// been patched to support Windows containers, which don't use Session ID 0 for services.
// https://github.com/dotnet/runtime/pull/74188
// This function can be replaced with go's once go brings in the fix.
//
// Copyright 2023-present Datadog, Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// https://github.com/DataDog/datadog-agent/blob/46740e82ef40a04c4be545ed8c16a4b0d1f046cf/pkg/util/winutil/servicemain/servicemain.go#L128
func isWindowsService() (bool, error) {
var currentProcess windows.PROCESS_BASIC_INFORMATION
infoSize := uint32(unsafe.Sizeof(currentProcess))
err := windows.NtQueryInformationProcess(windows.CurrentProcess(), windows.ProcessBasicInformation, unsafe.Pointer(&currentProcess), infoSize, &infoSize)
if err != nil {
return false, err
}
var parentProcess *windows.SYSTEM_PROCESS_INFORMATION
for infoSize = uint32((unsafe.Sizeof(*parentProcess) + unsafe.Sizeof(uintptr(0))) * 1024); ; {
parentProcess = (*windows.SYSTEM_PROCESS_INFORMATION)(unsafe.Pointer(&make([]byte, infoSize)[0]))
err = windows.NtQuerySystemInformation(windows.SystemProcessInformation, unsafe.Pointer(parentProcess), infoSize, &infoSize)
if err == nil {
break
} else if !errors.Is(err, windows.STATUS_INFO_LENGTH_MISMATCH) {
return false, err
}
}
for ; ; parentProcess = (*windows.SYSTEM_PROCESS_INFORMATION)(unsafe.Pointer(uintptr(unsafe.Pointer(parentProcess)) + uintptr(parentProcess.NextEntryOffset))) {
if parentProcess.UniqueProcessID == currentProcess.InheritedFromUniqueProcessId {
return strings.EqualFold("services.exe", parentProcess.ImageName.String()), nil
}
if parentProcess.NextEntryOffset == 0 {
break
}
}
return false, nil
}

View File

@@ -1,4 +1,6 @@
// Copyright 2024 The Prometheus Authors // SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
@@ -17,179 +19,5 @@ The main package for the windows_exporter executable.
usage: windows_exporter [<flags>] usage: windows_exporter [<flags>]
A metrics collector for Windows. A metrics collector for Windows.
Flags:
-h, --[no-]help Show context-sensitive help (also try
--help-long and --help-man).
--config.file=CONFIG.FILE YAML configuration file to use. Values set in
this file will be overridden by CLI flags.
--[no-]config.file.insecure-skip-verify
Skip TLS verification in loading YAML
configuration.
--web.listen-address=:9182 ...
Addresses on which to expose metrics and web
interface. Repeatable for multiple addresses.
Examples: `:9100` or `[::1]:9100` for http,
`vsock://:9100` for vsock
--web.config.file="" Path to configuration file that can
enable TLS or authentication. See:
https://github.com/prometheus/exporter-toolkit/blob/master/docs/web-configuration.md
--telemetry.path="/metrics"
URL path for surfacing collected metrics.
--[no-]web.disable-exporter-metrics
Exclude metrics about the exporter itself
(promhttp_*, process_*, go_*).
--telemetry.max-requests=5
Maximum number of concurrent requests. 0 to
disable.
--collectors.enabled="cpu,cs,memory,logical_disk,physical_disk,net,os,service,system"
Comma-separated list of collectors to use.
Use '[defaults]' as a placeholder for all the
collectors enabled by default.
--scrape.timeout-margin=0.5
Seconds to subtract from the timeout allowed by
the client. Tune to allow for overhead or high
loads.
--[no-]debug.enabled If true, windows_exporter will expose debug
endpoints under /debug/pprof.
--process.priority="normal"
Priority of the exporter process. Higher
priorities may improve exporter responsiveness
during periods of system load. Can be one of
["realtime", "high", "abovenormal", "normal",
"belownormal", "low"]
--log.level=info Only log messages with the given severity or
above. One of: [debug, info, warn, error]
--log.format=logfmt Output format of log messages. One of: [logfmt,
json]
--log.file=stderr Output file of log messages. One of [stdout,
stderr, eventlog, <path to log file>]
--[no-]version Show application version.
--collector.scheduled_task.exclude=""
Regexp of tasks to exclude. Task path must
both match include and not match exclude to be
included.
--collector.scheduled_task.include=".+"
Regexp of tasks to include. Task path must
both match include and not match exclude to be
included.
--[no-]collector.updates.online
Whether to search for updates online.
--collector.updates.scrape-interval=6h0m0s
Define the interval of scraping Windows Update
information.
--[no-]collector.exchange.list
List the collectors along with their perflib
object name/ids
--collector.exchange.enabled="ADAccessProcesses,TransportQueues,HttpProxy,ActiveSync,AvailabilityService,OutlookWebAccess,Autodiscover,WorkloadManagement,RpcClientAccess,MapiHttpEmsmdb"
Comma-separated list of collectors to use.
Defaults to all, if not specified.
--collector.net.nic-exclude=""
Regexp of NIC:s to exclude. NIC name must
both match include and not match exclude to be
included.
--collector.net.nic-include=".+"
Regexp of NIC:s to include. NIC name must
both match include and not match exclude to be
included.
--collector.net.enabled="metrics,nic_addresses"
Comma-separated list of collectors to use.
Defaults to all, if not specified.
--collector.mscluster.enabled="cluster,network,node,resource,resourcegroup"
Comma-separated list of collectors to use.
--collector.mssql.enabled="accessmethods,availreplica,bufman,databases,dbreplica,genstats,locks,memmgr,sqlerrors,sqlstats,transactions,waitstats"
Comma-separated list of collectors to use.
--collector.mssql.port=1433
Port of MSSQL server used for
windows_mssql_info metric.
--collector.physical_disk.disk-exclude=""
Regexp of disks to exclude. Disk number must
both match include and not match exclude to be
included.
--collector.physical_disk.disk-include=".+"
Regexp of disks to include. Disk number must
both match include and not match exclude to be
included.
--collector.textfile.directories="C:\\Users\\Jan\\GolandProjects\\windows_exporter\\textfile_inputs"
Directory or Directories to read text files
with metrics from.
--collector.filetime.file-patterns=""
Comma-separated list of file patterns.
Each pattern is a glob pattern that can
contain `*`, `?`, and `**` (recursive). See
https://github.com/bmatcuk/doublestar#patterns
--collector.iis.app-exclude=""
Regexp of apps to exclude. App name must both
match include and not match exclude to be
included.
--collector.iis.app-include=".+"
Regexp of apps to include. App name must both
match include and not match exclude to be
included.
--collector.iis.site-exclude=""
Regexp of sites to exclude. Site name must
both match include and not match exclude to be
included.
--collector.iis.site-include=".+"
Regexp of sites to include. Site name must
both match include and not match exclude to be
included.
--collector.perfdata.objects=""
Objects of performance data to observe.
See docs for more information on how to use
this flag. By default, no objects are observed.
--collector.printer.include=".+"
Regular expression to match printers to collect
metrics for
--collector.printer.exclude=""
Regular expression to match printers to exclude
--collector.process.exclude=""
Regexp of processes to exclude. Process name
must both match include and not match exclude
to be included.
--collector.process.include=".+"
Regexp of processes to include. Process name
must both match include and not match exclude
to be included.
--[no-]collector.process.iis
Enable IIS worker process name queries.
May cause the collector to leak memory.
--collector.hyperv.enabled="datastore,dynamic_memory_balancer,dynamic_memory_vm,hypervisor_logical_processor,hypervisor_root_partition,hypervisor_root_virtual_processor,hypervisor_virtual_processor,legacy_network_adapter,virtual_machine_health_summary,virtual_machine_vid_partition,virtual_network_adapter,virtual_network_adapter_drop_reasons,virtual_smb,virtual_storage_device,virtual_switch"
Comma-separated list of collectors to use.
--collector.logical_disk.volume-exclude=""
Regexp of volumes to exclude. Volume name must
both match include and not match exclude to be
included.
--collector.logical_disk.volume-include=".+"
Regexp of volumes to include. Volume name must
both match include and not match exclude to be
included.
--collector.smtp.server-exclude=""
Regexp of virtual servers to exclude. Server
name must both match include and not match
exclude to be included.
--collector.smtp.server-include=".+"
Regexp of virtual servers to include. Server
name must both match include and not match
exclude to be included.
--collector.tcp.enabled="metrics,connections_state"
Comma-separated list of collectors to use.
Defaults to all, if not specified.
--collector.dfsr.sources-enabled="connection,folder,volume"
Comma-separated list of DFSR Perflib sources to
use.
--collector.service.exclude=""
Regexp of service to exclude. Service name (not
the display name!) must both match include and
not match exclude to be included.
--collector.service.include=".+"
Regexp of service to include. Process name (not
the display name!) must both match include and
not match exclude to be included.
--collector.time.enabled="system_time,ntp"
Comma-separated list of collectors to use.
Defaults to all, if not specified. ntp may not
available on all systems.
*/ */
package main package main

View File

@@ -1,4 +1,6 @@
// Copyright 2024 The Prometheus Authors // SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
@@ -47,7 +49,11 @@ import (
) )
func main() { func main() {
exitCode := run() ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, os.Kill)
exitCode := run(ctx, os.Args[1:])
stop()
// If we are running as a service, we need to signal the service control manager that we are done. // If we are running as a service, we need to signal the service control manager that we are done.
if !IsService { if !IsService {
@@ -57,12 +63,11 @@ func main() {
exitCodeCh <- exitCode exitCodeCh <- exitCode
// Wait for the service control manager to signal that we are done. // Wait for the service control manager to signal that we are done.
<-stopCh <-serviceManagerFinishedCh
} }
func run() int { func run(ctx context.Context, args []string) int {
startTime := time.Now() startTime := time.Now()
ctx := context.Background()
app := kingpin.New("windows_exporter", "A metrics collector for Windows.") app := kingpin.New("windows_exporter", "A metrics collector for Windows.")
@@ -71,10 +76,6 @@ func run() int {
"config.file", "config.file",
"YAML configuration file to use. Values set in this file will be overridden by CLI flags.", "YAML configuration file to use. Values set in this file will be overridden by CLI flags.",
).String() ).String()
insecureSkipVerify = app.Flag(
"config.file.insecure-skip-verify",
"Skip TLS verification in loading YAML configuration.",
).Default("false").Bool()
webConfig = webflag.AddFlags(app, ":9182") webConfig = webflag.AddFlags(app, ":9182")
metricsPath = app.Flag( metricsPath = app.Flag(
"telemetry.path", "telemetry.path",
@@ -88,6 +89,10 @@ func run() int {
"collectors.enabled", "collectors.enabled",
"Comma-separated list of collectors to use. Use '[defaults]' as a placeholder for all the collectors enabled by default."). "Comma-separated list of collectors to use. Use '[defaults]' as a placeholder for all the collectors enabled by default.").
Default(collector.DefaultCollectors).String() Default(collector.DefaultCollectors).String()
disabledCollectors = app.Flag(
"collectors.disabled",
"Comma-separated list of collectors to exclude. Can be used to disable collector from the defaults.").
Default("").String()
timeoutMargin = app.Flag( timeoutMargin = app.Flag(
"scrape.timeout-margin", "scrape.timeout-margin",
"Seconds to subtract from the timeout allowed by the client. Tune to allow for overhead or high loads.", "Seconds to subtract from the timeout allowed by the client. Tune to allow for overhead or high loads.",
@@ -122,11 +127,9 @@ func run() int {
// Initialize collectors before loading and parsing CLI arguments // Initialize collectors before loading and parsing CLI arguments
collectors := collector.NewWithFlags(app) collectors := collector.NewWithFlags(app)
// Load values from configuration file(s). Executable flags must first be parsed, in order if err := config.Parse(app, args); err != nil {
// to load the specified file(s).
if _, err := app.Parse(os.Args[1:]); err != nil {
//nolint:sloglint // we do not have an logger yet //nolint:sloglint // we do not have an logger yet
slog.Error("Failed to parse CLI args", slog.LogAttrs(ctx, slog.LevelError, "Failed to load configuration",
slog.Any("err", err), slog.Any("err", err),
) )
@@ -137,61 +140,21 @@ func run() int {
logger, err := log.New(logConfig) logger, err := log.New(logConfig)
if err != nil { if err != nil {
//nolint:sloglint // we do not have an logger yet logger.LogAttrs(ctx, slog.LevelError, "failed to create logger",
slog.Error("failed to create logger",
slog.Any("err", err), slog.Any("err", err),
) )
return 1 return 1
} }
if *configFile != "" {
resolver, err := config.NewResolver(ctx, *configFile, logger, *insecureSkipVerify)
if err != nil {
logger.Error("could not load config file",
slog.Any("err", err),
)
return 1
}
if err = resolver.Bind(app, os.Args[1:]); err != nil {
logger.ErrorContext(ctx, "failed to bind configuration",
slog.Any("err", err),
)
return 1
}
// NOTE: This is temporary fix for issue #1092, calling kingpin.Parse
// twice makes slices flags duplicate its value, this clean up
// the first parse before the second call.
*webConfig.WebListenAddresses = (*webConfig.WebListenAddresses)[1:]
// Parse flags once more to include those discovered in configuration file(s).
if _, err = app.Parse(os.Args[1:]); err != nil {
logger.ErrorContext(ctx, "failed to parse CLI args from YAML file",
slog.Any("err", err),
)
return 1
}
logger, err = log.New(logConfig)
if err != nil {
//nolint:sloglint // we do not have an logger yet
slog.Error("failed to create logger",
slog.Any("err", err),
)
return 1
}
}
logger.LogAttrs(ctx, slog.LevelDebug, "logging has Started") logger.LogAttrs(ctx, slog.LevelDebug, "logging has Started")
if err = setPriorityWindows(logger, os.Getpid(), *processPriority); err != nil { if configFile != nil && *configFile != "" {
logger.Error("failed to set process priority", logger.LogAttrs(ctx, slog.LevelInfo, "using configuration file: "+*configFile)
}
if err = setPriorityWindows(ctx, logger, os.Getpid(), *processPriority); err != nil {
logger.LogAttrs(ctx, slog.LevelError, "failed to set process priority",
slog.Any("err", err), slog.Any("err", err),
) )
@@ -200,17 +163,21 @@ func run() int {
enabledCollectorList := expandEnabledCollectors(*enabledCollectors) enabledCollectorList := expandEnabledCollectors(*enabledCollectors)
if err := collectors.Enable(enabledCollectorList); err != nil { if err := collectors.Enable(enabledCollectorList); err != nil {
logger.Error("couldn't enable collectors", logger.LogAttrs(ctx, slog.LevelError, "couldn't enable collectors",
slog.Any("err", err), slog.Any("err", err),
) )
return 1 return 1
} }
if *disabledCollectors != "" {
collectors.Disable(slices.Compact(strings.Split(*disabledCollectors, ",")))
}
// Initialize collectors before loading // Initialize collectors before loading
if err = collectors.Build(logger); err != nil { if err = collectors.Build(ctx, logger); err != nil {
for _, err := range utils.SplitError(err) { for _, err := range utils.SplitError(err) {
logger.Error("couldn't initialize collector", logger.LogAttrs(ctx, slog.LevelError, "couldn't initialize collector",
slog.Any("err", err), slog.Any("err", err),
) )
@@ -218,7 +185,7 @@ func run() int {
} }
} }
logCurrentUser(logger) logCurrentUser(ctx, logger)
logger.InfoContext(ctx, "Enabled collectors: "+strings.Join(enabledCollectorList, ", ")) logger.InfoContext(ctx, "Enabled collectors: "+strings.Join(enabledCollectorList, ", "))
@@ -265,17 +232,14 @@ func run() int {
close(errCh) close(errCh)
}() }()
ctx, stop := signal.NotifyContext(ctx, os.Interrupt, os.Kill)
defer stop()
select { select {
case <-ctx.Done(): case <-ctx.Done():
logger.Info("Shutting down windows_exporter via kill signal") logger.LogAttrs(ctx, slog.LevelInfo, "Shutting down windows_exporter via kill signal")
case <-stopCh: case <-stopCh:
logger.Info("Shutting down windows_exporter via service control") logger.LogAttrs(ctx, slog.LevelInfo, "Shutting down windows_exporter via service control")
case err := <-errCh: case err := <-errCh:
if err != nil { if err != nil {
logger.ErrorContext(ctx, "Failed to start windows_exporter", logger.LogAttrs(ctx, slog.LevelError, "Failed to start windows_exporter",
slog.Any("err", err), slog.Any("err", err),
) )
@@ -286,32 +250,39 @@ func run() int {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel() defer cancel()
_ = server.Shutdown(ctx) //nolint:contextcheck // create a new context for server shutdown
if err = server.Shutdown(ctx); err != nil {
logger.InfoContext(ctx, "windows_exporter has shut down") //nolint:contextcheck
logger.LogAttrs(ctx, slog.LevelError, "Failed to shutdown windows_exporter",
slog.Any("err", err),
)
} else {
//nolint:contextcheck
logger.LogAttrs(ctx, slog.LevelInfo, "windows_exporter has shut down")
}
return 0 return 0
} }
func logCurrentUser(logger *slog.Logger) { func logCurrentUser(ctx context.Context, logger *slog.Logger) {
u, err := user.Current() u, err := user.Current()
if err != nil { if err != nil {
logger.Warn("Unable to determine which user is running this exporter. More info: https://github.com/golang/go/issues/37348", logger.LogAttrs(ctx, slog.LevelWarn, "Unable to determine which user is running this exporter. More info: https://github.com/golang/go/issues/37348",
slog.Any("err", err), slog.Any("err", err),
) )
return return
} }
logger.Info("Running as " + u.Username) logger.LogAttrs(ctx, slog.LevelInfo, "Running as "+u.Username)
if strings.Contains(u.Username, "ContainerAdministrator") || strings.Contains(u.Username, "ContainerUser") { if strings.Contains(u.Username, "ContainerAdministrator") || strings.Contains(u.Username, "ContainerUser") {
logger.Warn("Running as a preconfigured Windows Container user. This may mean you do not have Windows HostProcess containers configured correctly and some functionality will not work as expected.") logger.LogAttrs(ctx, slog.LevelWarn, "Running as a preconfigured Windows Container user. This may mean you do not have Windows HostProcess containers configured correctly and some functionality will not work as expected.")
} }
} }
// setPriorityWindows sets the priority of the current process to the specified value. // setPriorityWindows sets the priority of the current process to the specified value.
func setPriorityWindows(logger *slog.Logger, pid int, priority string) error { func setPriorityWindows(ctx context.Context, logger *slog.Logger, pid int, priority string) error {
// Mapping of priority names to uin32 values required by windows.SetPriorityClass. // Mapping of priority names to uin32 values required by windows.SetPriorityClass.
priorityStringToInt := map[string]uint32{ priorityStringToInt := map[string]uint32{
"realtime": windows.REALTIME_PRIORITY_CLASS, "realtime": windows.REALTIME_PRIORITY_CLASS,
@@ -325,11 +296,11 @@ func setPriorityWindows(logger *slog.Logger, pid int, priority string) error {
winPriority, ok := priorityStringToInt[priority] winPriority, ok := priorityStringToInt[priority]
// Only set process priority if a non-default and valid value has been set // Only set process priority if a non-default and valid value has been set
if !ok || winPriority != windows.NORMAL_PRIORITY_CLASS { if !ok || winPriority == windows.NORMAL_PRIORITY_CLASS {
return nil return nil
} }
logger.LogAttrs(context.Background(), slog.LevelDebug, "setting process priority to "+priority) logger.LogAttrs(ctx, slog.LevelDebug, "setting process priority to "+priority)
// https://learn.microsoft.com/en-us/windows/win32/procthread/process-security-and-access-rights // https://learn.microsoft.com/en-us/windows/win32/procthread/process-security-and-access-rights
handle, err := windows.OpenProcess( handle, err := windows.OpenProcess(

View File

@@ -0,0 +1,199 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build windows
package main
import (
"context"
"errors"
"fmt"
"io"
"net"
"net/http"
"net/url"
"os"
"strings"
"testing"
"time"
"github.com/stretchr/testify/require"
"golang.org/x/sys/windows"
)
//nolint:tparallel
func TestRun(t *testing.T) {
t.Parallel()
for _, tc := range []struct {
name string
args []string
config string
metricsEndpoint string
exitCode int
}{
{
name: "default",
args: []string{},
metricsEndpoint: "http://127.0.0.1:9182/metrics",
},
{
name: "web.listen-address",
args: []string{"--web.listen-address=127.0.0.1:8080"},
metricsEndpoint: "http://127.0.0.1:8080/metrics",
},
{
name: "web.listen-address",
args: []string{"--web.listen-address=127.0.0.1:8081", "--web.listen-address=[::1]:8081"},
metricsEndpoint: "http://[::1]:8081/metrics",
},
{
name: "config",
args: []string{"--config.file=config.yaml"},
config: `{"web":{"listen-address":"127.0.0.1:8082"}}`,
metricsEndpoint: "http://127.0.0.1:8082/metrics",
},
{
name: "web.listen-address with config",
args: []string{"--config.file=config.yaml", "--web.listen-address=127.0.0.1:8084"},
config: `{"web":{"listen-address":"127.0.0.1:8083"}}`,
metricsEndpoint: "http://127.0.0.1:8084/metrics",
},
} {
t.Run(tc.name, func(t *testing.T) {
ctx, cancel := context.WithCancel(t.Context())
defer cancel()
if tc.config != "" {
// Create a temporary config file.
tmpfile, err := os.CreateTemp(t.TempDir(), "config-*.yaml")
require.NoError(t, err)
t.Cleanup(func() {
require.NoError(t, tmpfile.Close())
})
_, err = tmpfile.WriteString(tc.config)
require.NoError(t, err)
for i, arg := range tc.args {
tc.args[i] = strings.ReplaceAll(arg, "config.yaml", tmpfile.Name())
}
}
exitCodeCh := make(chan int)
var stdout string
go func() {
stdout = captureOutput(t, func() {
// Simulate the service control manager signaling that we are done.
exitCodeCh <- run(ctx, tc.args)
})
}()
t.Cleanup(func() {
select {
case exitCode := <-exitCodeCh:
require.Equal(t, tc.exitCode, exitCode)
case <-time.After(2 * time.Second):
t.Fatalf("timed out waiting for exit code, want %d", tc.exitCode)
}
})
if tc.exitCode != 0 {
return
}
uri, err := url.Parse(tc.metricsEndpoint)
require.NoError(t, err)
err = waitUntilListening(t, "tcp", uri.Host)
require.NoError(t, err, "LOGS:\n%s", stdout)
req, err := http.NewRequestWithContext(ctx, http.MethodGet, tc.metricsEndpoint, nil)
require.NoError(t, err)
resp, err := http.DefaultClient.Do(req)
require.NoError(t, err, "LOGS:\n%s", stdout)
require.Equal(t, http.StatusOK, resp.StatusCode)
body, err := io.ReadAll(resp.Body)
require.NoError(t, err)
err = resp.Body.Close()
require.NoError(t, err)
require.NotEmpty(t, body)
require.Contains(t, string(body), "# HELP windows_exporter_build_info")
cancel()
})
}
}
func captureOutput(tb testing.TB, f func()) string {
tb.Helper()
orig := os.Stdout
r, w, _ := os.Pipe()
os.Stdout = w
f()
os.Stdout = orig
_ = w.Close()
out, _ := io.ReadAll(r)
return string(out)
}
func waitUntilListening(tb testing.TB, network, address string) error {
tb.Helper()
var (
conn net.Conn
err error
)
dialer := &net.Dialer{Timeout: 100 * time.Millisecond}
for range 20 {
conn, err = dialer.DialContext(tb.Context(), network, address)
if err == nil {
_ = conn.Close()
return nil
}
if errors.Is(err, windows.Errno(10061)) {
time.Sleep(50 * time.Millisecond)
continue
}
break
}
var winErr windows.Errno
if errors.As(err, &winErr) {
return fmt.Errorf("listener not listening: %w (#%d)", winErr, uint32(winErr))
}
return fmt.Errorf("listener not listening: %w", err)
}

View File

@@ -1,8 +1,12 @@
# example configuration file for windows_exporter # example configuration file for windows_exporter
collectors: collectors:
enabled: cpu,cpu_info,exchange,iis,logical_disk,logon,memory,net,os,performancecounter,process,remote_fx,service,system,tcp,time,terminal_services,textfile enabled: cpu,cpu_info,exchange,iis,logical_disk,memory,net,os,performancecounter,process,remote_fx,service,system,tcp,time,terminal_services,textfile
collector: collector:
textfile:
directories:
- 'C:\MyDir1'
- 'C:\MyDir2'
service: service:
include: "windows_exporter" include: "windows_exporter"
performancecounter: performancecounter:

13
dashboard/README.md Normal file
View File

@@ -0,0 +1,13 @@
## Sample dashboard for Windows Exporter
This sample dashboard is heavily inspired by [this dashboard in Chinese](https://grafana.com/grafana/dashboards/10467-windows-exporter-for-prometheus-dashboard-cn-v20230531/).
First row shows an Overview of your Windows landscape.
<br/>
![Screenshot of overview row.](dashboard-overview.png)
Second row provides resource details about specific Windows VM picked from the variables at the top.
<br/>
![Screenshot of resource details (part 1).](resource-details-part1.png)
<br/>
![Screenshot of resource details (part 2).](resource-details-part2.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 511 KiB

File diff suppressed because it is too large Load Diff

View File

@@ -9,18 +9,17 @@ This directory contains documentation of the collectors in the windows_exporter,
- [`container`](collector.container.md) - [`container`](collector.container.md)
- [`cpu`](collector.cpu.md) - [`cpu`](collector.cpu.md)
- [`cpu_info`](collector.cpu_info.md) - [`cpu_info`](collector.cpu_info.md)
- [`cs`](collector.cs.md)
- [`dfsr`](collector.dfsr.md) - [`dfsr`](collector.dfsr.md)
- [`dhcp`](collector.dhcp.md) - [`dhcp`](collector.dhcp.md)
- [`diskdrive`](collector.diskdrive.md) - [`diskdrive`](collector.diskdrive.md)
- [`dns`](collector.dns.md) - [`dns`](collector.dns.md)
- [`exchange`](collector.exchange.md) - [`exchange`](collector.exchange.md)
- [`file`](collector.file.md)
- [`fsrmquota`](collector.fsrmquota.md) - [`fsrmquota`](collector.fsrmquota.md)
- [`hyperv`](collector.hyperv.md) - [`hyperv`](collector.hyperv.md)
- [`iis`](collector.iis.md) - [`iis`](collector.iis.md)
- [`license`](collector.license.md) - [`license`](collector.license.md)
- [`logical_disk`](collector.logical_disk.md) - [`logical_disk`](collector.logical_disk.md)
- [`logon`](collector.logon.md)
- [`memory`](collector.memory.md) - [`memory`](collector.memory.md)
- [`mscluster`](collector.mscluster.md) - [`mscluster`](collector.mscluster.md)
- [`msmq`](collector.msmq.md) - [`msmq`](collector.msmq.md)
@@ -44,7 +43,6 @@ This directory contains documentation of the collectors in the windows_exporter,
- [`tcp`](collector.tcp.md) - [`tcp`](collector.tcp.md)
- [`terminal_services`](collector.terminal_services.md) - [`terminal_services`](collector.terminal_services.md)
- [`textfile`](collector.textfile.md) - [`textfile`](collector.textfile.md)
- [`thermalzone`](collector.thermalzone.md)
- [`time`](collector.time.md) - [`time`](collector.time.md)
- [`udp`](collector.udp.md) - [`udp`](collector.udp.md)
- [`update`](collector.update.md) - [`update`](collector.update.md)

View File

@@ -5,7 +5,7 @@ The container collector exposes metrics about containers running on a Hyper-V sy
||| |||
-|- -|-
Metric name prefix | `container` Metric name prefix | `container`
Data source | [hcsshim](https://github.com/Microsoft/hcsshim) Data source | [HCS](https://learn.microsoft.com/en-us/virtualization/api/hcs/overview)
Enabled by default? | No Enabled by default? | No
## Flags ## Flags
@@ -14,26 +14,26 @@ None
## Metrics ## Metrics
Name | Description | Type | Labels | Name | Description | Type | Labels |
-----|-------------|------|------- |------------------------------------------------------------|----------------------------------------|---------|----------------------------------------------------------|
`windows_container_available` | Available | counter | `container_id` | `windows_container_available` | Available | counter | `container_id`,`namespace`,`pod`,`container`, |
`windows_container_count` | Number of containers | gauge | `container_id` | `windows_container_count` | Number of containers | gauge | `container_id`,`namespace`,`pod`,`container`, |
`windows_container_cpu_usage_seconds_kernelmode` | Run time in Kernel mode in Seconds | counter | `container_id` | `windows_container_cpu_usage_seconds_kernelmode` | Run time in Kernel mode in Seconds | counter | `container_id`,`namespace`,`pod`,`container`, |
`windows_container_cpu_usage_seconds_usermode` | Run Time in User mode in Seconds | counter | `container_id` | `windows_container_cpu_usage_seconds_usermode` | Run Time in User mode in Seconds | counter | `container_id`,`namespace`,`pod`,`container`, |
`windows_container_cpu_usage_seconds_total` | Total Run time in Seconds | counter | `container_id` | `windows_container_cpu_usage_seconds_total` | Total Run time in Seconds | counter | `container_id`,`namespace`,`pod`,`container`, |
`windows_container_memory_usage_commit_bytes` | Memory Usage Commit Bytes | gauge | `container_id` | `windows_container_memory_usage_commit_bytes` | Memory Usage Commit Bytes | gauge | `container_id`,`namespace`,`pod`,`container`, |
`windows_container_memory_usage_commit_peak_bytes` | Memory Usage Commit Peak Bytes | gauge | `container_id` | `windows_container_memory_usage_commit_peak_bytes` | Memory Usage Commit Peak Bytes | gauge | `container_id`,`namespace`,`pod`,`container`, |
`windows_container_memory_usage_private_working_set_bytes` | Memory Usage Private Working Set Bytes | gauge | `container_id` | `windows_container_memory_usage_private_working_set_bytes` | Memory Usage Private Working Set Bytes | gauge | `container_id`,`namespace`,`pod`,`container`, |
`windows_container_network_receive_bytes_total` | Bytes Received on Interface | counter | `container_id`, `interface` | `windows_container_network_receive_bytes_total` | Bytes Received on Interface | counter | `container_id`,`namespace`,`pod`,`container`,`interface` |
`windows_container_network_receive_packets_total` | Packets Received on Interface | counter | `container_id`, `interface` | `windows_container_network_receive_packets_total` | Packets Received on Interface | counter | `container_id`,`namespace`,`pod`,`container`,`interface` |
`windows_container_network_receive_packets_dropped_total` | Dropped Incoming Packets on Interface | counter | `container_id`, `interface` | `windows_container_network_receive_packets_dropped_total` | Dropped Incoming Packets on Interface | counter | `container_id`,`namespace`,`pod`,`container`,`interface` |
`windows_container_network_transmit_bytes_total` | Bytes Sent on Interface | counter | `container_id`, `interface` | `windows_container_network_transmit_bytes_total` | Bytes Sent on Interface | counter | `container_id`,`namespace`,`pod`,`container`,`interface` |
`windows_container_network_transmit_packets_total` | Packets Sent on Interface | counter | `container_id`, `interface` | `windows_container_network_transmit_packets_total` | Packets Sent on Interface | counter | `container_id`,`namespace`,`pod`,`container`,`interface` |
`windows_container_network_transmit_packets_dropped_total` | Dropped Outgoing Packets on Interface | counter | `container_id`, `interface` | `windows_container_network_transmit_packets_dropped_total` | Dropped Outgoing Packets on Interface | counter | `container_id`,`namespace`,`pod`,`container`,`interface` |
`windows_container_storage_read_count_normalized_total` | Read Count Normalized | counter | `container_id` | `windows_container_storage_read_count_normalized_total` | Read Count Normalized | counter | `container_id`,`namespace`,`pod`,`container`, |
`windows_container_storage_read_size_bytes_total` | Read Size Bytes | counter | `container_id` | `windows_container_storage_read_size_bytes_total` | Read Size Bytes | counter | `container_id`,`namespace`,`pod`,`container`, |
`windows_container_storage_write_count_normalized_total` | Write Count Normalized | counter | `container_id` | `windows_container_storage_write_count_normalized_total` | Write Count Normalized | counter | `container_id`,`namespace`,`pod`,`container`, |
`windows_container_storage_write_size_bytes_total` | Write Size Bytes | counter | `container_id` | `windows_container_storage_write_size_bytes_total` | Write Size Bytes | counter | `container_id`,`namespace`,`pod`,`container`, |
### Example metric ### Example metric
_windows_container_network_receive_bytes_total{container_id="docker://1bd30e8b8ac28cbd76a9b697b4d7bb9d760267b0733d1bc55c60024e98d1e43e",interface="822179E7-002C-4280-ABBA-28BCFE401826"} 9.3305343e+07_ _windows_container_network_receive_bytes_total{container_id="docker://1bd30e8b8ac28cbd76a9b697b4d7bb9d760267b0733d1bc55c60024e98d1e43e",interface="822179E7-002C-4280-ABBA-28BCFE401826"} 9.3305343e+07_

View File

@@ -48,6 +48,27 @@ Show per-cpu utilisation using the processor utility metrics
``` ```
rate(windows_cpu_processor_utility_total{instance="localhost"}[5m]) / rate(windows_cpu_processor_rtc_total{instance="localhost"}[5m]) rate(windows_cpu_processor_utility_total{instance="localhost"}[5m]) / rate(windows_cpu_processor_rtc_total{instance="localhost"}[5m])
``` ```
Show average CPU utilization percentage (like Windows Task Manager)
```
sum by (instance) (
clamp_max(
(
rate(windows_cpu_processor_utility_total{
job=~"$job",
}[1m])
/
rate(windows_cpu_processor_rtc_total{
job=~"$job",
}[1m])
), 100
)
) /
count by (instance) (
windows_cpu_processor_utility_total{
job=~"$job"
}
)
```
Show actual average CPU frequency in Hz Show actual average CPU frequency in Hz
``` ```
avg by(instance) ( avg by(instance) (
@@ -59,7 +80,36 @@ avg by(instance) (
## Alerting examples ## Alerting examples
**prometheus.rules** #### Average CPU utilization over 1 hour exceeds 80% (New CPU metric)
```yaml
# Alert on hosts with 1h avg CPU more than 80%
- alert: HighCPUUtilization
expr: |
avg_over_time(
(
sum by (instance) (
(
rate(windows_cpu_processor_utility_total{}[1m])
/
rate(windows_cpu_processor_rtc_total{}[1m])
)
) /
count by (instance) (
windows_cpu_processor_utility_total{}
)
)[1h:]
) > 80
for: 1m
labels:
severity: warning
metric_name: CPUUtilization
annotations:
summary: "High CPU utilization on {{ $labels.instance }}"
description: |
CPU utilization on {{ $labels.instance }} has averaged more than 80% over the last hour (current value: {{ printf "%.2f" $value }})
```
#### Average CPU utilization over 1 hour exceeds 80% (Old CPU metric)
```yaml ```yaml
# Alert on hosts with more than 80% CPU usage over a 10 minute period # Alert on hosts with more than 80% CPU usage over a 10 minute period
- alert: CpuUsage - alert: CpuUsage
@@ -70,6 +120,10 @@ avg by(instance) (
annotations: annotations:
summary: "CPU Usage (instance {{ $labels.instance }})" summary: "CPU Usage (instance {{ $labels.instance }})"
description: "CPU Usage is more than 80%\n VALUE = {{ $value }}\n LABELS: {{ $labels }}" description: "CPU Usage is more than 80%\n VALUE = {{ $value }}\n LABELS: {{ $labels }}"
```
#### CPU not using boost frequencies
```yaml
# Alert on hosts which are not boosting their CPU frequencies # Alert on hosts which are not boosting their CPU frequencies
- alert: NoCpuTurbo - alert: NoCpuTurbo
expr: | expr: |

View File

@@ -1,34 +0,0 @@
# cs collector
> [!CAUTION]
> This collector is deprecated and will be removed in a future release.
> See https://github.com/prometheus-community/windows_exporter/pull/1596 for more information.
The cs collector exposes metrics detailing the hardware of the computer system
|||
-|-
Metric name prefix | `cs`
Classes | [`Win32_ComputerSystem`](https://msdn.microsoft.com/en-us/library/aa394102)
Enabled by default? | Yes
## Flags
None
## Metrics
Name | Description | Type | Labels
-----|-------------|------|-------
`windows_cs_logical_processors` | Number of installed logical processors | gauge | None
`windows_cs_physical_memory_bytes` | Total installed physical memory | gauge | None
`windows_cs_hostname` | Labelled system hostname information | gauge | `hostname`, `domain`, `fqdn`
### Example metric
_This collector does not yet have explained examples, we would appreciate your help adding them!_
## Useful queries
_This collector does not yet have any useful queries added, we would appreciate your help adding them!_
## Alerting examples
_This collector does not yet have alerting examples, we would appreciate your help adding them!_

View File

@@ -2,49 +2,177 @@
The dhcp collector exposes DHCP Server metrics The dhcp collector exposes DHCP Server metrics
||| | | |
-|- |---------------------|---------------|
Metric name prefix | `dhcp` | Metric name prefix | `dhcp` |
Data source | Perflib | Data source | Perflib |
Classes | `DHCP Server` | Classes | `DHCP Server` |
Enabled by default? | No | Enabled by default? | No |
## Flags ## Flags
None ### `--collector.dhcp.enabled`
Comma-separated list of collectors to use. Defaults to all, if not specified.
## Metrics ## Metrics
Name | Description | Type | Labels | Name | Description | Type | Labels |
-----|-------------|------|------- |--------------------------------------------------------------------------|--------------------------------------------------------------------------------|---------|-----------------------------------------------------|
`packets_received_total` | Total number of packets received by the DHCP server | counter | None | `windows_dhcp_ack_total` | Total DHCP Acks sent by the DHCP server | counter | None |
`duplicates_dropped_total` | Total number of duplicate packets received by the DHCP server | counter | None | `windows_dhcp_denied_due_to_match_total` | Total number of DHCP requests denied, based on matches from the Deny List | gauge | None |
`packets_expired_total` | Total number of packets expired in the DHCP server message queue | counter | None | `windows_dhcp_denied_due_to_nonmatch_total` | Total number of DHCP requests denied, based on non-matches from the Allow List | gauge | None |
`active_queue_length` | Number of packets in the processing queue of the DHCP server | gauge | None | `windows_dhcp_declines_total` | Total DHCP Declines received by the DHCP server | counter | None |
`conflict_check_queue_length` | Number of packets in the DHCP server queue waiting on conflict detection (ping) | gauge | None | `windows_dhcp_discovers_total` | Total DHCP Discovers received by the DHCP server | counter | None |
`discovers_total` | Total DHCP Discovers received by the DHCP server | counter | None | `windows_dhcp_failover_bndack_received_total` | Number of DHCP failover Binding Ack messages received | counter | None |
`offers_total` | Total DHCP Offers sent by the DHCP server | counter | None | `windows_dhcp_failover_bndack_sent_total` | Number of DHCP failover Binding Ack messages sent | counter | None |
`requests_total` | Total DHCP Requests received by the DHCP server | counter | None | `windows_dhcp_failover_bndupd_dropped_total` | Total number of DHCP failover Binding Updates dropped | counter | None |
`informs_total` | Total DHCP Informs received by the DHCP server | counter | None | `windows_dhcp_failover_bndupd_received_total` | Number of DHCP failover Binding Update messages received | counter | None |
`acks_total` | Total DHCP Acks sent by the DHCP server | counter | None | `windows_dhcp_failover_bndupd_sent_total` | Number of DHCP failover Binding Update messages sent | counter | None |
`nacks_total` | Total DHCP Nacks sent by the DHCP server | counter | None | `windows_dhcp_failover_bndupd_pending_in_outbound_queue` | Number of pending outbound DHCP failover Binding Update messages | counter | None |
`declines_total` | Total DHCP Declines received by the DHCP server | counter | None | `windows_dhcp_failover_transitions_communicationinterrupted_state_total` | Total number of transitions into COMMUNICATION INTERRUPTED state | counter | None |
`releases_total` | Total DHCP Releases received by the DHCP server | counter | None | `windows_dhcp_failover_transitions_partnerdown_state_total` | Total number of transitions into PARTNER DOWN state | counter | None |
`offer_queue_length` | Number of packets in the offer queue of the DHCP server | gauge | None | `windows_dhcp_failover_transitions_recover_total` | Total number of transitions into RECOVER state | counter | None |
`denied_due_to_match_total` | Total number of DHCP requests denied, based on matches from the Deny List | gauge | None | `windows_dhcp_informs_total` | Total DHCP Informs received by the DHCP server | counter | None |
`denied_due_to_nonmatch_total` | Total number of DHCP requests denied, based on non-matches from the Allow List | gauge | None | `windows_dhcp_nacks_total` | Total DHCP Nacks sent by the DHCP server | counter | None |
`failover_bndupd_sent_total` | Number of DHCP failover Binding Update messages sent | counter | None | `windows_dhcp_offers_total` | Total DHCP Offers sent by the DHCP server | counter | None |
`failover_bndupd_received_total` | Number of DHCP failover Binding Update messages received | counter | None | `windows_dhcp_packets_expired_total` | Total number of packets expired in the DHCP server message queue | counter | None |
`failover_bndack_sent_total` | Number of DHCP failover Binding Ack messages sent | counter | None | `windows_dhcp_packets_received_total` | Total number of packets received by the DHCP server | counter | None |
`failover_bndack_received_total` | Number of DHCP failover Binding Ack messages received | counter | None | `windows_dhcp_pending_offers_total` | Total number of pending offers in the DHCP server | counter | None |
`failover_bndupd_pending_in_outbound_queue` | Number of pending outbound DHCP failover Binding Update messages | counter | None | `windows_dhcp_releases_total` | Total DHCP Releases received by the DHCP server | counter | None |
`failover_transitions_communicationinterrupted_state_total` | Total number of transitions into COMMUNICATION INTERRUPTED state | counter | None | `windows_dhcp_requests_total` | Total DHCP Requests received by the DHCP server | counter | None |
`failover_transitions_partnerdown_state_total` | Total number of transitions into PARTNER DOWN state | counter | None | `windows_dhcp_scope_addresses_free_on_this_server` | DHCP Scope free addresses on this server | gauge | `scope` |
`failover_transitions_recover_total` | Total number of transitions into RECOVER state | counter | None | `windows_dhcp_scope_addresses_free_on_partner_server` | DHCP Scope free addresses on partner server | gauge | `scope` |
`failover_bndupd_dropped_total` | Total number of DHCP faileover Binding Updates dropped | counter | None | `windows_dhcp_scope_addresses_free` | DHCP Scope free addresses | gauge | `scope` |
| `windows_dhcp_scope_addresses_in_use_on_this_server` | DHCP Scope addresses in use on this server | gauge | `scope` |
| `windows_dhcp_scope_addresses_in_use_on_partner_server` | DHCP Scope addresses in use on partner server | gauge | `scope` |
| `windows_dhcp_scope_addresses_in_use` | DHCP Scope addresses in use | gauge | `scope` |
| `windows_dhcp_scope_info` | DHCP Scope information | gauge | `name`, `superscope_name`, `superscope_id`, `scope` |
| `windows_dhcp_scope_pending_offers` | DHCP Scope pending offers | gauge | `scope` |
| `windows_dhcp_scope_reserved_address` | DHCP Scope reserved addresses | gauge | `scope` |
| `windows_dhcp_scope_state` | DHCP Scope state | gauge | `scope`, `state` |
### Example metric ### Example metric
_This collector does not yet have explained examples, we would appreciate your help adding them!_ ```
# HELP windows_dhcp_acks_total Total DHCP Acks sent by the DHCP server (AcksTotal)
# TYPE windows_dhcp_acks_total counter
windows_dhcp_acks_total 0
# HELP windows_dhcp_active_queue_length Number of packets in the processing queue of the DHCP server (ActiveQueueLength)
# TYPE windows_dhcp_active_queue_length gauge
windows_dhcp_active_queue_length 0
# HELP windows_dhcp_conflict_check_queue_length Number of packets in the DHCP server queue waiting on conflict detection (ping). (ConflictCheckQueueLength)
# TYPE windows_dhcp_conflict_check_queue_length gauge
windows_dhcp_conflict_check_queue_length 0
# HELP windows_dhcp_declines_total Total DHCP Declines received by the DHCP server (DeclinesTotal)
# TYPE windows_dhcp_declines_total counter
windows_dhcp_declines_total 0
# HELP windows_dhcp_denied_due_to_match_total Total number of DHCP requests denied, based on matches from the Deny list (DeniedDueToMatch)
# TYPE windows_dhcp_denied_due_to_match_total counter
windows_dhcp_denied_due_to_match_total 0
# HELP windows_dhcp_denied_due_to_nonmatch_total Total number of DHCP requests denied, based on non-matches from the Allow list (DeniedDueToNonMatch)
# TYPE windows_dhcp_denied_due_to_nonmatch_total counter
windows_dhcp_denied_due_to_nonmatch_total 0
# HELP windows_dhcp_discovers_total Total DHCP Discovers received by the DHCP server (DiscoversTotal)
# TYPE windows_dhcp_discovers_total counter
windows_dhcp_discovers_total 0
# HELP windows_dhcp_duplicates_dropped_total Total number of duplicate packets received by the DHCP server (DuplicatesDroppedTotal)
# TYPE windows_dhcp_duplicates_dropped_total counter
windows_dhcp_duplicates_dropped_total 0
# HELP windows_dhcp_failover_bndack_received_total Number of DHCP fail over Binding Ack messages received (FailoverBndackReceivedTotal)
# TYPE windows_dhcp_failover_bndack_received_total counter
windows_dhcp_failover_bndack_received_total 0
# HELP windows_dhcp_failover_bndack_sent_total Number of DHCP fail over Binding Ack messages sent (FailoverBndackSentTotal)
# TYPE windows_dhcp_failover_bndack_sent_total counter
windows_dhcp_failover_bndack_sent_total 0
# HELP windows_dhcp_failover_bndupd_dropped_total Total number of DHCP fail over Binding Updates dropped (FailoverBndupdDropped)
# TYPE windows_dhcp_failover_bndupd_dropped_total counter
windows_dhcp_failover_bndupd_dropped_total 0
# HELP windows_dhcp_failover_bndupd_pending_in_outbound_queue Number of pending outbound DHCP fail over Binding Update messages (FailoverBndupdPendingOutboundQueue)
# TYPE windows_dhcp_failover_bndupd_pending_in_outbound_queue gauge
windows_dhcp_failover_bndupd_pending_in_outbound_queue 0
# HELP windows_dhcp_failover_bndupd_received_total Number of DHCP fail over Binding Update messages received (FailoverBndupdReceivedTotal)
# TYPE windows_dhcp_failover_bndupd_received_total counter
windows_dhcp_failover_bndupd_received_total 0
# HELP windows_dhcp_failover_bndupd_sent_total Number of DHCP fail over Binding Update messages sent (FailoverBndupdSentTotal)
# TYPE windows_dhcp_failover_bndupd_sent_total counter
windows_dhcp_failover_bndupd_sent_total 0
# HELP windows_dhcp_failover_transitions_communicationinterrupted_state_total Total number of transitions into COMMUNICATION INTERRUPTED state (FailoverTransitionsCommunicationinterruptedState)
# TYPE windows_dhcp_failover_transitions_communicationinterrupted_state_total counter
windows_dhcp_failover_transitions_communicationinterrupted_state_total 0
# HELP windows_dhcp_failover_transitions_partnerdown_state_total Total number of transitions into PARTNER DOWN state (FailoverTransitionsPartnerdownState)
# TYPE windows_dhcp_failover_transitions_partnerdown_state_total counter
windows_dhcp_failover_transitions_partnerdown_state_total 0
# HELP windows_dhcp_failover_transitions_recover_total Total number of transitions into RECOVER state (FailoverTransitionsRecoverState)
# TYPE windows_dhcp_failover_transitions_recover_total counter
windows_dhcp_failover_transitions_recover_total 0
# HELP windows_dhcp_informs_total Total DHCP Informs received by the DHCP server (InformsTotal)
# TYPE windows_dhcp_informs_total counter
windows_dhcp_informs_total 0
# HELP windows_dhcp_nacks_total Total DHCP Nacks sent by the DHCP server (NacksTotal)
# TYPE windows_dhcp_nacks_total counter
windows_dhcp_nacks_total 0
# HELP windows_dhcp_offer_queue_length Number of packets in the offer queue of the DHCP server (OfferQueueLength)
# TYPE windows_dhcp_offer_queue_length gauge
windows_dhcp_offer_queue_length 0
# HELP windows_dhcp_offers_total Total DHCP Offers sent by the DHCP server (OffersTotal)
# TYPE windows_dhcp_offers_total counter
windows_dhcp_offers_total 0
# HELP windows_dhcp_packets_expired_total Total number of packets expired in the DHCP server message queue (PacketsExpiredTotal)
# TYPE windows_dhcp_packets_expired_total counter
windows_dhcp_packets_expired_total 0
# HELP windows_dhcp_packets_received_total Total number of packets received by the DHCP server (PacketsReceivedTotal)
# TYPE windows_dhcp_packets_received_total counter
windows_dhcp_packets_received_total 0
# HELP windows_dhcp_releases_total Total DHCP Releases received by the DHCP server (ReleasesTotal)
# TYPE windows_dhcp_releases_total counter
windows_dhcp_releases_total 0
# HELP windows_dhcp_requests_total Total DHCP Requests received by the DHCP server (RequestsTotal)
# TYPE windows_dhcp_requests_total counter
windows_dhcp_requests_total 0
# HELP windows_dhcp_scope_addresses_free_total DHCP Scope free addresses
# TYPE windows_dhcp_scope_addresses_free_total gauge
windows_dhcp_scope_addresses_free_total{scope="10.11.12.0/25"} 0
windows_dhcp_scope_addresses_free_total{scope="172.16.0.0/24"} 0
windows_dhcp_scope_addresses_free_total{scope="192.168.0.0/24"} 231
# HELP windows_dhcp_scope_addresses_in_use_total DHCP Scope addresses in use
# TYPE windows_dhcp_scope_addresses_in_use_total gauge
windows_dhcp_scope_addresses_in_use_total{scope="10.11.12.0/25"} 0
windows_dhcp_scope_addresses_in_use_total{scope="172.16.0.0/24"} 0
windows_dhcp_scope_addresses_in_use_total{scope="192.168.0.0/24"} 0
# HELP windows_dhcp_scope_info DHCP Scope information
# TYPE windows_dhcp_scope_info gauge
windows_dhcp_scope_info{name="SUBSUPERSCOPE",scope="172.16.0.0/24",superscope_id="2",superscope_name="SUPERSCOPE"} 1
windows_dhcp_scope_info{name="TEST",scope="192.168.0.0/24",superscope_id="0",superscope_name=""} 1
windows_dhcp_scope_info{name="TEST2",scope="10.11.12.0/25",superscope_id="2",superscope_name="SUPERSCOPE"} 1
# HELP windows_dhcp_scope_pending_offers_total DHCP Scope pending offers
# TYPE windows_dhcp_scope_pending_offers_total gauge
windows_dhcp_scope_pending_offers_total{scope="10.11.12.0/25"} 0
windows_dhcp_scope_pending_offers_total{scope="172.16.0.0/24"} 0
windows_dhcp_scope_pending_offers_total{scope="192.168.0.0/24"} 0
# HELP windows_dhcp_scope_reserved_address_total DHCP Scope reserved addresses
# TYPE windows_dhcp_scope_reserved_address_total gauge
windows_dhcp_scope_reserved_address_total{scope="10.11.12.0/25"} 0
windows_dhcp_scope_reserved_address_total{scope="172.16.0.0/24"} 0
windows_dhcp_scope_reserved_address_total{scope="192.168.0.0/24"} 2
# HELP windows_dhcp_scope_state DHCP Scope state
# TYPE windows_dhcp_scope_state gauge
windows_dhcp_scope_state{scope="10.11.12.0/25",state="Disabled"} 1
windows_dhcp_scope_state{scope="10.11.12.0/25",state="DisabledSwitched"} 0
windows_dhcp_scope_state{scope="10.11.12.0/25",state="Enabled"} 0
windows_dhcp_scope_state{scope="10.11.12.0/25",state="EnabledSwitched"} 0
windows_dhcp_scope_state{scope="10.11.12.0/25",state="InvalidState"} 0
windows_dhcp_scope_state{scope="172.16.0.0/24",state="Disabled"} 1
windows_dhcp_scope_state{scope="172.16.0.0/24",state="DisabledSwitched"} 0
windows_dhcp_scope_state{scope="172.16.0.0/24",state="Enabled"} 0
windows_dhcp_scope_state{scope="172.16.0.0/24",state="EnabledSwitched"} 0
windows_dhcp_scope_state{scope="172.16.0.0/24",state="InvalidState"} 0
windows_dhcp_scope_state{scope="192.168.0.0/24",state="Disabled"} 0
windows_dhcp_scope_state{scope="192.168.0.0/24",state="DisabledSwitched"} 0
windows_dhcp_scope_state{scope="192.168.0.0/24",state="Enabled"} 1
windows_dhcp_scope_state{scope="192.168.0.0/24",state="EnabledSwitched"} 0
windows_dhcp_scope_state{scope="192.168.0.0/24",state="InvalidState"} 0
```
## Useful queries ## Useful queries
_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ _This collector does not yet have any useful queries added, we would appreciate your help adding them!_

View File

@@ -30,7 +30,7 @@ groups:
rules: rules:
- alert: Drive_Status - alert: Drive_Status
expr: windows_disk_drive_status{status="OK"} != 1 expr: windows_diskdrive_status{status="OK"} != 1
for: 10m for: 10m
labels: labels:
severity: high severity: high

View File

@@ -3,14 +3,19 @@
The dns collector exposes metrics about the DNS server The dns collector exposes metrics about the DNS server
||| |||
-|- -|-|-
Metric name prefix | `dns` Metric name prefix | `dns` |
Classes | [`Win32_PerfRawData_DNS_DNS`](https://technet.microsoft.com/en-us/library/cc977686.aspx) Classes | [`Win32_PerfRawData_DNS_DNS`](https://technet.microsoft.com/en-us/library/cc977686.aspx) |
Enabled by default? | No Enabled by default | Yes |
Metric name prefix (error stats) | `windows_dns` |
Classes | [`MicrosoftDNS_Statistic`](https://learn.microsoft.com/en-us/windows/win32/dns/dns-wmi-provider-overview) |
Enabled by default (error stats)? | Yes |
## Flags ## Flags
None Name | Description
-----|------------
`collector.dns.enabled` | Comma-separated list of collectors to use. Available collectors: `metrics`, `wmi_stats`. Defaults to all collectors if not specified.
## Metrics ## Metrics
@@ -38,9 +43,53 @@ Name | Description | Type | Labels
`windows_dns_wins_queries_total` | _Not yet documented_ | counter | `direction` `windows_dns_wins_queries_total` | _Not yet documented_ | counter | `direction`
`windows_dns_wins_responses_total` | _Not yet documented_ | counter | `direction` `windows_dns_wins_responses_total` | _Not yet documented_ | counter | `direction`
`windows_dns_unmatched_responses_total` | _Not yet documented_ | counter | None `windows_dns_unmatched_responses_total` | _Not yet documented_ | counter | None
`windows_dns_error_stats_total` | DNS error statistics from MicrosoftDNS_Statistic | counter | `name`, `collection_name`, `dns_server`
### Sub-collectors
The DNS collector is split into two sub-collectors:
1. `metrics` - Collects standard DNS performance metrics using PDH (Performance Data Helper)
2. `wmi_stats` - Collects DNS error statistics from the MicrosoftDNS_Statistic WMI class
By default, both sub-collectors are enabled. You can enable specific sub-collectors using the `collector.dns.enabled` flag.
### Example Usage
To enable only DNS error statistics collection:
```powershell
windows_exporter.exe --collector.dns.enabled=wmi_stats
```
To enable only standard DNS metrics:
```powershell
windows_exporter.exe --collector.dns.enabled=metrics
```
To enable both (default behavior):
```powershell
windows_exporter.exe --collector.dns.enabled=metrics,wmi_stats
```
### Example metric ### Example metric
_This collector does not yet have explained examples, we would appreciate your help adding them!_ ```
windows_dns_wmi_stats_total{collection_name="Error Stats",dns_server="EC2AMAZ-5NNM8M1",name="BadKey"} 0
windows_dns_wmi_stats_total{collection_name="Error Stats",dns_server="EC2AMAZ-5NNM8M1",name="BadSig"} 0
windows_dns_wmi_stats_total{collection_name="Error Stats",dns_server="EC2AMAZ-5NNM8M1",name="BadTime"} 0
windows_dns_wmi_stats_total{collection_name="Error Stats",dns_server="EC2AMAZ-5NNM8M1",name="FormError"} 0
windows_dns_wmi_stats_total{collection_name="Error Stats",dns_server="EC2AMAZ-5NNM8M1",name="Max"} 0
windows_dns_wmi_stats_total{collection_name="Error Stats",dns_server="EC2AMAZ-5NNM8M1",name="NoError"} 0
windows_dns_wmi_stats_total{collection_name="Error Stats",dns_server="EC2AMAZ-5NNM8M1",name="NotAuth"} 0
windows_dns_wmi_stats_total{collection_name="Error Stats",dns_server="EC2AMAZ-5NNM8M1",name="NotImpl"} 0
windows_dns_wmi_stats_total{collection_name="Error Stats",dns_server="EC2AMAZ-5NNM8M1",name="NotZone"} 0
windows_dns_wmi_stats_total{collection_name="Error Stats",dns_server="EC2AMAZ-5NNM8M1",name="NxDomain"} 0
windows_dns_wmi_stats_total{collection_name="Error Stats",dns_server="EC2AMAZ-5NNM8M1",name="NxRRSet"} 0
windows_dns_wmi_stats_total{collection_name="Error Stats",dns_server="EC2AMAZ-5NNM8M1",name="Refused"} 0
windows_dns_wmi_stats_total{collection_name="Error Stats",dns_server="EC2AMAZ-5NNM8M1",name="ServFail"} 0
windows_dns_wmi_stats_total{collection_name="Error Stats",dns_server="EC2AMAZ-5NNM8M1",name="UnknownError"} 0
windows_dns_wmi_stats_total{collection_name="Error Stats",dns_server="EC2AMAZ-5NNM8M1",name="YxDomain"} 0
windows_dns_wmi_stats_total{collection_name="Error Stats",dns_server="EC2AMAZ-5NNM8M1",name="YxRRSet"} 0
```
## Useful queries ## Useful queries
_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ _This collector does not yet have any useful queries added, we would appreciate your help adding them!_

View File

@@ -43,7 +43,7 @@ Comma-separated list of collectors to use, for example: `--collectors.exchange.e
| `windows_exchange_transport_queues_messages_submitted_total` | Messages Submitted Total | | `windows_exchange_transport_queues_messages_submitted_total` | Messages Submitted Total |
| `windows_exchange_transport_queues_messages_delayed_total` | Messages Delayed Total | | `windows_exchange_transport_queues_messages_delayed_total` | Messages Delayed Total |
| `windows_exchange_transport_queues_messages_completed_delivery_total` | Messages Completed Delivery Total | | `windows_exchange_transport_queues_messages_completed_delivery_total` | Messages Completed Delivery Total |
| `windows_exchange_transport_queues_shadow_queue_length` | Shadow Queue Length | | `windows_exchange_transport_queues_aggregate_shadow_queue_length` | The current number of messages in shadow queues |
| `windows_exchange_transport_queues_submission_queue_length` | Submission Queue Length | | `windows_exchange_transport_queues_submission_queue_length` | Submission Queue Length |
| `windows_exchange_transport_queues_delay_queue_length` | Delay Queue Length | | `windows_exchange_transport_queues_delay_queue_length` | Delay Queue Length |
| `windows_exchange_transport_queues_items_completed_delivery_total` | Items Completed Delivery Total | | `windows_exchange_transport_queues_items_completed_delivery_total` | Items Completed Delivery Total |
@@ -54,7 +54,7 @@ Comma-separated list of collectors to use, for example: `--collectors.exchange.e
| `windows_exchange_http_proxy_avg_auth_latency` | Average time spent authenticating CAS requests over the last 200 samples | | `windows_exchange_http_proxy_avg_auth_latency` | Average time spent authenticating CAS requests over the last 200 samples |
| `windows_exchange_http_proxy_outstanding_proxy_requests` | Number of concurrent outstanding proxy requests | | `windows_exchange_http_proxy_outstanding_proxy_requests` | Number of concurrent outstanding proxy requests |
| `windows_exchange_http_proxy_requests_total` | Number of proxy requests processed each second | | `windows_exchange_http_proxy_requests_total` | Number of proxy requests processed each second |
| `windows_exchange_avail_service_requests_per_sec` | Number of requests serviced per second | | `windows_exchange_availability_service_requests_per_sec` | Number of requests serviced per second |
| `windows_exchange_owa_current_unique_users` | Number of unique users currently logged on to Outlook Web App | | `windows_exchange_owa_current_unique_users` | Number of unique users currently logged on to Outlook Web App |
| `windows_exchange_owa_requests_total` | Number of requests handled by Outlook Web App per second | | `windows_exchange_owa_requests_total` | Number of requests handled by Outlook Web App per second |
| `windows_exchange_autodiscover_requests_total` | Number of autodiscover service requests processed each second | | `windows_exchange_autodiscover_requests_total` | Number of autodiscover service requests processed each second |
@@ -77,4 +77,3 @@ _This collector does not yet have any useful queries added, we would appreciate
## Alerting examples ## Alerting examples
_This collector does not yet have alerting examples, we would appreciate your help adding them!_ _This collector does not yet have alerting examples, we would appreciate your help adding them!_

40
docs/collector.file.md Normal file
View File

@@ -0,0 +1,40 @@
# file collector
The file collector exposes modified timestamps and file size of files in the filesystem.
The collector
|||
-|-
Metric name prefix | `file`
Enabled by default? | No
## Flags
### `--collector.file.file-patterns`
Comma-separated list of file patterns. Each pattern is a glob pattern that can contain `*`, `?`, and `**` (recursive).
See https://github.com/bmatcuk/doublestar#patterns for an extended description of the pattern syntax.
## Metrics
| Name | Description | Type | Labels |
|----------------------------------------|------------------------|-------|--------|
| `windows_file_mtime_timestamp_seconds` | File modification time | gauge | `file` |
| `windows_file_size_bytes` | File size | gauge | `file` |
### Example metric
```
# HELP windows_file_mtime_timestamp_seconds File modification time
# TYPE windows_file_mtime_timestamp_seconds gauge
windows_file_mtime_timestamp_seconds{file="C:\\Users\\admin\\Desktop\\Dashboard.lnk"} 1.726434517e+09
# HELP windows_file_size_bytes File size
# TYPE windows_file_size_bytes gauge
windows_file_size_bytes{file="C:\\Users\\admin\\Desktop\\Dashboard.lnk"} 123
```
## Useful queries
_This collector does not yet have any useful queries added, we would appreciate your help adding them!_
## Alerting examples
_This collector does not yet have alerting examples, we would appreciate your help adding them!_

View File

@@ -1,36 +0,0 @@
# filetime collector
The filetime collector exposes modified timestamps of files in the filesystem.
The collector
|||
-|-
Metric name prefix | `filetime`
Enabled by default? | No
## Flags
### `--collectors.filetime.file-patterns`
Comma-separated list of file patterns. Each pattern is a glob pattern that can contain `*`, `?`, and `**` (recursive).
See https://github.com/bmatcuk/doublestar#patterns for an extended description of the pattern syntax.
## Metrics
Name | Description | Type | Labels
-----|-------------|------|-------
`windows_filetime_mtime_timestamp_seconds` | File modification time | gauge | `file`
### Example metric
```
# HELP windows_filetime_mtime_timestamp_seconds File modification time
# TYPE windows_filetime_mtime_timestamp_seconds gauge
windows_filetime_mtime_timestamp_seconds{file="C:\\Users\\admin\\Desktop\\Dashboard.lnk"} 1.726434517e+09
```
## Useful queries
_This collector does not yet have any useful queries added, we would appreciate your help adding them!_
## Alerting examples
_This collector does not yet have alerting examples, we would appreciate your help adding them!_

149
docs/collector.gpu.md Normal file
View File

@@ -0,0 +1,149 @@
# gpu collector
The gpu collector exposes metrics about GPU usage and memory consumption, both at the adapter (physical GPU) and
per-process level.
| | |
|---------------------|--------------------------------------|
| Metric name prefix | `gpu` |
| Data source | Perflib |
| Counters | GPU Engine, GPU Adapter, GPU Process |
| Enabled by default? | No |
## Flags
None
## Metrics
These metrics are available on supported versions of Windows with compatible GPUs and drivers:
### Adapter-level Metrics
| Name | Description | Type | Labels |
|--------------------------------------------------|------------------------------------------------------------------------------------|-------|-----------------------------------------------------------------|
| `windows_gpu_info` | A metric with a constant '1' value labeled with gpu device information. | gauge | `bus_number`,`device_id`,`function_number`,`luid`,`name`,`phys` |
| `windows_gpu_dedicated_system_memory_size_bytes` | The size, in bytes, of memory that is dedicated from system memory. | gauge | `device_id`,`luid` |
| `windows_gpu_dedicated_video_memory_size_bytes` | The size, in bytes, of memory that is dedicated from video memory. | gauge | `device_id`,`luid` |
| `windows_gpu_shared_system_memory_size_bytes` | The size, in bytes, of memory from system memory that can be shared by many users. | gauge | `device_id`,`luid` |
| `windows_gpu_adapter_memory_committed_bytes` | Total committed GPU memory in bytes per physical GPU | gauge | `device_id`,`luid`,`phys` |
| `windows_gpu_adapter_memory_dedicated_bytes` | Dedicated GPU memory usage in bytes per physical GPU | gauge | `device_id`,`luid`,`phys` |
| `windows_gpu_adapter_memory_shared_bytes` | Shared GPU memory usage in bytes per physical GPU | gauge | `device_id`,`luid`,`phys` |
| `windows_gpu_local_adapter_memory_bytes` | Local adapter memory usage in bytes per physical GPU | gauge | `device_id`,`luid`,`phys`,`part` |
| `windows_gpu_non_local_adapter_memory_bytes` | Non-local adapter memory usage in bytes per physical GPU | gauge | `device_id`,`luid`,`phys`,`part` |
### Per-process Metrics
| Name | Description | Type | Labels |
|----------------------------------------------|-------------------------------------------------|---------|-----------------------------------------------------------|
| `windows_gpu_engine_time_seconds` | Total running time of the GPU engine in seconds | counter | `device_id`,`luid`,`phys`, `eng`, `engtype`, `process_id` |
| `windows_gpu_process_memory_committed_bytes` | Total committed GPU memory in bytes per process | gauge | `device_id`,`luid`,`phys`,`process_id` |
| `windows_gpu_process_memory_dedicated_bytes` | Dedicated GPU memory usage in bytes per process | gauge | `device_id`,`luid`,`phys`,`process_id` |
| `windows_gpu_process_memory_local_bytes` | Local GPU memory usage in bytes per process | gauge | `device_id`,`luid`,`phys`,`process_id` |
| `windows_gpu_process_memory_non_local_bytes` | Non-local GPU memory usage in bytes per process | gauge | `device_id`,`luid`,`phys`,`process_id` |
| `windows_gpu_process_memory_shared_bytes` | Shared GPU memory usage in bytes per process | gauge | `device_id`,`luid`,`phys`,`process_id` |
## Metric Labels
* `luid`,`phys`: Physical GPU index (e.g., "0")
* `eng`: GPU engine index (e.g., "0", "1", ...)
* `engtype`: GPU engine type (e.g., "3D", "Copy", "VideoDecode", etc.)
* `process_id`: Process ID
## Example Metric
These are basic queries to help you get started with GPU monitoring on Windows using Prometheus.
**Show GPU information for a specific physical GPU (0):**
```promql
windows_gpu_info{bus_number="8",device_id="PCI\\VEN_10DE&DEV_1B81&SUBSYS_61733842&REV_A1",function_number="0",luid="0x00000000_0x00010F8A",name="NVIDIA GeForce GTX 1070",phys="0"} 1
```
**Show total dedicated GPU memory (in bytes) usage on GPU 0:**
```promql
windows_gpu_adapter_memory_dedicated_bytes{phys="0"}
```
**Aggregate GPU utilization across all processes for a physical GPU (3D engine):**
```promql
sum by (phys) (
rate(windows_gpu_engine_time_seconds{phys="0", engtype="3D"}[1m])
) * 100
```
**Show GPU utilization for a specific process (3D engine):**
```promql
sum by (phys, process_id) (
rate(windows_gpu_engine_time_seconds{process_id="1234", engtype="3D"}[1m])
) * 100
```
**Show dedicated GPU memory per process:**
```promql
windows_gpu_adapter_memory_dedicated_bytes
```
## Useful Queries
**Show top 5 processes by GPU utilization (all engines):**
```promql
topk(5, sum by (process_id) (
rate(windows_gpu_engine_time_seconds[1m])
) * 100)
```
**Show GPU memory usage per physical GPU:**
```promql
sum by (phys) (
windows_gpu_adapter_memory_dedicated_bytes
)
```
Show GPU engine time with process owner and command line:
```promql
windows_gpu_engine_time_seconds * on(process_id) group_left(owner, cmdline) windows_process_info
```
## Alerting Examples
**prometheus.rules**
```yaml
# Alert on processes using more than 80% of a GPU's capacity over 10 minutes
- alert: HighGpuUtilization
expr: |
sum by (process_id) (
rate(windows_gpu_engine_time_seconds[1m])
) * 100 > 80
for: 10m
labels:
severity: warning
annotations:
summary: "High GPU Utilization (process {{ $labels.process_id }})"
description: "Process is using more than 80% of GPU resources\n VALUE = {{ $value }}\n LABELS: {{ $labels }}"
```
## Notes
* Per-process metrics allow you to identify which processes are consuming GPU resources.
* Adapter-level metrics provide an overview of total GPU memory usage.
* For overall GPU utilization, aggregate per-process metrics in Prometheus using queries such as `sum()`.
* The collector relies on Windows performance counters; ensure your system and drivers support these counters.
## Enabling the Collector
To enable the GPU collector, add `gpu` to the list of enabled collectors in your windows_exporter configuration.
Example (command line):
```shell
windows_exporter.exe --collectors.enabled=gpu
```

View File

@@ -28,108 +28,112 @@ If given, an application needs to *not* match the exclude regexp in order for th
## Metrics ## Metrics
Name | Description | Type | Labels | Name | Description | Type | Labels |
-----|-------------|------|------- |----------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|-----------------------------|
`windows_iis_current_anonymous_users` | The number of users who currently have an anonymous request pending with the web service | gauge | `site` | `windows_iis_current_anonymous_users` | The number of users who currently have an anonymous request pending with the web service | gauge | `site` |
`windows_iis_current_blocked_async_io_requests` | _Not yet documented_ | gauge | `site` | `windows_iis_current_blocked_async_io_requests` | _Not yet documented_ | gauge | `site` |
`windows_iis_current_cgi_requests` | The number of CGI requests that are being processed simultaneously by the web service | gauge | `site` | `windows_iis_current_cgi_requests` | The number of CGI requests that are being processed simultaneously by the web service | gauge | `site` |
`windows_iis_current_connections` | The number of active connections to the web service | gauge | `site` | `windows_iis_current_connections` | The number of active connections to the web service | gauge | `site` |
`windows_iis_current_isapi_extension_requests` | The number of [ISAPI extension](https://docs.microsoft.com/en-us/previous-versions/iis/6.0-sdk/ms525172(v=vs.90)) requests that are being processed simultaneously by the web service | gauge | `site` | `windows_iis_current_isapi_extension_requests` | The number of [ISAPI extension](https://docs.microsoft.com/en-us/previous-versions/iis/6.0-sdk/ms525172(v=vs.90)) requests that are being processed simultaneously by the web service | gauge | `site` |
`windows_iis_current_non_anonymous_users` | The number of users who currently have a nonanonymous request pending with the web service | gauge | `site` | `windows_iis_current_non_anonymous_users` | The number of users who currently have a nonanonymous request pending with the web service | gauge | `site` |
`windows_iis_service_uptime` | The uptime for the web service or a Web site (seconds) | gauge | `site` | `windows_iis_service_uptime` | The uptime for the web service or a Web site (seconds) | gauge | `site` |
`windows_iis_received_bytes_total` | The total bytes of data that have been received by the web service since the service started | counter | `site` | `windows_iis_received_bytes_total` | The total bytes of data that have been received by the web service since the service started | counter | `site` |
`windows_iis_sent_bytes_total` | The number of data bytes that have been sent by the web service since the service started | counter | `site` | `windows_iis_sent_bytes_total` | The number of data bytes that have been sent by the web service since the service started | counter | `site` |
`windows_iis_anonymous_users_total` | The number of users who have established an anonymous request since the web service started | counter | `site` | `windows_iis_anonymous_users_total` | The number of users who have established an anonymous request since the web service started | counter | `site` |
`windows_iis_blocked_async_io_requests_total` | The total number of blocked asynchronous I/O requests since the start of the IIS service | counter | `site` | `windows_iis_blocked_async_io_requests_total` | The total number of blocked asynchronous I/O requests since the start of the IIS service | counter | `site` |
`windows_iis_cgi_requests_total` | The number of all CGI requests that have been made since the web service started | counter | `site` | `windows_iis_cgi_requests_total` | The number of all CGI requests that have been made since the web service started | counter | `site` |
`windows_iis_connection_attempts_all_instances_total` | The number of connections to the web service that have been attempted since the service started | counter | `site` | `windows_iis_connection_attempts_all_instances_total` | The number of connections to the web service that have been attempted since the service started | counter | `site` |
`windows_iis_requests_total` | The number of requests that have been made since the web service was started | counter | `site`, `method` | `windows_iis_requests_total` | The number of requests that have been made since the web service was started | counter | `site`, `method` |
`windows_iis_files_received_total` | The total number of files that have been received by the FTP service since the service started | counter | `site` | `windows_iis_files_received_total` | The total number of files that have been received by the FTP service since the service started | counter | `site` |
`windows_iis_files_sent_total` | The total number of files that have been sent by the FTP service since the service started | counter | `site` | `windows_iis_files_sent_total` | The total number of files that have been sent by the FTP service since the service started | counter | `site` |
`windows_iis_ipapi_extension_requests_total` | The number of ISAPI extension requests that have been made since the web service started | counter | `site` | `windows_iis_ipapi_extension_requests_total` | The number of ISAPI extension requests that have been made since the web service started | counter | `site` |
`windows_iis_locked_errors_total` | The number of requests that have been made since the service started that could not be satisfied by the server because the requested document was locked. Usually reported as HTTP error 423 | counter | `site` | `windows_iis_locked_errors_total` | The number of requests that have been made since the service started that could not be satisfied by the server because the requested document was locked. Usually reported as HTTP error 423 | counter | `site` |
`windows_iis_logon_attempts_total` | The number of attempts to log on to the web service that have occurred since the service started | counter | `site` | `windows_iis_logon_attempts_total` | The number of attempts to log on to the web service that have occurred since the service started | counter | `site` |
`windows_iis_non_anonymous_users_total` | The number of users who have made nonanonymous requests to the web service since the service started | counter | `site` | `windows_iis_non_anonymous_users_total` | The number of users who have made nonanonymous requests to the web service since the service started | counter | `site` |
`windows_iis_not_found_errors_total` | The number of requests that have been made since the service started that were not satisfied by the server because the requested document was not found. Usually reported as HTTP error 404 | counter | `site` | `windows_iis_not_found_errors_total` | The number of requests that have been made since the service started that were not satisfied by the server because the requested document was not found. Usually reported as HTTP error 404 | counter | `site` |
`windows_iis_rejected_async_io_requests_total` |The total number of rejected asynchronous I/O requests since the start of the IIS service. | counter | `site` | `windows_iis_rejected_async_io_requests_total` | The total number of rejected asynchronous I/O requests since the start of the IIS service. | counter | `site` |
`windows_iis_current_application_pool_state` | The current status of the application pool (1 - Uninitialized, 2 - Initialized, 3 - Running, 4 - Disabling, 5 - Disabled, 6 - Shutdown Pending, 7 - Delete Pending) | gauge | `app`, `state` | `windows_iis_current_application_pool_state` | The current status of the application pool (1 - Uninitialized, 2 - Initialized, 3 - Running, 4 - Disabling, 5 - Disabled, 6 - Shutdown Pending, 7 - Delete Pending) | gauge | `app`, `state` |
`windows_iis_current_application_pool_start_time` | The unix timestamp for the application pool start time | gauge | `app` | `windows_iis_current_application_pool_start_time` | The unix timestamp for the application pool start time | gauge | `app` |
`windows_iis_current_worker_processes` | The current number of worker processes that are running in the application pool | gauge | `app` | `windows_iis_current_worker_processes` | The current number of worker processes that are running in the application pool | gauge | `app` |
`windows_iis_maximum_worker_processes` | The maximum number of worker processes that have been created for the application pool since Windows Process Activation Service (WAS) started | gauge | `app` | `windows_iis_maximum_worker_processes` | The maximum number of worker processes that have been created for the application pool since Windows Process Activation Service (WAS) started | gauge | `app` |
`windows_iis_recent_worker_process_failures` | The number of times that worker processes for the application pool failed during the rapid-fail protection interval | gauge | `app` | `windows_iis_recent_worker_process_failures` | The number of times that worker processes for the application pool failed during the rapid-fail protection interval | gauge | `app` |
`windows_iis_time_since_last_worker_process_failure` | The length of time, in seconds, since the last worker process failure occurred for the application pool | gauge | `app` | `windows_iis_time_since_last_worker_process_failure` | The length of time, in seconds, since the last worker process failure occurred for the application pool | gauge | `app` |
`windows_iis_total_application_pool_recycles` | The number of times that the application pool has been recycled since Windows Process Activation Service (WAS) started | counter | `app` | `windows_iis_total_application_pool_recycles` | The number of times that the application pool has been recycled since Windows Process Activation Service (WAS) started | counter | `app` |
`windows_iis_total_application_pool_start_time` | The unix timestamp for the application pool of when the Windows Process Activation Service (WAS) started | counter | `app` | `windows_iis_total_application_pool_start_time` | The unix timestamp for the application pool of when the Windows Process Activation Service (WAS) started | counter | `app` |
`windows_iis_total_worker_processes_created` | The number of worker processes created for the application pool since Windows Process Activation Service (WAS) started | counter | `app` | `windows_iis_total_worker_processes_created` | The number of worker processes created for the application pool since Windows Process Activation Service (WAS) started | counter | `app` |
`windows_iis_total_worker_process_failures` | The number of times that worker processes have crashed since the application pool was started | counter | `app` | `windows_iis_total_worker_process_failures` | The number of times that worker processes have crashed since the application pool was started | counter | `app` |
`windows_iis_total_worker_process_ping_failures` | The number of times that Windows Process Activation Service (WAS) did not receive a response to ping messages sent to a worker process | counter | `app` | `windows_iis_total_worker_process_ping_failures` | The number of times that Windows Process Activation Service (WAS) did not receive a response to ping messages sent to a worker process | counter | `app` |
`windows_iis_total_worker_process_shutdown_failures` | The number of times that Windows Process Activation Service (WAS) failed to shut down a worker process | counter | `app` | `windows_iis_total_worker_process_shutdown_failures` | The number of times that Windows Process Activation Service (WAS) failed to shut down a worker process | counter | `app` |
`windows_iis_total_worker_process_startup_failures` | The number of times that Windows Process Activation Service (WAS) failed to start a worker process | counter | `app` | `windows_iis_total_worker_process_startup_failures` | The number of times that Windows Process Activation Service (WAS) failed to start a worker process | counter | `app` |
`windows_iis_worker_cache_active_flushed_entries` | Number of file handles cached that will be closed when all current transfers complete | gauge | `app`, `pid` | `windows_iis_worker_cache_active_flushed_entries` | Number of file handles cached that will be closed when all current transfers complete | gauge | `app`, `pid` |
`windows_iis_worker_file_cache_memory_bytes` | Current number of bytes used by file cache | gauge | `app`, `pid` | `windows_iis_worker_file_cache_memory_bytes` | Current number of bytes used by file cache | gauge | `app`, `pid` |
`windows_iis_worker_file_cache_max_memory_bytes` | Maximum number of bytes used by file cache | counter | `app`, `pid` | `windows_iis_worker_file_cache_max_memory_bytes` | Maximum number of bytes used by file cache | counter | `app`, `pid` |
`windows_iis_worker_file_cache_flushes_total` | Total number of file cache flushes (since service startup) | counter | `app`, `pid` | `windows_iis_worker_file_cache_flushes_total` | Total number of file cache flushes (since service startup) | counter | `app`, `pid` |
`windows_iis_worker_file_cache_queries_total` | Total file cache queries (hits + misses) | counter | `app`, `pid` | `windows_iis_worker_file_cache_queries_total` | Total file cache queries (hits + misses) | counter | `app`, `pid` |
`windows_iis_worker_file_cache_hits_total` | Total number of successful lookups in the user-mode file cache | counter | `app`, `pid` | `windows_iis_worker_file_cache_hits_total` | Total number of successful lookups in the user-mode file cache | counter | `app`, `pid` |
`windows_iis_worker_file_cache_items` | Current number of files whose contents are present in user-mode cache | gauge | `app`, `pid` | `windows_iis_worker_file_cache_items` | Current number of files whose contents are present in user-mode cache | gauge | `app`, `pid` |
`windows_iis_worker_file_cache_items_total` | Total number of files whose contents were ever added to the user-mode cache (since service startup) | counter | `app`, `pid` | `windows_iis_worker_file_cache_items_total` | Total number of files whose contents were ever added to the user-mode cache (since service startup) | counter | `app`, `pid` |
`windows_iis_worker_file_cache_items_flushed_total` | Total number of file handles that have been removed from the user-mode cache (since service startup) | counter | `app`, `pid` | `windows_iis_worker_file_cache_items_flushed_total` | Total number of file handles that have been removed from the user-mode cache (since service startup) | counter | `app`, `pid` |
`windows_iis_worker_uri_cache_flushes_total` | Total number of URI cache flushes (since service startup) | counter | `app`, `pid` | `windows_iis_worker_uri_cache_flushes_total` | Total number of URI cache flushes (since service startup) | counter | `app`, `pid` |
`windows_iis_worker_uri_cache_queries_total` | Total number of uri cache queries (hits + misses) | counter | `app`, `pid` | `windows_iis_worker_uri_cache_queries_total` | Total number of uri cache queries (hits + misses) | counter | `app`, `pid` |
`windows_iis_worker_uri_cache_hits_total` | Total number of successful lookups in the user-mode URI cache (since service startup) | counter | `app`, `pid` | `windows_iis_worker_uri_cache_hits_total` | Total number of successful lookups in the user-mode URI cache (since service startup) | counter | `app`, `pid` |
`windows_iis_worker_uri_cache_items` | Number of URI information blocks currently in the user-mode cache | gauge | `app`, `pid` | `windows_iis_worker_uri_cache_items` | Number of URI information blocks currently in the user-mode cache | gauge | `app`, `pid` |
`windows_iis_worker_uri_cache_items_total` | Total number of URI information blocks added to the user-mode cache (since service startup) | counter | `app`, `pid` | `windows_iis_worker_uri_cache_items_total` | Total number of URI information blocks added to the user-mode cache (since service startup) | counter | `app`, `pid` |
`windows_iis_worker_uri_cache_items_flushed_total` | The number of URI information blocks that have been removed from the user-mode cache (since service startup) | counter | `app`, `pid` | `windows_iis_worker_uri_cache_items_flushed_total` | The number of URI information blocks that have been removed from the user-mode cache (since service startup) | counter | `app`, `pid` |
`windows_iis_worker_metadata_cache_items` | Number of metadata information blocks currently present in user-mode cache | gauge | `app`, `pid` | `windows_iis_worker_metadata_cache_items` | Number of metadata information blocks currently present in user-mode cache | gauge | `app`, `pid` |
`windows_iis_worker_metadata_cache_flushes_total` | Total number of user-mode metadata cache flushes (since service startup) | counter | `app`, `pid` | `windows_iis_worker_metadata_cache_flushes_total` | Total number of user-mode metadata cache flushes (since service startup) | counter | `app`, `pid` |
`windows_iis_worker_metadata_cache_queries_total` | Total metadata cache queries (hits + misses) | counter | `app`, `pid` | `windows_iis_worker_metadata_cache_queries_total` | Total metadata cache queries (hits + misses) | counter | `app`, `pid` |
`windows_iis_worker_metadata_cache_hits_total` | Total number of successful lookups in the user-mode metadata cache (since service startup) | counter | `app`, `pid` | `windows_iis_worker_metadata_cache_hits_total` | Total number of successful lookups in the user-mode metadata cache (since service startup) | counter | `app`, `pid` |
`windows_iis_worker_metadata_cache_items_cached_total` | Total number of metadata information blocks added to the user-mode cache (since service startup) | counter | `app`, `pid` | `windows_iis_worker_metadata_cache_items_cached_total` | Total number of metadata information blocks added to the user-mode cache (since service startup) | counter | `app`, `pid` |
`windows_iis_worker_metadata_cache_items_flushed_total` | Total number of metadata information blocks removed from the user-mode cache (since service startup) | counter | `app`, `pid` | `windows_iis_worker_metadata_cache_items_flushed_total` | Total number of metadata information blocks removed from the user-mode cache (since service startup) | counter | `app`, `pid` |
`windows_iis_worker_output_cache_active_flushed_items` |The total number of active and flushed items in the output cache of the IIS worker process. Active items are those that are currently being used to serve client requests, while flushed items are those that have been removed from the cache but are still waiting to be flushed to disk. | counter | `app`, `pid` | `windows_iis_worker_output_cache_active_flushed_items` | The total number of active and flushed items in the output cache of the IIS worker process. Active items are those that are currently being used to serve client requests, while flushed items are those that have been removed from the cache but are still waiting to be flushed to disk. | counter | `app`, `pid` |
`windows_iis_worker_output_cache_items` | Number of items current present in output cache | counter | `app`, `pid` | `windows_iis_worker_output_cache_items` | Number of items current present in output cache | counter | `app`, `pid` |
`windows_iis_worker_output_cache_memory_bytes` | Current number of bytes used by output cache | counter | `app`, `pid` | `windows_iis_worker_output_cache_memory_bytes` | Current number of bytes used by output cache | counter | `app`, `pid` |
`windows_iis_worker_output_queries_total` | Total number of output cache queries (hits + misses) | counter | `app`, `pid` | `windows_iis_worker_output_queries_total` | Total number of output cache queries (hits + misses) | counter | `app`, `pid` |
`windows_iis_worker_output_cache_hits_total` | Total number of successful lookups in output cache (since service startup) | counter | `app`, `pid` | `windows_iis_worker_output_cache_hits_total` | Total number of successful lookups in output cache (since service startup) | counter | `app`, `pid` |
`windows_iis_worker_output_cache_items_flushed_total` | Total number of items flushed from output cache (since service startup) | counter | `app`, `pid` | `windows_iis_worker_output_cache_items_flushed_total` | Total number of items flushed from output cache (since service startup) | counter | `app`, `pid` |
`windows_iis_worker_output_cache_flushes_total` | Total number of flushes of output cache (since service startup) | counter | `app`, `pid` | `windows_iis_worker_output_cache_flushes_total` | Total number of flushes of output cache (since service startup) | counter | `app`, `pid` |
`windows_iis_worker_threads` | Number of threads actively processing requests in the worker process | gauge | `app`, `pid`, `state` | `windows_iis_worker_threads` | Number of threads actively processing requests in the worker process | gauge | `app`, `pid`, `state` |
`windows_iis_worker_max_threads` | Maximum number of threads to which the thread pool can grow as needed | counter | `app`, `pid` | `windows_iis_worker_max_threads` | Maximum number of threads to which the thread pool can grow as needed | counter | `app`, `pid` |
`windows_iis_worker_requests_total` | Total number of HTTP requests served by the worker process | counter | `app`, `pid` | `windows_iis_worker_requests_total` | Total number of HTTP requests served by the worker process | counter | `app`, `pid` |
`windows_iis_worker_current_requests` | Current number of requests being processed by the worker process | counter | `app`, `pid` | `windows_iis_worker_current_requests` | Current number of requests being processed by the worker process | counter | `app`, `pid` |
`windows_iis_worker_request_errors_total` | Total number of requests that returned an error | counter | `app`, `pid`, `status_code` | `windows_iis_worker_request_errors_total` | Total number of requests that returned an error | counter | `app`, `pid`, `status_code` |
`windows_iis_worker_current_websocket_requests` | the current number of WebSocket connections being processed by the IIS worker process. | counter | `app`, `pid` | `windows_iis_worker_current_websocket_requests` | the current number of WebSocket connections being processed by the IIS worker process. | counter | `app`, `pid` |
`windows_iis_worker_websocket_connection_attempts_total` | the total number of attempted WebSocket connections since the start of the IIS worker process | counter | `app`, `pid` | `windows_iis_worker_websocket_connection_attempts_total` | the total number of attempted WebSocket connections since the start of the IIS worker process | counter | `app`, `pid` |
`windows_iis_worker_websocket_connection_accepted_total` | the total number of WebSocket connections that have been successfully established since the start of the IIS worker process | counter | `app`, `pid` | `windows_iis_worker_websocket_connection_accepted_total` | the total number of WebSocket connections that have been successfully established since the start of the IIS worker process | counter | `app`, `pid` |
`windows_iis_worker_websocket_connection_rejected_total` | the total number of WebSocket connections that have been rejected by the server since the start of the IIS worker process. Connections can be rejected for various reasons, such as capacity limitations, authentication failures, or configuration issues | counter | `app`, `pid` | `windows_iis_worker_websocket_connection_rejected_total` | the total number of WebSocket connections that have been rejected by the server since the start of the IIS worker process. Connections can be rejected for various reasons, such as capacity limitations, authentication failures, or configuration issues | counter | `app`, `pid` |
`windows_iis_server_cache_active_flushed_entries` | Number of file handles cached that will be closed when all current transfers complete | counter | None | `windows_iis_server_cache_active_flushed_entries` | Number of file handles cached that will be closed when all current transfers complete | counter | None |
`windows_iis_server_file_cache_memory_bytes` | Current number of bytes used by file cache | gauge | None | `windows_iis_server_file_cache_memory_bytes` | Current number of bytes used by file cache | gauge | None |
`windows_iis_server_file_cache_max_memory_bytes` | Maximum number of bytes used by file cache | counter | None | `windows_iis_server_file_cache_max_memory_bytes` | Maximum number of bytes used by file cache | counter | None |
`windows_iis_server_file_cache_flushes_total` | Total number of file cache flushes (since service startup) | counter | None | `windows_iis_server_file_cache_flushes_total` | Total number of file cache flushes (since service startup) | counter | None |
`windows_iis_server_file_cache_queries_total` | Total number of file cache queries (hits + misses) | counter | None | `windows_iis_server_file_cache_queries_total` | Total number of file cache queries (hits + misses) | counter | None |
`windows_iis_server_file_cache_hits_total` | Total number of successful lookups in the file cache | counter | None | `windows_iis_server_file_cache_hits_total` | Total number of successful lookups in the file cache | counter | None |
`windows_iis_server_file_cache_items` | Current number of files whose contents are present in cache | gauge | None | `windows_iis_server_file_cache_items` | Current number of files whose contents are present in cache | gauge | None |
`windows_iis_server_file_cache_items_total` | Total number of files whose contents were ever added to the cache (since service startup) | counter | None | `windows_iis_server_file_cache_items_total` | Total number of files whose contents were ever added to the cache (since service startup) | counter | None |
`windows_iis_server_file_cache_items_flushed_total` | Total number of file handles that have been removed from the cache (since service startup) | counter | None | `windows_iis_server_file_cache_items_flushed_total` | Total number of file handles that have been removed from the cache (since service startup) | counter | None |
`windows_iis_server_uri_cache_flushes_total` | Total number of URI cache flushes (since service startup) | counter | `mode` | `windows_iis_server_uri_cache_flushes_total` | Total number of URI cache flushes (since service startup) | counter | `mode` |
`windows_iis_server_uri_cache_queries_total` | Total number of uri cache queries (hits + misses) | counter | `mode` | `windows_iis_server_uri_cache_queries_total` | Total number of uri cache queries (hits + misses) | counter | `mode` |
`windows_iis_server_uri_cache_hits_total` | Total number of successful lookups in the URI cache (since service startup) | counter | `mode` | `windows_iis_server_uri_cache_hits_total` | Total number of successful lookups in the URI cache (since service startup) | counter | `mode` |
`windows_iis_server_uri_cache_items` | Number of URI information blocks currently in the cache | gauge | `mode` | `windows_iis_server_uri_cache_items` | Number of URI information blocks currently in the cache | gauge | `mode` |
`windows_iis_server_uri_cache_items_total` | Total number of URI information blocks added to the cache (since service startup) | counter | `mode` | `windows_iis_server_uri_cache_items_total` | Total number of URI information blocks added to the cache (since service startup) | counter | `mode` |
`windows_iis_server_uri_cache_items_flushed_total` | The number of URI information blocks that have been removed from the cache (since service startup) | counter | `mode` | `windows_iis_server_uri_cache_items_flushed_total` | The number of URI information blocks that have been removed from the cache (since service startup) | counter | `mode` |
`windows_iis_server_metadata_cache_items` | Number of metadata information blocks currently present in cache | gauge | None | `windows_iis_server_metadata_cache_items` | Number of metadata information blocks currently present in cache | gauge | None |
`windows_iis_server_metadata_cache_flushes_total` | Total number of metadata cache flushes (since service startup) | counter | None | `windows_iis_server_metadata_cache_flushes_total` | Total number of metadata cache flushes (since service startup) | counter | None |
`windows_iis_server_metadata_cache_queries_total` | Total metadata cache queries (hits + misses) | counter | None | `windows_iis_server_metadata_cache_queries_total` | Total metadata cache queries (hits + misses) | counter | None |
`windows_iis_server_metadata_cache_hits_total` | Total number of successful lookups in the metadata cache (since service startup) | counter | None | `windows_iis_server_metadata_cache_hits_total` | Total number of successful lookups in the metadata cache (since service startup) | counter | None |
`windows_iis_server_metadata_cache_items_cached_total` | Total number of metadata information blocks added to the cache (since service startup) | counter | None | `windows_iis_server_metadata_cache_items_cached_total` | Total number of metadata information blocks added to the cache (since service startup) | counter | None |
`windows_iis_server_metadata_cache_items_flushed_total` | Total number of metadata information blocks removed from the cache (since service startup) | counter | None | `windows_iis_server_metadata_cache_items_flushed_total` | Total number of metadata information blocks removed from the cache (since service startup) | counter | None |
`windows_iis_server_output_cache_active_flushed_items` | The total number of active and flushed items in the output cache of the IIS server | counter | None | `windows_iis_server_output_cache_active_flushed_items` | The total number of active and flushed items in the output cache of the IIS server | counter | None |
`windows_iis_server_output_cache_items` | Number of items current present in output cache | counter | None | `windows_iis_server_output_cache_items` | Number of items current present in output cache | counter | None |
`windows_iis_server_output_cache_memory_bytes` | Current number of bytes used by output cache | counter | None | `windows_iis_server_output_cache_memory_bytes` | Current number of bytes used by output cache | counter | None |
`windows_iis_server_output_cache_queries_total` | Total output cache queries (hits + misses) | counter | None | `windows_iis_server_output_cache_queries_total` | Total output cache queries (hits + misses) | counter | None |
`windows_iis_server_output_cache_hits_total` | Total number of successful lookups in output cache (since service startup) | counter | None | `windows_iis_server_output_cache_hits_total` | Total number of successful lookups in output cache (since service startup) | counter | None |
`windows_iis_server_output_cache_items_flushed_total` | Total number of items flushed from output cache (since service startup) | counter | None | `windows_iis_server_output_cache_items_flushed_total` | Total number of items flushed from output cache (since service startup) | counter | None |
`windows_iis_server_output_cache_flushes_total` | Total number of flushes of output cache (since service startup) | counter | None | `windows_iis_server_output_cache_flushes_total` | Total number of flushes of output cache (since service startup) | counter | None |
| `windows_iis_http_requests_current_queue_size` | Http Request Current queue size | counter | None |
| `windows_iis_http_request_total_rejected_request` | Http Request total rejected request | counter | None |
| `windows_iis_http_requests_max_queue_item_age` | Http Request Max queue Item age | counter | None |
| `windows_iis_http_requests_arrival_rate` | Http requests Arrival Rate | counter | None |
### Example metric ### Example metric
_This collector does not yet have explained examples, we would appreciate your help adding them!_ _This collector does not yet have explained examples, we would appreciate your help adding them!_

View File

@@ -2,12 +2,12 @@
The logical_disk collector exposes metrics about logical disks (in contrast to physical disks) The logical_disk collector exposes metrics about logical disks (in contrast to physical disks)
||| | | |
-|- |---------------------|------------------|
Metric name prefix | `logical_disk` | Metric name prefix | `logical_disk` |
Data source | Perflib | Data source | Performance Data |
Counters | `LogicalDisk` ([`Win32_PerfRawData_PerfDisk_LogicalDisk`](https://msdn.microsoft.com/en-us/windows/hardware/aa394307(v=vs.71))) | Counters | `LogicalDisk` |
Enabled by default? | Yes | Enabled by default? | Yes |
## Flags ## Flags
@@ -19,25 +19,30 @@ If given, a disk needs to match the include regexp in order for the correspondin
If given, a disk needs to *not* match the exclude regexp in order for the corresponding disk metrics to be reported If given, a disk needs to *not* match the exclude regexp in order for the corresponding disk metrics to be reported
### `--collector.logical_disk.enabled`
Comma-separated list of collectors to use. Available collectors: metrics, bitlocker_status. Defaults to metrics, if not specified.
## Metrics ## Metrics
Name | Description | Type | Labels | Name | Description | Type | Labels |
-----|-------------|------|------- |--------------------------------------------------|----------------------------------------------------------------------------------------------------|---------|-------------------------------------------------------------------|
`windows_logical_disk_info` | A metric with a constant '1' value labeled with logical disk information | gauge | `disk`,`filesystem`,`serial_number`,`volume`,`volume_name`,`type` | `windows_logical_disk_info` | A metric with a constant '1' value labeled with logical disk information | gauge | `disk`,`filesystem`,`serial_number`,`volume`,`volume_name`,`type` |
`windows_logical_disk_requests_queued` | Number of requests outstanding on the disk at the time the performance data is collected | gauge | `volume` | `windows_logical_disk_requests_queued` | Number of requests outstanding on the disk at the time the performance data is collected | gauge | `volume` |
`windows_logical_disk_avg_read_requests_queued` | Average number of read requests that were queued for the selected disk during the sample interval | gauge | `volume` | `windows_logical_disk_avg_read_requests_queued` | Average number of read requests that were queued for the selected disk during the sample interval | gauge | `volume` |
`windows_logical_disk_avg_write_requests_queued` | Average number of write requests that were queued for the selected disk during the sample interval | gauge | `volume` | `windows_logical_disk_avg_write_requests_queued` | Average number of write requests that were queued for the selected disk during the sample interval | gauge | `volume` |
`windows_logical_disk_read_bytes_total` | Rate at which bytes are transferred from the disk during read operations | counter | `volume` | `windows_logical_disk_read_bytes_total` | Rate at which bytes are transferred from the disk during read operations | counter | `volume` |
`windows_logical_disk_reads_total` | Rate of read operations on the disk | counter | `volume` | `windows_logical_disk_reads_total` | Rate of read operations on the disk | counter | `volume` |
`windows_logical_disk_write_bytes_total` | Rate at which bytes are transferred to the disk during write operations | counter | `volume` | `windows_logical_disk_write_bytes_total` | Rate at which bytes are transferred to the disk during write operations | counter | `volume` |
`windows_logical_disk_writes_total` | Rate of write operations on the disk | counter | `volume` | `windows_logical_disk_writes_total` | Rate of write operations on the disk | counter | `volume` |
`windows_logical_disk_read_seconds_total` | Seconds the disk was busy servicing read requests | counter | `volume` | `windows_logical_disk_read_seconds_total` | Seconds the disk was busy servicing read requests | counter | `volume` |
`windows_logical_disk_write_seconds_total` | Seconds the disk was busy servicing write requests | counter | `volume` | `windows_logical_disk_write_seconds_total` | Seconds the disk was busy servicing write requests | counter | `volume` |
`windows_logical_disk_free_bytes` | Unused space of the disk in bytes (not real time, updates every 10-15 min) | gauge | `volume` | `windows_logical_disk_free_bytes` | Unused space of the disk in bytes (not real time, updates every 10-15 min) | gauge | `volume` |
`windows_logical_disk_size_bytes` | Total size of the disk in bytes (not real time, updates every 10-15 min) | gauge | `volume` | `windows_logical_disk_size_bytes` | Total size of the disk in bytes (not real time, updates every 10-15 min) | gauge | `volume` |
`windows_logical_disk_idle_seconds_total` | Seconds the disk was idle (not servicing read/write requests) | counter | `volume` | `windows_logical_disk_idle_seconds_total` | Seconds the disk was idle (not servicing read/write requests) | counter | `volume` |
`windows_logical_disk_split_ios_total` | Number of I/Os to the disk split into multiple I/Os | counter | `volume` | `windows_logical_disk_split_ios_total` | Number of I/Os to the disk split into multiple I/Os | counter | `volume` |
`windows_logical_disk_readonly` | Whether the logical disk is read-only | gauge | `volume` | `windows_logical_disk_readonly` | Whether the logical disk is read-only | gauge | `volume` |
| `windows_logical_disk_bitlocker_status` | BitLocker status for the logical disk | gauge | `volume`,`status` |
### Warning about size metrics ### Warning about size metrics
The `free_bytes` and `size_bytes` metrics are not updated in real time and might have a delay of 10-15min. The `free_bytes` and `size_bytes` metrics are not updated in real time and might have a delay of 10-15min.
@@ -69,6 +74,23 @@ Show volume usage (%)
100.0 - 100 * (windows_logical_disk_free_bytes{instance="localhost", volume="C:"} / windows_logical_disk_size_bytes{instance="localhost", volume="C:"}) 100.0 - 100 * (windows_logical_disk_free_bytes{instance="localhost", volume="C:"} / windows_logical_disk_size_bytes{instance="localhost", volume="C:"})
``` ```
Disk Activity
```promql
(
rate(windows_logical_disk_read_seconds_total[2m])
+
rate(windows_logical_disk_write_seconds_total[2m])
)
/
(
rate(windows_logical_disk_read_seconds_total[2m])
+
rate(windows_logical_disk_write_seconds_total[2m])
+
rate(windows_logical_disk_idle_seconds_total[2m])
)
```
## Alerting examples ## Alerting examples
**prometheus.rules** **prometheus.rules**
```yaml ```yaml

View File

@@ -1,78 +0,0 @@
# logon collector
The logon collector exposes metrics detailing the active user logon sessions.
| | |
|---------------------|-----------|
| Metric name prefix | `logon` |
| Source | Win32 API |
| Enabled by default? | No |
## Flags
None
## Metrics
| Name | Description | Type | Labels |
|-------------------------------------------|--------------------------------------------|-------|------------------------------------|
| `windows_logon_session_logon_timestamp_seconds` | timestamp of the logon session in seconds. | gauge | `domain`, `id`, `type`, `username` |
### Example metric
Query the total number of interactive logon sessions
```
# HELP windows_logon_session_logon_timestamp_seconds timestamp of the logon session in seconds.
# TYPE windows_logon_session_logon_timestamp_seconds gauge
windows_logon_session_logon_timestamp_seconds{domain="",id="0x0:0x8c54",type="System",username=""} 1.72876928e+09
windows_logon_session_logon_timestamp_seconds{domain="Font Driver Host",id="0x0:0x991a",type="Interactive",username="UMFD-1"} 1.728769282e+09
windows_logon_session_logon_timestamp_seconds{domain="Font Driver Host",id="0x0:0x9933",type="Interactive",username="UMFD-0"} 1.728769282e+09
windows_logon_session_logon_timestamp_seconds{domain="Font Driver Host",id="0x0:0x994a",type="Interactive",username="UMFD-0"} 1.728769282e+09
windows_logon_session_logon_timestamp_seconds{domain="Font Driver Host",id="0x0:0x999d",type="Interactive",username="UMFD-1"} 1.728769282e+09
windows_logon_session_logon_timestamp_seconds{domain="Font Driver Host",id="0x0:0xbf25a",type="Interactive",username="UMFD-2"} 1.728769532e+09
windows_logon_session_logon_timestamp_seconds{domain="Font Driver Host",id="0x0:0xbf290",type="Interactive",username="UMFD-2"} 1.728769532e+09
windows_logon_session_logon_timestamp_seconds{domain="JKROEPKE",id="0x0:0x130241",type="Network",username="vm-jok-dev$"} 1.728769625e+09
windows_logon_session_logon_timestamp_seconds{domain="JKROEPKE",id="0x0:0x24f7c9",type="Network",username="vm-jok-dev$"} 1.728770121e+09
windows_logon_session_logon_timestamp_seconds{domain="JKROEPKE",id="0x0:0x276846",type="Network",username="vm-jok-dev$"} 1.728770195e+09
windows_logon_session_logon_timestamp_seconds{domain="JKROEPKE",id="0x0:0x3e4",type="Service",username="vm-jok-dev$"} 1.728769283e+09
windows_logon_session_logon_timestamp_seconds{domain="JKROEPKE",id="0x0:0x3e7",type="System",username="vm-jok-dev$"} 1.728769279e+09
windows_logon_session_logon_timestamp_seconds{domain="JKROEPKE",id="0x0:0x71d0f",type="Network",username="vm-jok-dev$"} 1.728769324e+09
windows_logon_session_logon_timestamp_seconds{domain="JKROEPKE",id="0x0:0x720a3",type="Network",username="vm-jok-dev$"} 1.728769324e+09
windows_logon_session_logon_timestamp_seconds{domain="JKROEPKE",id="0x0:0x725cb",type="Network",username="vm-jok-dev$"} 1.728769324e+09
windows_logon_session_logon_timestamp_seconds{domain="JKROEPKE",id="0x0:0x753d8",type="Network",username="vm-jok-dev$"} 1.728769325e+09
windows_logon_session_logon_timestamp_seconds{domain="JKROEPKE",id="0x0:0xa3913",type="Network",username="vm-jok-dev$"} 1.728769385e+09
windows_logon_session_logon_timestamp_seconds{domain="JKROEPKE",id="0x0:0xbe7f2",type="Network",username="jok"} 1.728769531e+09
windows_logon_session_logon_timestamp_seconds{domain="JKROEPKE",id="0x0:0xc76c4",type="RemoteInteractive",username="jok"} 1.728769533e+09
windows_logon_session_logon_timestamp_seconds{domain="NT AUTHORITY",id="0x0:0x3e3",type="Service",username="IUSR"} 1.728769295e+09
windows_logon_session_logon_timestamp_seconds{domain="NT AUTHORITY",id="0x0:0x3e5",type="Service",username="LOCAL SERVICE"} 1.728769283e+09
windows_logon_session_logon_timestamp_seconds{domain="NT Service",id="0x0:0xae4c7",type="Service",username="MSSQLSERVER"} 1.728769425e+09
windows_logon_session_logon_timestamp_seconds{domain="NT Service",id="0x0:0xb42f1",type="Service",username="SQLTELEMETRY"} 1.728769431e+09
windows_logon_session_logon_timestamp_seconds{domain="Window Manager",id="0x0:0xbfbac",type="Interactive",username="DWM-2"} 1.728769532e+09
windows_logon_session_logon_timestamp_seconds{domain="Window Manager",id="0x0:0xbfc72",type="Interactive",username="DWM-2"} 1.728769532e+09
windows_logon_session_logon_timestamp_seconds{domain="Window Manager",id="0x0:0xdedd",type="Interactive",username="DWM-1"} 1.728769283e+09
windows_logon_session_logon_timestamp_seconds{domain="Window Manager",id="0x0:0xdefd",type="Interactive",username="DWM-1"} 1.728769283e+09
```
### Possible values for `type`
- System
- Interactive
- Network
- Batch
- Service
- Proxy
- Unlock
- NetworkCleartext
- NewCredentials
- RemoteInteractive
- CachedInteractive
- CachedRemoteInteractive
- CachedUnlock
## Useful queries
Query the total number of local and remote (I.E. Terminal Services) interactive sessions.
```
count(windows_logon_logon_type{type=~"Interactive|RemoteInteractive"}) by (type)
```
## Alerting examples
_This collector doesnt yet have alerting examples, we would appreciate your help adding them!_

View File

@@ -68,7 +68,7 @@ Show memory usage for instance (%)
```yaml ```yaml
# Alert on hosts that have exhausted all available physical memory # Alert on hosts that have exhausted all available physical memory
- alert: MemoryExhausted - alert: MemoryExhausted
expr: windows_os_physical_memory_free_bytes == 0 expr: windows_memory_physical_free_bytes == 0
for: 10m for: 10m
labels: labels:
severity: high severity: high

View File

@@ -5,14 +5,14 @@ The MSCluster_Cluster class is a dynamic WMI class that represents a cluster.
||| |||
-|- -|-
Metric name prefix | `mscluster` Metric name prefix | `mscluster`
Classes | `MSCluster_Cluster`,`MSCluster_Network`,`MSCluster_Node`,`MSCluster_Resource`,`MSCluster_ResourceGroup` Classes | `MSCluster_Cluster`,`MSCluster_Network`,`MSCluster_Node`,`MSCluster_Resource`,`MSCluster_ResourceGroup`,`MSCluster_DiskPartition`,`MSFT_VirtualDisk`
Enabled by default? | No Enabled by default? | No
## Flags ## Flags
### `--collectors.mscluster.enabled` ### `--collectors.mscluster.enabled`
Comma-separated list of collectors to use, for example: Comma-separated list of collectors to use, for example:
`--collectors.mscluster.enabled=cluster,network,node,resource,resouregroup`. `--collectors.mscluster.enabled=cluster,network,node,resource,resouregroup,shared_volumes,virtualdisk`.
Matching is case-sensitive. Matching is case-sensitive.
## Metrics ## Metrics
@@ -109,7 +109,7 @@ Matching is case-sensitive.
| `mscluster_network_Role` | Provides access to the network's Role property. The Role property describes the role of the network in the cluster. 0: None; 1: Cluster; 2: Client; 3: Both | gauge | `name` | | `mscluster_network_Role` | Provides access to the network's Role property. The Role property describes the role of the network in the cluster. 0: None; 1: Cluster; 2: Client; 3: Both | gauge | `name` |
| `mscluster_network_State` | Provides the current state of the network. 1-1: Unknown; 0: Unavailable; 1: Down; 2: Partitioned; 3: Up | gauge | `name` | | `mscluster_network_State` | Provides the current state of the network. 1-1: Unknown; 0: Unavailable; 1: Down; 2: Partitioned; 3: Up | gauge | `name` |
### Network ### Node
| Name | Description | Type | Labels | | Name | Description | Type | Labels |
|----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------|--------| |----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------|--------|
@@ -170,17 +170,68 @@ Matching is case-sensitive.
| `mscluster_resourcegroup_State` | The current state of the resource group. -1: Unknown; 0: Online; 1: Offline; 2: Failed; 3: Partial Online; 4: Pending | gauge | `name` | | `mscluster_resourcegroup_State` | The current state of the resource group. -1: Unknown; 0: Online; 1: Offline; 2: Failed; 3: Partial Online; 4: Pending | gauge | `name` |
| `mscluster_resourcegroup_UpdateDomain` | | gauge | `name` | | `mscluster_resourcegroup_UpdateDomain` | | gauge | `name` |
### Shared Volumes
| Name | Description | Type | Labels |
|------------------------------------------|----------------------------------------------------------------|-------|-----------------------------|
| `mscluster_shared_volumes_info` | Cluster Shared Volumes information (value is always 1) | gauge | `name`,`path`,`volume_guid` |
| `mscluster_shared_volumes_total_bytes` | Total size of the Cluster Shared Volume in bytes | gauge | `name`,`volume_guid` |
| `mscluster_shared_volumes_free_bytes` | Free space on the Cluster Shared Volume in bytes | gauge | `name`,`volume_guid` |
### Virtual Disk
| Name | Description | Type | Labels |
|-----------------------------------------------------------|------------------------------------------------------------------------------------------------|-------|--------|
| `mscluster_virtualdisk_info` | Virtual disk information (value is always 1) | gauge | `name`, `unique_id` |
| `mscluster_virtualdisk_health_status` | Health status of the virtual disk. 0: Healthy, 1: Warning, 2: Unhealthy, 5: Unknown | gauge | `name`, `unique_id` |
| `mscluster_virtualdisk_size_bytes` | Total size of the virtual disk in bytes | gauge | `name`, `unique_id` |
| `mscluster_virtualdisk_footprint_on_pool_bytes` | Physical storage consumed by the virtual disk on the storage pool in bytes | gauge | `name`, `unique_id` |
| `mscluster_virtualdisk_storage_efficiency_percent` | Storage efficiency percentage (Size / FootprintOnPool * 100) | gauge | `name`, `unique_id` |
### Example metric ### Example metric
Query the state of all cluster resource owned by node1 Query the state of all cluster resource owned by node1
``` ```
windows_mscluster_resource_owner_node{node_name="node1"} windows_mscluster_resource_owner_node{node_name="node1"}
``` ```
Query virtual disk storage efficiency for thin provisioned disks
```
windows_mscluster_virtualdisk_storage_efficiency_percent
```
## Useful queries ## Useful queries
Counts the number of Network Name cluster resource Counts the number of Network Name cluster resource
``` ```
count(windows_mscluster_resource_state{type="Network Name"}) count(windows_mscluster_resource_state{type="Network Name"})
``` ```
Find virtual disks with low storage efficiency (over-provisioned)
```
windows_mscluster_virtualdisk_storage_efficiency_percent < 50
```
Calculate total virtual disk capacity vs physical usage
```
sum(windows_mscluster_virtualdisk_size_bytes) / sum(windows_mscluster_virtualdisk_footprint_on_pool_bytes) * 100
```
## Alerting examples ## Alerting examples
_This collector does not yet have alerting examples, we would appreciate your help adding them!_
#### Low free space on cluster shared volume
```yaml
# Alerts if volume has less then 20% free space
- alert: LowCSVFreeSpace
expr: |
(
max by (name, cluster) (windows_mscluster_shared_volumes_free_bytes{name!="ClusterPerformanceHistory"})
/
max by (name, cluster) (windows_mscluster_shared_volumes_total_bytes{name!="ClusterPerformanceHistory"})
) * 100 < 20
for: 10m
labels:
severity: warning
annotations:
summary: "Low CSV free space on {{ $labels.name }}"
description: |
Cluster Shared Volume {{ $labels.name }} on cluster {{ $labels.cluster }} has less than 20% free space (current: {{ printf "%.2f" $value }}%)
```

View File

@@ -5,7 +5,7 @@ The msmq collector exposes metrics about the queues on a MSMQ server
| | | | | |
|---------------------|----------------------| |---------------------|----------------------|
| Metric name prefix | `msmq` | | Metric name prefix | `msmq` |
| Spource | Performance Counters | | Source | Performance Counters |
| Enabled by default? | No | | Enabled by default? | No |
## Flags ## Flags

View File

@@ -10,13 +10,10 @@ Enabled by default? | No
## Flags ## Flags
### `--collectors.mssql.classes-enabled` ### `--collectors.mssql.enabled`
Comma-separated list of MSSQL WMI classes to use. Supported values are `accessmethods`, `availreplica`, `bufman`, `databases`, `dbreplica`, `genstats`, `locks`, `memmgr`, `sqlstats`, `sqlerrors`, `transactions`, and `waitstats`. Comma-separated list of MSSQL WMI classes to use. Supported values are `accessmethods`, `availreplica`, `bufman`, `databases`, `dbreplica`, `genstats`, `locks`, `memmgr`, `sqlstats`, `sqlerrors`, `transactions`, and `waitstats`.
### `--collectors.mssql.class-print`
If true, print available mssql WMI classes and exit. Only displays if the mssql collector is enabled.fman`, `databases`, `dbreplica`, `genstats`, `locks`, `memmgr`, `sqlstats`, `sqlerrors`, `transactions`, and `waitstats`.
## Metrics ## Metrics

View File

@@ -19,23 +19,31 @@ If given, an interface name needs to match the include regexp in order for the c
If given, an interface name needs to *not* match the exclude regexp in order for the corresponding metrics to be reported If given, an interface name needs to *not* match the exclude regexp in order for the corresponding metrics to be reported
### `--collector.net.enabled`
Comma-separated list of collectors to use. Defaults to all, if not specified. Supported values are: `metrics`, `nic_addresses`.
## Metrics ## Metrics
Name | Description | Type | Labels | Name | Description | Type | Labels |
-----|-------------|------|------- |------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------|---------|--------------------------------|
`windows_net_bytes_received_total` | Total bytes received by interface | counter | `nic` | `windows_net_bytes_received_total` | Total bytes received by interface | counter | `nic` |
`windows_net_bytes_sent_total` | Total bytes transmitted by interface | counter | `nic` | `windows_net_bytes_sent_total` | Total bytes transmitted by interface | counter | `nic` |
`windows_net_bytes_total` | Total bytes received and transmitted by interface | counter | `nic` | `windows_net_bytes_total` | Total bytes received and transmitted by interface | counter | `nic` |
`windows_net_output_queue_length_packets` | Length of the output packet queue (in packets). If this is longer than 2, delays occur. | gauge | `nic` | `windows_net_output_queue_length_packets` | Length of the output packet queue (in packets). If this is longer than 2, delays occur. | gauge | `nic` |
`windows_net_packets_outbound_discarded_total` | Total outbound packets that were chosen to be discarded even though no errors had been detected to prevent transmission | counter | `nic` | `windows_net_packets_outbound_discarded_total` | Total outbound packets that were chosen to be discarded even though no errors had been detected to prevent transmission | counter | `nic` |
`windows_net_packets_outbound_errors_total` | Total packets that could not be transmitted due to errors | counter | `nic` | `windows_net_packets_outbound_errors_total` | Total packets that could not be transmitted due to errors | counter | `nic` |
`windows_net_packets_received_discarded_total` | Total inbound packets that were chosen to be discarded even though no errors had been detected to prevent delivery | counter | `nic` | `windows_net_packets_received_discarded_total` | Total inbound packets that were chosen to be discarded even though no errors had been detected to prevent delivery | counter | `nic` |
`windows_net_packets_received_errors_total` | Total packets that could not be received due to errors | counter | `nic` | `windows_net_packets_received_errors_total` | Total packets that could not be received due to errors | counter | `nic` |
`windows_net_packets_received_total` | Total packets received by interface | counter | `nic` | `windows_net_packets_received_total` | Total packets received by interface | counter | `nic` |
`windows_net_packets_received_unknown_total` | Total packets received by interface that were discarded because of an unknown or unsupported protocol | counter | `nic` | `windows_net_packets_received_unknown_total` | Total packets received by interface that were discarded because of an unknown or unsupported protocol | counter | `nic` |
`windows_net_packets_total` | Total packets received and transmitted by interface | counter | `nic` | `windows_net_packets_total` | Total packets received and transmitted by interface | counter | `nic` |
`windows_net_packets_sent_total` | Total packets transmitted by interface | counter | `nic` | `windows_net_packets_sent_total` | Total packets transmitted by interface | counter | `nic` |
`windows_net_current_bandwidth_bytes` | Estimate of the interface's current bandwidth in bytes per second | gauge | `nic` | `windows_net_current_bandwidth_bytes` | Estimate of the interface's current bandwidth in bytes per second | gauge | `nic` |
| `windows_net_nic_address_info` | A metric with a constant '1' value labeled with the network interface's address information. | gauge | `nic`, `address`, `family` |
| `windows_net_nic_info` | A metric with a constant '1' value labeled with the network interface's general information. | gauge | `nic`, `friendly_name`, `mac` |
| `windows_net_nic_operation_status` | The operational status for the interface as defined in RFC 2863 as IfOperStatus. | gauge | `nic`, `status` |
| `windows_net_route_info` | A metric with a constant '1' value labeled with the network interface's route information. | gauge | `nic`, `src`, `dest`, `metric` |
### Example metric ### Example metric
Query the rate of transmitted network traffic Query the rate of transmitted network traffic

View File

@@ -10,7 +10,9 @@ The netframework collector exposes metrics about dotnet framework.
## Flags ## Flags
None ### `--collector.netframework.enabled`
Comma-separated list of collectors to use. Defaults to all, if not specified.
## Metrics ## Metrics
@@ -70,18 +72,18 @@ None
| Name | Description | Type | Labels | | Name | Description | Type | Labels |
|----------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|-----------| |----------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|-----------|
| `windows_netframework_clrmemory_allocated_bytes_total` | Displays the total number of bytes allocated on the garbage collection heap. | counter | `process` | | `windows_netframework_clrmemory_allocated_bytes_total` | Displays the total number of bytes allocated on the garbage collection heap. | counter | `process`, `process_id` |
| `windows_netframework_clrmemory_finalization_survivors` | Displays the number of garbage-collected objects that survive a collection because they are waiting to be finalized. | gauge | `process` | | `windows_netframework_clrmemory_finalization_survivors` | Displays the number of garbage-collected objects that survive a collection because they are waiting to be finalized. | gauge | `process`, `process_id` |
| `windows_netframework_clrmemory_heap_size_bytes` | Displays the maximum bytes that can be allocated; it does not indicate the current number of bytes allocated. | gauge | `process` | | `windows_netframework_clrmemory_heap_size_bytes` | Displays the maximum bytes that can be allocated; it does not indicate the current number of bytes allocated. | gauge | `process`, `process_id` |
| `windows_netframework_clrmemory_promoted_bytes` | Displays the bytes that were promoted from the generation to the next one during the last GC. Memory is promoted when it survives a garbage collection. | gauge | `process` | | `windows_netframework_clrmemory_promoted_bytes` | Displays the bytes that were promoted from the generation to the next one during the last GC. Memory is promoted when it survives a garbage collection. | gauge | `process`, `process_id` |
| `windows_netframework_clrmemory_number_gc_handles` | Displays the current number of garbage collection handles in use. Garbage collection handles are handles to resources external to the common language runtime and the managed environment. | gauge | `process` | | `windows_netframework_clrmemory_number_gc_handles` | Displays the current number of garbage collection handles in use. Garbage collection handles are handles to resources external to the common language runtime and the managed environment. | gauge | `process`, `process_id` |
| `windows_netframework_clrmemory_collections_total` | Displays the number of times the generation objects are garbage collected since the application started. | counter | `process` | | `windows_netframework_clrmemory_collections_total` | Displays the number of times the generation objects are garbage collected since the application started. | counter | `process`, `process_id` |
| `windows_netframework_clrmemory_induced_gc_total` | Displays the peak number of times garbage collection was performed because of an explicit call to GC.Collect. | counter | `process` | | `windows_netframework_clrmemory_induced_gc_total` | Displays the peak number of times garbage collection was performed because of an explicit call to GC.Collect. | counter | `process`, `process_id` |
| `windows_netframework_clrmemory_number_pinned_objects` | Displays the number of pinned objects encountered in the last garbage collection. | gauge | `process` | | `windows_netframework_clrmemory_number_pinned_objects` | Displays the number of pinned objects encountered in the last garbage collection. | gauge | `process`, `process_id` |
| `windows_netframework_clrmemory_number_sink_blocksinuse` | Displays the current number of synchronization blocks in use. Synchronization blocks are per-object data structures allocated for storing synchronization information. They hold weak references to managed objects and must be scanned by the garbage collector. | gauge | `process` | | `windows_netframework_clrmemory_number_sink_blocksinuse` | Displays the current number of synchronization blocks in use. Synchronization blocks are per-object data structures allocated for storing synchronization information. They hold weak references to managed objects and must be scanned by the garbage collector. | gauge | `process`, `process_id` |
| `windows_netframework_clrmemory_committed_bytes` | Displays the amount of virtual memory, in bytes, currently committed by the garbage collector. Committed memory is the physical memory for which space has been reserved in the disk paging file. | gauge | `process` | | `windows_netframework_clrmemory_committed_bytes` | Displays the amount of virtual memory, in bytes, currently committed by the garbage collector. Committed memory is the physical memory for which space has been reserved in the disk paging file. | gauge | `process`, `process_id` |
| `windows_netframework_clrmemory_reserved_bytes` | Displays the amount of virtual memory, in bytes, currently reserved by the garbage collector. Reserved memory is the virtual memory space reserved for the application when no disk or main memory pages have been used. | gauge | `process` | | `windows_netframework_clrmemory_reserved_bytes` | Displays the amount of virtual memory, in bytes, currently reserved by the garbage collector. Reserved memory is the virtual memory space reserved for the application when no disk or main memory pages have been used. | gauge | `process`, `process_id` |
| `windows_netframework_clrmemory_gc_time_percent` | Displays the percentage of time that was spent performing a garbage collection in the last sample. | gauge | `process` | | `windows_netframework_clrmemory_gc_time_percent` | Displays the percentage of time that was spent performing a garbage collection in the last sample. | gauge | `process`, `process_id` |
### CLR Remoting ### CLR Remoting

View File

@@ -14,10 +14,11 @@ None
## Metrics ## Metrics
| Name | Description | Type | Labels | | Name | Description | Type | Labels |
|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|-------|------------------------------------------------------------------------| |----------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|-------|-----------------------------------------------------------------------------------------------------------------|
| `windows_os_hostname` | Labelled system hostname information as provided by ComputerSystem.DNSHostName and ComputerSystem.Domain | gauge | `domain`, `fqdn`, `hostname` | | `windows_os_hostname` | Labelled system hostname information as provided by ComputerSystem.DNSHostName and ComputerSystem.Domain | gauge | `domain`, `fqdn`, `hostname` |
| `windows_os_info` | Contains full product name & version in labels. Note that the `major_version` for Windows 11 is "10"; a build number greater than 22000 represents Windows 11. | gauge | `product`, `version`, `major_version`, `minor_version`, `build_number` | | `windows_os_info` | Contains full product name & version in labels. Note that the `major_version` for Windows 11 is "10"; a build number greater than 22000 represents Windows 11. | gauge | `product`, `version`, `major_version`, `minor_version`, `build_number`, `revision`, `installation_type` |
| `windows_os_install_time_timestamp_seconds` | Unix timestamp of OS installation time | gauge | None |
### Example metric ### Example metric
@@ -27,11 +28,29 @@ None
windows_os_hostname{domain="",fqdn="PC",hostname="PC"} 1 windows_os_hostname{domain="",fqdn="PC",hostname="PC"} 1
# HELP windows_os_info Contains full product name & version in labels. Note that the "major_version" for Windows 11 is \\"10\\"; a build number greater than 22000 represents Windows 11. # HELP windows_os_info Contains full product name & version in labels. Note that the "major_version" for Windows 11 is \\"10\\"; a build number greater than 22000 represents Windows 11.
# TYPE windows_os_info gauge # TYPE windows_os_info gauge
windows_os_info{build_number="19045",major_version="10",minor_version="0",product="Windows 10 Pro",revision="4842",version="10.0.19045"} 1 windows_os_info{build_number="19045",installation_type="Client",major_version="10",minor_version="0",product="Windows 10 Pro",revision="4842",version="10.0.19045"} 1
# HELP windows_os_install_time_timestamp_seconds Unix timestamp of OS installation time
# TYPE windows_os_install_time_timestamp_seconds gauge
windows_os_install_time_timestamp_seconds 1.6725312e+09
``` ```
## Useful queries ## Useful queries
_This collector does not yet have useful queries, we would appreciate your help adding them!_ _This collector does not yet have useful queries, we would appreciate your help adding them!_
## Alerting examples ## Alerting examples
_This collector does not yet have alerting examples, we would appreciate your help adding them!_
#### Average CPU utilization over 1 hour exceeds 80% (New CPU metric)
```yaml
# Alerts if Agent/Host is down for 5min
- alert: HypervHostDown
expr: up{app="hyper-v"} == 0
for: 5m
labels:
severity: critical
annotations:
summary: Hyper-V host {{ $labels.instance }} is down
description: |
Hyper-V host {{ $labels.instance }} has been unreachable for more than 5 minutes.
Job: {{ $labels.job }}
```

View File

@@ -260,3 +260,27 @@ collector:
The perfdata collector returns metrics based on the user configuration. The perfdata collector returns metrics based on the user configuration.
The metrics are named based on the object name and the counter name. The metrics are named based on the object name and the counter name.
The instance name is added as a label to the metric. The instance name is added as a label to the metric.
# Examples
## thermalzone collector
```yaml
collector:
performancecounter:
objects: |-
- name: thermalzone
object: "Thermal Zone Information"
instances: ["*"]
type: formatted
counters:
- name: "Temperature"
type: "gauge"
metric: windows_thermalzone_percent_passive_limit
- name: "% Passive Limit"
type: "gauge"
metric: windows_thermalzone_temperature_celsius
- name: "Throttle Reasons"
type: "gauge"
metric: windows_thermalzone_throttle_reasons
```

View File

@@ -21,19 +21,21 @@ If given, a disk needs to *not* match the exclude regexp in order for the corres
## Metrics ## Metrics
Name | Description | Type | Labels | Name | Description | Type | Labels |
-----|-------------|------|------- |--------------------------------------------------------|---------------------------------------------------------------------------------------------------------|---------|--------|
`requests_queued` | Number of requests outstanding on the disk at the time the performance data is collected | gauge | `disk` | windows_physical_disk_requests_queued | The number of requests queued to the disk (PhysicalDisk.CurrentDiskQueueLength) | Gauge | disk |
`read_bytes_total` | Rate at which bytes are transferred from the disk during read operations | counter | `disk` | windows_physical_disk_read_bytes_total | The number of bytes transferred from the disk during read operations (PhysicalDisk.DiskReadBytesPerSec) | Counter | disk |
`reads_total` | Rate of read operations on the disk | counter | `disk` | windows_physical_disk_reads_total | The number of read operations on the disk (PhysicalDisk.DiskReadsPerSec) | Counter | disk |
`write_bytes_total` | Rate at which bytes are transferred to the disk during write operations | counter | `disk` | windows_physical_disk_write_bytes_total | The number of bytes transferred to the disk during write operations (PhysicalDisk.DiskWriteBytesPerSec) | Counter | disk |
`writes_total` | Rate of write operations on the disk | counter | `disk` | windows_physical_disk_writes_total | The number of write operations on the disk (PhysicalDisk.DiskWritesPerSec) | Counter | disk |
`read_seconds_total` | Seconds the disk was busy servicing read requests | counter | `disk` | windows_physical_disk_read_seconds_total | Seconds that the disk was busy servicing read requests (PhysicalDisk.PercentDiskReadTime) | Counter | disk |
`write_seconds_total` | Seconds the disk was busy servicing write requests | counter | `disk` | windows_physical_disk_write_seconds_total | Seconds that the disk was busy servicing write requests (PhysicalDisk.PercentDiskWriteTime) | Counter | disk |
`free_bytes` | Unused space of the disk in bytes (not real time, updates every 10-15 min) | gauge | `disk` | windows_physical_disk_idle_seconds_total | Seconds that the disk was idle (PhysicalDisk.PercentIdleTime) | Counter | disk |
`size_bytes` | Total size of the disk in bytes (not real time, updates every 10-15 min) | gauge | `disk` | windows_physical_disk_split_ios_total | The number of I/Os to the disk that were split into multiple I/Os (PhysicalDisk.SplitIOPerSec) | Counter | disk |
`idle_seconds_total` | Seconds the disk was idle (not servicing read/write requests) | counter | `disk` | windows_physical_disk_read_latency_seconds_total | The average time, in seconds, of a read operation from the disk (PhysicalDisk.AvgDiskSecPerRead) | Counter | disk |
`split_ios_total` | Number of I/Os to the disk split into multiple I/Os | counter | `disk` | windows_physical_disk_write_latency_seconds_total | The average time, in seconds, of a write operation to the disk (PhysicalDisk.AvgDiskSecPerWrite) | Counter | disk |
| windows_physical_disk_read_write_latency_seconds_total | The time, in seconds, of the average disk transfer (PhysicalDisk.AvgDiskSecPerTransfer) | Counter | disk |
### Warning about size metrics ### Warning about size metrics
The `free_bytes` and `size_bytes` metrics are not updated in real time and might have a delay of 10-15min. The `free_bytes` and `size_bytes` metrics are not updated in real time and might have a delay of 10-15min.
@@ -52,29 +54,4 @@ rate(windows_physical_disk_reads_total{instance="localhost", disk=~"0"}[2m]) + r
``` ```
## Alerting examples ## Alerting examples
**prometheus.rules** _This collector does not yet have alerting examples, we would appreciate your help adding them!_
```yaml
groups:
- name: Windows Disk Alerts
rules:
# Sends an alert when disk space usage is above 95%
- alert: DiskSpaceUsage
expr: 100.0 - 100 * (windows_physical_disk_free_bytes / windows_physical_disk_size_bytes) > 95
for: 10m
labels:
severity: high
annotations:
summary: "Disk Space Usage (instance {{ $labels.instance }})"
description: "Disk Space on Drive is used more than 95%\n VALUE = {{ $value }}\n LABELS: {{ $labels }}"
# Alerts on disks with over 85% space usage predicted to fill within the next four days
- alert: DiskFilling
expr: 100 * (windows_physical_disk_free_bytes / windows_physical_disk_size_bytes) < 15 and predict_linear(windows_physical_disk_free_bytes[6h], 4 * 24 * 3600) < 0
for: 10m
labels:
severity: warning
annotations:
summary: "Disk full in four days (instance {{ $labels.instance }})"
description: "{{ $labels.disk }} is expected to fill up within four days. Currently {{ $value | humanize }}% is available.\n VALUE = {{ $value }}\n LABELS: {{ $labels }}"
```

View File

@@ -37,6 +37,16 @@ Enables IIS process name queries. IIS process names are combined with their app
Disabled by default, and can be enabled with `--collector.process.iis`. NOTE: Just plain parameter without `true`. Disabled by default, and can be enabled with `--collector.process.iis`. NOTE: Just plain parameter without `true`.
### `--collector.process.counter-version`
Version of the process collector to use. 1 for Process V1, 2 for Process V2.
Defaults to 0 which will use the latest version available.
### `--collector.process.cmdline`
Enables the `cmdline` label for the process metrics.
This label contains the command line used to start the process.
Enabled by default, and can be turned off with `--no-collector.process.cmdline`.
### Example ### Example
To match all firefox processes: `--collector.process.include="firefox.*"`. To match all firefox processes: `--collector.process.include="firefox.*"`.
@@ -69,30 +79,35 @@ w3wp_Test
## Metrics ## Metrics
| Name | Description | Type | Labels | | Name | Description | Type | Labels |
|---------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|---------------------------------------------------------------------------------------| |------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|---------------------------------------------------------------------------------------|
| `windows_process_info` | A metric with a constant '1' value labeled with process information | gauge | `process`, `process_id`, `creating_process_id`, `process_group_id`,`owner`, `cmdline` | | `windows_process_info` | A metric with a constant '1' value labeled with process information | gauge | `process`, `process_id`, `creating_process_id`, `process_group_id`,`owner`, `cmdline` |
| `windows_process_start_time` | Time of process start | gauge | `process`, `process_id` | | `windows_process_start_time_seconds_timestamp` | Epoch time (seconds since 1970/1/1) of process start. | gauge | `process`, `process_id` |
| `windows_process_cpu_time_total` | Returns elapsed time that all of the threads of this process used the processor to execute instructions by mode (privileged, user). An instruction is the basic unit of execution in a computer, a thread is the object that executes instructions, and a process is the object created when a program is run. Code executed to handle some hardware interrupts and trap conditions is included in this count. | counter | `process`, `process_id`, `mode` | | `windows_process_cpu_time_total` | Returns elapsed time that all of the threads of this process used the processor to execute instructions by mode (privileged, user). An instruction is the basic unit of execution in a computer, a thread is the object that executes instructions, and a process is the object created when a program is run. Code executed to handle some hardware interrupts and trap conditions is included in this count. | counter | `process`, `process_id`, `mode` |
| `windows_process_handles` | Total number of handles the process has open. This number is the sum of the handles currently open by each thread in the process. | gauge | `process`, `process_id` | | `windows_process_handles` | Total number of handles the process has open. This number is the sum of the handles currently open by each thread in the process. | gauge | `process`, `process_id` |
| `windows_process_io_bytes_total` | Bytes issued to I/O operations in different modes (read, write, other). This property counts all I/O activity generated by the process to include file, network, and device I/Os. Read and write mode includes data operations; other mode includes those that do not involve data, such as control operations. | counter | `process`, `process_id`, `mode` | | `windows_process_io_bytes_total` | Bytes issued to I/O operations in different modes (read, write, other). This property counts all I/O activity generated by the process to include file, network, and device I/Os. Read and write mode includes data operations; other mode includes those that do not involve data, such as control operations. | counter | `process`, `process_id`, `mode` |
| `windows_process_io_operations_total` | I/O operations issued in different modes (read, write, other). This property counts all I/O activity generated by the process to include file, network, and device I/Os. Read and write mode includes data operations; other mode includes those that do not involve data, such as control operations. | counter | `process`, `process_id`, `mode` | | `windows_process_io_operations_total` | I/O operations issued in different modes (read, write, other). This property counts all I/O activity generated by the process to include file, network, and device I/Os. Read and write mode includes data operations; other mode includes those that do not involve data, such as control operations. | counter | `process`, `process_id`, `mode` |
| `windows_process_page_faults_total` | Page faults by the threads executing in this process. A page fault occurs when a thread refers to a virtual memory page that is not in its working set in main memory. This can cause the page not to be fetched from disk if it is on the standby list and hence already in main memory, or if it is in use by another process with which the page is shared. | counter | `process`, `process_id` | | `windows_process_page_faults_total` | Page faults by the threads executing in this process. A page fault occurs when a thread refers to a virtual memory page that is not in its working set in main memory. This can cause the page not to be fetched from disk if it is on the standby list and hence already in main memory, or if it is in use by another process with which the page is shared. | counter | `process`, `process_id` |
| `windows_process_page_file_bytes` | Current number of bytes this process has used in the paging file(s). Paging files are used to store pages of memory used by the process that are not contained in other files. Paging files are shared by all processes, and lack of space in paging files can prevent other processes from allocating memory. | gauge | `process`, `process_id` | | `windows_process_page_file_bytes` | Current number of bytes this process has used in the paging file(s). Paging files are used to store pages of memory used by the process that are not contained in other files. Paging files are shared by all processes, and lack of space in paging files can prevent other processes from allocating memory. | gauge | `process`, `process_id` |
| `windows_process_pool_bytes` | Pool Bytes is the last observed number of bytes in the paged or nonpaged pool. The nonpaged pool is an area of system memory (physical memory used by the operating system) for objects that cannot be written to disk, but must remain in physical memory as long as they are allocated. The paged pool is an area of system memory (physical memory used by the operating system) for objects that can be written to disk when they are not being used. Nonpaged pool bytes is calculated differently than paged pool bytes, so it might not equal the total of paged pool bytes. | gauge | `process`, `process_id`, `pool` | | `windows_process_pool_bytes` | Pool Bytes is the last observed number of bytes in the paged or nonpaged pool. The nonpaged pool is an area of system memory (physical memory used by the operating system) for objects that cannot be written to disk, but must remain in physical memory as long as they are allocated. The paged pool is an area of system memory (physical memory used by the operating system) for objects that can be written to disk when they are not being used. Nonpaged pool bytes is calculated differently than paged pool bytes, so it might not equal the total of paged pool bytes. | gauge | `process`, `process_id`, `pool` |
| `windows_process_priority_base` | Current base priority of this process. Threads within a process can raise and lower their own base priority relative to the process base priority of the process. | gauge | `process`, `process_id` | | `windows_process_priority_base` | Current base priority of this process. Threads within a process can raise and lower their own base priority relative to the process base priority of the process. | gauge | `process`, `process_id` |
| `windows_process_private_bytes` | Current number of bytes this process has allocated that cannot be shared with other processes. | gauge | `process`, `process_id` | | `windows_process_private_bytes` | Current number of bytes this process has allocated that cannot be shared with other processes. | gauge | `process`, `process_id` |
| `windows_process_threads` | Number of threads currently active in this process. An instruction is the basic unit of execution in a processor, and a thread is the object that executes instructions. Every running process has at least one thread. | gauge | `process`, `process_id` | | `windows_process_threads` | Number of threads currently active in this process. An instruction is the basic unit of execution in a processor, and a thread is the object that executes instructions. Every running process has at least one thread. | gauge | `process`, `process_id` |
| `windows_process_virtual_bytes` | Current size, in bytes, of the virtual address space that the process is using. Use of virtual address space does not necessarily imply corresponding use of either disk or main memory pages. Virtual space is finite and, by using too much, the process can limit its ability to load libraries. | gauge | `process`, `process_id` | | `windows_process_virtual_bytes` | Current size, in bytes, of the virtual address space that the process is using. Use of virtual address space does not necessarily imply corresponding use of either disk or main memory pages. Virtual space is finite and, by using too much, the process can limit its ability to load libraries. | gauge | `process`, `process_id` |
| `windows_process_working_set_private_bytes` | Size of the working set, in bytes, that is use for this process only and not shared nor shareable by other processes. | gauge | `process`, `process_id` | | `windows_process_working_set_private_bytes` | Size of the working set, in bytes, that is use for this process only and not shared nor shareable by other processes. | gauge | `process`, `process_id` |
| `windows_process_working_set_peak_bytes` | Maximum size, in bytes, of the Working Set of this process at any point in time. The Working Set is the set of memory pages touched recently by the threads in the process. If free memory in the computer is above a threshold, pages are left in the Working Set of a process even if they are not in use. When free memory falls below a threshold, pages are trimmed from Working Sets. If they are needed they will then be soft-faulted back into the Working Set before they leave main memory. | gauge | `process`, `process_id` | | `windows_process_working_set_peak_bytes` | Maximum size, in bytes, of the Working Set of this process at any point in time. The Working Set is the set of memory pages touched recently by the threads in the process. If free memory in the computer is above a threshold, pages are left in the Working Set of a process even if they are not in use. When free memory falls below a threshold, pages are trimmed from Working Sets. If they are needed they will then be soft-faulted back into the Working Set before they leave main memory. | gauge | `process`, `process_id` |
| `windows_process_working_set_bytes` | Maximum number of bytes in the working set of this process at any point in time. The working set is the set of memory pages touched recently by the threads in the process. If free memory in the computer is above a threshold, pages are left in the working set of a process even if they are not in use. When free memory falls below a threshold, pages are trimmed from working sets. If they are needed, they are then soft-faulted back into the working set before they leave main memory. | gauge | `process`, `process_id` | | `windows_process_working_set_bytes` | Maximum number of bytes in the working set of this process at any point in time. The working set is the set of memory pages touched recently by the threads in the process. If free memory in the computer is above a threshold, pages are left in the working set of a process even if they are not in use. When free memory falls below a threshold, pages are trimmed from working sets. If they are needed, they are then soft-faulted back into the working set before they leave main memory. | gauge | `process`, `process_id` |
### Example metric ### Example metric
_This collector does not yet have explained examples, we would appreciate your help adding them!_ _This collector does not yet have explained examples, we would appreciate your help adding them!_
## Useful queries ## Useful queries
_This collector does not yet have any useful queries added, we would appreciate your help adding them!_
Add extended information like cmdline or owner to other process metrics.
```
windows_process_working_set_bytes * on(process_id) group_left(owner, cmdline) windows_process_info
```
## Alerting examples ## Alerting examples
_This collector does not yet have alerting examples, we would appreciate your help adding them!_ _This collector does not yet have alerting examples, we would appreciate your help adding them!_

View File

@@ -16,7 +16,7 @@ None
| Name | Description | Type | Labels | | Name | Description | Type | Labels |
|----------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|--------| |----------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|--------|
| `windows_system_boot_time_timestamp_seconds` | Unix timestamp of last system boot | gauge | None | | `windows_system_boot_time_timestamp` | Unix timestamp of last system boot | gauge | None |
| `windows_system_context_switches_total` | Total number of [context switches](https://en.wikipedia.org/wiki/Context_switch) | counter | None | | `windows_system_context_switches_total` | Total number of [context switches](https://en.wikipedia.org/wiki/Context_switch) | counter | None |
| `windows_system_exception_dispatches_total` | Total exceptions dispatched by the system | counter | None | | `windows_system_exception_dispatches_total` | Total exceptions dispatched by the system | counter | None |
| `windows_system_processes` | Number of process contexts currently loaded or running on the operating system | gauge | None | | `windows_system_processes` | Number of process contexts currently loaded or running on the operating system | gauge | None |
@@ -41,7 +41,7 @@ windows_system_processes{instance="localhost"}
## Useful queries ## Useful queries
Find hosts that have rebooted in the last 24 hours Find hosts that have rebooted in the last 24 hours
``` ```
time() - windows_system_boot_time_timestamp_seconds < 86400 time() - windows_system_boot_time_timestamp < 86400
``` ```
## Alerting examples ## Alerting examples

View File

@@ -10,11 +10,6 @@ Enabled by default? | No
## Flags ## Flags
### `--collector.textfile.directory`
:warning: DEPRECATED Use `--collector.textfile.directories`
<br>
### `--collector.textfile.directories` ### `--collector.textfile.directories`
One or multiple directories containing the files to be ingested. One or multiple directories containing the files to be ingested.

View File

@@ -1,32 +0,0 @@
# thermalzone collector
The thermalzone collector exposes metrics about system temps. Note that temperature is given in Kelvin
|||
-|-
Metric name prefix | `thermalzone`
Classes | [`Win32_PerfRawData_Counters_ThermalZoneInformation`](https://wutils.com/wmi/root/cimv2/win32_perfrawdata_counters_thermalzoneinformation/#temperature_properties)
Enabled by default? | No
## Flags
None
## Metrics
Name | Description | Type | Labels
-----|-------------|------|-------
`windows_thermalzone_percent_passive_limit` | % Passive Limit is the current limit this thermal zone is placing on the devices it controls. A limit of 100% indicates the devices are unconstrained. A limit of 0% indicates the devices are fully constrained. | gauge | None
`windows_thermalzone_temperature_celsius ` | Temperature of the thermal zone, in degrees Celsius. | gauge | None
`windows_thermalzone_throttle_reasons ` | Throttle Reasons indicate reasons why the thermal zone is limiting performance of the devices it controls. 0x0 - The zone is not throttled. 0x1 - The zone is throttled for thermal reasons. 0x2 - The zone is throttled to limit electrical current. | gauge | None
[`Throttle reasons` source](https://docs.microsoft.com/en-us/windows-hardware/design/device-experiences/examples--requirements-and-diagnostics)
### Example metric
_This collector does not yet have explained examples, we would appreciate your help adding them!_
## Useful queries
_This collector does not yet have any useful queries added, we would appreciate your help adding them!_
## Alerting examples
_This collector does not yet have alerting examples, we would appreciate your help adding them!_

View File

@@ -1,6 +1,6 @@
# time collector # time collector
The time collector exposes the Windows Time Service metrics. Note that the Windows Time Service must be running, else metric collection will fail. The time collector exposes the Windows Time Service and other time related metrics.
If the Windows Time Service is stopped after collection has started, collector metric values will reset to 0. If the Windows Time Service is stopped after collection has started, collector metric values will reset to 0.
Please note the Time Service perflib counters are only available on [Windows Server 2016 or newer](https://docs.microsoft.com/en-us/windows-server/networking/windows-time-service/windows-server-2016-improvements). Please note the Time Service perflib counters are only available on [Windows Server 2016 or newer](https://docs.microsoft.com/en-us/windows-server/networking/windows-time-service/windows-server-2016-improvements).
@@ -21,19 +21,32 @@ Matching is case-sensitive.
## Metrics ## Metrics
| Name | Description | Type | Labels | | Name | Description | Type | Labels |
|-----------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|------------| |----------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|------------|
| `windows_time_clock_frequency_adjustment_ppb_total` | Total adjustment made to the local system clock frequency by W32Time in parts per billion (PPB) units. 1 PPB adjustment implies the system clock was adjusted at a rate of 1 nanosecond per second (1 ns/s). The smallest possible adjustment can vary and is expected to be in the order of 100's of PPB. | counter | None | | `windows_time_clock_frequency_adjustment` | Adjustment made to the local system clock frequency by W32Time in parts per billion (PPB) units. 1 PPB adjustment implies the system clock was adjusted at a rate of 1 nanosecond per second (1 ns/s). The smallest possible adjustment can vary and is expected to be in the order of 100's of PPB. | gauge | None |
| `windows_time_computed_time_offset_seconds` | The absolute time offset between the system clock and the chosen time source, as computed by the W32Time service in microseconds. When a new valid sample is available, the computed time is updated with the time offset indicated by the sample. This time is the actual time offset of the local clock. W32Time initiates clock correction by using this offset and updates the computed time in between samples with the remaining time offset that needs to be applied to the local clock. Clock accuracy can be tracked by using this performance counter with a low polling interval (for example, 256 seconds or less) and looking for the counter value to be smaller than the desired clock accuracy limit. | gauge | None | | `windows_time_clock_frequency_adjustment_ppb` | Adjustment made to the local system clock frequency by W32Time in parts per billion (PPB) units. 1 PPB adjustment implies the system clock was adjusted at a rate of 1 nanosecond per second (1 ns/s). The smallest possible adjustment can vary and is expected to be in the order of 100's of PPB. | gauge | None |
| `windows_time_ntp_client_time_sources` | Active number of NTP Time sources being used by the client. This is a count of active, distinct IP addresses of time servers that are responding to this client's requests. | gauge | None | | `windows_time_computed_time_offset_seconds` | The absolute time offset between the system clock and the chosen time source, as computed by the W32Time service in microseconds. When a new valid sample is available, the computed time is updated with the time offset indicated by the sample. This time is the actual time offset of the local clock. W32Time initiates clock correction by using this offset and updates the computed time in between samples with the remaining time offset that needs to be applied to the local clock. Clock accuracy can be tracked by using this performance counter with a low polling interval (for example, 256 seconds or less) and looking for the counter value to be smaller than the desired clock accuracy limit. | gauge | None |
| `windows_time_ntp_round_trip_delay_seconds` | Total roundtrip delay experienced by the NTP client in receiving a response from the server for the most recent request, in seconds. This is the time elapsed on the NTP client between transmitting a request to the NTP server and receiving a valid response from the server. | gauge | None | | `windows_time_ntp_client_time_sources` | Active number of NTP Time sources being used by the client. This is a count of active, distinct IP addresses of time servers that are responding to this client's requests. | gauge | None |
| `windows_time_ntp_server_outgoing_responses_total` | Total number of requests responded to by the NTP server. | counter | None | | `windows_time_ntp_round_trip_delay_seconds` | Total roundtrip delay experienced by the NTP client in receiving a response from the server for the most recent request, in seconds. This is the time elapsed on the NTP client between transmitting a request to the NTP server and receiving a valid response from the server. | gauge | None |
| `windows_time_ntp_server_incoming_requests_total` | Total number of requests received by the NTP server. | counter | None | | `windows_time_ntp_server_outgoing_responses_total` | Total number of requests responded to by the NTP server. | counter | None |
| `windows_time_current_timestamp_seconds` | Current time as reported by the operating system, in [Unix time](https://en.wikipedia.org/wiki/Unix_time). See [time.Unix()](https://golang.org/pkg/time/#Unix) for details | gauge | None | | `windows_time_ntp_server_incoming_requests_total` | Total number of requests received by the NTP server. | counter | None |
| `windows_time_timezone` | Current timezone as reported by the operating system. | gauge | `timezone` | | `windows_time_current_timestamp_seconds` | Current time as reported by the operating system, in [Unix time](https://en.wikipedia.org/wiki/Unix_time). See [time.UnixMicro()](https://golang.org/pkg/time/#UnixMicro) for details | gauge | None |
| `windows_time_timezone` | Current timezone as reported by the operating system. | gauge | `timezone` |
| `windows_time_clock_sync_source` | This value reflects the sync source of the system clock. | gauge | `type` |
### Example metric ### Example metric
_This collector does not yet have explained examples, we would appreciate your help adding them!_ ```
# HELP windows_time_clock_sync_source This value reflects the sync source of the system clock.
# TYPE windows_time_clock_sync_source gauge
windows_time_clock_sync_source{type="AllSync"} 0
windows_time_clock_sync_source{type="Local CMOS Clock"} 0
windows_time_clock_sync_source{type="NT5DS"} 0
windows_time_clock_sync_source{type="NTP"} 1
windows_time_clock_sync_source{type="NoSync"} 0
# HELP windows_time_current_timestamp_seconds OperatingSystem.LocalDateTime
# TYPE windows_time_current_timestamp_seconds gauge
windows_time_current_timestamp_seconds 1.74862554e+09
```
## Useful queries ## Useful queries
_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ _This collector does not yet have any useful queries added, we would appreciate your help adding them!_

View File

@@ -11,38 +11,50 @@ The Windows Update service is responsible for managing the installation of updat
| Data source | Windows Update service | | Data source | Windows Update service |
| Enabled by default? | No | | Enabled by default? | No |
## Flags ## Flags
### `--collector.updates.online` ### `--collector.update.online`
Whether to search for updates online. If set to `false`, the collector will only list updates that are already found by the Windows Update service. Whether to search for updates online. If set to `false` via `--no-collector.update.online`, the collector will only list updates that are already found by the Windows Update service.
Set to `true` to search for updates online, which will take longer to complete. Set to `true` via `--collector.update.online` to search for updates online, which will take longer to complete.
### `--collector.updates.scrape-interval` ### `--collector.update.scrape-interval`
Define the interval of scraping Windows Update information Define the interval of scraping Windows Update information
## Metrics ## Metrics
| Name | Description | Type | Labels | | Name | Description | Type | Labels |
|--------------------------------|-----------------------------------------------|-------|-------------------------------| |------------------------------------------------|------------------------------------------------------------------|-------|-------------------------------|
| `windows_updates_pending_info` | Expose information single pending update item | gauge | `category`,`severity`,`title` | | `windows_update_pending_info` | Expose information for a single pending update item | gauge | `category`,`severity`,`title` |
| `windows_updates_scrape_query_duration_seconds` | Duration of the last scrape query to the Windows Update API | gauge | | | `windows_update_pending_published_timestamp` | Expose last published timestamp for a single pending update item | gauge | `title` |
| `windows_updates_scrape_timestamp_seconds` | Timestamp of the last scrape | gauge | | | `windows_update_scrape_query_duration_seconds` | Duration of the last scrape query to the Windows Update API | gauge | |
| `windows_update_scrape_timestamp_seconds` | Timestamp of the last scrape | gauge | |
### Example metrics ### Example metrics
``` ```
# HELP windows_updates_pending Pending Windows Updates # HELP windows_update_pending_info Expose information for a single pending update item
# TYPE windows_updates_pending gauge # TYPE windows_update_pending_info gauge
windows_updates_pending{category="Drivers",severity="",title="Intel Corporation - Bluetooth - 23.60.5.10"} 1 windows_update_pending_info{category="Definition Updates",id="a32ca1d0-ddd4-486b-b708-d941db4f1051",revision="204",severity="",title="Update for Windows Security platform - KB5007651 (Version 10.0.27840.1000)"} 1
# HELP windows_updates_scrape_query_duration_seconds Duration of the last scrape query to the Windows Update API windows_update_pending_info{category="Definition Updates",id="b50a64de-a0bb-465b-9842-9963b6eee21e",revision="200",severity="",title="Security Intelligence Update for Microsoft Defender Antivirus - KB2267602 (Version 1.429.146.0) - Current Channel (Broad)"} 1
# TYPE windows_updates_scrape_query_duration_seconds gauge # HELP windows_update_pending_published_timestamp Expose last published timestamp for a single pending update item
windows_updates_scrape_query_duration_seconds 2.8161838 # TYPE windows_update_pending_published_timestamp gauge
# HELP windows_updates_scrape_timestamp_seconds Timestamp of the last scrape windows_update_pending_published_timestamp{id="a32ca1d0-ddd4-486b-b708-d941db4f1051",revision="204"} 1.747872e+09
# TYPE windows_updates_scrape_timestamp_seconds gauge windows_update_pending_published_timestamp{id="b50a64de-a0bb-465b-9842-9963b6eee21e",revision="200"} 1.7479584e+09
windows_updates_scrape_timestamp_seconds 1.727539734e+09 # HELP windows_update_scrape_query_duration_seconds Duration of the last scrape query to the Windows Update API
# TYPE windows_update_scrape_query_duration_seconds gauge
windows_update_scrape_query_duration_seconds 2.8161838
# HELP windows_update_scrape_timestamp_seconds Timestamp of the last scrape
# TYPE windows_update_scrape_timestamp_seconds gauge
windows_update_scrape_timestamp_seconds 1.727539734e+09
``` ```
## Useful queries ## Useful queries
_This collector does not yet have any useful queries added, we would appreciate your help adding them!_
Add extended information like cmdline or owner to other process metrics.
```
windows_update_pending_published_timestamp * on(id, revision) group_left(severity, title) windows_update_pending_info
```
## Alerting examples ## Alerting examples
_This collector does not yet have alerting examples, we would appreciate your help adding them!_ _This collector does not yet have alerting examples, we would appreciate your help adding them!_

View File

@@ -1,7 +1,7 @@
--- ---
# Note this is not an exhaustive list of all configuration values # Note this is not an exhaustive list of all configuration values
collectors: collectors:
enabled: cpu,cs,logical_disk,net,os,service,system enabled: cpu,logical_disk,net,os,service,system
collector: collector:
service: service:
include: "windows_exporter" include: "windows_exporter"
@@ -13,6 +13,5 @@ scrape:
timeout-margin: 0.5 timeout-margin: 0.5
telemetry: telemetry:
path: /metrics path: /metrics
max-requests: 5
web: web:
listen-address: ":9182" listen-address: ":9182"

57
go.mod
View File

@@ -1,55 +1,44 @@
module github.com/prometheus-community/windows_exporter module github.com/prometheus-community/windows_exporter
go 1.23 go 1.25
require ( require (
github.com/Microsoft/hcsshim v0.12.9
github.com/alecthomas/kingpin/v2 v2.4.0 github.com/alecthomas/kingpin/v2 v2.4.0
github.com/bmatcuk/doublestar/v4 v4.7.1 github.com/bmatcuk/doublestar/v4 v4.10.0
github.com/dimchansky/utfbom v1.1.1 github.com/dimchansky/utfbom v1.1.1
github.com/go-ole/go-ole v1.3.0 github.com/go-ole/go-ole v1.3.0
github.com/google/uuid v1.6.0 github.com/prometheus/client_golang v1.23.2
github.com/prometheus/client_golang v1.20.5 github.com/prometheus/client_model v0.6.2
github.com/prometheus/client_model v0.6.1 github.com/prometheus/common v0.67.5
github.com/prometheus/common v0.61.0 github.com/prometheus/exporter-toolkit v0.15.1
github.com/prometheus/exporter-toolkit v0.13.2 github.com/stretchr/testify v1.11.1
github.com/stretchr/testify v1.10.0 go.yaml.in/yaml/v3 v3.0.4
golang.org/x/sys v0.29.0 golang.org/x/sys v0.40.0
gopkg.in/yaml.v3 v3.0.1
) )
require ( require (
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b // indirect github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b // indirect
github.com/beorn7/perks v1.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/containerd/cgroups/v3 v3.0.4 // indirect github.com/coreos/go-systemd/v22 v22.7.0 // indirect
github.com/containerd/errdefs v1.0.0 // indirect
github.com/containerd/errdefs/pkg v0.3.0 // indirect
github.com/containerd/typeurl/v2 v2.2.3 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v5 v5.3.1 // indirect
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect github.com/google/uuid v1.6.0 // indirect
github.com/jpillora/backoff v1.0.0 // indirect github.com/jpillora/backoff v1.0.0 // indirect
github.com/klauspost/compress v1.17.11 // indirect
github.com/mdlayher/socket v0.5.1 // indirect github.com/mdlayher/socket v0.5.1 // indirect
github.com/mdlayher/vsock v1.2.1 // indirect github.com/mdlayher/vsock v1.2.1 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/procfs v0.19.2 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/xhit/go-str2duration/v2 v2.1.0 // indirect github.com/xhit/go-str2duration/v2 v2.1.0 // indirect
go.opencensus.io v0.24.0 // indirect go.yaml.in/yaml/v2 v2.4.3 // indirect
golang.org/x/crypto v0.31.0 // indirect golang.org/x/crypto v0.47.0 // indirect
golang.org/x/net v0.32.0 // indirect golang.org/x/net v0.49.0 // indirect
golang.org/x/oauth2 v0.24.0 // indirect golang.org/x/oauth2 v0.34.0 // indirect
golang.org/x/sync v0.10.0 // indirect golang.org/x/sync v0.19.0 // indirect
golang.org/x/text v0.21.0 // indirect golang.org/x/text v0.33.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241118233622-e639e219e697 // indirect golang.org/x/time v0.14.0 // indirect
google.golang.org/grpc v1.68.0 // indirect google.golang.org/protobuf v1.36.11 // indirect
google.golang.org/protobuf v1.35.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
) )

211
go.sum
View File

@@ -1,79 +1,32 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
github.com/Microsoft/hcsshim v0.12.9 h1:2zJy5KA+l0loz1HzEGqyNnjd3fyZA31ZBCGKacp6lLg=
github.com/Microsoft/hcsshim v0.12.9/go.mod h1:fJ0gkFAna6ukt0bLdKB8djt4XIJhF/vEPuoIWYVvZ8Y=
github.com/alecthomas/kingpin/v2 v2.4.0 h1:f48lwail6p8zpO1bC4TxtqACaGqHYA22qkHjHpqDjYY= github.com/alecthomas/kingpin/v2 v2.4.0 h1:f48lwail6p8zpO1bC4TxtqACaGqHYA22qkHjHpqDjYY=
github.com/alecthomas/kingpin/v2 v2.4.0/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE= github.com/alecthomas/kingpin/v2 v2.4.0/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE=
github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b h1:mimo19zliBX/vSQ6PWWSL9lK8qwHozUj03+zLoEB8O0= github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b h1:mimo19zliBX/vSQ6PWWSL9lK8qwHozUj03+zLoEB8O0=
github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b/go.mod h1:fvzegU4vN3H1qMT+8wDmzjAcDONcgo2/SZ/TyfdUOFs= github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b/go.mod h1:fvzegU4vN3H1qMT+8wDmzjAcDONcgo2/SZ/TyfdUOFs=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bmatcuk/doublestar/v4 v4.7.1 h1:fdDeAqgT47acgwd9bd9HxJRDmc9UAmPpc+2m0CXv75Q= github.com/bmatcuk/doublestar/v4 v4.10.0 h1:zU9WiOla1YA122oLM6i4EXvGW62DvKZVxIe6TYWexEs=
github.com/bmatcuk/doublestar/v4 v4.7.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/bmatcuk/doublestar/v4 v4.10.0/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/coreos/go-systemd/v22 v22.7.0 h1:LAEzFkke61DFROc7zNLX/WA2i5J8gYqe0rSj9KI28KA=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/coreos/go-systemd/v22 v22.7.0/go.mod h1:xNUYtjHu2EDXbsxz1i41wouACIwT7Ybq9o0BQhMwD0w=
github.com/containerd/cgroups/v3 v3.0.4 h1:2fs7l3P0Qxb1nKWuJNFiwhp2CqiKzho71DQkDrHJIo4=
github.com/containerd/cgroups/v3 v3.0.4/go.mod h1:SA5DLYnXO8pTGYiAHXz94qvLQTKfVM5GEVisn4jpins=
github.com/containerd/errdefs v1.0.0 h1:tg5yIfIlQIrxYtu9ajqY42W3lpS19XqdxRQeEwYG8PI=
github.com/containerd/errdefs v1.0.0/go.mod h1:+YBYIdtsnF4Iw6nWZhJcqGSg/dwvV7tyJ/kCkyJ2k+M=
github.com/containerd/errdefs/pkg v0.3.0 h1:9IKJ06FvyNlexW690DXuQNx2KA2cUJXx151Xdx3ZPPE=
github.com/containerd/errdefs/pkg v0.3.0/go.mod h1:NJw6s9HwNuRhnjJhM7pylWwMyAkmCQvQ4GpJHEqRLVk=
github.com/containerd/typeurl/v2 v2.2.3 h1:yNA/94zxWdvYACdYO8zofhrTVuQY73fFU1y++dYSw40=
github.com/containerd/typeurl/v2 v2.2.3/go.mod h1:95ljDnPfD3bAbDJRugOiShd/DlAAsxGtUBhJxIn7SCk=
github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs=
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U= github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U=
github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE= github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 h1:f+oWsMOmNPc8JmEHVZIycC7hBoQxHH9pNKQORJNozsQ=
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8/go.mod h1:wcDNUvekVysuuOpQKo3191zZyTpiI6se1N1ULghS0sw=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA= github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA=
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
@@ -88,131 +41,59 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU=
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o=
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg=
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk=
github.com/prometheus/common v0.61.0 h1:3gv/GThfX0cV2lpO7gkTUwZru38mxevy90Bj8YFSRQQ= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE=
github.com/prometheus/common v0.61.0/go.mod h1:zr29OCN/2BsJRaFwG8QOBr41D6kkchKbpeNH7pAjb/s= github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTUGI4=
github.com/prometheus/exporter-toolkit v0.13.2 h1:Z02fYtbqTMy2i/f+xZ+UK5jy/bl1Ex3ndzh06T/Q9DQ= github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw=
github.com/prometheus/exporter-toolkit v0.13.2/go.mod h1:tCqnfx21q6qN1KA4U3Bfb8uWzXfijIrJz3/kTIqMV7g= github.com/prometheus/exporter-toolkit v0.15.1 h1:XrGGr/qWl8Gd+pqJqTkNLww9eG8vR/CoRk0FubOKfLE=
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/exporter-toolkit v0.15.1/go.mod h1:P/NR9qFRGbCFgpklyhix9F6v6fFr/VQB/CVsrMDGKo4=
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/prometheus/procfs v0.19.2 h1:zUMhqEW66Ex7OXIiDkll3tl9a1ZdilUOd/F6ZXw4Vws=
github.com/prometheus/procfs v0.19.2/go.mod h1:M0aotyiemPhBCM0z5w87kL22CxfcH05ZpYlu+b4J7mw=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8Ydu2Bstc= github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8Ydu2Bstc=
github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU= github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0=
go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.47.0 h1:V6e3FRj+n4dbpw86FJ8Fv7XVOql7TEwpHapKoMJ/GO8=
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= golang.org/x/crypto v0.47.0/go.mod h1:ff3Y9VzzKbwSSEzWqJsJVBnWmRwRSHt/6Op5n9bQc4A=
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/oauth2 v0.34.0 h1:hqK/t4AKgbqWkdkcAeI8XLmbK+4m4G5YeQRrmiotGlw=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/oauth2 v0.34.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI=
golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE=
golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ=
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8=
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241118233622-e639e219e697 h1:LWZqQOEjDyONlF1H6afSWpAL/znlREo2tHfLoe+8LMA=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241118233622-e639e219e697/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
google.golang.org/grpc v1.68.0 h1:aHQeeJbo8zAkAa3pRzrVjZlbz6uSfeOXlJNQM0RAbz0=
google.golang.org/grpc v1.68.0/go.mod h1:fmSPC5AsjSBCK54MyHRx48kpOti1/jRfOlwEWywNjWA=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io=
google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=

View File

@@ -28,7 +28,7 @@ Copy-Item -Force $PathToExecutable Work/windows_exporter.exe
Write-Verbose "Creating windows_exporter-${Version}-${Arch}.msi" Write-Verbose "Creating windows_exporter-${Version}-${Arch}.msi"
$wixArch = @{"amd64" = "x64"; "arm64" = "arm64"}[$Arch] $wixArch = @{"amd64" = "x64"; "arm64" = "arm64"}[$Arch]
Invoke-Expression "wix build -arch $wixArch -o .\windows_exporter-$($Version)-$($Arch).msi .\files.wxs .\main.wxs -d ProductName=windows_exporter -d Version=$($MsiVersion) -ext WixToolset.Firewall.wixext -ext WixToolset.UI.wixext -ext WixToolset.Util.wixext" Invoke-Expression "wix build -sw1149 -arch $wixArch -o .\windows_exporter-$($Version)-$($Arch).msi .\files.wxs .\main.wxs -d ProductName=windows_exporter -d Version=$($MsiVersion) -ext WixToolset.Firewall.wixext -ext WixToolset.UI.wixext -ext WixToolset.Util.wixext"
Write-Verbose "Done!" Write-Verbose "Done!"
Pop-Location Pop-Location

BIN
installer/codesign.cer Normal file

Binary file not shown.

View File

@@ -1,5 +1,7 @@
<!-- <!--
~ Copyright 2024 The Prometheus Authors ~ SPDX-License-Identifier: Apache-2.0
~
~ Copyright The Prometheus Authors
~ Licensed under the Apache License, Version 2.0 (the "License"); ~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License. ~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at ~ You may obtain a copy of the License at
@@ -19,6 +21,14 @@
<DirectoryRef Id="APPLICATIONFOLDER"> <DirectoryRef Id="APPLICATIONFOLDER">
<Component Transitive="yes"> <Component Transitive="yes">
<File Id="windows_exporter.exe" Name="windows_exporter.exe" Source="Work\windows_exporter.exe" KeyPath="yes" Vital="yes" Checksum="yes"/> <File Id="windows_exporter.exe" Name="windows_exporter.exe" Source="Work\windows_exporter.exe" KeyPath="yes" Vital="yes" Checksum="yes"/>
<!-- The "Name" field must match the argument to eventlog.Open() -->
<util:EventSource Log="Application" Name="windows_exporter"
EventMessageFile="%SystemRoot%\System32\EventCreate.exe"
SupportsErrors="yes"
SupportsInformationals="yes"
SupportsWarnings="yes"/>
<ServiceInstall <ServiceInstall
Id="InstallExporterService" Id="InstallExporterService"
Name="windows_exporter" Name="windows_exporter"
@@ -43,7 +53,8 @@
/> />
<ServiceDependency Id="wmiApSrv" /> <ServiceDependency Id="wmiApSrv" />
</ServiceInstall> </ServiceInstall>
<ServiceControl Id="ServiceStateControl" Name="windows_exporter" Remove="uninstall" Start="install" Stop="both"/> <ServiceControl Id="StartService" Name="windows_exporter" Start="install" Wait="no" />
<ServiceControl Id="StopService" Name="windows_exporter" Remove="uninstall" Stop="both" Wait="yes" />
</Component> </Component>
<Component Id="CreateTextfileDirectory" Directory="textfile_inputs" Guid="d03ef58a-9cbf-4165-ad39-d143e9b27e14"> <Component Id="CreateTextfileDirectory" Directory="textfile_inputs" Guid="d03ef58a-9cbf-4165-ad39-d143e9b27e14">
<CreateFolder /> <CreateFolder />

BIN
installer/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

View File

@@ -10,7 +10,9 @@
<?endif?> <?endif?>
<!-- <!--
~ Copyright 2024 The Prometheus Authors ~ SPDX-License-Identifier: Apache-2.0
~
~ Copyright The Prometheus Authors
~ Licensed under the Apache License, Version 2.0 (the "License"); ~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License. ~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at ~ You may obtain a copy of the License at
@@ -43,43 +45,6 @@
Property="OLDERVERSIONBEINGUPGRADED" /> Property="OLDERVERSIONBEINGUPGRADED" />
</Upgrade> </Upgrade>
<CustomAction Id="set_maintenance" Property="MAINTENANCE" Value="true" />
<!-- Set to reinstall all features. -->
<CustomAction Id="set_reinstall_all_property"
Property="REINSTALL"
Value="ALL" />
<!-- "amus" will force reinstall all files.
See https://docs.microsoft.com/en-us/windows/desktop/Msi/reinstallmode -->
<CustomAction Id="set_reinstallmode_property"
Property="REINSTALLMODE"
Value="amus" />
<SetProperty
Id="CreateConfigFile"
Value="&quot;[%ComSpec]&quot; /c TYPE NUL >>&quot;[ConfigFile_NonDefault][ConfigFile_Default]&quot;"
Before="CreateConfigFile"
Sequence="execute"
Condition="ConfigFile_NonDefault OR ConfigFile_Default"
/>
<CustomAction
Id="CreateConfigFile"
BinaryRef="Wix4UtilCA_$(sys.BUILDARCHSHORT)"
DllEntry="WixQuietExec"
Execute="deferred"
Return="check"
Impersonate="no"
/>
<InstallExecuteSequence>
<!-- Set REINSTALL=all and REINSTALLMODE=amus if the user reruns the
MSI, which will force reinstalling all files and services. -->
<Custom Action="set_maintenance" Before="set_reinstall_all_property"
Condition="Installed AND (NOT REMOVE) AND (NOT UPGRADINGPRODUCTCODE)"/>
<Custom Action="set_reinstall_all_property" Before="set_reinstallmode_property" Condition="MAINTENANCE"/>
<Custom Action="set_reinstallmode_property" Before="LaunchConditions" Condition="MAINTENANCE"/>
<Custom Action="CreateConfigFile" Before="InstallServices" Condition="ConfigFile_NonDefault OR ConfigFile_Default" />
</InstallExecuteSequence>
<Media Id="1" Cabinet="windows_exporter.cab" EmbedCab="yes" /> <Media Id="1" Cabinet="windows_exporter.cab" EmbedCab="yes" />
<MajorUpgrade Schedule="afterInstallInitialize" DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit." AllowSameVersionUpgrades="yes" /> <MajorUpgrade Schedule="afterInstallInitialize" DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit." AllowSameVersionUpgrades="yes" />
@@ -95,25 +60,110 @@
<SetProperty Id="ConfigFileFlag" After="InstallFiles" Sequence="execute" Value="--config.file=&quot;[ConfigFile_NonDefault][ConfigFile_Default]&quot;" Condition="ConfigFile_NonDefault OR ConfigFile_Default" /> <SetProperty Id="ConfigFileFlag" After="InstallFiles" Sequence="execute" Value="--config.file=&quot;[ConfigFile_NonDefault][ConfigFile_Default]&quot;" Condition="ConfigFile_NonDefault OR ConfigFile_Default" />
<Property Id="LISTEN_PORT" Secure="yes" Value="9182" /> <Property Id="LISTEN_PORT" Secure="yes" Value="9182" />
<SetProperty Id="ListenFlag" After="InstallFiles" Sequence="execute" Value="--web.listen-address [LISTEN_ADDR]:[LISTEN_PORT]" Condition="LISTEN_ADDR&lt;&gt;&quot;&quot; OR LISTEN_PORT&lt;&gt;9182" /> <SetProperty Id="ListenFlag" After="InstallFiles" Sequence="execute" Value="--web.listen-address=&quot;[LISTEN_ADDR]:[LISTEN_PORT]&quot;" Condition="LISTEN_ADDR&lt;&gt;&quot;&quot; OR LISTEN_PORT&lt;&gt;9182" />
<Property Id="METRICS_PATH" Secure="yes" /> <Property Id="METRICS_PATH" Secure="yes" />
<SetProperty Id="MetricsPathFlag" After="InstallFiles" Sequence="execute" Value="--telemetry.path [METRICS_PATH]" Condition="METRICS_PATH" /> <SetProperty Id="MetricsPathFlag" After="InstallFiles" Sequence="execute" Value="--telemetry.path=&quot;[METRICS_PATH]&quot;" Condition="METRICS_PATH" />
<Property Id="REMOTE_ADDR" Secure="yes" /> <Property Id="REMOTE_ADDR" Secure="yes" />
<SetProperty Id="RemoteAddressFlag" After="InstallFiles" Sequence="execute" Value="[REMOTE_ADDR]" Condition="REMOTE_ADDR" /> <SetProperty Id="RemoteAddressFlag" After="InstallFiles" Sequence="execute" Value="[REMOTE_ADDR]" Condition="REMOTE_ADDR" />
<Property Id="TEXTFILE_DIRS" Secure="yes" /> <Property Id="TEXTFILE_DIRS" Secure="yes" />
<SetProperty Id="TextfileDirsFlag" After="InstallFiles" Sequence="execute" Value="--collector.textfile.directories [TEXTFILE_DIRS]" Condition="TEXTFILE_DIRS" /> <SetProperty Id="TextfileDirsFlag" After="InstallFiles" Sequence="execute" Value="--collector.textfile.directories=&quot;[TEXTFILE_DIRS]&quot;" Condition="TEXTFILE_DIRS" />
<!-- Configuration for how the installer shows in Add/Remove Programs. -->
<Icon Id="icon.ico" SourceFile=".\icon.ico"/>
<Property Id="ARPPRODUCTICON" Value="icon.ico" />
<Property Id="ARPHELPLINK" Value="https://github.com/prometheus-community/windows_exporter/issues" /> <Property Id="ARPHELPLINK" Value="https://github.com/prometheus-community/windows_exporter/issues" />
<Property Id="ARPSIZE" Value="9000" />
<Property Id="ARPURLINFOABOUT" Value="https://github.com/prometheus-community/windows_exporter" /> <Property Id="ARPURLINFOABOUT" Value="https://github.com/prometheus-community/windows_exporter" />
<!--<Property Id="ARPNOMODIFY" Value="0" />--> <Property Id="ARPCOMMENTS" Value="Prometheus exporter for Windows machines" />
<!--<Property Id="ARPNOREPAIR" Value="1" />--> <!-- Disable the repair option; the functionality is available through Change instead. -->
<Property Id="ARPNOREPAIR" Value="1" />
<Property Id="ARPSIZE" Value="10000" />
<Property Id="START_MENU_FOLDER" Value="0" /> <Property Id="START_MENU_FOLDER" Value="0" />
<Property Id="NOSTART" Value="0" /> <Property Id="NOSTART" Value="0" />
<CustomAction Id="CheckExtraFlags"
Error="The parameter '--config.file' must not be included in EXTRA_FLAGS. Use CONFIG_FILE instead. Please remove it and try again." />
<CustomAction Id="set_maintenance" Property="MAINTENANCE" Value="true" />
<!-- Set to reinstall all features. -->
<CustomAction Id="set_reinstall_all_property"
Property="REINSTALL"
Value="ALL" />
<!-- "amus" will force reinstall all files.
See https://docs.microsoft.com/en-us/windows/desktop/Msi/reinstallmode -->
<CustomAction Id="set_reinstallmode_property"
Property="REINSTALLMODE"
Value="amus" />
<!-- START CUSTOM ACTION FOR CONFIG FILE CREATION -->
<SetProperty
Id="CreateConfigFile"
Value="&quot;[%ComSpec]&quot; /c TYPE NUL >>&quot;[ConfigFile_NonDefault][ConfigFile_Default]&quot;"
Before="CreateConfigFile"
Sequence="execute"
/>
<CustomAction
Id="CreateConfigFile"
BinaryRef="Wix4UtilCA_$(sys.BUILDARCHSHORT)"
DllEntry="WixQuietExec"
Execute="deferred"
Return="check"
Impersonate="no"
/>
<!-- END CUSTOM ACTION FOR CONFIG FILE CREATION -->
<!-- START CUSTOM ACTION FOR KILLING THE PROCESS -->
<SetProperty
Id="KillProcess"
Value="&quot;[WindowsFolder]System32\taskkill.exe&quot; /T /F /IM windows_exporter.exe"
Before="KillProcess"
Sequence="execute"
/>
<CustomAction
Id="KillProcess"
BinaryRef="Wix4UtilCA_$(sys.BUILDARCHSHORT)"
DllEntry="WixQuietExec"
Execute="deferred"
Return="ignore"
Impersonate="no"
/>
<!-- END CUSTOM ACTION FOR KILLING THE PROCESS -->
<!-- START CUSTOM ACTION FOR SET SERVICE FAILUREFLAG -->
<SetProperty
Id="ConfigureServiceRecovery"
Value="&quot;[WindowsFolder]System32\sc.exe&quot; failureflag &quot;windows_exporter&quot; 1"
Before="ConfigureServiceRecovery"
Sequence="execute"
/>
<CustomAction
Id="ConfigureServiceRecovery"
BinaryRef="Wix4UtilCA_$(sys.BUILDARCHSHORT)"
DllEntry="WixQuietExec"
Execute="deferred"
Return="ignore"
Impersonate="no"
/>
<!-- END CUSTOM ACTION FFOR SET SERVICE FAILUREFLAG -->
<InstallExecuteSequence>
<!-- Set REINSTALL=all and REINSTALLMODE=amus if the user reruns the
MSI, which will force reinstalling all files and services. -->
<Custom Action="set_maintenance" Before="set_reinstall_all_property"
Condition="Installed AND (NOT REMOVE) AND (NOT UPGRADINGPRODUCTCODE)"/>
<Custom Action="set_reinstall_all_property" Before="set_reinstallmode_property" Condition="MAINTENANCE"/>
<Custom Action="set_reinstallmode_property" Before="LaunchConditions" Condition="MAINTENANCE"/>
<Custom Action="CreateConfigFile" Before="InstallServices" Condition="ConfigFile_Default" />
<Custom Action="ConfigureServiceRecovery" After="InstallServices" Condition="NOT REMOVE" />
<Custom Action="KillProcess" Before="RemoveFiles" />
<Custom Action="CheckExtraFlags" Before="InstallInitialize"
Condition="EXTRA_FLAGS AND (EXTRA_FLAGS&gt;&lt;&quot;--config.file&quot;)" />
</InstallExecuteSequence>
<Feature <Feature
Id="DefaultFeature" Id="DefaultFeature"
Level="1" Level="1"
@@ -151,7 +201,7 @@
<Control Id="Title" Type="Text" X="15" Y="6" Width="210" Height="15" Transparent="yes" NoPrefix="yes" Text="{\WixUI_Font_Title}windows_exporter configuration" /> <Control Id="Title" Type="Text" X="15" Y="6" Width="210" Height="15" Transparent="yes" NoPrefix="yes" Text="{\WixUI_Font_Title}windows_exporter configuration" />
<!-- Edit box for property input --> <!-- Edit box for property input -->
<!-- cpu,cs,logical_disk,physical_disk,net,os,service,system --> <!-- cpu,logical_disk,physical_disk,net,os,service,system -->
<Control Id="PropertyEdit_ENABLED_COLLECTORS_Title1" Type="Text" X="25" Y="55" Width="300" Height="15" Transparent="yes" NoPrefix="yes" Text="Comma-separated list of collectors to use. Use '[\[]defaults[\]]' as a placeholder for all" /> <Control Id="PropertyEdit_ENABLED_COLLECTORS_Title1" Type="Text" X="25" Y="55" Width="300" Height="15" Transparent="yes" NoPrefix="yes" Text="Comma-separated list of collectors to use. Use '[\[]defaults[\]]' as a placeholder for all" />
<Control Id="PropertyEdit_ENABLED_COLLECTORS_Title2" Type="Text" X="25" Y="65" Width="300" Height="15" Transparent="yes" NoPrefix="yes" Text="the collectors enabled by default. If value is empty, the exporter default will be used." /> <Control Id="PropertyEdit_ENABLED_COLLECTORS_Title2" Type="Text" X="25" Y="65" Width="300" Height="15" Transparent="yes" NoPrefix="yes" Text="the collectors enabled by default. If value is empty, the exporter default will be used." />
<Control Id="PropertyEdit_ENABLED_COLLECTORS" Type="Edit" X="24" Y="77" Width="300" Height="18" Property="ENABLED_COLLECTORS" Text="[ENABLED_COLLECTORS]" Indirect="no" /> <Control Id="PropertyEdit_ENABLED_COLLECTORS" Type="Edit" X="24" Y="77" Width="300" Height="18" Property="ENABLED_COLLECTORS" Text="[ENABLED_COLLECTORS]" Indirect="no" />

View File

@@ -1,4 +1,6 @@
// Copyright 2024 The Prometheus Authors // SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
@@ -129,14 +131,7 @@ func (c *Collector) Close() error {
return nil return nil
} }
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error { func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
var err error
c.perfDataCollector, err = pdh.NewCollector[perfDataCounterValues](pdh.CounterTypeRaw, "DirectoryServices", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create DirectoryServices collector: %w", err)
}
c.addressBookOperationsTotal = prometheus.NewDesc( c.addressBookOperationsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "address_book_operations_total"), prometheus.BuildFQName(types.Namespace, Name, "address_book_operations_total"),
"", "",
@@ -511,6 +506,13 @@ func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
nil, nil,
) )
var err error
c.perfDataCollector, err = pdh.NewCollector[perfDataCounterValues](logger.With(slog.String("collector", Name)), pdh.CounterTypeRaw, "DirectoryServices", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create DirectoryServices collector: %w", err)
}
return nil return nil
} }
@@ -520,6 +522,8 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
err := c.perfDataCollector.Collect(&c.perfDataObject) err := c.perfDataCollector.Collect(&c.perfDataObject)
if err != nil { if err != nil {
return fmt.Errorf("failed to collect DirectoryServices (AD) metrics: %w", err) return fmt.Errorf("failed to collect DirectoryServices (AD) metrics: %w", err)
} else if len(c.perfDataObject) == 0 {
return fmt.Errorf("failed to collect DirectoryServices (AD) metrics: %w", types.ErrNoDataUnexpected)
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -528,30 +532,35 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
c.perfDataObject[0].AbANRPerSec, c.perfDataObject[0].AbANRPerSec,
"ambiguous_name_resolution", "ambiguous_name_resolution",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.addressBookOperationsTotal, c.addressBookOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].AbBrowsesPerSec, c.perfDataObject[0].AbBrowsesPerSec,
"browse", "browse",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.addressBookOperationsTotal, c.addressBookOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].AbMatchesPerSec, c.perfDataObject[0].AbMatchesPerSec,
"find", "find",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.addressBookOperationsTotal, c.addressBookOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].AbPropertyReadsPerSec, c.perfDataObject[0].AbPropertyReadsPerSec,
"property_read", "property_read",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.addressBookOperationsTotal, c.addressBookOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].AbSearchesPerSec, c.perfDataObject[0].AbSearchesPerSec,
"search", "search",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.addressBookOperationsTotal, c.addressBookOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -576,22 +585,26 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
prometheus.GaugeValue, prometheus.GaugeValue,
c.perfDataObject[0].AtqEstimatedQueueDelay/1000, c.perfDataObject[0].AtqEstimatedQueueDelay/1000,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.atqOutstandingRequests, c.atqOutstandingRequests,
prometheus.GaugeValue, prometheus.GaugeValue,
c.perfDataObject[0].AtqOutstandingQueuedRequests, c.perfDataObject[0].AtqOutstandingQueuedRequests,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.atqAverageRequestLatency, c.atqAverageRequestLatency,
prometheus.GaugeValue, prometheus.GaugeValue,
c.perfDataObject[0].AtqRequestLatency, c.perfDataObject[0].AtqRequestLatency,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.atqCurrentThreads, c.atqCurrentThreads,
prometheus.GaugeValue, prometheus.GaugeValue,
c.perfDataObject[0].AtqThreadsLDAP, c.perfDataObject[0].AtqThreadsLDAP,
"ldap", "ldap",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.atqCurrentThreads, c.atqCurrentThreads,
prometheus.GaugeValue, prometheus.GaugeValue,
@@ -605,12 +618,14 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
c.perfDataObject[0].BaseSearchesPerSec, c.perfDataObject[0].BaseSearchesPerSec,
"base", "base",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.searchesTotal, c.searchesTotal,
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].SubtreeSearchesPerSec, c.perfDataObject[0].SubtreeSearchesPerSec,
"subtree", "subtree",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.searchesTotal, c.searchesTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -624,18 +639,21 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
c.perfDataObject[0].DatabaseAddsPerSec, c.perfDataObject[0].DatabaseAddsPerSec,
"add", "add",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.databaseOperationsTotal, c.databaseOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].DatabaseDeletesPerSec, c.perfDataObject[0].DatabaseDeletesPerSec,
"delete", "delete",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.databaseOperationsTotal, c.databaseOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].DatabaseModifiesPerSec, c.perfDataObject[0].DatabaseModifiesPerSec,
"modify", "modify",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.databaseOperationsTotal, c.databaseOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -649,48 +667,56 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
c.perfDataObject[0].DigestBindsPerSec, c.perfDataObject[0].DigestBindsPerSec,
"digest", "digest",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.bindsTotal, c.bindsTotal,
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].DsClientBindsPerSec, c.perfDataObject[0].DsClientBindsPerSec,
"ds_client", "ds_client",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.bindsTotal, c.bindsTotal,
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].DsServerBindsPerSec, c.perfDataObject[0].DsServerBindsPerSec,
"ds_server", "ds_server",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.bindsTotal, c.bindsTotal,
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].ExternalBindsPerSec, c.perfDataObject[0].ExternalBindsPerSec,
"external", "external",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.bindsTotal, c.bindsTotal,
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].FastBindsPerSec, c.perfDataObject[0].FastBindsPerSec,
"fast", "fast",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.bindsTotal, c.bindsTotal,
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].NegotiatedBindsPerSec, c.perfDataObject[0].NegotiatedBindsPerSec,
"negotiate", "negotiate",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.bindsTotal, c.bindsTotal,
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].NTLMBindsPerSec, c.perfDataObject[0].NTLMBindsPerSec,
"ntlm", "ntlm",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.bindsTotal, c.bindsTotal,
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].SimpleBindsPerSec, c.perfDataObject[0].SimpleBindsPerSec,
"simple", "simple",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.bindsTotal, c.bindsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -704,6 +730,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
float64(uint64(c.perfDataObject[0].DRAHighestUSNCommittedHighPart)<<32)+c.perfDataObject[0].DRAHighestUSNCommittedLowPart, float64(uint64(c.perfDataObject[0].DRAHighestUSNCommittedHighPart)<<32)+c.perfDataObject[0].DRAHighestUSNCommittedLowPart,
"committed", "committed",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.replicationHighestUsn, c.replicationHighestUsn,
prometheus.CounterValue, prometheus.CounterValue,
@@ -742,6 +769,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
c.perfDataObject[0].DRAInboundBytesNotCompressedWithinSitePerSec, c.perfDataObject[0].DRAInboundBytesNotCompressedWithinSitePerSec,
"inbound", "inbound",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.intraSiteReplicationDataBytesTotal, c.intraSiteReplicationDataBytesTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -766,6 +794,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].DRAInboundObjectsAppliedPerSec, c.perfDataObject[0].DRAInboundObjectsAppliedPerSec,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.replicationInboundObjectsFilteredTotal, c.replicationInboundObjectsFilteredTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -777,6 +806,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].DRAInboundPropertiesAppliedPerSec, c.perfDataObject[0].DRAInboundPropertiesAppliedPerSec,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.replicationInboundPropertiesFilteredTotal, c.replicationInboundPropertiesFilteredTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -788,6 +818,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
prometheus.GaugeValue, prometheus.GaugeValue,
c.perfDataObject[0].DRAPendingReplicationOperations, c.perfDataObject[0].DRAPendingReplicationOperations,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.replicationPendingSynchronizations, c.replicationPendingSynchronizations,
prometheus.GaugeValue, prometheus.GaugeValue,
@@ -799,11 +830,13 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].DRASyncRequestsMade, c.perfDataObject[0].DRASyncRequestsMade,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.replicationSyncRequestsSuccessTotal, c.replicationSyncRequestsSuccessTotal,
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].DRASyncRequestsSuccessful, c.perfDataObject[0].DRASyncRequestsSuccessful,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.replicationSyncRequestsSchemaMismatchFailureTotal, c.replicationSyncRequestsSchemaMismatchFailureTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -816,6 +849,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
c.perfDataObject[0].DsClientNameTranslationsPerSec, c.perfDataObject[0].DsClientNameTranslationsPerSec,
"client", "client",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.nameTranslationsTotal, c.nameTranslationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -828,6 +862,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
prometheus.GaugeValue, prometheus.GaugeValue,
c.perfDataObject[0].DsMonitorListSize, c.perfDataObject[0].DsMonitorListSize,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.changeMonitorUpdatesPending, c.changeMonitorUpdatesPending,
prometheus.GaugeValue, prometheus.GaugeValue,
@@ -839,6 +874,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].DsNameCacheHitRate, c.perfDataObject[0].DsNameCacheHitRate,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.nameCacheLookupsTotal, c.nameCacheLookupsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -852,6 +888,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
"read", "read",
"replication_agent", "replication_agent",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.directoryOperationsTotal, c.directoryOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -859,6 +896,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
"read", "read",
"knowledge_consistency_checker", "knowledge_consistency_checker",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.directoryOperationsTotal, c.directoryOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -866,6 +904,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
"read", "read",
"local_security_authority", "local_security_authority",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.directoryOperationsTotal, c.directoryOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -873,6 +912,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
"read", "read",
"name_service_provider_interface", "name_service_provider_interface",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.directoryOperationsTotal, c.directoryOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -880,6 +920,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
"read", "read",
"directory_service_api", "directory_service_api",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.directoryOperationsTotal, c.directoryOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -887,6 +928,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
"read", "read",
"security_account_manager", "security_account_manager",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.directoryOperationsTotal, c.directoryOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -894,6 +936,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
"read", "read",
"other", "other",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.directoryOperationsTotal, c.directoryOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -901,6 +944,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
"search", "search",
"replication_agent", "replication_agent",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.directoryOperationsTotal, c.directoryOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -908,6 +952,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
"search", "search",
"knowledge_consistency_checker", "knowledge_consistency_checker",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.directoryOperationsTotal, c.directoryOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -915,6 +960,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
"search", "search",
"ldap", "ldap",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.directoryOperationsTotal, c.directoryOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -922,6 +968,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
"search", "search",
"local_security_authority", "local_security_authority",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.directoryOperationsTotal, c.directoryOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -929,6 +976,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
"search", "search",
"name_service_provider_interface", "name_service_provider_interface",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.directoryOperationsTotal, c.directoryOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -936,6 +984,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
"search", "search",
"directory_service_api", "directory_service_api",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.directoryOperationsTotal, c.directoryOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -943,6 +992,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
"search", "search",
"security_account_manager", "security_account_manager",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.directoryOperationsTotal, c.directoryOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -950,6 +1000,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
"search", "search",
"other", "other",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.directoryOperationsTotal, c.directoryOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -957,6 +1008,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
"write", "write",
"replication_agent", "replication_agent",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.directoryOperationsTotal, c.directoryOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -964,6 +1016,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
"write", "write",
"knowledge_consistency_checker", "knowledge_consistency_checker",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.directoryOperationsTotal, c.directoryOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -971,6 +1024,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
"write", "write",
"ldap", "ldap",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.directoryOperationsTotal, c.directoryOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -978,6 +1032,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
"write", "write",
"local_security_authority", "local_security_authority",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.directoryOperationsTotal, c.directoryOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -985,6 +1040,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
"write", "write",
"name_service_provider_interface", "name_service_provider_interface",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.directoryOperationsTotal, c.directoryOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -992,6 +1048,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
"write", "write",
"directory_service_api", "directory_service_api",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.directoryOperationsTotal, c.directoryOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -999,6 +1056,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
"write", "write",
"security_account_manager", "security_account_manager",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.directoryOperationsTotal, c.directoryOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -1018,16 +1076,19 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].DsSecurityDescriptorSubOperationsPerSec, c.perfDataObject[0].DsSecurityDescriptorSubOperationsPerSec,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.securityDescriptorPropagationEventsQueued, c.securityDescriptorPropagationEventsQueued,
prometheus.GaugeValue, prometheus.GaugeValue,
c.perfDataObject[0].DsSecurityDescriptorPropagationsEvents, c.perfDataObject[0].DsSecurityDescriptorPropagationsEvents,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.securityDescriptorPropagationAccessWaitTotalSeconds, c.securityDescriptorPropagationAccessWaitTotalSeconds,
prometheus.GaugeValue, prometheus.GaugeValue,
c.perfDataObject[0].DsSecurityDescriptorPropagatorAverageExclusionTime, c.perfDataObject[0].DsSecurityDescriptorPropagatorAverageExclusionTime,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.securityDescriptorPropagationItemsQueuedTotal, c.securityDescriptorPropagationItemsQueuedTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -1045,12 +1106,14 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].LdapClosedConnectionsPerSec, c.perfDataObject[0].LdapClosedConnectionsPerSec,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ldapOpenedConnectionsTotal, c.ldapOpenedConnectionsTotal,
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].LdapNewConnectionsPerSec, c.perfDataObject[0].LdapNewConnectionsPerSec,
"ldap", "ldap",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ldapOpenedConnectionsTotal, c.ldapOpenedConnectionsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -1081,11 +1144,13 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].LdapUDPOperationsPerSec, c.perfDataObject[0].LdapUDPOperationsPerSec,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ldapWritesTotal, c.ldapWritesTotal,
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].LdapWritesPerSec, c.perfDataObject[0].LdapWritesPerSec,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ldapClientSessions, c.ldapClientSessions,
prometheus.GaugeValue, prometheus.GaugeValue,
@@ -1103,6 +1168,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].PhantomsCleanedPerSec, c.perfDataObject[0].PhantomsCleanedPerSec,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.phantomObjectsVisitedTotal, c.phantomObjectsVisitedTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -1115,18 +1181,21 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
c.perfDataObject[0].SamGlobalGroupMembershipEvaluationsPerSec, c.perfDataObject[0].SamGlobalGroupMembershipEvaluationsPerSec,
"global", "global",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.samGroupMembershipEvaluationsTotal, c.samGroupMembershipEvaluationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].SamDomainLocalGroupMembershipEvaluationsPerSec, c.perfDataObject[0].SamDomainLocalGroupMembershipEvaluationsPerSec,
"domain_local", "domain_local",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.samGroupMembershipEvaluationsTotal, c.samGroupMembershipEvaluationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].SamUniversalGroupMembershipEvaluationsPerSec, c.perfDataObject[0].SamUniversalGroupMembershipEvaluationsPerSec,
"universal", "universal",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.samGroupMembershipGlobalCatalogEvaluationsTotal, c.samGroupMembershipGlobalCatalogEvaluationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -1138,6 +1207,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].SamNonTransitiveMembershipEvaluationsPerSec, c.perfDataObject[0].SamNonTransitiveMembershipEvaluationsPerSec,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.samGroupMembershipEvaluationsTransitiveTotal, c.samGroupMembershipEvaluationsTransitiveTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -1150,6 +1220,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
c.perfDataObject[0].SamAccountGroupEvaluationLatency, c.perfDataObject[0].SamAccountGroupEvaluationLatency,
"account_group", "account_group",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.samGroupEvaluationLatency, c.samGroupEvaluationLatency,
prometheus.GaugeValue, prometheus.GaugeValue,
@@ -1162,6 +1233,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].SamSuccessfulComputerCreationsPerSecIncludesAllRequests, c.perfDataObject[0].SamSuccessfulComputerCreationsPerSecIncludesAllRequests,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.samComputerCreationSuccessfulRequestsTotal, c.samComputerCreationSuccessfulRequestsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -1173,6 +1245,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].SamUserCreationAttemptsPerSec, c.perfDataObject[0].SamUserCreationAttemptsPerSec,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.samUserCreationSuccessfulRequestsTotal, c.samUserCreationSuccessfulRequestsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -1184,6 +1257,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].SamDisplayInformationQueriesPerSec, c.perfDataObject[0].SamDisplayInformationQueriesPerSec,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.samEnumerationsTotal, c.samEnumerationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -1207,6 +1281,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].TombstonesGarbageCollectedPerSec, c.perfDataObject[0].TombstonesGarbageCollectedPerSec,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.tombstonesObjectsVisitedTotal, c.tombstonesObjectsVisitedTotal,
prometheus.CounterValue, prometheus.CounterValue,

View File

@@ -1,4 +1,6 @@
// Copyright 2024 The Prometheus Authors // SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at

View File

@@ -1,4 +1,6 @@
// Copyright 2024 The Prometheus Authors // SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at

View File

@@ -1,4 +1,6 @@
// Copyright 2024 The Prometheus Authors // SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
@@ -81,14 +83,7 @@ func (c *Collector) Close() error {
return nil return nil
} }
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error { func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
var err error
c.perfDataCollector, err = pdh.NewCollector[perfDataCounterValues](pdh.CounterTypeRaw, "Certification Authority", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create Certification Authority collector: %w", err)
}
c.requestsPerSecond = prometheus.NewDesc( c.requestsPerSecond = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "requests_total"), prometheus.BuildFQName(types.Namespace, Name, "requests_total"),
"Total certificate requests processed", "Total certificate requests processed",
@@ -168,6 +163,13 @@ func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
nil, nil,
) )
var err error
c.perfDataCollector, err = pdh.NewCollector[perfDataCounterValues](logger.With(slog.String("collector", Name)), pdh.CounterTypeRaw, "Certification Authority", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create Certification Authority collector: %w", err)
}
return nil return nil
} }
@@ -184,72 +186,84 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
data.RequestsPerSecond, data.RequestsPerSecond,
data.Name, data.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.requestProcessingTime, c.requestProcessingTime,
prometheus.GaugeValue, prometheus.GaugeValue,
utils.MilliSecToSec(data.RequestProcessingTime), utils.MilliSecToSec(data.RequestProcessingTime),
data.Name, data.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.retrievalsPerSecond, c.retrievalsPerSecond,
prometheus.CounterValue, prometheus.CounterValue,
data.RetrievalsPerSecond, data.RetrievalsPerSecond,
data.Name, data.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.retrievalProcessingTime, c.retrievalProcessingTime,
prometheus.GaugeValue, prometheus.GaugeValue,
utils.MilliSecToSec(data.RetrievalProcessingTime), utils.MilliSecToSec(data.RetrievalProcessingTime),
data.Name, data.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.failedRequestsPerSecond, c.failedRequestsPerSecond,
prometheus.CounterValue, prometheus.CounterValue,
data.FailedRequestsPerSecond, data.FailedRequestsPerSecond,
data.Name, data.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.issuedRequestsPerSecond, c.issuedRequestsPerSecond,
prometheus.CounterValue, prometheus.CounterValue,
data.IssuedRequestsPerSecond, data.IssuedRequestsPerSecond,
data.Name, data.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.pendingRequestsPerSecond, c.pendingRequestsPerSecond,
prometheus.CounterValue, prometheus.CounterValue,
data.PendingRequestsPerSecond, data.PendingRequestsPerSecond,
data.Name, data.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.requestCryptographicSigningTime, c.requestCryptographicSigningTime,
prometheus.GaugeValue, prometheus.GaugeValue,
utils.MilliSecToSec(data.RequestCryptographicSigningTime), utils.MilliSecToSec(data.RequestCryptographicSigningTime),
data.Name, data.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.requestPolicyModuleProcessingTime, c.requestPolicyModuleProcessingTime,
prometheus.GaugeValue, prometheus.GaugeValue,
utils.MilliSecToSec(data.RequestPolicyModuleProcessingTime), utils.MilliSecToSec(data.RequestPolicyModuleProcessingTime),
data.Name, data.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.challengeResponsesPerSecond, c.challengeResponsesPerSecond,
prometheus.CounterValue, prometheus.CounterValue,
data.ChallengeResponsesPerSecond, data.ChallengeResponsesPerSecond,
data.Name, data.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.challengeResponseProcessingTime, c.challengeResponseProcessingTime,
prometheus.GaugeValue, prometheus.GaugeValue,
utils.MilliSecToSec(data.ChallengeResponseProcessingTime), utils.MilliSecToSec(data.ChallengeResponseProcessingTime),
data.Name, data.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.signedCertificateTimestampListsPerSecond, c.signedCertificateTimestampListsPerSecond,
prometheus.CounterValue, prometheus.CounterValue,
data.SignedCertificateTimestampListsPerSecond, data.SignedCertificateTimestampListsPerSecond,
data.Name, data.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.signedCertificateTimestampListProcessingTime, c.signedCertificateTimestampListProcessingTime,
prometheus.GaugeValue, prometheus.GaugeValue,

View File

@@ -1,4 +1,6 @@
// Copyright 2024 The Prometheus Authors // SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at

View File

@@ -1,4 +1,6 @@
// Copyright 2024 The Prometheus Authors // SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at

View File

@@ -1,4 +1,6 @@
// Copyright 2024 The Prometheus Authors // SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
@@ -111,14 +113,7 @@ func (c *Collector) Close() error {
return nil return nil
} }
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error { func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
var err error
c.perfDataCollector, err = pdh.NewCollector[perfDataCounterValues](pdh.CounterTypeRaw, "AD FS", nil)
if err != nil {
return fmt.Errorf("failed to create AD FS collector: %w", err)
}
c.adLoginConnectionFailures = prometheus.NewDesc( c.adLoginConnectionFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "ad_login_connection_failures_total"), prometheus.BuildFQName(types.Namespace, Name, "ad_login_connection_failures_total"),
"Total number of connection failures to an Active Directory domain controller", "Total number of connection failures to an Active Directory domain controller",
@@ -378,6 +373,13 @@ func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
nil, nil,
) )
var err error
c.perfDataCollector, err = pdh.NewCollector[perfDataCounterValues](logger.With(slog.String("collector", Name)), pdh.CounterTypeRaw, "AD FS", nil)
if err != nil {
return fmt.Errorf("failed to create AD FS collector: %w", err)
}
return nil return nil
} }
@@ -385,6 +387,8 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
err := c.perfDataCollector.Collect(&c.perfDataObject) err := c.perfDataCollector.Collect(&c.perfDataObject)
if err != nil { if err != nil {
return fmt.Errorf("failed to collect ADFS metrics: %w", err) return fmt.Errorf("failed to collect ADFS metrics: %w", err)
} else if len(c.perfDataObject) == 0 {
return fmt.Errorf("failed to collect ADFS metrics: %w", types.ErrNoDataUnexpected)
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(

View File

@@ -1,4 +1,6 @@
// Copyright 2024 The Prometheus Authors // SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at

View File

@@ -1,4 +1,6 @@
// Copyright 2024 The Prometheus Authors // SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at

View File

@@ -1,4 +1,6 @@
// Copyright 2024 The Prometheus Authors // SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
@@ -97,14 +99,7 @@ func (c *Collector) Close() error {
return nil return nil
} }
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error { func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
var err error
c.perfDataCollector, err = pdh.NewCollector[perfDataCounterValues](pdh.CounterTypeRaw, "Cache", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create Cache collector: %w", err)
}
c.asyncCopyReadsTotal = prometheus.NewDesc( c.asyncCopyReadsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "async_copy_reads_total"), prometheus.BuildFQName(types.Namespace, Name, "async_copy_reads_total"),
"(AsyncCopyReadsTotal)", "(AsyncCopyReadsTotal)",
@@ -280,6 +275,13 @@ func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
nil, nil,
) )
var err error
c.perfDataCollector, err = pdh.NewCollector[perfDataCounterValues](logger.With(slog.String("collector", Name)), pdh.CounterTypeRaw, "Cache", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create Cache collector: %w", err)
}
return nil return nil
} }
@@ -288,6 +290,8 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
err := c.perfDataCollector.Collect(&c.perfDataObject) err := c.perfDataCollector.Collect(&c.perfDataObject)
if err != nil { if err != nil {
return fmt.Errorf("failed to collect Cache metrics: %w", err) return fmt.Errorf("failed to collect Cache metrics: %w", err)
} else if len(c.perfDataObject) == 0 {
return fmt.Errorf("failed to collect Cache metrics: %w", types.ErrNoDataUnexpected)
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(

View File

@@ -1,4 +1,6 @@
// Copyright 2024 The Prometheus Authors // SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at

View File

@@ -1,4 +1,6 @@
// Copyright 2024 The Prometheus Authors // SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at

View File

@@ -1,4 +1,6 @@
// Copyright 2024 The Prometheus Authors // SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
@@ -16,25 +18,49 @@
package container package container
import ( import (
"encoding/json"
"errors" "errors"
"fmt" "fmt"
"io/fs"
"log/slog" "log/slog"
"os"
"slices"
"strings" "strings"
"unsafe"
"github.com/Microsoft/hcsshim"
"github.com/alecthomas/kingpin/v2" "github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/internal/headers/hcn"
"github.com/prometheus-community/windows_exporter/internal/headers/hcs"
"github.com/prometheus-community/windows_exporter/internal/headers/kernel32"
"github.com/prometheus-community/windows_exporter/internal/mi" "github.com/prometheus-community/windows_exporter/internal/mi"
"github.com/prometheus-community/windows_exporter/internal/pdh" "github.com/prometheus-community/windows_exporter/internal/pdh"
"github.com/prometheus-community/windows_exporter/internal/types" "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"golang.org/x/sys/windows"
) )
const Name = "container" const (
Name = "container"
type Config struct{} subCollectorHCS = "hcs"
subCollectorHostprocess = "hostprocess"
JobObjectMemoryUsageInformation = 28
)
type Config struct {
CollectorsEnabled []string `yaml:"enabled"`
ContainerDStateDir string `yaml:"containerd-state-dir"`
}
//nolint:gochecknoglobals //nolint:gochecknoglobals
var ConfigDefaults = Config{} var ConfigDefaults = Config{
CollectorsEnabled: []string{
subCollectorHCS,
subCollectorHostprocess,
},
ContainerDStateDir: `C:\ProgramData\containerd\state\io.containerd.runtime.v2.task\k8s.io\`,
}
// A Collector is a Prometheus Collector for containers metrics. // A Collector is a Prometheus Collector for containers metrics.
type Collector struct { type Collector struct {
@@ -42,6 +68,9 @@ type Collector struct {
logger *slog.Logger logger *slog.Logger
annotationsCacheHCS map[string]containerInfo
annotationsCacheJob map[string]containerInfo
// Presence // Presence
containerAvailable *prometheus.Desc containerAvailable *prometheus.Desc
@@ -73,12 +102,27 @@ type Collector struct {
writeSizeBytes *prometheus.Desc writeSizeBytes *prometheus.Desc
} }
type containerInfo struct {
id string
namespace string
pod string
container string
}
type ociSpec struct {
Annotations map[string]string `json:"annotations"`
}
// New constructs a new Collector. // New constructs a new Collector.
func New(config *Config) *Collector { func New(config *Config) *Collector {
if config == nil { if config == nil {
config = &ConfigDefaults config = &ConfigDefaults
} }
if config.CollectorsEnabled == nil {
config.CollectorsEnabled = ConfigDefaults.CollectorsEnabled
}
c := &Collector{ c := &Collector{
config: *config, config: *config,
} }
@@ -86,8 +130,31 @@ func New(config *Config) *Collector {
return c return c
} }
func NewWithFlags(_ *kingpin.Application) *Collector { func NewWithFlags(app *kingpin.Application) *Collector {
return &Collector{} c := &Collector{
config: ConfigDefaults,
}
c.config.CollectorsEnabled = make([]string, 0)
var collectorsEnabled string
app.Flag(
"collector.container.enabled",
"Comma-separated list of collectors to use. Defaults to all, if not specified.",
).Default(strings.Join(ConfigDefaults.CollectorsEnabled, ",")).StringVar(&collectorsEnabled)
app.Flag(
"collector.container.containerd-state-dir",
"Path to the containerd state directory. Defaults to C:\\ProgramData\\containerd\\state\\io.containerd.runtime.v2.task\\k8s.io\\",
).Default(ConfigDefaults.ContainerDStateDir).StringVar(&c.config.ContainerDStateDir)
app.Action(func(*kingpin.ParseContext) error {
c.config.CollectorsEnabled = strings.Split(collectorsEnabled, ",")
return nil
})
return c
} }
func (c *Collector) GetName() string { func (c *Collector) GetName() string {
@@ -101,10 +168,19 @@ func (c *Collector) Close() error {
func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error { func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
c.logger = logger.With(slog.String("collector", Name)) c.logger = logger.With(slog.String("collector", Name))
for _, collector := range c.config.CollectorsEnabled {
if !slices.Contains([]string{subCollectorHCS, subCollectorHostprocess}, collector) {
return fmt.Errorf("unknown collector: %s", collector)
}
}
c.annotationsCacheHCS = make(map[string]containerInfo)
c.annotationsCacheJob = make(map[string]containerInfo)
c.containerAvailable = prometheus.NewDesc( c.containerAvailable = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "available"), prometheus.BuildFQName(types.Namespace, Name, "available"),
"Available", "Available",
[]string{"container_id"}, []string{"container_id", "namespace", "pod", "container", "hostprocess"},
nil, nil,
) )
c.containersCount = prometheus.NewDesc( c.containersCount = prometheus.NewDesc(
@@ -116,97 +192,97 @@ func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
c.usageCommitBytes = prometheus.NewDesc( c.usageCommitBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "memory_usage_commit_bytes"), prometheus.BuildFQName(types.Namespace, Name, "memory_usage_commit_bytes"),
"Memory Usage Commit Bytes", "Memory Usage Commit Bytes",
[]string{"container_id"}, []string{"container_id", "namespace", "pod", "container"},
nil, nil,
) )
c.usageCommitPeakBytes = prometheus.NewDesc( c.usageCommitPeakBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "memory_usage_commit_peak_bytes"), prometheus.BuildFQName(types.Namespace, Name, "memory_usage_commit_peak_bytes"),
"Memory Usage Commit Peak Bytes", "Memory Usage Commit Peak Bytes",
[]string{"container_id"}, []string{"container_id", "namespace", "pod", "container"},
nil, nil,
) )
c.usagePrivateWorkingSetBytes = prometheus.NewDesc( c.usagePrivateWorkingSetBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "memory_usage_private_working_set_bytes"), prometheus.BuildFQName(types.Namespace, Name, "memory_usage_private_working_set_bytes"),
"Memory Usage Private Working Set Bytes", "Memory Usage Private Working Set Bytes",
[]string{"container_id"}, []string{"container_id", "namespace", "pod", "container"},
nil, nil,
) )
c.runtimeTotal = prometheus.NewDesc( c.runtimeTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "cpu_usage_seconds_total"), prometheus.BuildFQName(types.Namespace, Name, "cpu_usage_seconds_total"),
"Total Run time in Seconds", "Total Run time in Seconds",
[]string{"container_id"}, []string{"container_id", "namespace", "pod", "container"},
nil, nil,
) )
c.runtimeUser = prometheus.NewDesc( c.runtimeUser = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "cpu_usage_seconds_usermode"), prometheus.BuildFQName(types.Namespace, Name, "cpu_usage_seconds_usermode"),
"Run Time in User mode in Seconds", "Run Time in User mode in Seconds",
[]string{"container_id"}, []string{"container_id", "namespace", "pod", "container"},
nil, nil,
) )
c.runtimeKernel = prometheus.NewDesc( c.runtimeKernel = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "cpu_usage_seconds_kernelmode"), prometheus.BuildFQName(types.Namespace, Name, "cpu_usage_seconds_kernelmode"),
"Run time in Kernel mode in Seconds", "Run time in Kernel mode in Seconds",
[]string{"container_id"}, []string{"container_id", "namespace", "pod", "container"},
nil, nil,
) )
c.bytesReceived = prometheus.NewDesc( c.bytesReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "network_receive_bytes_total"), prometheus.BuildFQName(types.Namespace, Name, "network_receive_bytes_total"),
"Bytes Received on Interface", "Bytes Received on Interface",
[]string{"container_id", "interface"}, []string{"container_id", "namespace", "pod", "container", "interface"},
nil, nil,
) )
c.bytesSent = prometheus.NewDesc( c.bytesSent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "network_transmit_bytes_total"), prometheus.BuildFQName(types.Namespace, Name, "network_transmit_bytes_total"),
"Bytes Sent on Interface", "Bytes Sent on Interface",
[]string{"container_id", "interface"}, []string{"container_id", "namespace", "pod", "container", "interface"},
nil, nil,
) )
c.packetsReceived = prometheus.NewDesc( c.packetsReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "network_receive_packets_total"), prometheus.BuildFQName(types.Namespace, Name, "network_receive_packets_total"),
"Packets Received on Interface", "Packets Received on Interface",
[]string{"container_id", "interface"}, []string{"container_id", "namespace", "pod", "container", "interface"},
nil, nil,
) )
c.packetsSent = prometheus.NewDesc( c.packetsSent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "network_transmit_packets_total"), prometheus.BuildFQName(types.Namespace, Name, "network_transmit_packets_total"),
"Packets Sent on Interface", "Packets Sent on Interface",
[]string{"container_id", "interface"}, []string{"container_id", "namespace", "pod", "container", "interface"},
nil, nil,
) )
c.droppedPacketsIncoming = prometheus.NewDesc( c.droppedPacketsIncoming = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "network_receive_packets_dropped_total"), prometheus.BuildFQName(types.Namespace, Name, "network_receive_packets_dropped_total"),
"Dropped Incoming Packets on Interface", "Dropped Incoming Packets on Interface",
[]string{"container_id", "interface"}, []string{"container_id", "namespace", "pod", "container", "interface"},
nil, nil,
) )
c.droppedPacketsOutgoing = prometheus.NewDesc( c.droppedPacketsOutgoing = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "network_transmit_packets_dropped_total"), prometheus.BuildFQName(types.Namespace, Name, "network_transmit_packets_dropped_total"),
"Dropped Outgoing Packets on Interface", "Dropped Outgoing Packets on Interface",
[]string{"container_id", "interface"}, []string{"container_id", "namespace", "pod", "container", "interface"},
nil, nil,
) )
c.readCountNormalized = prometheus.NewDesc( c.readCountNormalized = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "storage_read_count_normalized_total"), prometheus.BuildFQName(types.Namespace, Name, "storage_read_count_normalized_total"),
"Read Count Normalized", "Read Count Normalized",
[]string{"container_id"}, []string{"container_id", "namespace", "pod", "container"},
nil, nil,
) )
c.readSizeBytes = prometheus.NewDesc( c.readSizeBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "storage_read_size_bytes_total"), prometheus.BuildFQName(types.Namespace, Name, "storage_read_size_bytes_total"),
"Read Size Bytes", "Read Size Bytes",
[]string{"container_id"}, []string{"container_id", "namespace", "pod", "container"},
nil, nil,
) )
c.writeCountNormalized = prometheus.NewDesc( c.writeCountNormalized = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "storage_write_count_normalized_total"), prometheus.BuildFQName(types.Namespace, Name, "storage_write_count_normalized_total"),
"Write Count Normalized", "Write Count Normalized",
[]string{"container_id"}, []string{"container_id", "namespace", "pod", "container"},
nil, nil,
) )
c.writeSizeBytes = prometheus.NewDesc( c.writeSizeBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "storage_write_size_bytes_total"), prometheus.BuildFQName(types.Namespace, Name, "storage_write_size_bytes_total"),
"Write Size Bytes", "Write Size Bytes",
[]string{"container_id"}, []string{"container_id", "namespace", "pod", "container"},
nil, nil,
) )
@@ -216,39 +292,91 @@ func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
// Collect sends the metric values for each metric // Collect sends the metric values for each metric
// to the provided prometheus Metric channel. // to the provided prometheus Metric channel.
func (c *Collector) Collect(ch chan<- prometheus.Metric) error { func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
errs := make([]error, 0)
if slices.Contains(c.config.CollectorsEnabled, subCollectorHCS) {
if err := c.collectHCS(ch); err != nil {
errs = append(errs, err)
}
}
if slices.Contains(c.config.CollectorsEnabled, subCollectorHostprocess) {
if err := c.collectJobContainers(ch); err != nil {
errs = append(errs, err)
}
}
return errors.Join(errs...)
}
func (c *Collector) collectHCS(ch chan<- prometheus.Metric) error {
// Types Container is passed to get the containers compute systems only // Types Container is passed to get the containers compute systems only
containers, err := hcsshim.GetContainers(hcsshim.ComputeSystemQuery{Types: []string{"Container"}}) containers, err := hcs.GetContainers()
if err != nil { if err != nil {
return fmt.Errorf("error in fetching containers: %w", err) return fmt.Errorf("error in fetching containers: %w", err)
} }
count := len(containers) count := len(containers)
ch <- prometheus.MustNewConstMetric(
c.containersCount,
prometheus.GaugeValue,
float64(count),
)
if count == 0 { if count == 0 {
ch <- prometheus.MustNewConstMetric(
c.containersCount,
prometheus.GaugeValue,
0,
)
return nil return nil
} }
containerPrefixes := make(map[string]string) var countersCount float64
collectErrors := make([]error, 0, len(containers))
for _, containerDetails := range containers { containerIDs := make([]string, 0, len(containers))
containerIdWithPrefix := getContainerIdWithPrefix(containerDetails) collectErrors := make([]error, 0)
if err = c.collectContainer(ch, containerDetails, containerIdWithPrefix); err != nil { for _, container := range containers {
if hcsshim.IsNotExist(err) { if container.State != "Running" {
continue
}
containerIDs = append(containerIDs, container.ID)
countersCount++
var (
namespace string
podName string
containerName string
)
if _, ok := c.annotationsCacheHCS[container.ID]; !ok {
if spec, err := c.getContainerAnnotations(container.ID); err == nil {
namespace = spec.Annotations["io.kubernetes.cri.sandbox-namespace"]
podName = spec.Annotations["io.kubernetes.cri.sandbox-name"]
containerName = spec.Annotations["io.kubernetes.cri.container-name"]
}
c.annotationsCacheHCS[container.ID] = containerInfo{
id: getContainerIdWithPrefix(container),
namespace: namespace,
pod: podName,
container: containerName,
}
}
if err = c.collectHCSContainer(ch, container, c.annotationsCacheHCS[container.ID]); err != nil {
if errors.Is(err, hcs.ErrIDNotFound) {
c.logger.Debug("err in fetching container statistics", c.logger.Debug("err in fetching container statistics",
slog.String("container_id", containerDetails.ID), slog.String("container_id", container.ID),
slog.String("container_name", c.annotationsCacheHCS[container.ID].container),
slog.String("container_pod_name", c.annotationsCacheHCS[container.ID].pod),
slog.String("container_namespace", c.annotationsCacheHCS[container.ID].namespace),
slog.Any("err", err), slog.Any("err", err),
) )
} else { } else {
c.logger.Error("err in fetching container statistics", c.logger.Error("err in fetching container statistics",
slog.String("container_id", containerDetails.ID), slog.String("container_id", container.ID),
slog.String("container_name", c.annotationsCacheHCS[container.ID].container),
slog.String("container_pod_name", c.annotationsCacheHCS[container.ID].pod),
slog.String("container_namespace", c.annotationsCacheHCS[container.ID].namespace),
slog.Any("err", err), slog.Any("err", err),
) )
@@ -257,14 +385,25 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
continue continue
} }
containerPrefixes[containerDetails.ID] = containerIdWithPrefix
} }
if err = c.collectNetworkMetrics(ch, containerPrefixes); err != nil { ch <- prometheus.MustNewConstMetric(
c.containersCount,
prometheus.GaugeValue,
countersCount,
)
if err = c.collectNetworkMetrics(ch); err != nil {
return fmt.Errorf("error in fetching container network statistics: %w", err) return fmt.Errorf("error in fetching container network statistics: %w", err)
} }
// Remove containers that are no longer running
for _, containerID := range c.annotationsCacheHCS {
if !slices.Contains(containerIDs, containerID.id) {
delete(c.annotationsCacheHCS, containerID.id)
}
}
if len(collectErrors) > 0 { if len(collectErrors) > 0 {
return fmt.Errorf("errors while fetching container statistics: %w", errors.Join(collectErrors...)) return fmt.Errorf("errors while fetching container statistics: %w", errors.Join(collectErrors...))
} }
@@ -272,117 +411,133 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
return nil return nil
} }
func (c *Collector) collectContainer(ch chan<- prometheus.Metric, containerDetails hcsshim.ContainerProperties, containerIdWithPrefix string) error { func (c *Collector) collectHCSContainer(ch chan<- prometheus.Metric, containerDetails hcs.Properties, containerInfo containerInfo) error {
container, err := hcsshim.OpenContainer(containerDetails.ID) // Skip if the container is a pause container
if err != nil { if containerInfo.pod != "" && containerInfo.container == "" {
return fmt.Errorf("error in opening container: %w", err) c.logger.Debug("skipping pause container",
slog.String("container_id", containerDetails.ID),
slog.String("container_name", containerInfo.container),
slog.String("pod_name", containerInfo.pod),
slog.String("namespace", containerInfo.namespace),
)
return nil
} }
defer func() { containerStats, err := hcs.GetContainerStatistics(containerDetails.ID)
if container == nil {
return
}
if err := container.Close(); err != nil {
c.logger.Error("error in closing container",
slog.Any("err", err),
)
}
}()
containerStats, err := container.Statistics()
if err != nil { if err != nil {
return fmt.Errorf("error in fetching container statistics: %w", err) return fmt.Errorf("error fetching container statistics: %w", err)
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.containerAvailable, c.containerAvailable,
prometheus.CounterValue, prometheus.GaugeValue,
1, 1,
containerIdWithPrefix, containerInfo.id, containerInfo.namespace, containerInfo.pod, containerInfo.container, "false",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.usageCommitBytes, c.usageCommitBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(containerStats.Memory.UsageCommitBytes), float64(containerStats.Memory.MemoryUsageCommitBytes),
containerIdWithPrefix,
containerInfo.id, containerInfo.namespace, containerInfo.pod, containerInfo.container,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.usageCommitPeakBytes, c.usageCommitPeakBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(containerStats.Memory.UsageCommitPeakBytes), float64(containerStats.Memory.MemoryUsageCommitPeakBytes),
containerIdWithPrefix,
containerInfo.id, containerInfo.namespace, containerInfo.pod, containerInfo.container,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.usagePrivateWorkingSetBytes, c.usagePrivateWorkingSetBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(containerStats.Memory.UsagePrivateWorkingSetBytes), float64(containerStats.Memory.MemoryUsagePrivateWorkingSetBytes),
containerIdWithPrefix,
containerInfo.id, containerInfo.namespace, containerInfo.pod, containerInfo.container,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.runtimeTotal, c.runtimeTotal,
prometheus.CounterValue, prometheus.CounterValue,
float64(containerStats.Processor.TotalRuntime100ns)*pdh.TicksToSecondScaleFactor, float64(containerStats.Processor.TotalRuntime100ns)*pdh.TicksToSecondScaleFactor,
containerIdWithPrefix,
containerInfo.id, containerInfo.namespace, containerInfo.pod, containerInfo.container,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.runtimeUser, c.runtimeUser,
prometheus.CounterValue, prometheus.CounterValue,
float64(containerStats.Processor.RuntimeUser100ns)*pdh.TicksToSecondScaleFactor, float64(containerStats.Processor.RuntimeUser100ns)*pdh.TicksToSecondScaleFactor,
containerIdWithPrefix,
containerInfo.id, containerInfo.namespace, containerInfo.pod, containerInfo.container,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.runtimeKernel, c.runtimeKernel,
prometheus.CounterValue, prometheus.CounterValue,
float64(containerStats.Processor.RuntimeKernel100ns)*pdh.TicksToSecondScaleFactor, float64(containerStats.Processor.RuntimeKernel100ns)*pdh.TicksToSecondScaleFactor,
containerIdWithPrefix,
containerInfo.id, containerInfo.namespace, containerInfo.pod, containerInfo.container,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.readCountNormalized, c.readCountNormalized,
prometheus.CounterValue, prometheus.CounterValue,
float64(containerStats.Storage.ReadCountNormalized), float64(containerStats.Storage.ReadCountNormalized),
containerIdWithPrefix,
containerInfo.id, containerInfo.namespace, containerInfo.pod, containerInfo.container,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.readSizeBytes, c.readSizeBytes,
prometheus.CounterValue, prometheus.CounterValue,
float64(containerStats.Storage.ReadSizeBytes), float64(containerStats.Storage.ReadSizeBytes),
containerIdWithPrefix,
containerInfo.id, containerInfo.namespace, containerInfo.pod, containerInfo.container,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.writeCountNormalized, c.writeCountNormalized,
prometheus.CounterValue, prometheus.CounterValue,
float64(containerStats.Storage.WriteCountNormalized), float64(containerStats.Storage.WriteCountNormalized),
containerIdWithPrefix,
containerInfo.id, containerInfo.namespace, containerInfo.pod, containerInfo.container,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.writeSizeBytes, c.writeSizeBytes,
prometheus.CounterValue, prometheus.CounterValue,
float64(containerStats.Storage.WriteSizeBytes), float64(containerStats.Storage.WriteSizeBytes),
containerIdWithPrefix,
containerInfo.id, containerInfo.namespace, containerInfo.pod, containerInfo.container,
) )
return nil return nil
} }
// collectNetworkMetrics collects network metrics for containers. // collectNetworkMetrics collects network metrics for containers.
// With HNSv2, the network stats must be collected from hcsshim.HNSListEndpointRequest. func (c *Collector) collectNetworkMetrics(ch chan<- prometheus.Metric) error {
// Network statistics from the container.Statistics() are providing data only, if HNSv1 is used. endpoints, err := hcn.ListEndpoints()
// Ref: https://github.com/prometheus-community/windows_exporter/pull/1218
func (c *Collector) collectNetworkMetrics(ch chan<- prometheus.Metric, containerPrefixes map[string]string) error {
hnsEndpoints, err := hcsshim.HNSListEndpointRequest()
if err != nil { if err != nil {
return fmt.Errorf("error in fetching HNS endpoints: %w", err) return fmt.Errorf("error in fetching HCN endpoints: %w", err)
} }
if len(hnsEndpoints) == 0 { if len(endpoints) == 0 {
return errors.New("no network stats for containers to collect") return nil
} }
for _, endpoint := range hnsEndpoints { for _, endpoint := range endpoints {
endpointStats, err := hcsshim.GetHNSEndpointStats(endpoint.Id) if len(endpoint.SharedContainers) == 0 {
continue
}
endpointStats, err := hcn.GetHNSEndpointStats(endpoint.ID)
if err != nil { if err != nil {
c.logger.Warn("Failed to collect network stats for interface "+endpoint.Id, c.logger.Warn("Failed to collect network stats for interface "+endpoint.ID,
slog.Any("err", err), slog.Any("err", err),
) )
@@ -390,52 +545,61 @@ func (c *Collector) collectNetworkMetrics(ch chan<- prometheus.Metric, container
} }
for _, containerId := range endpoint.SharedContainers { for _, containerId := range endpoint.SharedContainers {
containerIdWithPrefix, ok := containerPrefixes[containerId] containerInfo, ok := c.annotationsCacheHCS[containerId]
if !ok { if !ok {
c.logger.Debug("Failed to collect network stats for container " + containerId) c.logger.Debug("Unknown container " + containerId + " for endpoint " + endpoint.ID)
continue continue
} }
endpointId := strings.ToUpper(endpoint.Id) // Skip if the container is a pause container
if containerInfo.pod != "" && containerInfo.container == "" {
continue
}
endpointId := strings.ToUpper(endpoint.ID)
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.bytesReceived, c.bytesReceived,
prometheus.CounterValue, prometheus.CounterValue,
float64(endpointStats.BytesReceived), float64(endpointStats.BytesReceived),
containerIdWithPrefix, endpointId, containerInfo.id, containerInfo.namespace, containerInfo.pod, containerInfo.container, endpointId,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.bytesSent, c.bytesSent,
prometheus.CounterValue, prometheus.CounterValue,
float64(endpointStats.BytesSent), float64(endpointStats.BytesSent),
containerIdWithPrefix, endpointId, containerInfo.id, containerInfo.namespace, containerInfo.pod, containerInfo.container, endpointId,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.packetsReceived, c.packetsReceived,
prometheus.CounterValue, prometheus.CounterValue,
float64(endpointStats.PacketsReceived), float64(endpointStats.PacketsReceived),
containerIdWithPrefix, endpointId, containerInfo.id, containerInfo.namespace, containerInfo.pod, containerInfo.container, endpointId,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.packetsSent, c.packetsSent,
prometheus.CounterValue, prometheus.CounterValue,
float64(endpointStats.PacketsSent), float64(endpointStats.PacketsSent),
containerIdWithPrefix, endpointId, containerInfo.id, containerInfo.namespace, containerInfo.pod, containerInfo.container, endpointId,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.droppedPacketsIncoming, c.droppedPacketsIncoming,
prometheus.CounterValue, prometheus.CounterValue,
float64(endpointStats.DroppedPacketsIncoming), float64(endpointStats.DroppedPacketsIncoming),
containerIdWithPrefix, endpointId, containerInfo.id, containerInfo.namespace, containerInfo.pod, containerInfo.container, endpointId,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.droppedPacketsOutgoing, c.droppedPacketsOutgoing,
prometheus.CounterValue, prometheus.CounterValue,
float64(endpointStats.DroppedPacketsOutgoing), float64(endpointStats.DroppedPacketsOutgoing),
containerIdWithPrefix, endpointId, containerInfo.id, containerInfo.namespace, containerInfo.pod, containerInfo.container, endpointId,
) )
} }
} }
@@ -443,12 +607,317 @@ func (c *Collector) collectNetworkMetrics(ch chan<- prometheus.Metric, container
return nil return nil
} }
func getContainerIdWithPrefix(containerDetails hcsshim.ContainerProperties) string { // collectJobContainers collects container metrics for job containers.
switch containerDetails.Owner { // Job container based on Win32 Job objects.
// https://learn.microsoft.com/en-us/windows/win32/procthread/job-objects
//
// Job containers are containers that aren't managed by HCS, e.g host process containers.
func (c *Collector) collectJobContainers(ch chan<- prometheus.Metric) error {
containerDStateFS := os.DirFS(c.config.ContainerDStateDir)
allContainerIDs := make([]string, 0, len(c.annotationsCacheJob)+len(c.annotationsCacheHCS))
jobContainerIDs := make([]string, 0, len(allContainerIDs))
if err := fs.WalkDir(containerDStateFS, ".", func(path string, d fs.DirEntry, err error) error {
if err != nil {
if errors.Is(err, fs.ErrNotExist) {
c.logger.Warn("containerd state directory does not exist",
slog.String("path", c.config.ContainerDStateDir),
slog.Any("err", err),
)
return nil
}
return err
}
if path == "." {
return nil
}
if !d.IsDir() {
return nil
}
if _, err := os.Stat(path + "\\config.json"); err != nil {
containerID := strings.TrimPrefix(strings.Replace(path, c.config.ContainerDStateDir, "", 1), `\`)
if spec, err := c.getContainerAnnotations(containerID); err == nil {
isHostProcess, ok := spec.Annotations["microsoft.com/hostprocess-container"]
if ok && isHostProcess == "true" {
allContainerIDs = append(allContainerIDs, containerID)
if _, ok := c.annotationsCacheJob[containerID]; !ok {
var (
namespace string
podName string
containerName string
)
namespace = spec.Annotations["io.kubernetes.cri.sandbox-namespace"]
podName = spec.Annotations["io.kubernetes.cri.sandbox-name"]
containerName = spec.Annotations["io.kubernetes.cri.container-name"]
c.annotationsCacheJob[containerID] = containerInfo{
id: "containerd://" + containerID,
namespace: namespace,
pod: podName,
container: containerName,
}
}
}
}
}
// Skip the directory content
return fs.SkipDir
}); err != nil {
return fmt.Errorf("error in walking containerd state directory: %w", err)
}
errs := make([]error, 0)
for _, containerID := range allContainerIDs {
if err := c.collectJobContainer(ch, containerID); err != nil {
errs = append(errs, err)
} else {
jobContainerIDs = append(jobContainerIDs, containerID)
}
}
// Remove containers that are no longer running
for _, containerID := range c.annotationsCacheJob {
if !slices.Contains(jobContainerIDs, containerID.id) {
delete(c.annotationsCacheJob, containerID.id)
}
}
return errors.Join(errs...)
}
func (c *Collector) collectJobContainer(ch chan<- prometheus.Metric, containerID string) error {
jobObjectHandle, err := kernel32.OpenJobObject("Global\\JobContainer_" + containerID)
if err != nil {
if errors.Is(err, windows.ERROR_FILE_NOT_FOUND) {
return nil
}
return fmt.Errorf("error in opening job object: %w", err)
}
defer func(fd windows.Handle) {
_ = windows.Close(fd)
}(jobObjectHandle)
var jobInfo kernel32.JobObjectBasicAndIOAccountingInformation
if err = windows.QueryInformationJobObject(
jobObjectHandle,
windows.JobObjectBasicAndIoAccountingInformation,
uintptr(unsafe.Pointer(&jobInfo)),
uint32(unsafe.Sizeof(jobInfo)),
nil,
); err != nil {
return fmt.Errorf("error in querying job object information: %w", err)
}
var jobMemoryInfo kernel32.JobObjectMemoryUsageInformation
// https://github.com/microsoft/hcsshim/blob/bfb2a106798d3765666f6e39ec6cf0117275eab4/internal/jobobject/jobobject.go#L410
if err = windows.QueryInformationJobObject(
jobObjectHandle,
JobObjectMemoryUsageInformation,
uintptr(unsafe.Pointer(&jobMemoryInfo)),
uint32(unsafe.Sizeof(jobMemoryInfo)),
nil,
); err != nil {
return fmt.Errorf("error in querying job object memory usage information: %w", err)
}
privateWorkingSetBytes, err := calculatePrivateWorkingSetBytes(jobObjectHandle)
if err != nil {
c.logger.Debug("error in calculating private working set bytes", slog.Any("err", err))
}
containerInfo := c.annotationsCacheJob[containerID]
ch <- prometheus.MustNewConstMetric(
c.containerAvailable,
prometheus.GaugeValue,
1,
containerInfo.id, containerInfo.namespace, containerInfo.pod, containerInfo.container, "true",
)
ch <- prometheus.MustNewConstMetric(
c.usageCommitBytes,
prometheus.GaugeValue,
float64(jobMemoryInfo.JobMemory),
containerInfo.id, containerInfo.namespace, containerInfo.pod, containerInfo.container,
)
ch <- prometheus.MustNewConstMetric(
c.usageCommitPeakBytes,
prometheus.GaugeValue,
float64(jobMemoryInfo.PeakJobMemoryUsed),
containerInfo.id, containerInfo.namespace, containerInfo.pod, containerInfo.container,
)
ch <- prometheus.MustNewConstMetric(
c.usagePrivateWorkingSetBytes,
prometheus.GaugeValue,
float64(privateWorkingSetBytes),
containerInfo.id, containerInfo.namespace, containerInfo.pod, containerInfo.container,
)
ch <- prometheus.MustNewConstMetric(
c.runtimeTotal,
prometheus.CounterValue,
(float64(jobInfo.BasicInfo.ThisPeriodTotalKernelTime)+float64(jobInfo.BasicInfo.ThisPeriodTotalUserTime))*pdh.TicksToSecondScaleFactor,
containerInfo.id, containerInfo.namespace, containerInfo.pod, containerInfo.container,
)
ch <- prometheus.MustNewConstMetric(
c.runtimeUser,
prometheus.CounterValue,
float64(jobInfo.BasicInfo.ThisPeriodTotalUserTime)*pdh.TicksToSecondScaleFactor,
containerInfo.id, containerInfo.namespace, containerInfo.pod, containerInfo.container,
)
ch <- prometheus.MustNewConstMetric(
c.runtimeKernel,
prometheus.CounterValue,
float64(jobInfo.BasicInfo.ThisPeriodTotalKernelTime)*pdh.TicksToSecondScaleFactor,
containerInfo.id, containerInfo.namespace, containerInfo.pod, containerInfo.container,
)
ch <- prometheus.MustNewConstMetric(
c.readCountNormalized,
prometheus.CounterValue,
float64(jobInfo.IoInfo.ReadOperationCount),
containerInfo.id, containerInfo.namespace, containerInfo.pod, containerInfo.container,
)
ch <- prometheus.MustNewConstMetric(
c.readSizeBytes,
prometheus.CounterValue,
float64(jobInfo.IoInfo.ReadTransferCount),
containerInfo.id, containerInfo.namespace, containerInfo.pod, containerInfo.container,
)
ch <- prometheus.MustNewConstMetric(
c.writeCountNormalized,
prometheus.CounterValue,
float64(jobInfo.IoInfo.WriteOperationCount),
containerInfo.id, containerInfo.namespace, containerInfo.pod, containerInfo.container,
)
ch <- prometheus.MustNewConstMetric(
c.writeSizeBytes,
prometheus.CounterValue,
float64(jobInfo.IoInfo.WriteTransferCount),
containerInfo.id, containerInfo.namespace, containerInfo.pod, containerInfo.container,
)
return nil
}
func getContainerIdWithPrefix(container hcs.Properties) string {
switch container.Owner {
case "containerd-shim-runhcs-v1.exe": case "containerd-shim-runhcs-v1.exe":
return "containerd://" + containerDetails.ID return "containerd://" + container.ID
default: default:
// default to docker or if owner is not set // default to docker or if owner is not set
return "docker://" + containerDetails.ID return "docker://" + container.ID
} }
} }
func (c *Collector) getContainerAnnotations(containerID string) (ociSpec, error) {
configJSON, err := os.OpenFile(fmt.Sprintf(`%s%s\config.json`, c.config.ContainerDStateDir, containerID), os.O_RDONLY, 0)
if err != nil {
return ociSpec{}, fmt.Errorf("error in opening config.json file: %w", err)
}
var annotations ociSpec
if err = json.NewDecoder(configJSON).Decode(&annotations); err != nil {
return ociSpec{}, fmt.Errorf("error in decoding config.json file: %w", err)
}
return annotations, nil
}
func calculatePrivateWorkingSetBytes(jobObjectHandle windows.Handle) (uint64, error) {
var pidList kernel32.JobObjectBasicProcessIDList
retLen := uint32(unsafe.Sizeof(pidList))
if err := windows.QueryInformationJobObject(
jobObjectHandle,
windows.JobObjectBasicProcessIdList,
uintptr(unsafe.Pointer(&pidList)),
retLen, &retLen); err != nil {
return 0, err
}
var (
privateWorkingSetBytes uint64
vmCounters kernel32.PROCESS_VM_COUNTERS
)
retLen = uint32(unsafe.Sizeof(vmCounters))
getMemoryStats := func(pid uint32) (uint64, error) {
processHandle, err := windows.OpenProcess(windows.PROCESS_QUERY_LIMITED_INFORMATION, false, pid)
if err != nil {
return 0, fmt.Errorf("error in opening process: %w", err)
}
defer func(fd windows.Handle) {
_ = windows.Close(fd)
}(processHandle)
var isInJob bool
if err := kernel32.IsProcessInJob(processHandle, jobObjectHandle, &isInJob); err != nil {
return 0, fmt.Errorf("error in checking if process is in job: %w", err)
}
if !isInJob {
return 0, nil
}
if err := windows.NtQueryInformationProcess(
processHandle,
windows.ProcessVmCounters,
unsafe.Pointer(&vmCounters),
retLen,
&retLen,
); err != nil {
return 0, fmt.Errorf("error in querying process information: %w", err)
}
return uint64(vmCounters.PrivateWorkingSetSize), nil
}
for _, pid := range pidList.PIDs() {
privateWorkingSetSize, err := getMemoryStats(pid)
if err != nil {
return 0, fmt.Errorf("error in getting private working set bytes: %w", err)
}
privateWorkingSetBytes += privateWorkingSetSize
}
return privateWorkingSetBytes, nil
}

View File

@@ -1,4 +1,6 @@
// Copyright 2024 The Prometheus Authors // SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at

View File

@@ -1,4 +1,6 @@
// Copyright 2024 The Prometheus Authors // SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
@@ -88,16 +90,9 @@ func (c *Collector) Close() error {
return nil return nil
} }
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error { func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
var err error
c.mu = sync.Mutex{} c.mu = sync.Mutex{}
c.perfDataCollector, err = pdh.NewCollector[perfDataCounterValues](pdh.CounterTypeRaw, "Processor Information", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create Processor Information collector: %w", err)
}
c.logicalProcessors = prometheus.NewDesc( c.logicalProcessors = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "logical_processor"), prometheus.BuildFQName(types.Namespace, Name, "logical_processor"),
"Total number of logical processors", "Total number of logical processors",
@@ -186,6 +181,13 @@ func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
c.processorRTCValues = map[string]utils.Counter{} c.processorRTCValues = map[string]utils.Counter{}
c.processorMPerfValues = map[string]utils.Counter{} c.processorMPerfValues = map[string]utils.Counter{}
var err error
c.perfDataCollector, err = pdh.NewCollector[perfDataCounterValues](logger.With(slog.String("collector", Name)), pdh.CounterTypeRaw, "Processor Information", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create Processor Information collector: %w", err)
}
return nil return nil
} }
@@ -232,12 +234,14 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
coreData.C1TimeSeconds, coreData.C1TimeSeconds,
core, "c1", core, "c1",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.cStateSecondsTotal, c.cStateSecondsTotal,
prometheus.CounterValue, prometheus.CounterValue,
coreData.C2TimeSeconds, coreData.C2TimeSeconds,
core, "c2", core, "c2",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.cStateSecondsTotal, c.cStateSecondsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -251,24 +255,28 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
coreData.IdleTimeSeconds, coreData.IdleTimeSeconds,
core, "idle", core, "idle",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.timeTotal, c.timeTotal,
prometheus.CounterValue, prometheus.CounterValue,
coreData.InterruptTimeSeconds, coreData.InterruptTimeSeconds,
core, "interrupt", core, "interrupt",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.timeTotal, c.timeTotal,
prometheus.CounterValue, prometheus.CounterValue,
coreData.DpcTimeSeconds, coreData.DpcTimeSeconds,
core, "dpc", core, "dpc",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.timeTotal, c.timeTotal,
prometheus.CounterValue, prometheus.CounterValue,
coreData.PrivilegedTimeSeconds, coreData.PrivilegedTimeSeconds,
core, "privileged", core, "privileged",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.timeTotal, c.timeTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -282,18 +290,21 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
coreData.InterruptsTotal, coreData.InterruptsTotal,
core, core,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.dpcsTotal, c.dpcsTotal,
prometheus.CounterValue, prometheus.CounterValue,
coreData.DpcQueuedPerSecond, coreData.DpcQueuedPerSecond,
core, core,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.clockInterruptsTotal, c.clockInterruptsTotal,
prometheus.CounterValue, prometheus.CounterValue,
coreData.ClockInterruptsTotal, coreData.ClockInterruptsTotal,
core, core,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.idleBreakEventsTotal, c.idleBreakEventsTotal,
prometheus.CounterValue, prometheus.CounterValue,
@@ -314,30 +325,35 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
coreData.ProcessorFrequencyMHz, coreData.ProcessorFrequencyMHz,
core, core,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.processorPerformance, c.processorPerformance,
prometheus.CounterValue, prometheus.CounterValue,
coreData.ProcessorPerformance, coreData.ProcessorPerformance,
core, core,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.processorMPerf, c.processorMPerf,
prometheus.CounterValue, prometheus.CounterValue,
counterProcessorMPerfValues.Value(), counterProcessorMPerfValues.Value(),
core, core,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.processorRTC, c.processorRTC,
prometheus.CounterValue, prometheus.CounterValue,
counterProcessorRTCValues.Value(), counterProcessorRTCValues.Value(),
core, core,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.processorUtility, c.processorUtility,
prometheus.CounterValue, prometheus.CounterValue,
coreData.ProcessorUtilityRate, coreData.ProcessorUtilityRate,
core, core,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.processorPrivilegedUtility, c.processorPrivilegedUtility,
prometheus.CounterValue, prometheus.CounterValue,

View File

@@ -1,4 +1,6 @@
// Copyright 2024 The Prometheus Authors // SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at

View File

@@ -1,4 +1,6 @@
// Copyright 2024 The Prometheus Authors // SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at

View File

@@ -1,4 +1,6 @@
// Copyright 2024 The Prometheus Authors // SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
@@ -75,18 +77,6 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build(_ *slog.Logger, miSession *mi.Session) error { func (c *Collector) Build(_ *slog.Logger, miSession *mi.Session) error {
if miSession == nil {
return errors.New("miSession is nil")
}
miQuery, err := mi.NewQuery("SELECT Architecture, DeviceId, Description, Family, L2CacheSize, L3CacheSize, Name, ThreadCount, NumberOfCores, NumberOfEnabledCore, NumberOfLogicalProcessors FROM Win32_Processor")
if err != nil {
return fmt.Errorf("failed to create WMI query: %w", err)
}
c.miQuery = miQuery
c.miSession = miSession
c.cpuInfo = prometheus.NewDesc( c.cpuInfo = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, "", Name), prometheus.BuildFQName(types.Namespace, "", Name),
"Labelled CPU information as provided by Win32_Processor", "Labelled CPU information as provided by Win32_Processor",
@@ -148,6 +138,18 @@ func (c *Collector) Build(_ *slog.Logger, miSession *mi.Session) error {
nil, nil,
) )
if miSession == nil {
return errors.New("miSession is nil")
}
miQuery, err := mi.NewQuery("SELECT Architecture, DeviceId, Description, Family, L2CacheSize, L3CacheSize, Name, ThreadCount, NumberOfCores, NumberOfEnabledCore, NumberOfLogicalProcessors FROM Win32_Processor")
if err != nil {
return fmt.Errorf("failed to create WMI query: %w", err)
}
c.miQuery = miQuery
c.miSession = miSession
var dst []miProcessor var dst []miProcessor
if err := c.miSession.Query(&dst, mi.NamespaceRootCIMv2, c.miQuery); err != nil { if err := c.miSession.Query(&dst, mi.NamespaceRootCIMv2, c.miQuery); err != nil {
return fmt.Errorf("WMI query failed: %w", err) return fmt.Errorf("WMI query failed: %w", err)
@@ -192,36 +194,42 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
strconv.Itoa(int(processor.Family)), strconv.Itoa(int(processor.Family)),
strings.TrimRight(processor.Name, " "), strings.TrimRight(processor.Name, " "),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.cpuCoreCount, c.cpuCoreCount,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(processor.NumberOfCores), float64(processor.NumberOfCores),
strings.TrimRight(processor.DeviceID, " "), strings.TrimRight(processor.DeviceID, " "),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.cpuEnabledCoreCount, c.cpuEnabledCoreCount,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(processor.NumberOfEnabledCore), float64(processor.NumberOfEnabledCore),
strings.TrimRight(processor.DeviceID, " "), strings.TrimRight(processor.DeviceID, " "),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.cpuLogicalProcessorsCount, c.cpuLogicalProcessorsCount,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(processor.NumberOfLogicalProcessors), float64(processor.NumberOfLogicalProcessors),
strings.TrimRight(processor.DeviceID, " "), strings.TrimRight(processor.DeviceID, " "),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.cpuThreadCount, c.cpuThreadCount,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(processor.ThreadCount), float64(processor.ThreadCount),
strings.TrimRight(processor.DeviceID, " "), strings.TrimRight(processor.DeviceID, " "),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.cpuL2CacheSize, c.cpuL2CacheSize,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(processor.L2CacheSize), float64(processor.L2CacheSize),
strings.TrimRight(processor.DeviceID, " "), strings.TrimRight(processor.DeviceID, " "),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.cpuL3CacheSize, c.cpuL3CacheSize,
prometheus.GaugeValue, prometheus.GaugeValue,

View File

@@ -1,4 +1,6 @@
// Copyright 2024 The Prometheus Authors // SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at

View File

@@ -1,155 +0,0 @@
// Copyright 2024 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build windows
package cs
import (
"log/slog"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/internal/headers/sysinfoapi"
"github.com/prometheus-community/windows_exporter/internal/mi"
"github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus"
)
const Name = "cs"
type Config struct{}
//nolint:gochecknoglobals
var ConfigDefaults = Config{}
// A Collector is a Prometheus Collector for WMI metrics.
type Collector struct {
config Config
// physicalMemoryBytes
// Deprecated: Use windows_physical_memory_total_bytes instead
physicalMemoryBytes *prometheus.Desc
// logicalProcessors
// Deprecated: Use windows_cpu_logical_processor instead
logicalProcessors *prometheus.Desc
// hostname
// Deprecated: Use windows_os_hostname instead
hostname *prometheus.Desc
}
func New(config *Config) *Collector {
if config == nil {
config = &ConfigDefaults
}
c := &Collector{
config: *config,
}
return c
}
func NewWithFlags(_ *kingpin.Application) *Collector {
return &Collector{}
}
func (c *Collector) GetName() string {
return Name
}
func (c *Collector) Close() error {
return nil
}
func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
logger.Warn("The cs collector is deprecated and will be removed in a future release. " +
"Logical processors has been moved to cpu_info collector. " +
"Physical memory has been moved to memory collector. " +
"Hostname has been moved to os collector.")
c.logicalProcessors = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "logical_processors"),
"Deprecated: Use windows_cpu_logical_processor instead",
nil,
nil,
)
c.physicalMemoryBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "physical_memory_bytes"),
"Deprecated: Use windows_physical_memory_total_bytes instead",
nil,
nil,
)
c.hostname = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "hostname"),
"Deprecated: Use windows_os_hostname instead",
[]string{
"hostname",
"domain",
"fqdn",
},
nil,
)
return nil
}
// Collect sends the metric values for each metric
// to the provided prometheus Metric channel.
func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
// Get systeminfo for number of processors
systemInfo := sysinfoapi.GetSystemInfo()
// Get memory status for physical memory
mem, err := sysinfoapi.GlobalMemoryStatusEx()
if err != nil {
return err
}
ch <- prometheus.MustNewConstMetric(
c.logicalProcessors,
prometheus.GaugeValue,
float64(systemInfo.NumberOfProcessors),
)
ch <- prometheus.MustNewConstMetric(
c.physicalMemoryBytes,
prometheus.GaugeValue,
float64(mem.TotalPhys),
)
hostname, err := sysinfoapi.GetComputerName(sysinfoapi.ComputerNameDNSHostname)
if err != nil {
return err
}
domain, err := sysinfoapi.GetComputerName(sysinfoapi.ComputerNameDNSDomain)
if err != nil {
return err
}
fqdn, err := sysinfoapi.GetComputerName(sysinfoapi.ComputerNameDNSFullyQualified)
if err != nil {
return err
}
ch <- prometheus.MustNewConstMetric(
c.hostname,
prometheus.GaugeValue,
1.0,
hostname,
domain,
fqdn,
)
return nil
}

View File

@@ -1,4 +1,6 @@
// Copyright 2024 The Prometheus Authors // SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
@@ -32,7 +34,7 @@ import (
const Name = "dfsr" const Name = "dfsr"
type Config struct { type Config struct {
CollectorsEnabled []string `yaml:"collectors_enabled"` CollectorsEnabled []string `yaml:"sources-enabled"`
} }
//nolint:gochecknoglobals //nolint:gochecknoglobals
@@ -160,29 +162,6 @@ func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
logger.Info("dfsr collector is in an experimental state! Metrics for this collector have not been tested.") logger.Info("dfsr collector is in an experimental state! Metrics for this collector have not been tested.")
var err error
if slices.Contains(c.config.CollectorsEnabled, "connection") {
c.perfDataCollectorConnection, err = pdh.NewCollector[perfDataCounterValuesConnection](pdh.CounterTypeRaw, "DFS Replication Connections", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create DFS Replication Connections collector: %w", err)
}
}
if slices.Contains(c.config.CollectorsEnabled, "folder") {
c.perfDataCollectorFolder, err = pdh.NewCollector[perfDataCounterValuesFolder](pdh.CounterTypeRaw, "DFS Replicated Folders", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create DFS Replicated Folders collector: %w", err)
}
}
if slices.Contains(c.config.CollectorsEnabled, "volume") {
c.perfDataCollectorVolume, err = pdh.NewCollector[perfDataCounterValuesVolume](pdh.CounterTypeRaw, "DFS Replication Service Volumes", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create DFS Replication Service Volumes collector: %w", err)
}
}
// connection // connection
c.connectionBandwidthSavingsUsingDFSReplicationTotal = prometheus.NewDesc( c.connectionBandwidthSavingsUsingDFSReplicationTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "connection_bandwidth_savings_using_dfs_replication_bytes_total"), prometheus.BuildFQName(types.Namespace, Name, "connection_bandwidth_savings_using_dfs_replication_bytes_total"),
@@ -473,13 +452,36 @@ func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
nil, nil,
) )
var err error
if slices.Contains(c.config.CollectorsEnabled, "connection") {
c.perfDataCollectorConnection, err = pdh.NewCollector[perfDataCounterValuesConnection](logger.With(slog.String("collector", Name)), pdh.CounterTypeRaw, "DFS Replication Connections", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create DFS Replication Connections collector: %w", err)
}
}
if slices.Contains(c.config.CollectorsEnabled, "folder") {
c.perfDataCollectorFolder, err = pdh.NewCollector[perfDataCounterValuesFolder](logger.With(slog.String("collector", Name)), pdh.CounterTypeRaw, "DFS Replicated Folders", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create DFS Replicated Folders collector: %w", err)
}
}
if slices.Contains(c.config.CollectorsEnabled, "volume") {
c.perfDataCollectorVolume, err = pdh.NewCollector[perfDataCounterValuesVolume](logger.With(slog.String("collector", Name)), pdh.CounterTypeRaw, "DFS Replication Service Volumes", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create DFS Replication Service Volumes collector: %w", err)
}
}
return nil return nil
} }
// Collect implements the Collector interface. // Collect implements the Collector interface.
// Sends metric values for each metric to the provided prometheus Metric channel. // Sends metric values for each metric to the provided prometheus Metric channel.
func (c *Collector) Collect(ch chan<- prometheus.Metric) error { func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
errs := make([]error, 0, 3) errs := make([]error, 0)
if slices.Contains(c.config.CollectorsEnabled, "connection") { if slices.Contains(c.config.CollectorsEnabled, "connection") {
errs = append(errs, c.collectPDHConnection(ch)) errs = append(errs, c.collectPDHConnection(ch))

View File

@@ -1,4 +1,6 @@
// Copyright 2024 The Prometheus Authors // SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at

View File

@@ -1,4 +1,6 @@
// Copyright 2024 The Prometheus Authors // SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at

View File

@@ -1,4 +1,6 @@
// Copyright 2024 The Prometheus Authors // SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
@@ -16,27 +18,46 @@
package dhcp package dhcp
import ( import (
"errors"
"fmt" "fmt"
"log/slog" "log/slog"
"slices"
"strconv"
"strings"
"github.com/alecthomas/kingpin/v2" "github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/internal/headers/dhcpsapi"
"github.com/prometheus-community/windows_exporter/internal/mi" "github.com/prometheus-community/windows_exporter/internal/mi"
"github.com/prometheus-community/windows_exporter/internal/pdh" "github.com/prometheus-community/windows_exporter/internal/pdh"
"github.com/prometheus-community/windows_exporter/internal/types" "github.com/prometheus-community/windows_exporter/internal/types"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
) )
const Name = "dhcp" const (
Name = "dhcp"
type Config struct{} subCollectorServerMetrics = "server_metrics"
subCollectorScopeMetrics = "scope_metrics"
)
type Config struct {
CollectorsEnabled []string `yaml:"enabled"`
}
//nolint:gochecknoglobals //nolint:gochecknoglobals
var ConfigDefaults = Config{} var ConfigDefaults = Config{
CollectorsEnabled: []string{
subCollectorServerMetrics,
subCollectorScopeMetrics,
},
}
// A Collector is a Prometheus Collector perflib DHCP metrics. // A Collector is a Prometheus Collector perflib DHCP metrics.
type Collector struct { type Collector struct {
config Config config Config
logger *slog.Logger
perfDataCollector *pdh.Collector perfDataCollector *pdh.Collector
perfDataObject []perfDataCounterValues perfDataObject []perfDataCounterValues
@@ -65,6 +86,17 @@ type Collector struct {
packetsReceivedTotal *prometheus.Desc packetsReceivedTotal *prometheus.Desc
releasesTotal *prometheus.Desc releasesTotal *prometheus.Desc
requestsTotal *prometheus.Desc requestsTotal *prometheus.Desc
scopeInfo *prometheus.Desc
scopeState *prometheus.Desc
scopeAddressesFreeTotal *prometheus.Desc
scopeAddressesFreeOnPartnerServerTotal *prometheus.Desc
scopeAddressesFreeOnThisServerTotal *prometheus.Desc
scopeAddressesInUseTotal *prometheus.Desc
scopeAddressesInUseOnPartnerServerTotal *prometheus.Desc
scopeAddressesInUseOnThisServerTotal *prometheus.Desc
scopePendingOffersTotal *prometheus.Desc
scopeReservedAddressTotal *prometheus.Desc
} }
func New(config *Config) *Collector { func New(config *Config) *Collector {
@@ -72,6 +104,10 @@ func New(config *Config) *Collector {
config = &ConfigDefaults config = &ConfigDefaults
} }
if config.CollectorsEnabled == nil {
config.CollectorsEnabled = ConfigDefaults.CollectorsEnabled
}
c := &Collector{ c := &Collector{
config: *config, config: *config,
} }
@@ -79,8 +115,26 @@ func New(config *Config) *Collector {
return c return c
} }
func NewWithFlags(_ *kingpin.Application) *Collector { func NewWithFlags(app *kingpin.Application) *Collector {
return &Collector{} c := &Collector{
config: ConfigDefaults,
}
c.config.CollectorsEnabled = make([]string, 0)
var collectorsEnabled string
app.Flag(
"collector.dhcp.enabled",
"Comma-separated list of collectors to use. Defaults to all, if not specified.",
).Default(strings.Join(ConfigDefaults.CollectorsEnabled, ",")).StringVar(&collectorsEnabled)
app.Action(func(*kingpin.ParseContext) error {
c.config.CollectorsEnabled = strings.Split(collectorsEnabled, ",")
return nil
})
return c
} }
func (c *Collector) GetName() string { func (c *Collector) GetName() string {
@@ -88,177 +142,275 @@ func (c *Collector) GetName() string {
} }
func (c *Collector) Close() error { func (c *Collector) Close() error {
c.perfDataCollector.Close() if slices.Contains(c.config.CollectorsEnabled, subCollectorServerMetrics) {
c.perfDataCollector.Close()
}
return nil return nil
} }
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error { func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
c.logger = logger.With(slog.String("collector", Name))
var err error var err error
c.perfDataCollector, err = pdh.NewCollector[perfDataCounterValues](pdh.CounterTypeRaw, "DHCP Server", nil) if slices.Contains(c.config.CollectorsEnabled, subCollectorScopeMetrics) {
if err != nil { c.scopeInfo = prometheus.NewDesc(
return fmt.Errorf("failed to create DHCP Server collector: %w", err) prometheus.BuildFQName(types.Namespace, Name, "scope_info"),
"DHCP Scope information",
[]string{"name", "superscope_name", "superscope_id", "scope"},
nil,
)
c.scopeState = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "scope_state"),
"DHCP Scope state",
[]string{"scope", "state"},
nil,
)
c.scopeAddressesFreeTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "scope_addresses_free"),
"DHCP Scope free addresses",
[]string{"scope"},
nil,
)
c.scopeAddressesFreeOnPartnerServerTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "scope_addresses_free_on_partner_server"),
"DHCP Scope free addresses on partner server",
[]string{"scope"},
nil,
)
c.scopeAddressesFreeOnThisServerTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "scope_addresses_free_on_this_server"),
"DHCP Scope free addresses on this server",
[]string{"scope"},
nil,
)
c.scopeAddressesInUseTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "scope_addresses_in_use"),
"DHCP Scope addresses in use",
[]string{"scope"},
nil,
)
c.scopeAddressesInUseOnPartnerServerTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "scope_addresses_in_use_on_partner_server"),
"DHCP Scope addresses in use on partner server",
[]string{"scope"},
nil,
)
c.scopeAddressesInUseOnThisServerTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "scope_addresses_in_use_on_this_server"),
"DHCP Scope addresses in use on this server",
[]string{"scope"},
nil,
)
c.scopePendingOffersTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "scope_pending_offers"),
"DHCP Scope pending offers",
[]string{"scope"},
nil,
)
c.scopeReservedAddressTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "scope_reserved_address"),
"DHCP Scope reserved addresses",
[]string{"scope"},
nil,
)
} }
c.packetsReceivedTotal = prometheus.NewDesc( if slices.Contains(c.config.CollectorsEnabled, subCollectorServerMetrics) {
prometheus.BuildFQName(types.Namespace, Name, "packets_received_total"), c.packetsReceivedTotal = prometheus.NewDesc(
"Total number of packets received by the DHCP server (PacketsReceivedTotal)", prometheus.BuildFQName(types.Namespace, Name, "packets_received_total"),
nil, "Total number of packets received by the DHCP server (PacketsReceivedTotal)",
nil, nil,
) nil,
c.duplicatesDroppedTotal = prometheus.NewDesc( )
prometheus.BuildFQName(types.Namespace, Name, "duplicates_dropped_total"), c.duplicatesDroppedTotal = prometheus.NewDesc(
"Total number of duplicate packets received by the DHCP server (DuplicatesDroppedTotal)", prometheus.BuildFQName(types.Namespace, Name, "duplicates_dropped_total"),
nil, "Total number of duplicate packets received by the DHCP server (DuplicatesDroppedTotal)",
nil, nil,
) nil,
c.packetsExpiredTotal = prometheus.NewDesc( )
prometheus.BuildFQName(types.Namespace, Name, "packets_expired_total"), c.packetsExpiredTotal = prometheus.NewDesc(
"Total number of packets expired in the DHCP server message queue (PacketsExpiredTotal)", prometheus.BuildFQName(types.Namespace, Name, "packets_expired_total"),
nil, "Total number of packets expired in the DHCP server message queue (PacketsExpiredTotal)",
nil, nil,
) nil,
c.activeQueueLength = prometheus.NewDesc( )
prometheus.BuildFQName(types.Namespace, Name, "active_queue_length"), c.activeQueueLength = prometheus.NewDesc(
"Number of packets in the processing queue of the DHCP server (ActiveQueueLength)", prometheus.BuildFQName(types.Namespace, Name, "active_queue_length"),
nil, "Number of packets in the processing queue of the DHCP server (ActiveQueueLength)",
nil, nil,
) nil,
c.conflictCheckQueueLength = prometheus.NewDesc( )
prometheus.BuildFQName(types.Namespace, Name, "conflict_check_queue_length"), c.conflictCheckQueueLength = prometheus.NewDesc(
"Number of packets in the DHCP server queue waiting on conflict detection (ping). (ConflictCheckQueueLength)", prometheus.BuildFQName(types.Namespace, Name, "conflict_check_queue_length"),
nil, "Number of packets in the DHCP server queue waiting on conflict detection (ping). (ConflictCheckQueueLength)",
nil, nil,
) nil,
c.discoversTotal = prometheus.NewDesc( )
prometheus.BuildFQName(types.Namespace, Name, "discovers_total"), c.discoversTotal = prometheus.NewDesc(
"Total DHCP Discovers received by the DHCP server (DiscoversTotal)", prometheus.BuildFQName(types.Namespace, Name, "discovers_total"),
nil, "Total DHCP Discovers received by the DHCP server (DiscoversTotal)",
nil, nil,
) nil,
c.offersTotal = prometheus.NewDesc( )
prometheus.BuildFQName(types.Namespace, Name, "offers_total"), c.offersTotal = prometheus.NewDesc(
"Total DHCP Offers sent by the DHCP server (OffersTotal)", prometheus.BuildFQName(types.Namespace, Name, "offers_total"),
nil, "Total DHCP Offers sent by the DHCP server (OffersTotal)",
nil, nil,
) nil,
c.requestsTotal = prometheus.NewDesc( )
prometheus.BuildFQName(types.Namespace, Name, "requests_total"), c.requestsTotal = prometheus.NewDesc(
"Total DHCP Requests received by the DHCP server (RequestsTotal)", prometheus.BuildFQName(types.Namespace, Name, "requests_total"),
nil, "Total DHCP Requests received by the DHCP server (RequestsTotal)",
nil, nil,
) nil,
c.informsTotal = prometheus.NewDesc( )
prometheus.BuildFQName(types.Namespace, Name, "informs_total"), c.informsTotal = prometheus.NewDesc(
"Total DHCP Informs received by the DHCP server (InformsTotal)", prometheus.BuildFQName(types.Namespace, Name, "informs_total"),
nil, "Total DHCP Informs received by the DHCP server (InformsTotal)",
nil, nil,
) nil,
c.acksTotal = prometheus.NewDesc( )
prometheus.BuildFQName(types.Namespace, Name, "acks_total"), c.acksTotal = prometheus.NewDesc(
"Total DHCP Acks sent by the DHCP server (AcksTotal)", prometheus.BuildFQName(types.Namespace, Name, "acks_total"),
nil, "Total DHCP Acks sent by the DHCP server (AcksTotal)",
nil, nil,
) nil,
c.nACKsTotal = prometheus.NewDesc( )
prometheus.BuildFQName(types.Namespace, Name, "nacks_total"), c.nACKsTotal = prometheus.NewDesc(
"Total DHCP Nacks sent by the DHCP server (NacksTotal)", prometheus.BuildFQName(types.Namespace, Name, "nacks_total"),
nil, "Total DHCP Nacks sent by the DHCP server (NacksTotal)",
nil, nil,
) nil,
c.declinesTotal = prometheus.NewDesc( )
prometheus.BuildFQName(types.Namespace, Name, "declines_total"), c.declinesTotal = prometheus.NewDesc(
"Total DHCP Declines received by the DHCP server (DeclinesTotal)", prometheus.BuildFQName(types.Namespace, Name, "declines_total"),
nil, "Total DHCP Declines received by the DHCP server (DeclinesTotal)",
nil, nil,
) nil,
c.releasesTotal = prometheus.NewDesc( )
prometheus.BuildFQName(types.Namespace, Name, "releases_total"), c.releasesTotal = prometheus.NewDesc(
"Total DHCP Releases received by the DHCP server (ReleasesTotal)", prometheus.BuildFQName(types.Namespace, Name, "releases_total"),
nil, "Total DHCP Releases received by the DHCP server (ReleasesTotal)",
nil, nil,
) nil,
c.offerQueueLength = prometheus.NewDesc( )
prometheus.BuildFQName(types.Namespace, Name, "offer_queue_length"), c.offerQueueLength = prometheus.NewDesc(
"Number of packets in the offer queue of the DHCP server (OfferQueueLength)", prometheus.BuildFQName(types.Namespace, Name, "offer_queue_length"),
nil, "Number of packets in the offer queue of the DHCP server (OfferQueueLength)",
nil, nil,
) nil,
c.deniedDueToMatch = prometheus.NewDesc( )
prometheus.BuildFQName(types.Namespace, Name, "denied_due_to_match_total"), c.deniedDueToMatch = prometheus.NewDesc(
"Total number of DHCP requests denied, based on matches from the Deny list (DeniedDueToMatch)", prometheus.BuildFQName(types.Namespace, Name, "denied_due_to_match_total"),
nil, "Total number of DHCP requests denied, based on matches from the Deny list (DeniedDueToMatch)",
nil, nil,
) nil,
c.deniedDueToNonMatch = prometheus.NewDesc( )
prometheus.BuildFQName(types.Namespace, Name, "denied_due_to_nonmatch_total"), c.deniedDueToNonMatch = prometheus.NewDesc(
"Total number of DHCP requests denied, based on non-matches from the Allow list (DeniedDueToNonMatch)", prometheus.BuildFQName(types.Namespace, Name, "denied_due_to_nonmatch_total"),
nil, "Total number of DHCP requests denied, based on non-matches from the Allow list (DeniedDueToNonMatch)",
nil, nil,
) nil,
c.failoverBndUpdSentTotal = prometheus.NewDesc( )
prometheus.BuildFQName(types.Namespace, Name, "failover_bndupd_sent_total"), c.failoverBndUpdSentTotal = prometheus.NewDesc(
"Number of DHCP fail over Binding Update messages sent (FailoverBndupdSentTotal)", prometheus.BuildFQName(types.Namespace, Name, "failover_bndupd_sent_total"),
nil, "Number of DHCP fail over Binding Update messages sent (FailoverBndupdSentTotal)",
nil, nil,
) nil,
c.failoverBndUpdReceivedTotal = prometheus.NewDesc( )
prometheus.BuildFQName(types.Namespace, Name, "failover_bndupd_received_total"), c.failoverBndUpdReceivedTotal = prometheus.NewDesc(
"Number of DHCP fail over Binding Update messages received (FailoverBndupdReceivedTotal)", prometheus.BuildFQName(types.Namespace, Name, "failover_bndupd_received_total"),
nil, "Number of DHCP fail over Binding Update messages received (FailoverBndupdReceivedTotal)",
nil, nil,
) nil,
c.failoverBndAckSentTotal = prometheus.NewDesc( )
prometheus.BuildFQName(types.Namespace, Name, "failover_bndack_sent_total"), c.failoverBndAckSentTotal = prometheus.NewDesc(
"Number of DHCP fail over Binding Ack messages sent (FailoverBndackSentTotal)", prometheus.BuildFQName(types.Namespace, Name, "failover_bndack_sent_total"),
nil, "Number of DHCP fail over Binding Ack messages sent (FailoverBndackSentTotal)",
nil, nil,
) nil,
c.failoverBndAckReceivedTotal = prometheus.NewDesc( )
prometheus.BuildFQName(types.Namespace, Name, "failover_bndack_received_total"), c.failoverBndAckReceivedTotal = prometheus.NewDesc(
"Number of DHCP fail over Binding Ack messages received (FailoverBndackReceivedTotal)", prometheus.BuildFQName(types.Namespace, Name, "failover_bndack_received_total"),
nil, "Number of DHCP fail over Binding Ack messages received (FailoverBndackReceivedTotal)",
nil, nil,
) nil,
c.failoverBndUpdPendingOutboundQueue = prometheus.NewDesc( )
prometheus.BuildFQName(types.Namespace, Name, "failover_bndupd_pending_in_outbound_queue"), c.failoverBndUpdPendingOutboundQueue = prometheus.NewDesc(
"Number of pending outbound DHCP fail over Binding Update messages (FailoverBndupdPendingOutboundQueue)", prometheus.BuildFQName(types.Namespace, Name, "failover_bndupd_pending_in_outbound_queue"),
nil, "Number of pending outbound DHCP fail over Binding Update messages (FailoverBndupdPendingOutboundQueue)",
nil, nil,
) nil,
c.failoverTransitionsCommunicationInterruptedState = prometheus.NewDesc( )
prometheus.BuildFQName(types.Namespace, Name, "failover_transitions_communicationinterrupted_state_total"), c.failoverTransitionsCommunicationInterruptedState = prometheus.NewDesc(
"Total number of transitions into COMMUNICATION INTERRUPTED state (FailoverTransitionsCommunicationinterruptedState)", prometheus.BuildFQName(types.Namespace, Name, "failover_transitions_communicationinterrupted_state_total"),
nil, "Total number of transitions into COMMUNICATION INTERRUPTED state (FailoverTransitionsCommunicationinterruptedState)",
nil, nil,
) nil,
c.failoverTransitionsPartnerDownState = prometheus.NewDesc( )
prometheus.BuildFQName(types.Namespace, Name, "failover_transitions_partnerdown_state_total"), c.failoverTransitionsPartnerDownState = prometheus.NewDesc(
"Total number of transitions into PARTNER DOWN state (FailoverTransitionsPartnerdownState)", prometheus.BuildFQName(types.Namespace, Name, "failover_transitions_partnerdown_state_total"),
nil, "Total number of transitions into PARTNER DOWN state (FailoverTransitionsPartnerdownState)",
nil, nil,
) nil,
c.failoverTransitionsRecoverState = prometheus.NewDesc( )
prometheus.BuildFQName(types.Namespace, Name, "failover_transitions_recover_total"), c.failoverTransitionsRecoverState = prometheus.NewDesc(
"Total number of transitions into RECOVER state (FailoverTransitionsRecoverState)", prometheus.BuildFQName(types.Namespace, Name, "failover_transitions_recover_total"),
nil, "Total number of transitions into RECOVER state (FailoverTransitionsRecoverState)",
nil, nil,
) nil,
c.failoverBndUpdDropped = prometheus.NewDesc( )
prometheus.BuildFQName(types.Namespace, Name, "failover_bndupd_dropped_total"), c.failoverBndUpdDropped = prometheus.NewDesc(
"Total number of DHCP fail over Binding Updates dropped (FailoverBndupdDropped)", prometheus.BuildFQName(types.Namespace, Name, "failover_bndupd_dropped_total"),
nil, "Total number of DHCP fail over Binding Updates dropped (FailoverBndupdDropped)",
nil, nil,
) nil,
)
c.perfDataCollector, err = pdh.NewCollector[perfDataCounterValues](c.logger, pdh.CounterTypeRaw, "DHCP Server", nil)
if err != nil {
return fmt.Errorf("failed to create DHCP Server collector: %w", err)
}
}
return nil return nil
} }
func (c *Collector) Collect(ch chan<- prometheus.Metric) error { func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
var errs []error
if slices.Contains(c.config.CollectorsEnabled, subCollectorServerMetrics) {
if err := c.collectServerMetrics(ch); err != nil {
errs = append(errs, err)
}
}
if slices.Contains(c.config.CollectorsEnabled, subCollectorScopeMetrics) {
if err := c.collectScopeMetrics(ch); err != nil {
errs = append(errs, err)
}
}
return errors.Join(errs...)
}
func (c *Collector) collectServerMetrics(ch chan<- prometheus.Metric) error {
err := c.perfDataCollector.Collect(&c.perfDataObject) err := c.perfDataCollector.Collect(&c.perfDataObject)
if err != nil { if err != nil {
return fmt.Errorf("failed to collect DHCP Server metrics: %w", err) return fmt.Errorf("failed to collect DHCP Server metrics: %w", err)
} else if len(c.perfDataObject) == 0 {
return fmt.Errorf("failed to collect DHCP Server metrics: %w", types.ErrNoDataUnexpected)
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -413,3 +565,113 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
return nil return nil
} }
func (c *Collector) collectScopeMetrics(ch chan<- prometheus.Metric) error {
dhcpScopes, err := dhcpsapi.GetDHCPV4ScopeStatistics()
if err != nil {
return fmt.Errorf("failed to get DHCP scopes: %w", err)
}
for _, scope := range dhcpScopes {
scopeID := scope.ScopeIPAddress.String()
ch <- prometheus.MustNewConstMetric(
c.scopeInfo,
prometheus.GaugeValue,
1,
scope.Name,
scope.SuperScopeName,
strconv.Itoa(int(scope.SuperScopeNumber)),
scopeID,
)
for state, name := range dhcpsapi.DHCP_SUBNET_STATE_NAMES {
metric := 0.0
if state == scope.State {
metric = 1.0
}
ch <- prometheus.MustNewConstMetric(
c.scopeState,
prometheus.GaugeValue,
metric,
scopeID,
name,
)
}
if scope.AddressesFree != -1 {
ch <- prometheus.MustNewConstMetric(
c.scopeAddressesFreeTotal,
prometheus.GaugeValue,
scope.AddressesFree,
scopeID,
)
}
if scope.AddressesFreeOnPartnerServer != -1 {
ch <- prometheus.MustNewConstMetric(
c.scopeAddressesFreeOnPartnerServerTotal,
prometheus.GaugeValue,
scope.AddressesFreeOnPartnerServer,
scopeID,
)
}
if scope.AddressesFreeOnThisServer != -1 {
ch <- prometheus.MustNewConstMetric(
c.scopeAddressesFreeOnThisServerTotal,
prometheus.GaugeValue,
scope.AddressesFreeOnThisServer,
scopeID,
)
}
if scope.AddressesInUse != -1 {
ch <- prometheus.MustNewConstMetric(
c.scopeAddressesInUseTotal,
prometheus.GaugeValue,
scope.AddressesInUse,
scopeID,
)
}
if scope.AddressesInUseOnPartnerServer != -1 {
ch <- prometheus.MustNewConstMetric(
c.scopeAddressesInUseOnPartnerServerTotal,
prometheus.GaugeValue,
scope.AddressesInUseOnPartnerServer,
scopeID,
)
}
if scope.AddressesInUseOnThisServer != -1 {
ch <- prometheus.MustNewConstMetric(
c.scopeAddressesInUseOnThisServerTotal,
prometheus.GaugeValue,
scope.AddressesInUseOnThisServer,
scopeID,
)
}
if scope.PendingOffers != -1 {
ch <- prometheus.MustNewConstMetric(
c.scopePendingOffersTotal,
prometheus.GaugeValue,
scope.PendingOffers,
scopeID,
)
}
if scope.ReservedAddress != -1 {
ch <- prometheus.MustNewConstMetric(
c.scopeReservedAddressTotal,
prometheus.GaugeValue,
scope.ReservedAddress,
scopeID,
)
}
}
return nil
}

View File

@@ -1,4 +1,6 @@
// Copyright 2024 The Prometheus Authors // SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at

View File

@@ -1,4 +1,6 @@
// Copyright 2024 The Prometheus Authors // SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at

View File

@@ -1,4 +1,6 @@
// Copyright 2024 The Prometheus Authors // SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
@@ -36,7 +38,9 @@ var ConfigDefaults = Config{}
// A Collector is a Prometheus Collector for a few WMI metrics in Win32_DiskDrive. // A Collector is a Prometheus Collector for a few WMI metrics in Win32_DiskDrive.
type Collector struct { type Collector struct {
config Config config Config
logger *slog.Logger
miSession *mi.Session miSession *mi.Session
miQuery mi.Query miQuery mi.Query
@@ -71,18 +75,8 @@ func (c *Collector) Close() error {
return nil return nil
} }
func (c *Collector) Build(_ *slog.Logger, miSession *mi.Session) error { func (c *Collector) Build(logger *slog.Logger, miSession *mi.Session) error {
if miSession == nil { c.logger = logger.With(slog.String("collector", Name))
return errors.New("miSession is nil")
}
miQuery, err := mi.NewQuery("SELECT DeviceID, Model, Caption, Name, Partitions, Size, Status, Availability FROM WIN32_DiskDrive")
if err != nil {
return fmt.Errorf("failed to create WMI query: %w", err)
}
c.miQuery = miQuery
c.miSession = miSession
c.diskInfo = prometheus.NewDesc( c.diskInfo = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "info"), prometheus.BuildFQName(types.Namespace, Name, "info"),
@@ -120,6 +114,18 @@ func (c *Collector) Build(_ *slog.Logger, miSession *mi.Session) error {
nil, nil,
) )
if miSession == nil {
return errors.New("miSession is nil")
}
miQuery, err := mi.NewQuery("SELECT DeviceID, Model, Caption, Name, Partitions, Size, Status, Availability FROM WIN32_DiskDrive")
if err != nil {
return fmt.Errorf("failed to create WMI query: %w", err)
}
c.miQuery = miQuery
c.miSession = miSession
var dst []diskDrive var dst []diskDrive
if err := c.miSession.Query(&dst, mi.NamespaceRootCIMv2, c.miQuery); err != nil { if err := c.miSession.Query(&dst, mi.NamespaceRootCIMv2, c.miQuery); err != nil {
return fmt.Errorf("WMI query failed: %w", err) return fmt.Errorf("WMI query failed: %w", err)
@@ -146,7 +152,7 @@ var (
"Error", "Error",
"Degraded", "Degraded",
"Unknown", "Unknown",
"Pred fail", "Pred Fail",
"Starting", "Starting",
"Stopping", "Stopping",
"Service", "Service",
@@ -239,6 +245,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
if availNum == int(disk.Availability) { if availNum == int(disk.Availability) {
isCurrentState = 1.0 isCurrentState = 1.0
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.availability, c.availability,
prometheus.GaugeValue, prometheus.GaugeValue,

View File

@@ -1,4 +1,6 @@
// Copyright 2024 The Prometheus Authors // SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at

View File

@@ -1,4 +1,6 @@
// Copyright 2024 The Prometheus Authors // SPDX-License-Identifier: Apache-2.0
//
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
@@ -16,8 +18,11 @@
package dns package dns
import ( import (
"errors"
"fmt" "fmt"
"log/slog" "log/slog"
"slices"
"strings"
"github.com/alecthomas/kingpin/v2" "github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/internal/mi" "github.com/prometheus-community/windows_exporter/internal/mi"
@@ -26,12 +31,23 @@ import (
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
) )
const Name = "dns" const (
Name = "dns"
subCollectorMetrics = "metrics"
subCollectorWMIStats = "wmi_stats"
)
type Config struct{} type Config struct {
CollectorsEnabled []string `yaml:"enabled"`
}
//nolint:gochecknoglobals //nolint:gochecknoglobals
var ConfigDefaults = Config{} var ConfigDefaults = Config{
CollectorsEnabled: []string{
subCollectorMetrics,
subCollectorWMIStats,
},
}
// A Collector is a Prometheus Collector for WMI Win32_PerfRawData_DNS_DNS metrics. // A Collector is a Prometheus Collector for WMI Win32_PerfRawData_DNS_DNS metrics.
type Collector struct { type Collector struct {
@@ -40,6 +56,9 @@ type Collector struct {
perfDataCollector *pdh.Collector perfDataCollector *pdh.Collector
perfDataObject []perfDataCounterValues perfDataObject []perfDataCounterValues
miSession *mi.Session
miQuery mi.Query
dynamicUpdatesFailures *prometheus.Desc dynamicUpdatesFailures *prometheus.Desc
dynamicUpdatesQueued *prometheus.Desc dynamicUpdatesQueued *prometheus.Desc
dynamicUpdatesReceived *prometheus.Desc dynamicUpdatesReceived *prometheus.Desc
@@ -62,6 +81,7 @@ type Collector struct {
zoneTransferResponsesReceived *prometheus.Desc zoneTransferResponsesReceived *prometheus.Desc
zoneTransferSuccessReceived *prometheus.Desc zoneTransferSuccessReceived *prometheus.Desc
zoneTransferSuccessSent *prometheus.Desc zoneTransferSuccessSent *prometheus.Desc
dnsWMIStats *prometheus.Desc
} }
func New(config *Config) *Collector { func New(config *Config) *Collector {
@@ -69,6 +89,10 @@ func New(config *Config) *Collector {
config = &ConfigDefaults config = &ConfigDefaults
} }
if config.CollectorsEnabled == nil {
config.CollectorsEnabled = ConfigDefaults.CollectorsEnabled
}
c := &Collector{ c := &Collector{
config: *config, config: *config,
} }
@@ -76,8 +100,26 @@ func New(config *Config) *Collector {
return c return c
} }
func NewWithFlags(_ *kingpin.Application) *Collector { func NewWithFlags(app *kingpin.Application) *Collector {
return &Collector{} c := &Collector{
config: ConfigDefaults,
}
c.config.CollectorsEnabled = make([]string, 0)
var collectorsEnabled string
app.Flag(
"collector.dns.enabled",
"Comma-separated list of collectors to use. Defaults to all, if not specified.",
).Default(strings.Join(ConfigDefaults.CollectorsEnabled, ",")).StringVar(&collectorsEnabled)
app.Action(func(*kingpin.ParseContext) error {
c.config.CollectorsEnabled = strings.Split(collectorsEnabled, ",")
return nil
})
return c
} }
func (c *Collector) GetName() string { func (c *Collector) GetName() string {
@@ -90,14 +132,31 @@ func (c *Collector) Close() error {
return nil return nil
} }
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error { func (c *Collector) Build(logger *slog.Logger, miSession *mi.Session) error {
var err error for _, collector := range c.config.CollectorsEnabled {
if !slices.Contains([]string{subCollectorMetrics, subCollectorWMIStats}, collector) {
c.perfDataCollector, err = pdh.NewCollector[perfDataCounterValues](pdh.CounterTypeRaw, "DNS", pdh.InstancesAll) return fmt.Errorf("unknown sub collector: %s. Possible values: %s", collector,
if err != nil { strings.Join([]string{subCollectorMetrics, subCollectorWMIStats}, ", "),
return fmt.Errorf("failed to create DNS collector: %w", err) )
}
} }
if slices.Contains(c.config.CollectorsEnabled, subCollectorMetrics) {
if err := c.buildMetricsCollector(logger); err != nil {
return err
}
}
if slices.Contains(c.config.CollectorsEnabled, subCollectorWMIStats) {
if err := c.buildErrorStatsCollector(miSession); err != nil {
return err
}
}
return nil
}
func (c *Collector) buildMetricsCollector(logger *slog.Logger) error {
c.zoneTransferRequestsReceived = prometheus.NewDesc( c.zoneTransferRequestsReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "zone_transfer_requests_received_total"), prometheus.BuildFQName(types.Namespace, Name, "zone_transfer_requests_received_total"),
"Number of zone transfer requests (AXFR/IXFR) received by the master DNS server", "Number of zone transfer requests (AXFR/IXFR) received by the master DNS server",
@@ -231,15 +290,65 @@ func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
nil, nil,
) )
c.dnsWMIStats = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "wmi_stats_total"),
"DNS WMI statistics from MicrosoftDNS_Statistic",
[]string{"name", "collection_name", "dns_server"},
nil,
)
var err error
c.perfDataCollector, err = pdh.NewCollector[perfDataCounterValues](logger.With(slog.String("collector", Name)), pdh.CounterTypeRaw, "DNS", pdh.InstancesAll)
if err != nil {
return fmt.Errorf("failed to create DNS collector: %w", err)
}
return nil
}
func (c *Collector) buildErrorStatsCollector(miSession *mi.Session) error {
if miSession == nil {
return errors.New("miSession is nil")
}
query, err := mi.NewQuery("SELECT Name, CollectionName, Value, DnsServerName FROM MicrosoftDNS_Statistic WHERE CollectionName = 'Error Stats'")
if err != nil {
return fmt.Errorf("failed to create query: %w", err)
}
c.miSession = miSession
c.miQuery = query
return nil return nil
} }
// Collect sends the metric values for each metric // Collect sends the metric values for each metric
// to the provided prometheus Metric channel. // to the provided prometheus Metric channel.
func (c *Collector) Collect(ch chan<- prometheus.Metric) error { func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
errs := make([]error, 0)
if slices.Contains(c.config.CollectorsEnabled, subCollectorMetrics) {
if err := c.collectMetrics(ch); err != nil {
errs = append(errs, fmt.Errorf("failed collecting metrics: %w", err))
}
}
if slices.Contains(c.config.CollectorsEnabled, subCollectorWMIStats) {
if err := c.collectErrorStats(ch); err != nil {
errs = append(errs, fmt.Errorf("failed collecting WMI statistics: %w", err))
}
}
return errors.Join(errs...)
}
func (c *Collector) collectMetrics(ch chan<- prometheus.Metric) error {
err := c.perfDataCollector.Collect(&c.perfDataObject) err := c.perfDataCollector.Collect(&c.perfDataObject)
if err != nil { if err != nil {
return fmt.Errorf("failed to collect DNS metrics: %w", err) return fmt.Errorf("failed to collect DNS metrics: %w", err)
} else if len(c.perfDataObject) == 0 {
return fmt.Errorf("failed to collect DNS metrics: %w", types.ErrNoDataUnexpected)
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -248,6 +357,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
c.perfDataObject[0].AxfrRequestReceived, c.perfDataObject[0].AxfrRequestReceived,
"full", "full",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.zoneTransferRequestsReceived, c.zoneTransferRequestsReceived,
prometheus.CounterValue, prometheus.CounterValue,
@@ -261,12 +371,14 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
c.perfDataObject[0].AxfrRequestSent, c.perfDataObject[0].AxfrRequestSent,
"full", "full",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.zoneTransferRequestsSent, c.zoneTransferRequestsSent,
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].IxfrRequestSent, c.perfDataObject[0].IxfrRequestSent,
"incremental", "incremental",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.zoneTransferRequestsSent, c.zoneTransferRequestsSent,
prometheus.CounterValue, prometheus.CounterValue,
@@ -280,6 +392,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
c.perfDataObject[0].AxfrResponseReceived, c.perfDataObject[0].AxfrResponseReceived,
"full", "full",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.zoneTransferResponsesReceived, c.zoneTransferResponsesReceived,
prometheus.CounterValue, prometheus.CounterValue,
@@ -294,6 +407,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
"full", "full",
"tcp", "tcp",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.zoneTransferSuccessReceived, c.zoneTransferSuccessReceived,
prometheus.CounterValue, prometheus.CounterValue,
@@ -301,6 +415,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
"incremental", "incremental",
"tcp", "tcp",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.zoneTransferSuccessReceived, c.zoneTransferSuccessReceived,
prometheus.CounterValue, prometheus.CounterValue,
@@ -315,6 +430,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
c.perfDataObject[0].AxfrSuccessSent, c.perfDataObject[0].AxfrSuccessSent,
"full", "full",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.zoneTransferSuccessSent, c.zoneTransferSuccessSent,
prometheus.CounterValue, prometheus.CounterValue,
@@ -334,30 +450,35 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
c.perfDataObject[0].CachingMemory, c.perfDataObject[0].CachingMemory,
"caching", "caching",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.memoryUsedBytes, c.memoryUsedBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
c.perfDataObject[0].DatabaseNodeMemory, c.perfDataObject[0].DatabaseNodeMemory,
"database_node", "database_node",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.memoryUsedBytes, c.memoryUsedBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
c.perfDataObject[0].NbStatMemory, c.perfDataObject[0].NbStatMemory,
"nbstat", "nbstat",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.memoryUsedBytes, c.memoryUsedBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
c.perfDataObject[0].RecordFlowMemory, c.perfDataObject[0].RecordFlowMemory,
"record_flow", "record_flow",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.memoryUsedBytes, c.memoryUsedBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
c.perfDataObject[0].TcpMessageMemory, c.perfDataObject[0].TcpMessageMemory,
"tcp_message", "tcp_message",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.memoryUsedBytes, c.memoryUsedBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
@@ -371,23 +492,27 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
c.perfDataObject[0].DynamicUpdateNoOperation, c.perfDataObject[0].DynamicUpdateNoOperation,
"noop", "noop",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.dynamicUpdatesReceived, c.dynamicUpdatesReceived,
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].DynamicUpdateWrittenToDatabase, c.perfDataObject[0].DynamicUpdateWrittenToDatabase,
"written", "written",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.dynamicUpdatesQueued, c.dynamicUpdatesQueued,
prometheus.GaugeValue, prometheus.GaugeValue,
c.perfDataObject[0].DynamicUpdateQueued, c.perfDataObject[0].DynamicUpdateQueued,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.dynamicUpdatesFailures, c.dynamicUpdatesFailures,
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].DynamicUpdateRejected, c.perfDataObject[0].DynamicUpdateRejected,
"rejected", "rejected",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.dynamicUpdatesFailures, c.dynamicUpdatesFailures,
prometheus.CounterValue, prometheus.CounterValue,
@@ -400,6 +525,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].NotifyReceived, c.perfDataObject[0].NotifyReceived,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.notifySent, c.notifySent,
prometheus.CounterValue, prometheus.CounterValue,
@@ -411,11 +537,13 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].RecursiveQueries, c.perfDataObject[0].RecursiveQueries,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.recursiveQueryFailures, c.recursiveQueryFailures,
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].RecursiveQueryFailure, c.perfDataObject[0].RecursiveQueryFailure,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.recursiveQuerySendTimeouts, c.recursiveQuerySendTimeouts,
prometheus.CounterValue, prometheus.CounterValue,
@@ -428,6 +556,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
c.perfDataObject[0].TcpQueryReceived, c.perfDataObject[0].TcpQueryReceived,
"tcp", "tcp",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.queries, c.queries,
prometheus.CounterValue, prometheus.CounterValue,
@@ -441,6 +570,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
c.perfDataObject[0].TcpResponseSent, c.perfDataObject[0].TcpResponseSent,
"tcp", "tcp",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.responses, c.responses,
prometheus.CounterValue, prometheus.CounterValue,
@@ -460,6 +590,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
c.perfDataObject[0].WinsLookupReceived, c.perfDataObject[0].WinsLookupReceived,
"forward", "forward",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.winsQueries, c.winsQueries,
prometheus.CounterValue, prometheus.CounterValue,
@@ -473,6 +604,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
c.perfDataObject[0].WinsResponseSent, c.perfDataObject[0].WinsResponseSent,
"forward", "forward",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.winsResponses, c.winsResponses,
prometheus.CounterValue, prometheus.CounterValue,
@@ -485,6 +617,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
prometheus.CounterValue, prometheus.CounterValue,
c.perfDataObject[0].SecureUpdateFailure, c.perfDataObject[0].SecureUpdateFailure,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.secureUpdateReceived, c.secureUpdateReceived,
prometheus.CounterValue, prometheus.CounterValue,
@@ -493,3 +626,24 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
return nil return nil
} }
func (c *Collector) collectErrorStats(ch chan<- prometheus.Metric) error {
var stats []Statistic
if err := c.miSession.Query(&stats, mi.NamespaceRootMicrosoftDNS, c.miQuery); err != nil {
return fmt.Errorf("failed to query DNS statistics: %w", err)
}
// Collect DNS error statistics
for _, stat := range stats {
ch <- prometheus.MustNewConstMetric(
c.dnsWMIStats,
prometheus.CounterValue,
float64(stat.Value),
stat.Name,
stat.CollectionName,
stat.DnsServerName,
)
}
return nil
}

Some files were not shown because too many files have changed in this diff Show More