Compare commits

...

137 Commits

Author SHA1 Message Date
Ben Reedy
677a7c8d67 Merge pull request #1065 from shivsepra/patch-1
Update collector.mssql.md
2022-09-24 06:59:04 +10:00
Shiva Prasad
8f05e77b0a Update collector.mssql.md
Corrected the buffer cache hit ratio PromQL

Signed-off-by: Shiva Prasad <sr7231@gmail.com>
2022-09-21 15:27:34 +05:30
Ben Reedy
8efca83ac4 Merge pull request #1059 from kaffarell/master
Added WebService uptime metric in iis collector
2022-09-14 07:19:51 +10:00
kaffarell
fb38512f38 Added WebService uptime metric in iis collector
Signed-off-by: kaffarell <gabrielgoller123@gmail.com>
2022-09-13 16:41:44 +02:00
Ben Reedy
63800b5c6a Merge pull request #1061 from kaffarell/patch-1
Update collector.logon.md
2022-09-13 06:31:47 +10:00
Gabriel Goller
c1b7ca42c5 Update collector.logon.md
Signed-off-by: Gabriel Goller <gabrielgoller123@gmail.com>
2022-09-10 12:34:19 +02:00
Ben Reedy
f8abca5292 Merge pull request #999 from trunov-ms/master
fix PercentTimeinGC metric
2022-09-10 10:55:25 +10:00
Max Trunov
2ef7c5604a gofmt netframework_clrmemory.go
Signed-off-by: Max Trunov <trunov_ms@taximaxim.ru>
2022-09-09 17:13:26 +05:00
Ben Reedy
a0a81c4a9f Merge pull request #1060 from kaffarell/iis-docs
Added documentation for iis collector
2022-09-09 20:23:42 +10:00
kaffarell
8e27a9983f Added documentation for iis collector
Signed-off-by: kaffarell <gabrielgoller123@gmail.com>
2022-09-09 12:08:33 +02:00
amdmax
6d506887cd Add comments to changes
Signed-off-by: Max Trunov <trunov_ms@taximaxim.ru>
2022-09-07 09:13:12 +05:00
Ben Reedy
15be1c1bd6 Merge pull request #1052 from breed808/os_version_docs
Document recent changes to os_build_info metric
2022-08-30 18:00:40 +10:00
Ben Reedy
7bd2ebc6d0 Document recent changes to os_build_info metric
Changes introduced in 46fa84f have exposed additional labels to the
os_build_info metric.

Signed-off-by: Ben Reedy <breed808@breed808.com>
2022-08-30 17:50:15 +10:00
Ben Reedy
690fe8de86 Merge pull request #1051 from benridley/feature_version_info
Export extra version information
2022-08-30 16:47:26 +10:00
Ben Ridley
46fa84f9b0 Export extra version information
Adds major version, minor version, and build number as independent
labels when exporting OS info.

Signed-off-by: Ben Ridley <benridley29@gmail.com>
2022-08-29 22:02:00 -07:00
Ben Reedy
4b226cde40 Merge pull request #1047 from jammiemil/master
fix Windows Service timeout during high CPU (eg. post Windows Update)
2022-08-24 21:00:22 +10:00
Ben Reedy
cdeceaeca5 Merge pull request #1034 from gloyka/master
Add Hyper-V Hypervisor Logical Processor metrics
2022-08-24 19:11:18 +10:00
Jamie Milton
8061c4e5fa Additional Comments
Signed-off-by: Jamie Milton <jammiemil@hotmail.com>
2022-08-24 10:04:23 +01:00
Jamie Milton
981d687e60 Remove unused Const
Signed-off-by: Jamie Milton <jammiemil@hotmail.com>
2022-08-24 09:16:16 +01:00
Anton Akhmedzyanov
37ea988125 Added percent suffix for metric names
Signed-off-by: Anton Akhmedzyanov <gloin@gloin.ru>
2022-08-23 19:42:16 +03:00
Anton Akhmedzyanov
a722cee322 Add Hyper-V Hypervisor CPU utilization query.
Signed-off-by: Anton Akhmedzyanov <gloin@gloin.ru>
2022-08-23 19:42:16 +03:00
Anton Akhmedzyanov
b43978eeb4 Add Hyper-V Hypervisor Logical Processor metrics
Signed-off-by: Anton Akhmedzyanov <gloin@gloin.ru>
2022-08-23 19:42:16 +03:00
Jamie Milton
f02f51aceb Correct Channel Definition
Signed-off-by: Jamie Milton <jammiemil@hotmail.com>
2022-08-23 16:47:31 +01:00
Jamie Milton
a5f22ebb04 Move Service Initiate out to seperate package
Signed-off-by: Jamie Milton <jammiemil@hotmail.com>
2022-08-23 14:57:16 +01:00
Ben Reedy
1c199e6c0e Merge pull request #1036 from alvarocabanas/master
Fix Error "Service Access is denied" in service collector useApi
2022-08-23 07:38:08 +10:00
Ben Reedy
306197fe93 Merge pull request #1028 from prometheus-community/dependabot/go_modules/github.com/sirupsen/logrus-1.9.0
chore(deps): bump github.com/sirupsen/logrus from 1.8.1 to 1.9.0
2022-08-21 18:38:11 +10:00
dependabot[bot]
45fac2a618 chore(deps): bump github.com/sirupsen/logrus from 1.8.1 to 1.9.0
Bumps [github.com/sirupsen/logrus](https://github.com/sirupsen/logrus) from 1.8.1 to 1.9.0.
- [Release notes](https://github.com/sirupsen/logrus/releases)
- [Changelog](https://github.com/sirupsen/logrus/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sirupsen/logrus/compare/v1.8.1...v1.9.0)

---
updated-dependencies:
- dependency-name: github.com/sirupsen/logrus
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-21 08:28:00 +00:00
Ben Reedy
716707cd06 Merge pull request #1043 from breed808/ci_spellcheck
Fix broken Spellcheck CI job
2022-08-20 21:55:56 +10:00
Ben Reedy
4b0bcb46d0 Fix Exchange docs spelling error
Required to fix Github CI/CD

Signed-off-by: Ben Reedy <breed808@breed808.com>
2022-08-20 21:44:42 +10:00
Ben Reedy
55312ebdca Don't spellcheck Go dependency files
Signed-off-by: Ben Reedy <breed808@breed808.com>
2022-08-20 21:44:38 +10:00
Ben Reedy
3df660799c Merge pull request #1041 from prometheus-community/dependabot/go_modules/github.com/prometheus/client_golang-1.13.0
chore(deps): bump github.com/prometheus/client_golang from 1.12.2 to 1.13.0
2022-08-20 20:27:37 +10:00
dependabot[bot]
8ef590ee3a chore(deps): bump github.com/prometheus/client_golang
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.12.2 to 1.13.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.12.2...v1.13.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-08 11:13:15 +00:00
alvarocabanas
c9e28c4c00 Fix Service Access is denied in collector useApi
Signed-off-by: Alvaro Cabanas <albanas@gmail.com>
Signed-off-by: alvarocabanas <acabanas@newrelic.com>
2022-07-29 10:53:29 +02:00
Ben Reedy
c5ec339750 Merge pull request #1030 from prometheus-community/dependabot/go_modules/gopkg.in/yaml.v3-3.0.1
chore(deps): bump gopkg.in/yaml.v3 from 3.0.0 to 3.0.1
2022-07-27 19:51:10 +10:00
Ben Reedy
2602ca04f6 Merge pull request #1029 from prometheus-community/dependabot/go_modules/github.com/Microsoft/hcsshim-0.9.4
chore(deps): bump github.com/Microsoft/hcsshim from 0.9.3 to 0.9.4
2022-07-27 19:48:28 +10:00
dependabot[bot]
8fe8e85559 chore(deps): bump gopkg.in/yaml.v3 from 3.0.0 to 3.0.1
Bumps [gopkg.in/yaml.v3](https://github.com/go-yaml/yaml) from 3.0.0 to 3.0.1.
- [Release notes](https://github.com/go-yaml/yaml/releases)
- [Commits](https://github.com/go-yaml/yaml/compare/v3.0.0...v3.0.1)

---
updated-dependencies:
- dependency-name: gopkg.in/yaml.v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-25 11:25:10 +00:00
dependabot[bot]
38cfae3e66 chore(deps): bump github.com/Microsoft/hcsshim from 0.9.3 to 0.9.4
Bumps [github.com/Microsoft/hcsshim](https://github.com/Microsoft/hcsshim) from 0.9.3 to 0.9.4.
- [Release notes](https://github.com/Microsoft/hcsshim/releases)
- [Commits](https://github.com/Microsoft/hcsshim/compare/v0.9.3...v0.9.4)

---
updated-dependencies:
- dependency-name: github.com/Microsoft/hcsshim
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-25 11:25:06 +00:00
Ben Reedy
b2ed5f61b4 Merge pull request #997 from breed808/yaml_v3
Update gopkg.in/yaml_v2 to yaml_v3
2022-07-25 17:15:39 +10:00
Ben Reedy
752d467b12 Merge pull request #1026 from breed808/ci
Add content write permissions to GITHUB_TOKEN
2022-07-23 19:24:58 +10:00
Ben Reedy
1fab2621eb Add content write permissions to GITHUB_TOKEN
Write permissions are required to upload release artifacts.

Signed-off-by: Ben Reedy <breed808@breed808.com>
2022-07-23 19:05:47 +10:00
Ben Reedy
739642bd6a Merge pull request #1015 from breed808/iis_log_noise
Skip missing IIS instances
2022-07-23 10:31:18 +10:00
Ben Reedy
a4cf96d94d Skip missing IIS instances
Collector would previously break from loop rather than skip nameless
entries, with the additional result of spamming event logs.

Signed-off-by: Ben Reedy <breed808@breed808.com>
2022-07-23 09:59:01 +10:00
Ben Reedy
1dd7b58bdf Merge pull request #1025 from alexwiedermann/mscluster-fix-wrong-metric
fix: remove UpdateDomain (mscluster-resourcegroup)
2022-07-23 09:57:03 +10:00
Ben Reedy
c696fb40cf Merge pull request #1021 from prometheus-community/dependabot/go_modules/github.com/prometheus/common-0.37.0
chore(deps): bump github.com/prometheus/common from 0.35.0 to 0.37.0
2022-07-23 09:47:02 +10:00
Alex Wiedermann
ae4bc822e8 fix: remove UpdateDomain (mscluster-resourcegroup)
UpdateDomain metric not exists as we can see in  https://docs.microsoft.com/en-us/previous-versions/windows/desktop/cluswmi/mscluster-resourcegroup, just removing from mscluster_resourcegroup.go
When execute windows_exporter.exe with this metric we get this error:

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x60 pc=0xaad61d]

goroutine 66 [running]:
github.com/prometheus/client_golang/prometheus.NewConstMetric(0xc00009de30?, 0x2?, 0x3ff0000000000000?, {0xc000387730?, 0x1?, 0x1?})
        C:/Users/ricar/go/pkg/mod/github.com/prometheus/client_golang@v1.12.2/prometheus/value.go:88 +0x1d
github.com/prometheus/client_golang/prometheus.MustNewConstMetric(...)
        C:/Users/ricar/go/pkg/mod/github.com/prometheus/client_golang@v1.12.2/prometheus/value.go:105
github.com/prometheus-community/windows_exporter/collector.(*MSCluster_ResourceGroupCollector).Collect(0xc000552000, 0x0?, 0x0?)
        E:/Downloads/Prometheus/windows_exporter/windows_exporter/collector/mscluster_resourcegroup.go:240 +0xdfb
main.execute({0xc00006e0c6, 0x17}, {0xef6420, 0xc000552000}, 0x0?, 0x0?)
        E:/Downloads/Prometheus/windows_exporter/windows_exporter/exporter.go:199 +0x84
main.windowsCollector.Collect.func2({0xc00006e0c6, 0x17}, {0xef6420?, 0xc000552000?})
        E:/Downloads/Prometheus/windows_exporter/windows_exporter/exporter.go:140 +0x9b
created by main.windowsCollector.Collect
        E:/Downloads/Prometheus/windows_exporter/windows_exporter/exporter.go:138 +0x5c5

Signed-off-by: Alex Wiedermann <alexwdrnn@gmail.com>
2022-07-22 18:06:29 -03:00
dependabot[bot]
096949c682 chore(deps): bump github.com/prometheus/common from 0.35.0 to 0.37.0
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.35.0 to 0.37.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Commits](https://github.com/prometheus/common/compare/v0.35.0...v0.37.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-18 11:20:37 +00:00
Ben Reedy
da15c9659d Merge pull request #1020 from Woldelig/patch-1
Update collector.fsrmquota.md
2022-07-16 10:31:37 +10:00
Christoffer Wold
a12b3e0ea0 Update collector.fsrmquota.md
Fix table formatting

Signed-off-by: Christoffer Wold <christoffer.wold@gmail.com>
2022-07-15 10:33:35 +02:00
Ben Reedy
7e7bdc104f Merge pull request #1012 from gopihc/patch-1
Update kubernetes.md
2022-07-02 07:05:52 +10:00
Gopi Chinnappa
682e6967b0 Update kubernetes.md
Signed-off-by: Gopi Chinnappa <gopihc@gmail.com>
2022-06-28 17:29:56 +05:30
Ben Reedy
93dcdf95f7 Merge pull request #885 from sstorie/mscluster
Add support for MSCluster collectors
2022-06-23 19:25:48 +10:00
Ben Reedy
3619d14844 Merge pull request #1003 from prometheus-community/dependabot/go_modules/github.com/prometheus/common-0.35.0
Bump github.com/prometheus/common from 0.34.0 to 0.35.0
2022-06-21 07:18:11 +10:00
dependabot[bot]
9712fa3bad Bump github.com/prometheus/common from 0.34.0 to 0.35.0
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.34.0 to 0.35.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Commits](https://github.com/prometheus/common/compare/v0.34.0...v0.35.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-20 11:38:44 +00:00
Sam Storie
fe7730a51b chore: adding links to the doc pages in the README
Signed-off-by: Storie <Sam.Storie@Emerson.com>
2022-06-19 18:40:43 +10:00
Sam Storie
61ea9d049c chore: fix mis-spelling
Signed-off-by: Sam Storie <sam.storie@emerson.com>
2022-06-19 18:40:42 +10:00
Sam Storie
a50fe95370 chore: adding/updating the documentation for mscluster_resourcegroup collector
Signed-off-by: Sam Storie <sam.storie@emerson.com>
2022-06-19 18:40:41 +10:00
Sam Storie
33615c8b58 chore: updating the label list in the docs
Signed-off-by: Sam Storie <sam.storie@emerson.com>
2022-06-19 18:40:40 +10:00
Sam Storie
313ffb73bd chore: Adding/updating the documentation for mscluster_resource collector
Signed-off-by: Sam Storie <sam.storie@emerson.com>
2022-06-19 18:40:39 +10:00
Sam Storie
48e54e8513 chore: Adding/updating documentation for mscluster_node collector
The isolation or quarantine status of the node.

Signed-off-by: Sam Storie <sam.storie@emerson.com>
2022-06-19 18:40:39 +10:00
Sam Storie
bf5177ed12 chore: fixing a typo
Signed-off-by: Sam Storie <sam.storie@emerson.com>
2022-06-19 18:40:38 +10:00
Sam Storie
00f79ebaf4 chore: Adding/updating documentation for mscluster_network collector
Signed-off-by: Sam Storie <sam.storie@emerson.com>
2022-06-19 18:40:37 +10:00
Sam Storie
3d50cf4309 chore: Added/updated documentation for mscluster_cluster collector
Signed-off-by: Sam Storie <sam.storie@emerson.com>
2022-06-19 18:40:36 +10:00
Sam Storie
c7cbc48afc chore: updated links to MS documentation for each struct
Signed-off-by: Sam Storie <sam.storie@emerson.com>
2022-06-19 18:40:35 +10:00
Sam Storie
0f304413b5 chore: removing some errant comments about perflib
Signed-off-by: Sam Storie <sam.storie@emerson.com>
2022-06-19 18:40:34 +10:00
Sam Storie
b6f12aeb9f feat: added the mscluster_resourcegroup collector functionality
Signed-off-by: Sam Storie <sam.storie@emerson.com>
2022-06-19 18:40:33 +10:00
Sam Storie
af523f13bc feat: added the mscluster_resource collector functionality
Signed-off-by: Sam Storie <sam.storie@emerson.com>
2022-06-19 18:40:32 +10:00
Sam Storie
8c7dd7fd5f feat: added the mscluster_cluster collector functionality
Signed-off-by: Sam Storie <sam.storie@emerson.com>
2022-06-19 18:40:31 +10:00
Sam Storie
6a186f26f0 feat: added mscluster_network collector functionality
Signed-off-by: Sam Storie <sam.storie@emerson.com>
2022-06-19 18:40:30 +10:00
Sam Storie
740e277cf6 feat: Adding mscluster_node collector functionality
Breaks out the metrics by the name specified by each node

Signed-off-by: Sam Storie <sam.storie@emerson.com>
2022-06-19 18:40:29 +10:00
Sam Storie
96e081c7d4 feat: adapting to support CimSession and alternative namespaces
Signed-off-by: Sam Storie <sam.storie@emerson.com>
2022-06-19 18:40:28 +10:00
Ben Reedy
3cf0fa347f Merge pull request #954 from breed808/os_paging
Continue OS collector on absent paging file
2022-06-12 09:27:19 +10:00
Ben Reedy
ebabddf558 Continue OS collector on absent paging file
Inactive or missing paging file should not be cause for OS collector to
fail.
Instead, log the error and continue with OS collection.

Signed-off-by: Ben Reedy <breed808@breed808.com>
2022-06-12 09:13:21 +10:00
amdmax
4e76e6938a fix PercentTimeinGC metric
Signed-off-by: Max Trunov <trunov_ms@taximaxim.ru>
2022-06-10 14:45:45 +05:00
Ben Reedy
5f9759586e Update gopkg.in/yaml_v2 to yaml_v3
Previous version was vulnerable to CVE-2022-28948

Signed-off-by: Ben Reedy <breed808@breed808.com>
2022-05-29 10:46:09 +10:00
Ben Reedy
7f69cc0acf Merge pull request #995 from prometheus-community/dependabot/go_modules/github.com/Microsoft/hcsshim-0.9.3
Bump github.com/Microsoft/hcsshim from 0.9.2 to 0.9.3
2022-05-29 10:30:43 +10:00
dependabot[bot]
820c6bdb93 Bump github.com/Microsoft/hcsshim from 0.9.2 to 0.9.3
Bumps [github.com/Microsoft/hcsshim](https://github.com/Microsoft/hcsshim) from 0.9.2 to 0.9.3.
- [Release notes](https://github.com/Microsoft/hcsshim/releases)
- [Commits](https://github.com/Microsoft/hcsshim/compare/v0.9.2...v0.9.3)

---
updated-dependencies:
- dependency-name: github.com/Microsoft/hcsshim
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-23 11:13:54 +00:00
Ben Reedy
6042ea3e51 Merge pull request #990 from prometheus-community/dependabot/go_modules/github.com/go-kit/log-0.2.1
Bump github.com/go-kit/log from 0.2.0 to 0.2.1
2022-05-17 09:25:51 +10:00
dependabot[bot]
641f3222c7 Bump github.com/go-kit/log from 0.2.0 to 0.2.1
Bumps [github.com/go-kit/log](https://github.com/go-kit/log) from 0.2.0 to 0.2.1.
- [Release notes](https://github.com/go-kit/log/releases)
- [Commits](https://github.com/go-kit/log/compare/v0.2.0...v0.2.1)

---
updated-dependencies:
- dependency-name: github.com/go-kit/log
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-16 23:12:38 +00:00
Ben Reedy
9241df5528 Merge pull request #989 from prometheus-community/dependabot/go_modules/github.com/go-ole/go-ole-1.2.6
Bump github.com/go-ole/go-ole from 1.2.5 to 1.2.6
2022-05-17 09:11:46 +10:00
dependabot[bot]
c443eafe2b Bump github.com/go-ole/go-ole from 1.2.5 to 1.2.6
Bumps [github.com/go-ole/go-ole](https://github.com/go-ole/go-ole) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/go-ole/go-ole/releases)
- [Changelog](https://github.com/go-ole/go-ole/blob/master/ChangeLog.md)
- [Commits](https://github.com/go-ole/go-ole/compare/v1.2.5...v1.2.6)

---
updated-dependencies:
- dependency-name: github.com/go-ole/go-ole
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-16 22:50:05 +00:00
Ben Reedy
0cd6fd3f3c Merge pull request #988 from prometheus-community/dependabot/go_modules/github.com/prometheus/client_golang-1.12.2
Bump github.com/prometheus/client_golang from 1.12.1 to 1.12.2
2022-05-17 08:49:13 +10:00
Ben Reedy
79a3a1ccec Adjust e2e output for client_golang-1.12.2
v1.12.2 removes some high cardinality metrics introduced in v1.12.0.
See https://github.com/prometheus/client_golang/issues/967 for context.

Signed-off-by: Ben Reedy <breed808@breed808.com>
2022-05-17 08:04:25 +10:00
dependabot[bot]
603cb54e8f Bump github.com/prometheus/client_golang from 1.12.1 to 1.12.2
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.12.1 to 1.12.2.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.12.1...v1.12.2)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-16 11:14:21 +00:00
Ben Reedy
329a96de44 Merge pull request #968 from breed808/textfile
Skip processing files with duplicates metrics
2022-05-16 18:46:23 +10:00
Ben Reedy
fd36eae54d Merge pull request #982 from yangliyl/fix/replace-functions
replace these deprecated functions
2022-05-15 13:13:53 +10:00
yangliyl
0dc32bf434 replace these deprecated functions
Signed-off-by: yangliyl <yangli_yl@qq.com>
2022-05-15 09:49:08 +08:00
Ben Reedy
306e63a240 Skip processing files with duplicates metrics
This change affects processing of single files with duplicate metrics.
Single files with duplicate metrics will be skipped, with no metrics being
collected and exposed by the exporter.

Previous duplicate metric processing across multiple files remains
unchanged (all files skipped, collector returns error).

Signed-off-by: Ben Reedy <breed808@breed808.com>
2022-05-15 08:56:23 +10:00
Ben Reedy
42c05df272 Merge pull request #969 from breed808/init_powershell
Use `powershell` image for firewall init container
2022-05-15 08:47:10 +10:00
Ben Reedy
f471cc0e4e Use powershell image for firewall init container
Previous `nanoserver` image did not have Powershell installed, causing
the init container to fail.

Signed-off-by: Ben Reedy <breed808@breed808.com>
2022-05-15 08:38:31 +10:00
Calle Pettersson
3c4ae95a8d Merge pull request #821 from mousavian/master
Adding Scheduled Tasks Collector
2022-05-14 21:00:23 +02:00
Ben Reedy
21f4757b63 Merge pull request #971 from andbanman/ft_hyperv_vm_memory
Add Hyper-V VM Memory metrics
2022-05-13 07:43:16 +10:00
Ben Reedy
4aba3e1222 Add initial docs for hyperv memory metrics
Signed-off-by: Ben Reedy <breed808@breed808.com>
2022-05-13 07:14:55 +10:00
Andrew Banman
8f6204f960 Fix typo in vm_memory_pressure_minimum description
Signed-off-by: Andrew Banman <abanman@pnri.org>
2022-05-12 13:26:26 -07:00
Andrew Banman
dd494b11bb Add _total to hyper-v memory counter metrics
Signed-off-by: Andrew Banman <abanman@pnri.org>
2022-05-12 10:00:59 -07:00
Andrew Banman
9f384e3db1 Fix hyper-v collector memory metric names
Remove "memory", which is redundant with the module and breaks symmetry
with vm_memory_physical_guest_visible.

Signed-off-by: Andrew Banman <abanman@pnri.org>
2022-05-12 09:54:41 -07:00
Andrew Banman
68c338b479 Fix hyper-v collector memory metric descriptions
Signed-off-by: Andrew Banman <abanman@pnri.org>
2022-05-12 09:53:47 -07:00
Andrew Banman
a01f72a8b0 Fix Hyper-V VM memory metric types
Signed-off-by: Andrew Banman <abanman@pnri.org>
2022-05-12 09:49:31 -07:00
Andrew Banman
09ec6e68ad Add Hyper-V VM Memory metrics
Signed-off-by: Andrew Banman <abanman@pnri.org>
2022-05-12 09:49:31 -07:00
Rahman Mousavian
5dc10096f9 Dropping 0.0 value from float declaration
Signed-off-by: Rahman Mousavian <rahman.mousavian@oracle.com>
2022-05-12 17:51:43 +10:00
Rahman Mousavian
1aa00ebca8 Handling errors to prevent panics
Signed-off-by: Rahman Mousavian <rahman.mousavian@oracle.com>
2022-05-12 17:51:43 +10:00
Rahman Mousavian
fb11263c3e Initilizing once, upon app start
Signed-off-by: Rahman Mousavian <rahman.mousavian@oracle.com>
2022-05-12 16:36:47 +10:00
Rahman Mousavian
9df59c75cd Using CoInitializeEx, Locking OLE calls to the OS thread
Signed-off-by: Rahman Mousavian <rahman.mousavian@oracle.com>
2022-05-12 16:36:46 +10:00
Rahman Mousavian
e112446ce9 changing anonymous funcs to normal funcs
Signed-off-by: Rahman Mousavian <rahman.mousavian@oracle.com>
2022-05-12 16:36:46 +10:00
Rahman Mousavian
4f82e02d8d Updated README.md
Signed-off-by: Rahman Mousavian <rahman.mousavian@oracle.com>
2022-05-12 16:36:46 +10:00
Rahman Mousavian
c3ed036402 Added tests
Signed-off-by: Rahman Mousavian <rahman.mousavian@oracle.com>
2022-05-12 16:36:46 +10:00
Rahman Mousavian
393546fe01 Added doc for Scheduled Task collector
Signed-off-by: Rahman Mousavian <rahman.mousavian@oracle.com>
2022-05-12 16:36:46 +10:00
Rahman Mousavian
ca645edde1 Added Scheduled Task Collector
Signed-off-by: Rahman Mousavian <rahman.mousavian@oracle.com>
2022-05-12 16:36:42 +10:00
Ben Reedy
69d4043ce4 Merge pull request #977 from prometheus-community/dependabot/go_modules/github.com/prometheus/common-0.34.0
Bump github.com/prometheus/common from 0.33.0 to 0.34.0
2022-05-04 08:58:25 +10:00
dependabot[bot]
fd5135f5ff Bump github.com/prometheus/common from 0.33.0 to 0.34.0
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.33.0 to 0.34.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Commits](https://github.com/prometheus/common/compare/v0.33.0...v0.34.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-03 22:42:53 +00:00
Ben Reedy
8f08f55cf2 Merge pull request #970 from breed808/ci
Resolve recent CI issues
2022-05-04 05:46:27 +10:00
Calle Pettersson
92d53d07b2 Merge pull request #913 from mjtrangoni/fix-memory-non-counter
Fix memory collector promtool metric issues
2022-05-01 19:15:15 +02:00
Ben Reedy
02e2e257c9 Use go install for build deps
Previous `go get` method of installation was causing issues with
`goversiontool`, preventing successful CI builds.

Signed-off-by: Ben Reedy <breed808@breed808.com>
2022-04-07 09:13:16 +10:00
Ben Reedy
791df8009c Update golangci-lint CI action to latest version
Signed-off-by: Ben Reedy <breed808@breed808.com>
2022-04-07 09:13:10 +10:00
Ben Reedy
aaf202236d Merge pull request #965 from prometheus-community/dependabot/go_modules/github.com/prometheus/common-0.33.0
Bump github.com/prometheus/common from 0.32.1 to 0.33.0
2022-04-06 20:24:58 +10:00
dependabot[bot]
e9ba751c82 Bump github.com/prometheus/common from 0.32.1 to 0.33.0
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.32.1 to 0.33.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Commits](https://github.com/prometheus/common/compare/v0.32.1...v0.33.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-04 11:15:41 +00:00
Calle Pettersson
ed83cb1c3e Merge pull request #963 from jsturtevant/fix-k8s-doc-formatting
Fix formatting for kubernetes documentation
2022-04-03 08:53:45 +02:00
James Sturtevant
ac447e5b15 Fix formatting
Signed-off-by: GitHub <noreply@github.com>
2022-04-01 23:34:10 +00:00
Ben Reedy
4d2a247e50 Merge pull request #948 from breed808/ci_tag_name
Fix image build issues
2022-02-27 18:51:06 +10:00
Ben Reedy
54f86001ad Merge pull request #949 from szediktam/fix/container-docs-typo
fix: typo of container docs
2022-02-27 18:50:07 +10:00
szediktam
bccb3b3296 fix: typo of container docs
Signed-off-by: szediktam <alianlianlianlian@gmail.com>
2022-02-27 16:32:45 +08:00
Ben Reedy
c6285cdf9d Fix VERSION env variable for image push
Powershell uses $Env: prefix for environment variables.

Signed-off-by: Ben Reedy <breed808@breed808.com>
2022-02-27 17:28:51 +10:00
Ben Reedy
cde750f76d Replace invalid tag characters for master images
Signed-off-by: Ben Reedy <breed808@breed808.com>
2022-02-27 17:28:46 +10:00
Ben Reedy
dedd60f02b Merge pull request #943 from szediktam/feat/add_storage_metrics_for_container
feat: add storage metrics for container collector
2022-02-27 13:42:32 +10:00
szediktam
d0c9fc6dbb feat: add useful queries example for container docs
Signed-off-by: szediktam <alianlianlianlian@gmail.com>
2022-02-27 13:32:34 +10:00
szediktam
f728224ef2 feat: add storage metrics for container collector
Signed-off-by: szediktam <alianlianlianlian@gmail.com>
2022-02-27 13:32:23 +10:00
Ben Reedy
fba7682f01 Merge pull request #945 from breed808/ci_master_pushes
Run CI on pushes to master branch
2022-02-27 13:31:29 +10:00
Ben Reedy
79ecaf6a99 Check for listening exporter before querying
CI runs have exposed timing issues where promtool/e2e scripts query the
exporter, before exporter has begun listening.

Signed-off-by: Ben Reedy <breed808@breed808.com>
2022-02-27 08:37:42 +10:00
Ben Reedy
6941ee7ab2 Run promtool windows_exporter on non-default port
Prevents conflicts when promtool & test jobs are run concurrently in
CI.

Signed-off-by: Ben Reedy <breed808@breed808.com>
2022-02-26 20:43:25 +10:00
Ben Reedy
5a9711dc90 Run CI on pushes to master branch
Required to keep container image (with "latest" tag) up to date. Will
also ensure the master branch is healthy after PR merges.

Signed-off-by: Ben Reedy <breed808@breed808.com>
2022-02-26 09:25:27 +10:00
Ben Reedy
5106b829c3 Merge pull request #907 from breed808/ci_promtool
Check default collector metrics with promtool
2022-02-08 18:47:09 +10:00
Ben Reedy
e1796c3d42 Upgrade promu build tool to v0.13.0
Signed-off-by: Ben Reedy <breed808@breed808.com>
2022-02-08 17:15:03 +10:00
Ben Reedy
14d3e4ea28 Check default collector metrics with promtool
Signed-off-by: Ben Reedy <breed808@breed808.com>
2022-02-08 17:14:39 +10:00
Ben Reedy
36f033ae57 Merge pull request #925 from breed808/cpu_docs
Ensure CPU time description matches `mode` flag
2022-02-08 08:09:18 +10:00
Ben Reedy
0de2fc4af7 Merge pull request #864 from jsturtevant/use-hostprocess
Add HostProcess Container Configuration for k8s
2022-02-08 08:07:24 +10:00
James Sturtevant
b450a50103 Add HostProcess Container Configuration for k8s
Co-authored-by: Brian Redmond <brianisrunning@gmail.com>
Signed-off-by: Brian Redmond <brianisrunning@gmail.com>
Signed-off-by: James Sturtevant <jstur@microsoft.com>
2022-02-07 10:16:34 -08:00
Ben Reedy
d4be3b9f31 Ensure CPU time description matches mode flag
Signed-off-by: Ben Reedy <breed808@breed808.com>
2022-01-30 13:26:40 +10:00
Mario Trangoni
57c7911c91 Fix memory collector promtool metric issues
See,
```
windows_memory_demand_zero_faults_total non-counter metrics should not have "_total" suffix
windows_memory_cache_faults_total non-counter metrics should not have "_total" suffix
windows_memory_page_faults_total non-counter metrics should not have "_total" suffix
windows_memory_pool_nonpaged_allocs_total non-counter metrics should not have "_total" suffix
windows_memory_pool_nonpaged_bytes_total non-counter metrics should not have "_total" suffix
windows_memory_pool_paged_allocs_total non-counter metrics should not have "_total" suffix
windows_memory_swap_page_operations_total non-counter metrics should not have "_total" suffix
windows_memory_swap_page_reads_total non-counter metrics should not have "_total" suffix
windows_memory_swap_page_writes_total non-counter metrics should not have "_total" suffix
windows_memory_swap_pages_read_total non-counter metrics should not have "_total" suffix
windows_memory_swap_pages_written_total non-counter metrics should not have "_total" suffix
windows_memory_transition_faults_total non-counter metrics should not have "_total" suffix
windows_memory_transition_pages_repurposed_total non-counter metrics should not have "_total" suffix
windows_memory_write_copies_total non-counter metrics should not have "_total" suffix
```

Only `windows_memory_pool_nonpaged_bytes` is a gauge, all the other
metrics were counters.

Also added some missing documentation.

Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
2022-01-07 16:59:29 +01:00
51 changed files with 3986 additions and 439 deletions

View File

@@ -1,8 +1,11 @@
name: windows_exporter CI/CD
# Trigger on pull requests and releases
# Trigger on pull requests, releases and pushes to master branch.
# Deployments will only occur for releases (see `if` clauses in the build job).
on:
push:
branches:
- master
pull_request:
branches:
- master
@@ -11,6 +14,13 @@ on:
- published
- edited
permissions:
contents: write
packages: write
env:
PROMU_VER: 'v0.13.0'
jobs:
test:
runs-on: windows-2019
@@ -25,16 +35,43 @@ jobs:
- name: Install e2e deps
run: |
go get github.com/prometheus/promu@v0.11.1
go get github.com/josephspurrier/goversioninfo/cmd/goversioninfo@v1.2.0
go install "github.com/prometheus/promu@$($Env:PROMU_VER)"
go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@v1.2.0
# GOPATH\bin dir must be appended to PATH else the `promu` command won't be found
echo "$(go env GOPATH)\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: e2e Test
run: make e2e-test
lint:
promtool:
runs-on: windows-2019
env:
PROMTOOL_VER: '2.32.1'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '^1.17.5'
- name: Install promtool
run: |
# promtool brings in a lot of dependencies, slowing down compilation via `go get` and `go install`, so
# download the binary directly and extract.
# go get github.com/prometheus/prometheus/cmd/promtool@main
Invoke-WebRequest -Uri https://github.com/prometheus/prometheus/releases/download/v$($Env:PROMTOOL_VER)/prometheus-$($Env:PROMTOOL_VER).windows-amd64.zip -OutFile prometheus-$($Env:PROMTOOL_VER).windows-amd64.zip
Expand-Archive -Path prometheus-$($Env:PROMTOOL_VER).windows-amd64.zip -DestinationPath .
Copy-Item -Path prometheus-$($Env:PROMTOOL_VER).windows-amd64\promtool.exe -Destination "$(go env GOPATH)\bin"
go install "github.com/prometheus/promu@$($Env:PROMU_VER)"
go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@v1.2.0
# GOPATH\bin dir must be appended to PATH else the `promu` command won't be found
echo "$(go env GOPATH)\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Promtool
run: make promtool
lint:
runs-on: windows-2022
steps:
# `gofmt` linter run by golangci-lint fails on CRLF line endings (the default for Windows)
- name: Set git to use LF
@@ -48,9 +85,9 @@ jobs:
go-version: '^1.17.5'
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
uses: golangci/golangci-lint-action@v3
with:
version: v1.43
version: v1.45.2
args: "--timeout=5m"
# golangci-lint action doesn't always provide helpful output, so re-run without the action for
@@ -69,11 +106,11 @@ jobs:
with:
check_filenames: true
# When using this Action in other repos, the --skip option below can be removed
skip: ./.git
skip: ./.git,go.mod,go.sum
ignore_words_list: calle
build:
runs-on: windows-2019
runs-on: windows-2022
needs:
- test
- lint
@@ -90,8 +127,9 @@ jobs:
- name: Install Build deps
run: |
go get github.com/prometheus/promu@v0.11.1
go get github.com/josephspurrier/goversioninfo/cmd/goversioninfo@v1.2.0
dotnet tool install --global GitVersion.Tool --version 5.*
go install "github.com/prometheus/promu@$($Env:PROMU_VER)"
go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@v1.4.0
# GOPATH\bin dir must be added to PATH else the `promu` and `goversioninfo` commands won't be found
echo "$(go env GOPATH)\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
@@ -99,13 +137,16 @@ jobs:
run: |
$ErrorActionPreference = "Stop"
gitversion /output json /showvariable FullSemVer | Set-Content VERSION -PassThru
dotnet-gitversion /output json /showvariable FullSemVer | Set-Content VERSION -PassThru
$Version = Get-Content VERSION
# Windows versioninfo resources need the file version by parts (but product version is free text)
$VersionParts = ($Version -replace '^v?([0-9\.]+).*$','$1').Split(".")
goversioninfo.exe -ver-major $VersionParts[0] -ver-minor $VersionParts[1] -ver-patch $VersionParts[2] -product-version $Version -platform-specific
make crossbuild
# '+' symbols are invalid characters in image tags
(Get-Content -Path VERSION) -replace '\+', '_' | Set-Content -Path VERSION
make build-all
# GH requires all files to have different names, so add version/arch to differentiate
foreach($Arch in "amd64","386") {
Move-Item output\$Arch\windows_exporter.exe output\windows_exporter-$Version-$Arch.exe
@@ -133,6 +174,22 @@ jobs:
promu checksum output\
- name: Login to GitHub container registry
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Latest image
if: ${{ github.event_name != 'pull_request' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$Env:VERSION = 'latest'
make push-all
- name: Release
if: startsWith(github.ref, 'refs/tags/')
env:
@@ -140,3 +197,4 @@ jobs:
run: |
$TagName = $env:GITHUB_REF -replace 'refs/tags/', ''
Get-ChildItem -Path output\* -Include @('windows_exporter*.msi', 'windows_exporter*.exe', 'sha256sums.txt') | Foreach-Object {gh release upload $TagName $_}
make push-all

9
Dockerfile Normal file
View File

@@ -0,0 +1,9 @@
# Note this image doesn't really matter for hostprocess but it is good to build per OS version
# the files in the image are copied to $env:CONTAINER_SANDBOX_MOUNT_POINT on the host
# but the file system is the Host NOT the container
ARG BASE="mcr.microsoft.com/windows/nanoserver:1809"
FROM $BASE
ENV PATH="C:\Windows\system32;C:\Windows;"
COPY output/amd64/windows_exporter.exe /windows_exporter.exe
ENTRYPOINT ["windows_exporter.exe"]

View File

@@ -1,4 +1,15 @@
export GOOS=windows
export DOCKER_IMAGE_NAME ?= windows-exporter
export DOCKER_REPO ?= ghcr.io/prometheus-community
VERSION?=$(shell cat VERSION)
DOCKER?=docker
# Image Variables for Hostprocess Container
# Windows image build is heavily influenced by https://github.com/kubernetes/kubernetes/blob/master/cluster/images/etcd/Makefile
OS=1809
ALL_OS:= 1809 ltsc2022
BASE_IMAGE=mcr.microsoft.com/windows/nanoserver
.PHONY: build
build: windows_exporter.exe
@@ -18,6 +29,10 @@ lint:
e2e-test: windows_exporter.exe
pwsh -NonInteractive -ExecutionPolicy Bypass -File .\tools\end-to-end-test.ps1
.PHONY: promtool
promtool: windows_exporter.exe
pwsh -NonInteractive -ExecutionPolicy Bypass -File .\tools\promtool.ps1
fmt:
gofmt -l -w -s .
@@ -26,3 +41,23 @@ crossbuild:
# on Windows, so for now, we'll just build twice
GOARCH=amd64 promu build --prefix=output/amd64
GOARCH=386 promu build --prefix=output/386
build-image: crossbuild
$(DOCKER) build --build-arg=BASE=$(BASE_IMAGE):$(OS) -f Dockerfile -t $(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(VERSION)-$(OS) .
sub-build-%:
$(MAKE) OS=$* build-image
build-all: $(addprefix sub-build-,$(ALL_OS))
push:
set -x; \
for osversion in ${ALL_OS}; do \
$(DOCKER) push $(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(VERSION)-$${osversion}; \
$(DOCKER) manifest create --amend $(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(VERSION) $(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(VERSION)-$${osversion}; \
full_version=`$(DOCKER) manifest inspect $(BASE_IMAGE):$${osversion} | grep "os.version" | head -n 1 | awk -F\" '{print $$4}'` || true; \
$(DOCKER) manifest annotate --os windows --arch amd64 --os-version $${full_version} $(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(VERSION) $(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(VERSION)-$${osversion}; \
done
$(DOCKER) manifest push --purge $(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(VERSION)
push-all: build-all push

View File

@@ -27,6 +27,11 @@ Name | Description | Enabled by default
[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 |
[mscluster_cluster](docs/collector.mscluster_cluster.md) | MSCluster cluster metrics |
[mscluster_network](docs/collector.mscluster_network.md) | MSCluster network metrics |
[mscluster_node](docs/collector.mscluster_node.md) | MSCluster Node metrics |
[mscluster_resource](docs/collector.mscluster_resource.md) | MSCluster Resource metrics |
[mscluster_resourcegroup](docs/collector.mscluster_resourcegroup.md) | MSCluster ResourceGroup metrics |
[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 |
[netframework_clrexceptions](docs/collector.netframework_clrexceptions.md) | .NET Framework CLR Exceptions |
@@ -41,6 +46,7 @@ Name | Description | Enabled by default
[os](docs/collector.os.md) | OS metrics (memory, processes, users) | &#10003;
[process](docs/collector.process.md) | Per-process metrics |
[remote_fx](docs/collector.remote_fx.md) | RemoteFX protocol (RDP) metrics |
[scheduled_task](docs/collector.scheduled_task.md) | Scheduled Tasks metrics |
[service](docs/collector.service.md) | Service state metrics | &#10003;
[smtp](docs/collector.smtp.md) | IIS SMTP Server |
[system](docs/collector.system.md) | System calls | &#10003;
@@ -78,7 +84,7 @@ Flag | Description | Default value
`--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.print` | If true, print available collectors and exit. |
`--collectors.print` | If true, print available collectors and exit. |
`--scrape.timeout-margin` | Seconds to subtract from the timeout allowed by the client. Tune to allow for overhead or high loads. | `0.5`
`--web.config.file` | A [web config][web_config] for setting up TLS and Auth | None
@@ -115,6 +121,11 @@ On some older versions of Windows you may need to surround parameter values with
msiexec /i C:\Users\Administrator\Downloads\windows_exporter.msi ENABLED_COLLECTORS="ad,iis,logon,memory,process,tcp,thermalzone" TEXTFILE_DIR="C:\custom_metrics\"
```
## Kubernetes Implementation
See detailed steps to install on Windows Kubernetes [here](./kubernetes/kubernetes.md).
## Supported versions
windows_exporter supports Windows Server versions 2008R2 and later, and desktop Windows version 7 and later.
@@ -146,7 +157,7 @@ When there are multiple processes with the same name, WMI represents those after
Using `[defaults]` with `--collectors.enabled` argument which gets expanded with all default collectors.
.\windows_exporter.exe --collectors.enabled "[defaults],process,container"
This enables the additional process and container collectors on top of the defaults.
### Using a configuration file

View File

@@ -37,6 +37,12 @@ type ContainerMetricsCollector struct {
PacketsSent *prometheus.Desc
DroppedPacketsIncoming *prometheus.Desc
DroppedPacketsOutgoing *prometheus.Desc
// Storage
ReadCountNormalized *prometheus.Desc
ReadSizeBytes *prometheus.Desc
WriteCountNormalized *prometheus.Desc
WriteSizeBytes *prometheus.Desc
}
// NewContainerMetricsCollector constructs a new ContainerMetricsCollector
@@ -127,6 +133,30 @@ func NewContainerMetricsCollector() (Collector, error) {
[]string{"container_id", "interface"},
nil,
),
ReadCountNormalized: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "storage_read_count_normalized_total"),
"Read Count Normalized",
[]string{"container_id"},
nil,
),
ReadSizeBytes: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "storage_read_size_bytes_total"),
"Read Size Bytes",
[]string{"container_id"},
nil,
),
WriteCountNormalized: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "storage_write_count_normalized_total"),
"Write Count Normalized",
[]string{"container_id"},
nil,
),
WriteSizeBytes: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "storage_write_size_bytes_total"),
"Write Size Bytes",
[]string{"container_id"},
nil,
),
}, nil
}
@@ -274,6 +304,31 @@ func (c *ContainerMetricsCollector) collect(ch chan<- prometheus.Metric) (*prome
)
break
}
ch <- prometheus.MustNewConstMetric(
c.ReadCountNormalized,
prometheus.CounterValue,
float64(cstats.Storage.ReadCountNormalized),
containerIdWithPrefix,
)
ch <- prometheus.MustNewConstMetric(
c.ReadSizeBytes,
prometheus.CounterValue,
float64(cstats.Storage.ReadSizeBytes),
containerIdWithPrefix,
)
ch <- prometheus.MustNewConstMetric(
c.WriteCountNormalized,
prometheus.CounterValue,
float64(cstats.Storage.WriteCountNormalized),
containerIdWithPrefix,
)
ch <- prometheus.MustNewConstMetric(
c.WriteSizeBytes,
prometheus.CounterValue,
float64(cstats.Storage.WriteSizeBytes),
containerIdWithPrefix,
)
}
return nil, nil

View File

@@ -60,7 +60,7 @@ func newCPUCollector() (Collector, error) {
),
TimeTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "time_total"),
"Time that processor spent in different modes (idle, user, system, ...)",
"Time that processor spent in different modes (dpc, idle, interrupt, privileged, user)",
[]string{"core", "mode"},
nil,
),
@@ -88,7 +88,7 @@ func newCPUCollector() (Collector, error) {
),
TimeTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "time_total"),
"Time that processor spent in different modes (idle, user, system, ...)",
"Time that processor spent in different modes (dpc, idle, interrupt, privileged, user)",
[]string{"core", "mode"},
nil,
),

View File

@@ -53,6 +53,11 @@ type HyperVCollector struct {
LogicalProcessors *prometheus.Desc
VirtualProcessors *prometheus.Desc
// Win32_PerfRawData_HvStats_HyperVHypervisorLogicalProcessor
HostLPGuestRunTimePercent *prometheus.Desc
HostLPHypervisorRunTimePercent *prometheus.Desc
HostLPTotalRunTimePercent *prometheus.Desc
// Win32_PerfRawData_HvStats_HyperVHypervisorRootVirtualProcessor
HostGuestRunTime *prometheus.Desc
HostHypervisorRunTime *prometheus.Desc
@@ -111,6 +116,18 @@ type HyperVCollector struct {
VMNetworkDroppedPacketsOutgoing *prometheus.Desc
VMNetworkPacketsReceived *prometheus.Desc
VMNetworkPacketsSent *prometheus.Desc
// Win32_PerfRawData_BalancerStats_HyperVDynamicMemoryVM
VMMemoryAddedMemory *prometheus.Desc
VMMemoryAveragePressure *prometheus.Desc
VMMemoryCurrentPressure *prometheus.Desc
VMMemoryGuestVisiblePhysicalMemory *prometheus.Desc
VMMemoryMaximumPressure *prometheus.Desc
VMMemoryMemoryAddOperations *prometheus.Desc
VMMemoryMemoryRemoveOperations *prometheus.Desc
VMMemoryMinimumPressure *prometheus.Desc
VMMemoryPhysicalMemory *prometheus.Desc
VMMemoryRemovedMemory *prometheus.Desc
}
// NewHyperVCollector ...
@@ -297,6 +314,27 @@ func NewHyperVCollector() (Collector, error) {
//
HostLPGuestRunTimePercent: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("host_lp"), "guest_run_time_percent"),
"The percentage of time spent by the processor in guest code",
[]string{"core"},
nil,
),
HostLPHypervisorRunTimePercent: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("host_lp"), "hypervisor_run_time_percent"),
"The percentage of time spent by the processor in hypervisor code",
[]string{"core"},
nil,
),
HostLPTotalRunTimePercent: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("host_lp"), "total_run_time_percent"),
"The percentage of time spent by the processor in guest and hypervisor code",
[]string{"core"},
nil,
),
//
HostGuestRunTime: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("host_cpu"), "guest_run_time"),
"The time spent by the virtual processor in guest code",
@@ -593,6 +631,69 @@ func NewHyperVCollector() (Collector, error) {
[]string{"vm_interface"},
nil,
),
//
VMMemoryAddedMemory: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vm_memory"), "added_total"),
"This counter represents memory in MB added to the VM",
[]string{"vm"},
nil,
),
VMMemoryAveragePressure: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vm_memory"), "pressure_average"),
"This gauge represents the average pressure in the VM.",
[]string{"vm"},
nil,
),
VMMemoryCurrentPressure: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vm_memory"), "pressure_current"),
"This gauge represents the current pressure in the VM.",
[]string{"vm"},
nil,
),
VMMemoryGuestVisiblePhysicalMemory: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vm_memory"), "physical_guest_visible"),
"'This gauge represents the amount of memory in MB visible to the VM guest.'",
[]string{"vm"},
nil,
),
VMMemoryMaximumPressure: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vm_memory"), "pressure_maximum"),
"This gauge represents the maximum pressure band in the VM.",
[]string{"vm"},
nil,
),
VMMemoryMemoryAddOperations: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vm_memory"), "add_operations_total"),
"This counter represents the number of operations adding memory to the VM.",
[]string{"vm"},
nil,
),
VMMemoryMemoryRemoveOperations: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vm_memory"), "remove_operations_total"),
"This counter represents the number of operations removing memory from the VM.",
[]string{"vm"},
nil,
),
VMMemoryMinimumPressure: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vm_memory"), "pressure_minimum"),
"This gauge represents the minimum pressure band in the VM.",
[]string{"vm"},
nil,
),
VMMemoryPhysicalMemory: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vm_memory"), "physical"),
"This gauge represents the current amount of memory in MB assigned to the VM.",
[]string{"vm"},
nil,
),
VMMemoryRemovedMemory: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vm_memory"), "removed_total"),
"This counter represents memory in MB removed from the VM",
[]string{"vm"},
nil,
),
}, nil
}
@@ -619,6 +720,11 @@ func (c *HyperVCollector) Collect(ctx *ScrapeContext, ch chan<- prometheus.Metri
return err
}
if desc, err := c.collectHostLPUsage(ch); err != nil {
log.Error("failed collecting hyperV host logical processors metrics:", desc, err)
return err
}
if desc, err := c.collectHostCpuUsage(ch); err != nil {
log.Error("failed collecting hyperV host CPU metrics:", desc, err)
return err
@@ -649,6 +755,11 @@ func (c *HyperVCollector) Collect(ctx *ScrapeContext, ch chan<- prometheus.Metri
return err
}
if desc, err := c.collectVmMemory(ch); err != nil {
log.Error("failed collecting hyperV virtual memory metrics:", desc, err)
return err
}
return nil
}
@@ -919,6 +1030,59 @@ func (c *HyperVCollector) collectVmProcessor(ch chan<- prometheus.Metric) (*prom
return nil, nil
}
// Win32_PerfRawData_HvStats_HyperVHypervisorLogicalProcessor ...
type Win32_PerfRawData_HvStats_HyperVHypervisorLogicalProcessor struct {
Name string
PercentGuestRunTime uint64
PercentHypervisorRunTime uint64
PercentTotalRunTime uint
}
func (c *HyperVCollector) collectHostLPUsage(ch chan<- prometheus.Metric) (*prometheus.Desc, error) {
var dst []Win32_PerfRawData_HvStats_HyperVHypervisorLogicalProcessor
q := queryAll(&dst)
if err := wmi.Query(q, &dst); err != nil {
return nil, err
}
for _, obj := range dst {
if strings.Contains(obj.Name, "_Total") {
continue
}
// The name format is Hv LP <core id>
parts := strings.Split(obj.Name, " ")
if len(parts) != 3 {
log.Warnf("Unexpected format of Name in collectHostLPUsage: %q", obj.Name)
continue
}
coreId := parts[2]
ch <- prometheus.MustNewConstMetric(
c.HostLPGuestRunTimePercent,
prometheus.GaugeValue,
float64(obj.PercentGuestRunTime),
coreId,
)
ch <- prometheus.MustNewConstMetric(
c.HostLPHypervisorRunTimePercent,
prometheus.GaugeValue,
float64(obj.PercentHypervisorRunTime),
coreId,
)
ch <- prometheus.MustNewConstMetric(
c.HostLPTotalRunTimePercent,
prometheus.GaugeValue,
float64(obj.PercentTotalRunTime),
coreId,
)
}
return nil, nil
}
// Win32_PerfRawData_HvStats_HyperVHypervisorRootVirtualProcessor ...
type Win32_PerfRawData_HvStats_HyperVHypervisorRootVirtualProcessor struct {
Name string
@@ -1431,3 +1595,104 @@ func (c *HyperVCollector) collectVmNetwork(ch chan<- prometheus.Metric) (*promet
return nil, nil
}
// Win32_PerfRawData_BalancerStats_HyperVDynamicMemoryVM ...
type Win32_PerfRawData_BalancerStats_HyperVDynamicMemoryVM struct {
Name string
AddedMemory uint64
AveragePressure uint64
CurrentPressure uint64
GuestVisiblePhysicalMemory uint64
MaximumPressure uint64
MemoryAddOperations uint64
MemoryRemoveOperations uint64
MinimumPressure uint64
PhysicalMemory uint64
RemovedMemory uint64
}
func (c *HyperVCollector) collectVmMemory(ch chan<- prometheus.Metric) (*prometheus.Desc, error) {
var dst []Win32_PerfRawData_BalancerStats_HyperVDynamicMemoryVM
q := queryAll(&dst)
if err := wmi.Query(q, &dst); err != nil {
return nil, err
}
for _, obj := range dst {
if strings.Contains(obj.Name, "_Total") {
continue
}
ch <- prometheus.MustNewConstMetric(
c.VMMemoryAddedMemory,
prometheus.CounterValue,
float64(obj.AddedMemory),
obj.Name,
)
ch <- prometheus.MustNewConstMetric(
c.VMMemoryAveragePressure,
prometheus.GaugeValue,
float64(obj.AveragePressure),
obj.Name,
)
ch <- prometheus.MustNewConstMetric(
c.VMMemoryCurrentPressure,
prometheus.GaugeValue,
float64(obj.CurrentPressure),
obj.Name,
)
ch <- prometheus.MustNewConstMetric(
c.VMMemoryGuestVisiblePhysicalMemory,
prometheus.GaugeValue,
float64(obj.GuestVisiblePhysicalMemory),
obj.Name,
)
ch <- prometheus.MustNewConstMetric(
c.VMMemoryMaximumPressure,
prometheus.GaugeValue,
float64(obj.MaximumPressure),
obj.Name,
)
ch <- prometheus.MustNewConstMetric(
c.VMMemoryMemoryAddOperations,
prometheus.CounterValue,
float64(obj.MemoryAddOperations),
obj.Name,
)
ch <- prometheus.MustNewConstMetric(
c.VMMemoryMemoryRemoveOperations,
prometheus.CounterValue,
float64(obj.MemoryRemoveOperations),
obj.Name,
)
ch <- prometheus.MustNewConstMetric(
c.VMMemoryMinimumPressure,
prometheus.GaugeValue,
float64(obj.MinimumPressure),
obj.Name,
)
ch <- prometheus.MustNewConstMetric(
c.VMMemoryPhysicalMemory,
prometheus.GaugeValue,
float64(obj.PhysicalMemory),
obj.Name,
)
ch <- prometheus.MustNewConstMetric(
c.VMMemoryRemovedMemory,
prometheus.CounterValue,
float64(obj.RemovedMemory),
obj.Name,
)
}
return nil, nil
}

View File

@@ -69,6 +69,7 @@ type IISCollector struct {
CurrentConnections *prometheus.Desc
CurrentISAPIExtensionRequests *prometheus.Desc
CurrentNonAnonymousUsers *prometheus.Desc
ServiceUptime *prometheus.Desc
TotalBytesReceived *prometheus.Desc
TotalBytesSent *prometheus.Desc
TotalAnonymousUsers *prometheus.Desc
@@ -242,6 +243,12 @@ func NewIISCollector() (Collector, error) {
[]string{"site"},
nil,
),
ServiceUptime: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "service_uptime"),
"Number of seconds the WebService is up (WebService.ServiceUptime)",
[]string{"site"},
nil,
),
TotalBytesReceived: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "received_bytes_total"),
"Number of data bytes that have been received by the Web service (WebService.TotalBytesReceived)",
@@ -416,25 +423,25 @@ func NewIISCollector() (Collector, error) {
// W3SVC_W3WP
Threads: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_threads"),
"",
"Number of threads actively processing requests in the worker process",
[]string{"app", "pid", "state"},
nil,
),
MaximumThreads: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_max_threads"),
"",
"Maximum number of threads to which the thread pool can grow as needed",
[]string{"app", "pid"},
nil,
),
RequestsTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_requests_total"),
"",
"Total number of HTTP requests served by the worker process",
[]string{"app", "pid"},
nil,
),
RequestsActive: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_current_requests"),
"",
"Current number of requests being processed by the worker process",
[]string{"app", "pid"},
nil,
),
@@ -446,121 +453,121 @@ func NewIISCollector() (Collector, error) {
),
CurrentFileCacheMemoryUsage: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_file_cache_memory_bytes"),
"",
"Current number of bytes used by user-mode file cache",
[]string{"app", "pid"},
nil,
),
MaximumFileCacheMemoryUsage: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_file_cache_max_memory_bytes"),
"",
"Maximum number of bytes used by user-mode file cache",
[]string{"app", "pid"},
nil,
),
FileCacheFlushesTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_file_cache_flushes_total"),
"",
"Total number of files removed from the user-mode cache",
[]string{"app", "pid"},
nil,
),
FileCacheQueriesTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_file_cache_queries_total"),
"",
"Total file cache queries (hits + misses)",
[]string{"app", "pid"},
nil,
),
FileCacheHitsTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_file_cache_hits_total"),
"",
"Total number of successful lookups in the user-mode file cache",
[]string{"app", "pid"},
nil,
),
FilesCached: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_file_cache_items"),
"",
"Current number of files whose contents are present in user-mode cache",
[]string{"app", "pid"},
nil,
),
FilesCachedTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_file_cache_items_total"),
"",
"Total number of files whose contents were ever added to the user-mode cache (since service startup)",
[]string{"app", "pid"},
nil,
),
FilesFlushedTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_file_cache_items_flushed_total"),
"",
"Total number of file handles that have been removed from the user-mode cache (since service startup)",
[]string{"app", "pid"},
nil,
),
URICacheFlushesTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_uri_cache_flushes_total"),
"",
"Total number of URI cache flushes (since service startup)",
[]string{"app", "pid"},
nil,
),
URICacheQueriesTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_uri_cache_queries_total"),
"",
"Total number of uri cache queries (hits + misses)",
[]string{"app", "pid"},
nil,
),
URICacheHitsTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_uri_cache_hits_total"),
"",
"Total number of successful lookups in the user-mode URI cache (since service startup)",
[]string{"app", "pid"},
nil,
),
URIsCached: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_uri_cache_items"),
"",
"Number of URI information blocks currently in the user-mode cache",
[]string{"app", "pid"},
nil,
),
URIsCachedTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_uri_cache_items_total"),
"",
"Total number of URI information blocks added to the user-mode cache (since service startup)",
[]string{"app", "pid"},
nil,
),
URIsFlushedTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_uri_cache_items_flushed_total"),
"",
"The number of URI information blocks that have been removed from the user-mode cache (since service startup)",
[]string{"app", "pid"},
nil,
),
MetadataCached: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_metadata_cache_items"),
"",
"Number of metadata information blocks currently present in user-mode cache",
[]string{"app", "pid"},
nil,
),
MetadataCacheFlushes: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_metadata_cache_flushes_total"),
"",
"Total number of user-mode metadata cache flushes (since service startup)",
[]string{"app", "pid"},
nil,
),
MetadataCacheQueriesTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_metadata_cache_queries_total"),
"",
"Total metadata cache queries (hits + misses)",
[]string{"app", "pid"},
nil,
),
MetadataCacheHitsTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_metadata_cache_hits_total"),
"",
"Total number of successful lookups in the user-mode metadata cache (since service startup)",
[]string{"app", "pid"},
nil,
),
MetadataCachedTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_metadata_cache_items_cached_total"),
"",
"Total number of metadata information blocks added to the user-mode cache (since service startup)",
[]string{"app", "pid"},
nil,
),
MetadataFlushedTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_metadata_cache_items_flushed_total"),
"",
"Total number of metadata information blocks removed from the user-mode cache (since service startup)",
[]string{"app", "pid"},
nil,
),
@@ -572,44 +579,44 @@ func NewIISCollector() (Collector, error) {
),
OutputCacheItems: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_output_cache_items"),
"",
"Number of items current present in output cache",
[]string{"app", "pid"},
nil,
),
OutputCacheMemoryUsage: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_output_cache_memory_bytes"),
"",
"Current number of bytes used by output cache",
[]string{"app", "pid"},
nil,
),
OutputCacheQueriesTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_output_queries_total"),
"",
"Total number of output cache queries (hits + misses)",
[]string{"app", "pid"},
nil,
),
OutputCacheHitsTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_output_cache_hits_total"),
"",
"Total number of successful lookups in output cache (since service startup)",
[]string{"app", "pid"},
nil,
),
OutputCacheFlushedItemsTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_output_cache_items_flushed_total"),
"",
"Total number of items flushed from output cache (since service startup)",
[]string{"app", "pid"},
nil,
),
OutputCacheFlushesTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_output_cache_flushes_total"),
"",
"Total number of flushes of output cache (since service startup)",
[]string{"app", "pid"},
nil,
),
// W3SVC_W3WP_IIS8
RequestErrorsTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_request_errors_total"),
"",
"Total number of requests that returned an error",
[]string{"app", "pid", "status_code"},
nil,
),
@@ -641,127 +648,127 @@ func NewIISCollector() (Collector, error) {
// Web Service Cache
ServiceCache_ActiveFlushedEntries: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "server_cache_active_flushed_entries"),
"Number of file handles cached in user-mode that will be closed when all current transfers complete.",
"Number of file handles cached that will be closed when all current transfers complete.",
nil,
nil,
),
ServiceCache_CurrentFileCacheMemoryUsage: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "server_file_cache_memory_bytes"),
"",
"Current number of bytes used by file cache",
nil,
nil,
),
ServiceCache_MaximumFileCacheMemoryUsage: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "server_file_cache_max_memory_bytes"),
"",
"Maximum number of bytes used by file cache",
nil,
nil,
),
ServiceCache_FileCacheFlushesTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "server_file_cache_flushes_total"),
"",
"Total number of file cache flushes (since service startup)",
nil,
nil,
),
ServiceCache_FileCacheQueriesTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "server_file_cache_queries_total"),
"",
"Total number of file cache queries (hits + misses)",
nil,
nil,
),
ServiceCache_FileCacheHitsTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "server_file_cache_hits_total"),
"",
"Total number of successful lookups in the user-mode file cache",
nil,
nil,
),
ServiceCache_FilesCached: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "server_file_cache_items"),
"",
"Current number of files whose contents are present in cache",
nil,
nil,
),
ServiceCache_FilesCachedTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "server_file_cache_items_total"),
"",
"Total number of files whose contents were ever added to the cache (since service startup)",
nil,
nil,
),
ServiceCache_FilesFlushedTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "server_file_cache_items_flushed_total"),
"",
"Total number of file handles that have been removed from the cache (since service startup)",
nil,
nil,
),
ServiceCache_URICacheFlushesTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "server_uri_cache_flushes_total"),
"",
"Total number of URI cache flushes (since service startup)",
[]string{"mode"},
nil,
),
ServiceCache_URICacheQueriesTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "server_uri_cache_queries_total"),
"",
"Total number of uri cache queries (hits + misses)",
[]string{"mode"},
nil,
),
ServiceCache_URICacheHitsTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "server_uri_cache_hits_total"),
"",
"Total number of successful lookups in the URI cache (since service startup)",
[]string{"mode"},
nil,
),
ServiceCache_URIsCached: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "server_uri_cache_items"),
"",
"Number of URI information blocks currently in the cache",
[]string{"mode"},
nil,
),
ServiceCache_URIsCachedTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "server_uri_cache_items_total"),
"",
"Total number of URI information blocks added to the cache (since service startup)",
[]string{"mode"},
nil,
),
ServiceCache_URIsFlushedTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "server_uri_cache_items_flushed_total"),
"",
"The number of URI information blocks that have been removed from the cache (since service startup)",
[]string{"mode"},
nil,
),
ServiceCache_MetadataCached: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "server_metadata_cache_items"),
"",
"Number of metadata information blocks currently present in cache",
nil,
nil,
),
ServiceCache_MetadataCacheFlushes: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "server_metadata_cache_flushes_total"),
"",
"Total number of metadata cache flushes (since service startup)",
nil,
nil,
),
ServiceCache_MetadataCacheQueriesTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "server_metadata_cache_queries_total"),
"",
"Total metadata cache queries (hits + misses)",
nil,
nil,
),
ServiceCache_MetadataCacheHitsTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "server_metadata_cache_hits_total"),
"",
"Total number of successful lookups in the metadata cache (since service startup)",
nil,
nil,
),
ServiceCache_MetadataCachedTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "server_metadata_cache_items_cached_total"),
"",
"Total number of metadata information blocks added to the cache (since service startup)",
nil,
nil,
),
ServiceCache_MetadataFlushedTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "server_metadata_cache_items_flushed_total"),
"",
"Total number of metadata information blocks removed from the cache (since service startup)",
nil,
nil,
),
@@ -773,37 +780,37 @@ func NewIISCollector() (Collector, error) {
),
ServiceCache_OutputCacheItems: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "server_output_cache_items"),
"",
"Number of items current present in output cache",
nil,
nil,
),
ServiceCache_OutputCacheMemoryUsage: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "server_output_cache_memory_bytes"),
"",
"Current number of bytes used by output cache",
nil,
nil,
),
ServiceCache_OutputCacheQueriesTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "server_output_cache_queries_total"),
"",
"Total output cache queries (hits + misses)",
nil,
nil,
),
ServiceCache_OutputCacheHitsTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "server_output_cache_hits_total"),
"",
"Total number of successful lookups in output cache (since service startup)",
nil,
nil,
),
ServiceCache_OutputCacheFlushedItemsTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "server_output_cache_items_flushed_total"),
"",
"Total number of items flushed from output cache (since service startup)",
nil,
nil,
),
ServiceCache_OutputCacheFlushesTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "server_output_cache_flushes_total"),
"",
"Total number of flushes of output cache (since service startup)",
nil,
nil,
),
@@ -845,6 +852,7 @@ type perflibWebService struct {
CurrentConnections float64 `perflib:"Current Connections"`
CurrentISAPIExtensionRequests float64 `perflib:"Current ISAPI Extension Requests"`
CurrentNonAnonymousUsers float64 `perflib:"Current NonAnonymous Users"`
ServiceUptime float64 `perflib:"Service Uptime"`
TotalBytesReceived float64 `perflib:"Total Bytes Received"`
TotalBytesSent float64 `perflib:"Total Bytes Sent"`
@@ -925,6 +933,12 @@ func (c *IISCollector) collectWebService(ctx *ScrapeContext, ch chan<- prometheu
app.CurrentNonAnonymousUsers,
app.Name,
)
ch <- prometheus.MustNewConstMetric(
c.ServiceUptime,
prometheus.GaugeValue,
app.ServiceUptime,
app.Name,
)
ch <- prometheus.MustNewConstMetric(
c.TotalBytesReceived,
prometheus.CounterValue,
@@ -1340,11 +1354,7 @@ func (c *IISCollector) collectW3SVC_W3WP(ctx *ScrapeContext, ch chan<- prometheu
// Extract the apppool name from the format <PID>_<NAME>
pid := workerProcessNameExtractor.ReplaceAllString(app.Name, "$1")
name := workerProcessNameExtractor.ReplaceAllString(app.Name, "$2")
if name == "" {
log.Error("no instances found in W3SVC_W3WP - skipping collection")
break
}
if name == "_Total" ||
if name == "" || name == "_Total" ||
c.appBlacklistPattern.MatchString(name) ||
!c.appWhitelistPattern.MatchString(name) {
continue
@@ -1596,11 +1606,7 @@ func (c *IISCollector) collectW3SVC_W3WP(ctx *ScrapeContext, ch chan<- prometheu
// Extract the apppool name from the format <PID>_<NAME>
pid := workerProcessNameExtractor.ReplaceAllString(app.Name, "$1")
name := workerProcessNameExtractor.ReplaceAllString(app.Name, "$2")
if name == "" {
log.Error("no instances found in W3SVC_W3WP_IIS8 - skipping collection")
break
}
if name == "_Total" ||
if name == "" || name == "_Total" ||
c.appBlacklistPattern.MatchString(name) ||
!c.appWhitelistPattern.MatchString(name) {
continue

View File

@@ -77,7 +77,8 @@ func NewMemoryCollector() (Collector, error) {
),
CacheFaultsTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "cache_faults_total"),
"(CacheFaultsPersec)",
"Number of faults which occur when a page sought in the file system cache is not found there and must be retrieved from elsewhere in memory (soft fault) "+
"or from disk (hard fault) (Cache Faults/sec)",
nil,
nil,
),
@@ -96,13 +97,14 @@ func NewMemoryCollector() (Collector, error) {
DemandZeroFaultsTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "demand_zero_faults_total"),
"The number of zeroed pages required to satisfy faults. Zeroed pages, pages emptied of previously stored data and filled with zeros, are a security"+
" feature of Windows that prevent processes from seeing data stored by earlier processes that used the memory space (DemandZeroFaults)",
" feature of Windows that prevent processes from seeing data stored by earlier processes that used the memory space (Demand Zero Faults/sec)",
nil,
nil,
),
FreeAndZeroPageListBytes: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "free_and_zero_page_list_bytes"),
"(FreeAndZeroPageListBytes)",
"The amount of physical memory, in bytes, that is assigned to the free and zero page lists. This memory does not contain cached data. It is immediately"+
" available for allocation to a process or for system use (FreeAndZeroPageListBytes)",
nil,
nil,
),
@@ -114,13 +116,14 @@ func NewMemoryCollector() (Collector, error) {
),
ModifiedPageListBytes: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "modified_page_list_bytes"),
"(ModifiedPageListBytes)",
"The amount of physical memory, in bytes, that is assigned to the modified page list. This memory contains cached data and code that is not actively in "+
"use by processes, the system and the system cache (ModifiedPageListBytes)",
nil,
nil,
),
PageFaultsTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "page_faults_total"),
"(PageFaultsPersec)",
"Overall rate at which faulted pages are handled by the processor (Page Faults/sec)",
nil,
nil,
),
@@ -162,14 +165,15 @@ func NewMemoryCollector() (Collector, error) {
nil,
),
PoolNonpagedBytes: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "pool_nonpaged_bytes_total"),
"(PoolNonpagedBytes)",
prometheus.BuildFQName(Namespace, subsystem, "pool_nonpaged_bytes"),
"Number of bytes in the non-paged pool, an area of the system virtual memory that is used for objects that cannot be written to disk, but must "+
"remain in physical memory as long as they are allocated (PoolNonpagedBytes)",
nil,
nil,
),
PoolPagedAllocsTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "pool_paged_allocs_total"),
"(PoolPagedAllocs)",
"Number of calls to allocate space in the paged pool, regardless of the amount of space allocated in each call (PoolPagedAllocs)",
nil,
nil,
),
@@ -181,67 +185,72 @@ func NewMemoryCollector() (Collector, error) {
),
PoolPagedResidentBytes: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "pool_paged_resident_bytes"),
"(PoolPagedResidentBytes)",
"The size, in bytes, of the portion of the paged pool that is currently resident and active in physical memory. The paged pool is an area of the "+
"system virtual memory that is used for objects that can be written to disk when they are not being used (PoolPagedResidentBytes)",
nil,
nil,
),
StandbyCacheCoreBytes: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "standby_cache_core_bytes"),
"(StandbyCacheCoreBytes)",
"The amount of physical memory, in bytes, that is assigned to the core standby cache page lists. This memory contains cached data and code that is "+
"not actively in use by processes, the system and the system cache (StandbyCacheCoreBytes)",
nil,
nil,
),
StandbyCacheNormalPriorityBytes: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "standby_cache_normal_priority_bytes"),
"(StandbyCacheNormalPriorityBytes)",
"The amount of physical memory, in bytes, that is assigned to the normal priority standby cache page lists. This memory contains cached data and "+
"code that is not actively in use by processes, the system and the system cache (StandbyCacheNormalPriorityBytes)",
nil,
nil,
),
StandbyCacheReserveBytes: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "standby_cache_reserve_bytes"),
"(StandbyCacheReserveBytes)",
"The amount of physical memory, in bytes, that is assigned to the reserve standby cache page lists. This memory contains cached data and code "+
"that is not actively in use by processes, the system and the system cache (StandbyCacheReserveBytes)",
nil,
nil,
),
SystemCacheResidentBytes: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "system_cache_resident_bytes"),
"(SystemCacheResidentBytes)",
"The size, in bytes, of the portion of the system file cache which is currently resident and active in physical memory (SystemCacheResidentBytes)",
nil,
nil,
),
SystemCodeResidentBytes: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "system_code_resident_bytes"),
"(SystemCodeResidentBytes)",
"The size, in bytes, of the pageable operating system code that is currently resident and active in physical memory (SystemCodeResidentBytes)",
nil,
nil,
),
SystemCodeTotalBytes: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "system_code_total_bytes"),
"(SystemCodeTotalBytes)",
"The size, in bytes, of the pageable operating system code currently mapped into the system virtual address space (SystemCodeTotalBytes)",
nil,
nil,
),
SystemDriverResidentBytes: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "system_driver_resident_bytes"),
"(SystemDriverResidentBytes)",
"The size, in bytes, of the pageable physical memory being used by device drivers. It is the working set (physical memory area) of the drivers (SystemDriverResidentBytes)",
nil,
nil,
),
SystemDriverTotalBytes: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "system_driver_total_bytes"),
"(SystemDriverTotalBytes)",
"The size, in bytes, of the pageable virtual memory currently being used by device drivers. Pageable memory can be written to disk when it is not being used (SystemDriverTotalBytes)",
nil,
nil,
),
TransitionFaultsTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "transition_faults_total"),
"(TransitionFaultsPersec)",
"Number of faults rate at which page faults are resolved by recovering pages that were being used by another process sharing the page, or were on the "+
"modified page list or the standby list, or were being written to disk at the time of the page fault (TransitionFaultsPersec)",
nil,
nil,
),
TransitionPagesRepurposedTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "transition_pages_repurposed_total"),
"(TransitionPagesRePurposedPersec)",
"Transition Pages RePurposed is the rate at which the number of transition cache pages were reused for a different purpose (TransitionPagesRePurposedPersec)",
nil,
nil,
),
@@ -327,7 +336,7 @@ func (c *MemoryCollector) collect(ctx *ScrapeContext, ch chan<- prometheus.Metri
ch <- prometheus.MustNewConstMetric(
c.CacheFaultsTotal,
prometheus.GaugeValue,
prometheus.CounterValue,
dst[0].CacheFaultsPersec,
)
@@ -345,7 +354,7 @@ func (c *MemoryCollector) collect(ctx *ScrapeContext, ch chan<- prometheus.Metri
ch <- prometheus.MustNewConstMetric(
c.DemandZeroFaultsTotal,
prometheus.GaugeValue,
prometheus.CounterValue,
dst[0].DemandZeroFaultsPersec,
)
@@ -369,37 +378,37 @@ func (c *MemoryCollector) collect(ctx *ScrapeContext, ch chan<- prometheus.Metri
ch <- prometheus.MustNewConstMetric(
c.PageFaultsTotal,
prometheus.GaugeValue,
prometheus.CounterValue,
dst[0].PageFaultsPersec,
)
ch <- prometheus.MustNewConstMetric(
c.SwapPageReadsTotal,
prometheus.GaugeValue,
prometheus.CounterValue,
dst[0].PageReadsPersec,
)
ch <- prometheus.MustNewConstMetric(
c.SwapPagesReadTotal,
prometheus.GaugeValue,
prometheus.CounterValue,
dst[0].PagesInputPersec,
)
ch <- prometheus.MustNewConstMetric(
c.SwapPagesWrittenTotal,
prometheus.GaugeValue,
prometheus.CounterValue,
dst[0].PagesOutputPersec,
)
ch <- prometheus.MustNewConstMetric(
c.SwapPageOperationsTotal,
prometheus.GaugeValue,
prometheus.CounterValue,
dst[0].PagesPersec,
)
ch <- prometheus.MustNewConstMetric(
c.SwapPageWritesTotal,
prometheus.GaugeValue,
prometheus.CounterValue,
dst[0].PageWritesPersec,
)
@@ -417,7 +426,7 @@ func (c *MemoryCollector) collect(ctx *ScrapeContext, ch chan<- prometheus.Metri
ch <- prometheus.MustNewConstMetric(
c.PoolPagedAllocsTotal,
prometheus.GaugeValue,
prometheus.CounterValue,
dst[0].PoolPagedAllocs,
)
@@ -483,19 +492,19 @@ func (c *MemoryCollector) collect(ctx *ScrapeContext, ch chan<- prometheus.Metri
ch <- prometheus.MustNewConstMetric(
c.TransitionFaultsTotal,
prometheus.GaugeValue,
prometheus.CounterValue,
dst[0].TransitionFaultsPersec,
)
ch <- prometheus.MustNewConstMetric(
c.TransitionPagesRepurposedTotal,
prometheus.GaugeValue,
prometheus.CounterValue,
dst[0].TransitionPagesRePurposedPersec,
)
ch <- prometheus.MustNewConstMetric(
c.WriteCopiesTotal,
prometheus.GaugeValue,
prometheus.CounterValue,
dst[0].WriteCopiesPersec,
)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,117 @@
package collector
import (
"github.com/StackExchange/wmi"
"github.com/prometheus/client_golang/prometheus"
)
func init() {
registerCollector("mscluster_network", newMSCluster_NetworkCollector)
}
// A MSCluster_NetworkCollector is a Prometheus collector for WMI MSCluster_Network metrics
type MSCluster_NetworkCollector struct {
Characteristics *prometheus.Desc
Flags *prometheus.Desc
Metric *prometheus.Desc
Role *prometheus.Desc
State *prometheus.Desc
}
func newMSCluster_NetworkCollector() (Collector, error) {
const subsystem = "mscluster_network"
return &MSCluster_NetworkCollector{
Characteristics: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "characteristics"),
"Provides the characteristics of the network.",
[]string{"name"},
nil,
),
Flags: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "flags"),
"Provides access to the flags set for the node. ",
[]string{"name"},
nil,
),
Metric: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "metric"),
"The metric of a cluster network (networks with lower values are used first). If this value is set, then the AutoMetric property is set to false.",
[]string{"name"},
nil,
),
Role: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "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 ",
[]string{"name"},
nil,
),
State: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "state"),
"Provides the current state of the network. 1-1: Unknown; 0: Unavailable; 1: Down; 2: Partitioned; 3: Up",
[]string{"name"},
nil,
),
}, nil
}
// MSCluster_Network docs:
// - https://docs.microsoft.com/en-us/previous-versions/windows/desktop/cluswmi/mscluster-network
//
type MSCluster_Network struct {
Name string
Characteristics uint
Flags uint
Metric uint
Role uint
State uint
}
// Collect sends the metric values for each metric
// to the provided prometheus Metric channel.
func (c *MSCluster_NetworkCollector) Collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) error {
var dst []MSCluster_Network
q := queryAll(&dst)
if err := wmi.QueryNamespace(q, &dst, "root/MSCluster"); err != nil {
return err
}
for _, v := range dst {
ch <- prometheus.MustNewConstMetric(
c.Characteristics,
prometheus.GaugeValue,
float64(v.Characteristics),
v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.Flags,
prometheus.GaugeValue,
float64(v.Flags),
v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.Metric,
prometheus.GaugeValue,
float64(v.Metric),
v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.Role,
prometheus.GaugeValue,
float64(v.Role),
v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.State,
prometheus.GaugeValue,
float64(v.State),
v.Name,
)
}
return nil
}

253
collector/mscluster_node.go Normal file
View File

@@ -0,0 +1,253 @@
package collector
import (
"github.com/StackExchange/wmi"
"github.com/prometheus/client_golang/prometheus"
)
func init() {
registerCollector("mscluster_node", newMSCluster_NodeCollector)
}
// A MSCluster_NodeCollector is a Prometheus collector for WMI MSCluster_Node metrics
type MSCluster_NodeCollector struct {
BuildNumber *prometheus.Desc
Characteristics *prometheus.Desc
DetectedCloudPlatform *prometheus.Desc
DynamicWeight *prometheus.Desc
Flags *prometheus.Desc
MajorVersion *prometheus.Desc
MinorVersion *prometheus.Desc
NeedsPreventQuorum *prometheus.Desc
NodeDrainStatus *prometheus.Desc
NodeHighestVersion *prometheus.Desc
NodeLowestVersion *prometheus.Desc
NodeWeight *prometheus.Desc
State *prometheus.Desc
StatusInformation *prometheus.Desc
}
func newMSCluster_NodeCollector() (Collector, error) {
const subsystem = "mscluster_node"
return &MSCluster_NodeCollector{
BuildNumber: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "build_number"),
"Provides access to the node's BuildNumber property.",
[]string{"name"},
nil,
),
Characteristics: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "characteristics"),
"Provides access to the characteristics set for the node.",
[]string{"name"},
nil,
),
DetectedCloudPlatform: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "detected_cloud_platform"),
"(DetectedCloudPlatform)",
[]string{"name"},
nil,
),
DynamicWeight: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "dynamic_weight"),
"The dynamic vote weight of the node adjusted by dynamic quorum feature.",
[]string{"name"},
nil,
),
Flags: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "flags"),
"Provides access to the flags set for the node.",
[]string{"name"},
nil,
),
MajorVersion: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "major_version"),
"Provides access to the node's MajorVersion property, which specifies the major portion of the Windows version installed.",
[]string{"name"},
nil,
),
MinorVersion: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "minor_version"),
"Provides access to the node's MinorVersion property, which specifies the minor portion of the Windows version installed.",
[]string{"name"},
nil,
),
NeedsPreventQuorum: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "needs_prevent_quorum"),
"Whether the cluster service on that node should be started with prevent quorum flag.",
[]string{"name"},
nil,
),
NodeDrainStatus: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "node_drain_status"),
"The current node drain status of a node. 0: Not Initiated; 1: In Progress; 2: Completed; 3: Failed",
[]string{"name"},
nil,
),
NodeHighestVersion: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "node_highest_version"),
"Provides access to the node's NodeHighestVersion property, which specifies the highest possible version of the cluster service with which the node can join or communicate.",
[]string{"name"},
nil,
),
NodeLowestVersion: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "node_lowest_version"),
"Provides access to the node's NodeLowestVersion property, which specifies the lowest possible version of the cluster service with which the node can join or communicate.",
[]string{"name"},
nil,
),
NodeWeight: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "node_weight"),
"The vote weight of the node.",
[]string{"name"},
nil,
),
State: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "state"),
"Returns the current state of a node. -1: Unknown; 0: Up; 1: Down; 2: Paused; 3: Joining",
[]string{"name"},
nil,
),
StatusInformation: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "status_information"),
"The isolation or quarantine status of the node.",
[]string{"name"},
nil,
),
}, nil
}
// MSCluster_Node docs:
// - https://docs.microsoft.com/en-us/previous-versions/windows/desktop/cluswmi/mscluster-node
//
type MSCluster_Node struct {
Name string
BuildNumber uint
Characteristics uint
DetectedCloudPlatform uint
DynamicWeight uint
Flags uint
MajorVersion uint
MinorVersion uint
NeedsPreventQuorum uint
NodeDrainStatus uint
NodeHighestVersion uint
NodeLowestVersion uint
NodeWeight uint
State uint
StatusInformation uint
}
// Collect sends the metric values for each metric
// to the provided prometheus Metric channel.
func (c *MSCluster_NodeCollector) Collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) error {
var dst []MSCluster_Node
q := queryAll(&dst)
if err := wmi.QueryNamespace(q, &dst, "root/MSCluster"); err != nil {
return err
}
for _, v := range dst {
ch <- prometheus.MustNewConstMetric(
c.BuildNumber,
prometheus.GaugeValue,
float64(v.BuildNumber),
v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.Characteristics,
prometheus.GaugeValue,
float64(v.Characteristics),
v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.DetectedCloudPlatform,
prometheus.GaugeValue,
float64(v.DetectedCloudPlatform),
v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.DynamicWeight,
prometheus.GaugeValue,
float64(v.DynamicWeight),
v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.Flags,
prometheus.GaugeValue,
float64(v.Flags),
v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.MajorVersion,
prometheus.GaugeValue,
float64(v.MajorVersion),
v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.MinorVersion,
prometheus.GaugeValue,
float64(v.MinorVersion),
v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.NeedsPreventQuorum,
prometheus.GaugeValue,
float64(v.NeedsPreventQuorum),
v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.NodeDrainStatus,
prometheus.GaugeValue,
float64(v.NodeDrainStatus),
v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.NodeHighestVersion,
prometheus.GaugeValue,
float64(v.NodeHighestVersion),
v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.NodeLowestVersion,
prometheus.GaugeValue,
float64(v.NodeLowestVersion),
v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.NodeWeight,
prometheus.GaugeValue,
float64(v.NodeWeight),
v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.State,
prometheus.GaugeValue,
float64(v.State),
v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.StatusInformation,
prometheus.GaugeValue,
float64(v.StatusInformation),
v.Name,
)
}
return nil
}

View File

@@ -0,0 +1,285 @@
package collector
import (
"github.com/StackExchange/wmi"
"github.com/prometheus/client_golang/prometheus"
)
func init() {
registerCollector("mscluster_resource", newMSCluster_ResourceCollector)
}
// A MSCluster_ResourceCollector is a Prometheus collector for WMI MSCluster_Resource metrics
type MSCluster_ResourceCollector struct {
Characteristics *prometheus.Desc
DeadlockTimeout *prometheus.Desc
EmbeddedFailureAction *prometheus.Desc
Flags *prometheus.Desc
IsAlivePollInterval *prometheus.Desc
LooksAlivePollInterval *prometheus.Desc
MonitorProcessId *prometheus.Desc
PendingTimeout *prometheus.Desc
ResourceClass *prometheus.Desc
RestartAction *prometheus.Desc
RestartDelay *prometheus.Desc
RestartPeriod *prometheus.Desc
RestartThreshold *prometheus.Desc
RetryPeriodOnFailure *prometheus.Desc
State *prometheus.Desc
Subclass *prometheus.Desc
}
func newMSCluster_ResourceCollector() (Collector, error) {
const subsystem = "mscluster_resource"
return &MSCluster_ResourceCollector{
Characteristics: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "characteristics"),
"Provides the characteristics of the object.",
[]string{"type", "owner_group", "name"},
nil,
),
DeadlockTimeout: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "deadlock_timeout"),
"Indicates the length of time to wait, in milliseconds, before declaring a deadlock in any call into a resource.",
[]string{"type", "owner_group", "name"},
nil,
),
EmbeddedFailureAction: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "embedded_failure_action"),
"The time, in milliseconds, that a resource should remain in a failed state before the Cluster service attempts to restart it.",
[]string{"type", "owner_group", "name"},
nil,
),
Flags: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "flags"),
"Provides access to the flags set for the object.",
[]string{"type", "owner_group", "name"},
nil,
),
IsAlivePollInterval: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "is_alive_poll_interval"),
"Provides access to the resource's IsAlivePollInterval property, which is the recommended interval in milliseconds at which the Cluster Service should poll the resource to determine whether it is operational. If the property is set to 0xFFFFFFFF, the Cluster Service uses the IsAlivePollInterval property for the resource type associated with the resource.",
[]string{"type", "owner_group", "name"},
nil,
),
LooksAlivePollInterval: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "looks_alive_poll_interval"),
"Provides access to the resource's LooksAlivePollInterval property, which is the recommended interval in milliseconds at which the Cluster Service should poll the resource to determine whether it appears operational. If the property is set to 0xFFFFFFFF, the Cluster Service uses the LooksAlivePollInterval property for the resource type associated with the resource.",
[]string{"type", "owner_group", "name"},
nil,
),
MonitorProcessId: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "monitor_process_id"),
"Provides the process ID of the resource host service that is currently hosting the resource.",
[]string{"type", "owner_group", "name"},
nil,
),
PendingTimeout: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "pending_timeout"),
"Provides access to the resource's PendingTimeout property. If a resource cannot be brought online or taken offline in the number of milliseconds specified by the PendingTimeout property, the resource is forcibly terminated.",
[]string{"type", "owner_group", "name"},
nil,
),
ResourceClass: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "resource_class"),
"Gets or sets the resource class of a resource. 0: Unknown; 1: Storage; 2: Network; 32768: Unknown ",
[]string{"type", "owner_group", "name"},
nil,
),
RestartAction: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "restart_action"),
"Provides access to the resource's RestartAction property, which is the action to be taken by the Cluster Service if the resource fails.",
[]string{"type", "owner_group", "name"},
nil,
),
RestartDelay: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "restart_delay"),
"Indicates the time delay before a failed resource is restarted.",
[]string{"type", "owner_group", "name"},
nil,
),
RestartPeriod: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "restart_period"),
"Provides access to the resource's RestartPeriod property, which is interval of time, in milliseconds, during which a specified number of restart attempts can be made on a nonresponsive resource.",
[]string{"type", "owner_group", "name"},
nil,
),
RestartThreshold: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "restart_threshold"),
"Provides access to the resource's RestartThreshold property which is the maximum number of restart attempts that can be made on a resource within an interval defined by the RestartPeriod property before the Cluster Service initiates the action specified by the RestartAction property.",
[]string{"type", "owner_group", "name"},
nil,
),
RetryPeriodOnFailure: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "retry_period_on_failure"),
"Provides access to the resource's RetryPeriodOnFailure property, which is the interval of time (in milliseconds) that a resource should remain in a failed state before the Cluster service attempts to restart it.",
[]string{"type", "owner_group", "name"},
nil,
),
State: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "state"),
"The current state of the resource. -1: Unknown; 0: Inherited; 1: Initializing; 2: Online; 3: Offline; 4: Failed; 128: Pending; 129: Online Pending; 130: Offline Pending ",
[]string{"type", "owner_group", "name"},
nil,
),
Subclass: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "subclass"),
"Provides the list of references to nodes that can be the owner of this resource.",
[]string{"type", "owner_group", "name"},
nil,
),
}, nil
}
// MSCluster_Resource docs:
// - https://docs.microsoft.com/en-us/previous-versions/windows/desktop/cluswmi/mscluster-resource
//
type MSCluster_Resource struct {
Name string
Type string
OwnerGroup string
Characteristics uint
DeadlockTimeout uint
EmbeddedFailureAction uint
Flags uint
IsAlivePollInterval uint
LooksAlivePollInterval uint
MonitorProcessId uint
PendingTimeout uint
ResourceClass uint
RestartAction uint
RestartDelay uint
RestartPeriod uint
RestartThreshold uint
RetryPeriodOnFailure uint
State uint
Subclass uint
}
// Collect sends the metric values for each metric
// to the provided prometheus Metric channel.
func (c *MSCluster_ResourceCollector) Collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) error {
var dst []MSCluster_Resource
q := queryAll(&dst)
if err := wmi.QueryNamespace(q, &dst, "root/MSCluster"); err != nil {
return err
}
for _, v := range dst {
ch <- prometheus.MustNewConstMetric(
c.Characteristics,
prometheus.GaugeValue,
float64(v.Characteristics),
v.Type, v.OwnerGroup, v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.DeadlockTimeout,
prometheus.GaugeValue,
float64(v.DeadlockTimeout),
v.Type, v.OwnerGroup, v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.EmbeddedFailureAction,
prometheus.GaugeValue,
float64(v.EmbeddedFailureAction),
v.Type, v.OwnerGroup, v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.Flags,
prometheus.GaugeValue,
float64(v.Flags),
v.Type, v.OwnerGroup, v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.IsAlivePollInterval,
prometheus.GaugeValue,
float64(v.IsAlivePollInterval),
v.Type, v.OwnerGroup, v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.LooksAlivePollInterval,
prometheus.GaugeValue,
float64(v.LooksAlivePollInterval),
v.Type, v.OwnerGroup, v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.MonitorProcessId,
prometheus.GaugeValue,
float64(v.MonitorProcessId),
v.Type, v.OwnerGroup, v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.PendingTimeout,
prometheus.GaugeValue,
float64(v.PendingTimeout),
v.Type, v.OwnerGroup, v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.ResourceClass,
prometheus.GaugeValue,
float64(v.ResourceClass),
v.Type, v.OwnerGroup, v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.RestartAction,
prometheus.GaugeValue,
float64(v.RestartAction),
v.Type, v.OwnerGroup, v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.RestartDelay,
prometheus.GaugeValue,
float64(v.RestartDelay),
v.Type, v.OwnerGroup, v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.RestartPeriod,
prometheus.GaugeValue,
float64(v.RestartPeriod),
v.Type, v.OwnerGroup, v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.RestartThreshold,
prometheus.GaugeValue,
float64(v.RestartThreshold),
v.Type, v.OwnerGroup, v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.RetryPeriodOnFailure,
prometheus.GaugeValue,
float64(v.RetryPeriodOnFailure),
v.Type, v.OwnerGroup, v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.State,
prometheus.GaugeValue,
float64(v.State),
v.Type, v.OwnerGroup, v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.Subclass,
prometheus.GaugeValue,
float64(v.Subclass),
v.Type, v.OwnerGroup, v.Name,
)
}
return nil
}

View File

@@ -0,0 +1,241 @@
package collector
import (
"github.com/StackExchange/wmi"
"github.com/prometheus/client_golang/prometheus"
)
func init() {
registerCollector("mscluster_resourcegroup", newMSCluster_ResourceGroupCollector)
}
// A MSCluster_ResourceGroupCollector is a Prometheus collector for WMI MSCluster_ResourceGroup metrics
type MSCluster_ResourceGroupCollector struct {
AutoFailbackType *prometheus.Desc
Characteristics *prometheus.Desc
ColdStartSetting *prometheus.Desc
DefaultOwner *prometheus.Desc
FailbackWindowEnd *prometheus.Desc
FailbackWindowStart *prometheus.Desc
FailoverPeriod *prometheus.Desc
FailoverThreshold *prometheus.Desc
FaultDomain *prometheus.Desc
Flags *prometheus.Desc
GroupType *prometheus.Desc
PlacementOptions *prometheus.Desc
Priority *prometheus.Desc
ResiliencyPeriod *prometheus.Desc
State *prometheus.Desc
}
func newMSCluster_ResourceGroupCollector() (Collector, error) {
const subsystem = "mscluster_resourcegroup"
return &MSCluster_ResourceGroupCollector{
AutoFailbackType: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "auto_failback_type"),
"Provides access to the group's AutoFailbackType property.",
[]string{"name"},
nil,
),
Characteristics: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "characteristics"),
"Provides the characteristics of the group.",
[]string{"name"},
nil,
),
ColdStartSetting: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "cold_start_setting"),
"Indicates whether a group can start after a cluster cold start.",
[]string{"name"},
nil,
),
DefaultOwner: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "default_owner"),
"Number of the last node the resource group was activated on or explicitly moved to.",
[]string{"name"},
nil,
),
FailbackWindowEnd: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "failback_window_end"),
"The FailbackWindowEnd property provides the latest time that the group can be moved back to the node identified as its preferred node.",
[]string{"name"},
nil,
),
FailbackWindowStart: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "failback_window_start"),
"The FailbackWindowStart property provides the earliest time (that is, local time as kept by the cluster) that the group can be moved back to the node identified as its preferred node.",
[]string{"name"},
nil,
),
FailoverPeriod: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "failover_period"),
"The FailoverPeriod property specifies a number of hours during which a maximum number of failover attempts, specified by the FailoverThreshold property, can occur.",
[]string{"name"},
nil,
),
FailoverThreshold: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "failover_threshold"),
"The FailoverThreshold property specifies the maximum number of failover attempts.",
[]string{"name"},
nil,
),
Flags: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "flags"),
"Provides access to the flags set for the group. ",
[]string{"name"},
nil,
),
GroupType: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "group_type"),
"The Type of the resource group.",
[]string{"name"},
nil,
),
Priority: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "priority"),
"Priority value of the resource group",
[]string{"name"},
nil,
),
ResiliencyPeriod: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "resiliency_period"),
"The resiliency period for this group, in seconds.",
[]string{"name"},
nil,
),
State: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "state"),
"The current state of the resource group. -1: Unknown; 0: Online; 1: Offline; 2: Failed; 3: Partial Online; 4: Pending",
[]string{"name"},
nil,
),
}, nil
}
// MSCluster_ResourceGroup docs:
// - https://docs.microsoft.com/en-us/previous-versions/windows/desktop/cluswmi/mscluster-resourcegroup
//
type MSCluster_ResourceGroup struct {
Name string
AutoFailbackType uint
Characteristics uint
ColdStartSetting uint
DefaultOwner uint
FailbackWindowEnd int
FailbackWindowStart int
FailoverPeriod uint
FailoverThreshold uint
Flags uint
GroupType uint
Priority uint
ResiliencyPeriod uint
State uint
}
// Collect sends the metric values for each metric
// to the provided prometheus Metric channel.
func (c *MSCluster_ResourceGroupCollector) Collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) error {
var dst []MSCluster_ResourceGroup
q := queryAll(&dst)
if err := wmi.QueryNamespace(q, &dst, "root/MSCluster"); err != nil {
return err
}
for _, v := range dst {
ch <- prometheus.MustNewConstMetric(
c.AutoFailbackType,
prometheus.GaugeValue,
float64(v.AutoFailbackType),
v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.Characteristics,
prometheus.GaugeValue,
float64(v.Characteristics),
v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.ColdStartSetting,
prometheus.GaugeValue,
float64(v.ColdStartSetting),
v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.DefaultOwner,
prometheus.GaugeValue,
float64(v.DefaultOwner),
v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.FailbackWindowEnd,
prometheus.GaugeValue,
float64(v.FailbackWindowEnd),
v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.FailbackWindowStart,
prometheus.GaugeValue,
float64(v.FailbackWindowStart),
v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.FailoverPeriod,
prometheus.GaugeValue,
float64(v.FailoverPeriod),
v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.FailoverThreshold,
prometheus.GaugeValue,
float64(v.FailoverThreshold),
v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.Flags,
prometheus.GaugeValue,
float64(v.Flags),
v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.GroupType,
prometheus.GaugeValue,
float64(v.GroupType),
v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.Priority,
prometheus.GaugeValue,
float64(v.Priority),
v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.ResiliencyPeriod,
prometheus.GaugeValue,
float64(v.ResiliencyPeriod),
v.Name,
)
ch <- prometheus.MustNewConstMetric(
c.State,
prometheus.GaugeValue,
float64(v.State),
v.Name,
)
}
return nil
}

View File

@@ -124,26 +124,31 @@ func (c *NETFramework_NETCLRMemoryCollector) Collect(ctx *ScrapeContext, ch chan
type Win32_PerfRawData_NETFramework_NETCLRMemory struct {
Name string
AllocatedBytesPersec uint64
FinalizationSurvivors uint64
Frequency_PerfTime uint64
Gen0heapsize uint64
Gen0PromotedBytesPerSec uint64
Gen1heapsize uint64
Gen1PromotedBytesPerSec uint64
Gen2heapsize uint64
LargeObjectHeapsize uint64
NumberBytesinallHeaps uint64
NumberGCHandles uint64
NumberGen0Collections uint64
NumberGen1Collections uint64
NumberGen2Collections uint64
NumberInducedGC uint64
NumberofPinnedObjects uint64
NumberofSinkBlocksinuse uint64
NumberTotalcommittedBytes uint64
NumberTotalreservedBytes uint64
PercentTimeinGC uint32
AllocatedBytesPersec uint64
FinalizationSurvivors uint64
Frequency_PerfTime uint64
Gen0heapsize uint64
Gen0PromotedBytesPerSec uint64
Gen1heapsize uint64
Gen1PromotedBytesPerSec uint64
Gen2heapsize uint64
LargeObjectHeapsize uint64
NumberBytesinallHeaps uint64
NumberGCHandles uint64
NumberGen0Collections uint64
NumberGen1Collections uint64
NumberGen2Collections uint64
NumberInducedGC uint64
NumberofPinnedObjects uint64
NumberofSinkBlocksinuse uint64
NumberTotalcommittedBytes uint64
NumberTotalreservedBytes uint64
// PercentTimeinGC has countertype=PERF_RAW_FRACTION.
// Formula: (100 * CounterValue) / BaseValue
// By docs https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/scripting-articles/ms974615(v=msdn.10)#perf_raw_fraction
PercentTimeinGC uint32
// BaseValue is just a "magic" number used to make the calculation come out right.
PercentTimeinGC_base uint32
ProcessID uint64
PromotedFinalizationMemoryfromGen0 uint64
PromotedMemoryfromGen0 uint64
@@ -294,7 +299,7 @@ func (c *NETFramework_NETCLRMemoryCollector) collect(ch chan<- prometheus.Metric
ch <- prometheus.MustNewConstMetric(
c.TimeinGC,
prometheus.GaugeValue,
float64(process.PercentTimeinGC)/float64(process.Frequency_PerfTime),
float64(100*process.PercentTimeinGC)/float64(process.PercentTimeinGC_base),
process.Name,
)
}

View File

@@ -52,7 +52,7 @@ func NewOSCollector() (Collector, error) {
OSInformation: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "info"),
"OperatingSystem.Caption, OperatingSystem.Version",
[]string{"product", "version"},
[]string{"product", "version", "major_version", "minor_version", "build_number"},
nil,
),
PagingLimitBytes: prometheus.NewDesc(
@@ -179,11 +179,7 @@ func (c *OSCollector) collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) (
if err != nil {
return nil, err
}
pagingFiles, _, err := memManKey.GetStringsValue("ExistingPageFiles")
if err != nil {
return nil, err
}
pagingFiles, _, pagingErr := memManKey.GetStringsValue("ExistingPageFiles")
// Get build number and product name from registry
ntKey, err := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\Microsoft\Windows NT\CurrentVersion`, registry.QUERY_VALUE)
defer ntKey.Close()
@@ -240,6 +236,9 @@ func (c *OSCollector) collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) (
1.0,
fmt.Sprintf("Microsoft %s", pn), // Caption
fmt.Sprintf("%d.%d.%s", nwgi.VersionMajor, nwgi.VersionMinor, bn), // Version
fmt.Sprintf("%d", nwgi.VersionMajor), // Major Version
fmt.Sprintf("%d", nwgi.VersionMinor), // Minor Version
bn, // Build number
)
ch <- prometheus.MustNewConstMetric(
@@ -261,12 +260,21 @@ func (c *OSCollector) collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) (
timezoneName,
)
ch <- prometheus.MustNewConstMetric(
c.PagingFreeBytes,
prometheus.GaugeValue,
pfb,
)
if pagingErr == nil {
ch <- prometheus.MustNewConstMetric(
c.PagingFreeBytes,
prometheus.GaugeValue,
pfb,
)
ch <- prometheus.MustNewConstMetric(
c.PagingLimitBytes,
prometheus.GaugeValue,
fsipf,
)
} else {
log.Debugln("Could not find HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management key. windows_os_paging_free_bytes and windows_os_paging_limit_bytes will be omitted.")
}
ch <- prometheus.MustNewConstMetric(
c.VirtualMemoryFreeBytes,
prometheus.GaugeValue,
@@ -300,12 +308,6 @@ func (c *OSCollector) collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) (
float64(nwgi.LoggedOnUsers),
)
ch <- prometheus.MustNewConstMetric(
c.PagingLimitBytes,
prometheus.GaugeValue,
fsipf,
)
ch <- prometheus.MustNewConstMetric(
c.VirtualMemoryBytes,
prometheus.GaugeValue,

314
collector/scheduled_task.go Normal file
View File

@@ -0,0 +1,314 @@
//go:build windows
// +build windows
package collector
import (
"fmt"
"regexp"
"runtime"
"strings"
ole "github.com/go-ole/go-ole"
"github.com/go-ole/go-ole/oleutil"
"github.com/prometheus-community/windows_exporter/log"
"github.com/prometheus/client_golang/prometheus"
"gopkg.in/alecthomas/kingpin.v2"
)
var (
taskWhitelist = kingpin.Flag(
"collector.scheduled_task.whitelist",
"Regexp of tasks to whitelist. Task path must both match whitelist and not match blacklist to be included.",
).Default(".+").String()
taskBlacklist = kingpin.Flag(
"collector.scheduled_task.blacklist",
"Regexp of tasks to blacklist. Task path must both match whitelist and not match blacklist to be included.",
).String()
)
type ScheduledTaskCollector struct {
LastResult *prometheus.Desc
MissedRuns *prometheus.Desc
State *prometheus.Desc
taskWhitelistPattern *regexp.Regexp
taskBlacklistPattern *regexp.Regexp
}
// TaskState ...
// https://docs.microsoft.com/en-us/windows/desktop/api/taskschd/ne-taskschd-task_state
type TaskState uint
type TaskResult uint
const (
TASK_STATE_UNKNOWN TaskState = iota
TASK_STATE_DISABLED
TASK_STATE_QUEUED
TASK_STATE_READY
TASK_STATE_RUNNING
TASK_RESULT_SUCCESS TaskResult = 0x0
)
// RegisteredTask ...
type ScheduledTask struct {
Name string
Path string
Enabled bool
State TaskState
MissedRunsCount float64
LastTaskResult TaskResult
}
type ScheduledTasks []ScheduledTask
func init() {
registerCollector("scheduled_task", NewScheduledTask)
}
// NewScheduledTask ...
func NewScheduledTask() (Collector, error) {
const subsystem = "scheduled_task"
runtime.LockOSThread()
defer runtime.UnlockOSThread()
err := ole.CoInitializeEx(0, ole.COINIT_MULTITHREADED)
if err != nil {
code := err.(*ole.OleError).Code()
if code != ole.S_OK && code != S_FALSE {
return nil, err
}
}
defer ole.CoUninitialize()
return &ScheduledTaskCollector{
LastResult: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "last_result"),
"The result that was returned the last time the registered task was run",
[]string{"task"},
nil,
),
MissedRuns: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "missed_runs"),
"The number of times the registered task missed a scheduled run",
[]string{"task"},
nil,
),
State: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "state"),
"The current state of a scheduled task",
[]string{"task", "state"},
nil,
),
taskWhitelistPattern: regexp.MustCompile(fmt.Sprintf("^(?:%s)$", *taskWhitelist)),
taskBlacklistPattern: regexp.MustCompile(fmt.Sprintf("^(?:%s)$", *taskBlacklist)),
}, nil
}
func (c *ScheduledTaskCollector) Collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) error {
if desc, err := c.collect(ch); err != nil {
log.Error("failed collecting user metrics:", desc, err)
return err
}
return nil
}
var TASK_STATES = []string{"disabled", "queued", "ready", "running", "unknown"}
func (c *ScheduledTaskCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, error) {
scheduledTasks, err := getScheduledTasks()
if err != nil {
return nil, err
}
for _, task := range scheduledTasks {
if c.taskBlacklistPattern.MatchString(task.Path) ||
!c.taskWhitelistPattern.MatchString(task.Path) {
continue
}
lastResult := 0.0
if task.LastTaskResult == TASK_RESULT_SUCCESS {
lastResult = 1.0
}
ch <- prometheus.MustNewConstMetric(
c.LastResult,
prometheus.GaugeValue,
lastResult,
task.Path,
)
ch <- prometheus.MustNewConstMetric(
c.MissedRuns,
prometheus.GaugeValue,
task.MissedRunsCount,
task.Path,
)
for _, state := range TASK_STATES {
var stateValue float64
if strings.ToLower(task.State.String()) == state {
stateValue = 1.0
}
ch <- prometheus.MustNewConstMetric(
c.State,
prometheus.GaugeValue,
stateValue,
task.Path,
state,
)
}
}
return nil, nil
}
const SCHEDULED_TASK_PROGRAM_ID = "Schedule.Service.1"
// S_FALSE is returned by CoInitialize if it was already called on this thread.
const S_FALSE = 0x00000001
func getScheduledTasks() (scheduledTasks ScheduledTasks, err error) {
schedClassID, err := ole.ClassIDFrom(SCHEDULED_TASK_PROGRAM_ID)
if err != nil {
return scheduledTasks, err
}
taskSchedulerObj, err := ole.CreateInstance(schedClassID, nil)
if err != nil || taskSchedulerObj == nil {
return scheduledTasks, err
}
defer taskSchedulerObj.Release()
taskServiceObj := taskSchedulerObj.MustQueryInterface(ole.IID_IDispatch)
_, err = oleutil.CallMethod(taskServiceObj, "Connect")
if err != nil {
return scheduledTasks, err
}
defer taskServiceObj.Release()
res, err := oleutil.CallMethod(taskServiceObj, "GetFolder", `\`)
if err != nil {
return scheduledTasks, err
}
rootFolderObj := res.ToIDispatch()
defer rootFolderObj.Release()
err = fetchTasksRecursively(rootFolderObj, &scheduledTasks)
return scheduledTasks, err
}
func fetchTasksInFolder(folder *ole.IDispatch, scheduledTasks *ScheduledTasks) error {
res, err := oleutil.CallMethod(folder, "GetTasks", 1)
if err != nil {
return err
}
tasks := res.ToIDispatch()
defer tasks.Release()
err = oleutil.ForEach(tasks, func(v *ole.VARIANT) error {
task := v.ToIDispatch()
parsedTask, err := parseTask(task)
if err != nil {
return err
}
*scheduledTasks = append(*scheduledTasks, parsedTask)
return nil
})
return err
}
func fetchTasksRecursively(folder *ole.IDispatch, scheduledTasks *ScheduledTasks) error {
if err := fetchTasksInFolder(folder, scheduledTasks); err != nil {
return err
}
res, err := oleutil.CallMethod(folder, "GetFolders", 1)
if err != nil {
return err
}
subFolders := res.ToIDispatch()
defer subFolders.Release()
err = oleutil.ForEach(subFolders, func(v *ole.VARIANT) error {
subFolder := v.ToIDispatch()
return fetchTasksRecursively(subFolder, scheduledTasks)
})
return err
}
func parseTask(task *ole.IDispatch) (scheduledTask ScheduledTask, err error) {
taskNameVar, err := oleutil.GetProperty(task, "Name")
if err != nil {
return scheduledTask, err
}
taskPathVar, err := oleutil.GetProperty(task, "Path")
if err != nil {
return scheduledTask, err
}
taskEnabledVar, err := oleutil.GetProperty(task, "Enabled")
if err != nil {
return scheduledTask, err
}
taskStateVar, err := oleutil.GetProperty(task, "State")
if err != nil {
return scheduledTask, err
}
taskNumberOfMissedRunsVar, err := oleutil.GetProperty(task, "NumberOfMissedRuns")
if err != nil {
return scheduledTask, err
}
taskLastTaskResultVar, err := oleutil.GetProperty(task, "LastTaskResult")
if err != nil {
return scheduledTask, err
}
scheduledTask.Name = taskNameVar.ToString()
scheduledTask.Path = strings.ReplaceAll(taskPathVar.ToString(), "\\", "/")
scheduledTask.Enabled = taskEnabledVar.Value().(bool)
scheduledTask.State = TaskState(taskStateVar.Val)
scheduledTask.MissedRunsCount = float64(taskNumberOfMissedRunsVar.Val)
scheduledTask.LastTaskResult = TaskResult(taskLastTaskResultVar.Val)
return scheduledTask, err
}
func (t TaskState) String() string {
switch t {
case TASK_STATE_UNKNOWN:
return "Unknown"
case TASK_STATE_DISABLED:
return "Disabled"
case TASK_STATE_QUEUED:
return "Queued"
case TASK_STATE_READY:
return "Ready"
case TASK_STATE_RUNNING:
return "Running"
default:
return ""
}
}

View File

@@ -0,0 +1,9 @@
package collector
import (
"testing"
)
func BenchmarkScheduledTaskCollector(b *testing.B) {
benchmarkCollector(b, "scheduled_task", NewScheduledTask)
}

View File

@@ -6,6 +6,7 @@ package collector
import (
"fmt"
"strings"
"syscall"
"github.com/StackExchange/wmi"
"github.com/prometheus-community/windows_exporter/log"
@@ -234,30 +235,43 @@ func (c *serviceCollector) collectAPI(ch chan<- prometheus.Metric) error {
}
defer svcmgrConnection.Disconnect() //nolint:errcheck
// List All Services from the Services Manager
// List All Services from the Services Manager.
serviceList, err := svcmgrConnection.ListServices()
if err != nil {
return err
}
// Iterate through the Services List
// Iterate through the Services List.
for _, service := range serviceList {
// Retrieve handle for each service
serviceHandle, err := svcmgrConnection.OpenService(service)
if err != nil {
continue
}
defer serviceHandle.Close()
// Get Service Configuration
serviceConfig, err := serviceHandle.Config()
// Get UTF16 service name.
serviceName, err := syscall.UTF16PtrFromString(service)
if err != nil {
log.Warnf("Service %s get name error: %#v", service, err)
continue
}
// Get Service Current Status
serviceStatus, err := serviceHandle.Query()
// Open connection for service handler.
serviceHandle, err := windows.OpenService(svcmgrConnection.Handle, serviceName, windows.GENERIC_READ)
if err != nil {
log.Warnf("Open service %s error: %#v", service, err)
continue
}
// Create handle for each service.
serviceManager := &mgr.Service{Name: service, Handle: serviceHandle}
defer serviceManager.Close()
// Get Service Configuration.
serviceConfig, err := serviceManager.Config()
if err != nil {
log.Warnf("Get ervice %s config error: %#v", service, err)
continue
}
// Get Service Current Status.
serviceStatus, err := serviceManager.Query()
if err != nil {
log.Warnf("Get service %s status error: %#v", service, err)
continue
}

View File

@@ -284,7 +284,12 @@ fileLoop:
error = 1.0
continue
}
// Use temporary array to check for duplicates
var families_array []*dto.MetricFamily
for _, mf := range parsedFamilies {
families_array = append(families_array, mf)
for _, m := range mf.Metric {
if m.TimestampMs != nil {
log.Errorf("Textfile %q contains unsupported client-side timestamps, skipping entire file", path)
@@ -298,6 +303,13 @@ fileLoop:
}
}
// If duplicate metrics are detected in a *single* file, skip processing of file metrics
if duplicateMetricEntry(families_array) {
log.Errorf("Duplicate metrics detected in file %s. Skipping file processing.", f.Name())
error = 1.0
continue
}
// Only set this once it has been parsed and validated, so that
// a failure does not appear fresh.
mtimes[f.Name()] = f.ModTime()
@@ -307,8 +319,9 @@ fileLoop:
}
}
// If duplicates are detected across *multiple* files, return error.
if duplicateMetricEntry(metricFamilies) {
log.Errorf("Duplicate metrics detected in files")
log.Errorf("Duplicate metrics detected across multiple files")
error = 1.0
} else {
for _, mf := range metricFamilies {

View File

@@ -19,7 +19,7 @@ import (
"github.com/prometheus-community/windows_exporter/log"
"gopkg.in/alecthomas/kingpin.v2"
"gopkg.in/yaml.v2"
"gopkg.in/yaml.v3"
)
type getFlagger interface {

View File

@@ -1,7 +1,7 @@
package config
import (
"gopkg.in/yaml.v2"
"gopkg.in/yaml.v3"
"reflect"
"testing"
)

View File

@@ -28,6 +28,7 @@ This directory contains documentation of the collectors in the windows_exporter,
- [`os`](collector.os.md)
- [`process`](collector.process.md)
- [`remote_fx`](collector.remote_fx.md)
- [`scheduled_task`](collector.scheduled_task.md)
- [`service`](collector.service.md)
- [`smtp`](collector.smtp.md)
- [`system`](collector.system.md)

View File

@@ -30,6 +30,10 @@ Name | Description | Type | Labels
`windows_container_network_transmit_bytes_total` | Bytes Sent on Interface | counter | `container_id`, `interface`
`windows_container_network_transmit_packets_total` | Packets Sent on Interface | counter | `container_id`, `interface`
`windows_container_network_transmit_packets_dropped_total` | Dropped Outgoing Packets on Interface | counter | `container_id`, `interface`
`windows_container_storage_read_count_normalized_total` | Read Count Normalized | counter | `container_id`
`windows_container_storage_read_size_bytes_total` | Read Size Bytes | counter | `container_id`
`windows_container_storage_write_count_normalized_total` | Write Count Normalized | counter | `container_id`
`windows_container_storage_write_size_bytes_total` | Write Size Bytes | counter | `container_id`
### Example metric
_windows_container_network_receive_bytes_total{container_id="docker://1bd30e8b8ac28cbd76a9b697b4d7bb9d760267b0733d1bc55c60024e98d1e43e",interface="822179E7-002C-4280-ABBA-28BCFE401826"} 9.3305343e+07_
@@ -37,7 +41,11 @@ _windows_container_network_receive_bytes_total{container_id="docker://1bd30e8b8a
This metric means that total _9.3305343e+07_ bytes received on interface _822179E7-002C-4280-ABBA-28BCFE401826_ for container _docker://1bd30e8b8ac28cbd76a9b697b4d7bb9d760267b0733d1bc55c60024e98d1e43e_
## Useful queries
_This collector does not yet have any useful queries added, we would appreciate your help adding them!_
Attach labels namespace/pod/container fow windows container metrics.
```
# kube_pod_container_info(a metric of kube-state-metrics) has labels namespace/pod/container/container_id for a container, while windows container metrics only have container_id.
# Attaching labels namespace/pod/container for windows container metrics, is useful to query for windows pods.
windows_container_network_receive_bytes_total * on(container_id) group_left(namespace, pod, container) kube_pod_container_info{container_id!=""}
```
## Alerting examples
_This collector does not yet have alerting examples, we would appreciate your help adding them!_

View File

@@ -19,7 +19,7 @@ These metrics are available on all versions of Windows:
Name | Description | Type | Labels
-----|-------------|------|-------
`windows_cpu_cstate_seconds_total` | Time spent in low-power idle states | counter | `core`, `state`
`windows_cpu_time_total` | Time that processor spent in different modes (idle, user, system, ...) | counter | `core`, `mode`
`windows_cpu_time_total` | Time that processor spent in different modes (dpc, idle, interrupt, privileged, user) | counter | `core`, `mode`
`windows_cpu_interrupts_total` | Total number of received and serviced hardware interrupts | counter | `core`
`windows_cpu_dpcs_total` | Total number of received and serviced deferred procedure calls (DPCs) | counter | `core`

View File

@@ -16,7 +16,7 @@ Enabled by default? | No
Lists the Perflib Objects that are queried for data along with the perlfib object id
### `--collectors.exchange.enabled`
Comma-separated list of collectors to use, for example: `--collectors.exchange.enabled=AvailabilityService,OutlookWebAccess`. Matching is case-sensetive. Depending on the exchange installation not all performance counters are available. Use `--collectors.exchange.list` to obtain a list of supported collectors.
Comma-separated list of collectors to use, for example: `--collectors.exchange.enabled=AvailabilityService,OutlookWebAccess`. Matching is case-sensitive. Depending on the exchange installation not all performance counters are available. Use `--collectors.exchange.list` to obtain a list of supported collectors.
## Metrics
Name | Description

View File

@@ -18,7 +18,6 @@ None
Name | Description | Type | Labels
-----|-------------|------|-------
`windows_fsrmquota_count` | Number of Quotas | counter |None
`windows_fsrmquota_description` | A string up to 1KB in size. Optional. The default value is an empty string. (Description) | counter |`path`, `template`,`description`
`windows_fsrmquota_disabled` | If 1, the quota is disabled. The default value is 0. (Disabled) | counter |`path`, `template`

View File

@@ -5,7 +5,7 @@ The hyperv collector exposes metrics about the Hyper-V hypervisor
|||
-|-
Metric name prefix | `hyperv`
Classes | `Win32_PerfRawData_VmmsVirtualMachineStats_HyperVVirtualMachineHealthSummary`<br/>`Win32_PerfRawData_VidPerfProvider_HyperVVMVidPartition`<br/>`Win32_PerfRawData_HvStats_HyperVHypervisorRootPartition`<br/>`Win32_PerfRawData_HvStats_HyperVHypervisor`<br/>`Win32_PerfRawData_HvStats_HyperVHypervisorRootVirtualProcessor`<br/>`Win32_PerfRawData_HvStats_HyperVHypervisorVirtualProcessor`<br/>`Win32_PerfRawData_NvspSwitchStats_HyperVVirtualSwitch`<br/>`Win32_PerfRawData_EthernetPerfProvider_HyperVLegacyNetworkAdapter`<br/>`Win32_PerfRawData_Counters_HyperVVirtualStorageDevice`<br/>`Win32_PerfRawData_NvspNicStats_HyperVVirtualNetworkAdapter`
Classes | `Win32_PerfRawData_VmmsVirtualMachineStats_HyperVVirtualMachineHealthSummary`<br/>`Win32_PerfRawData_VidPerfProvider_HyperVVMVidPartition`<br/>`Win32_PerfRawData_HvStats_HyperVHypervisorRootPartition`<br/>`Win32_PerfRawData_HvStats_HyperVHypervisor`<br/>`Win32_PerfRawData_HvStats_HyperVHypervisorLogicalProcessor`<br/>`Win32_PerfRawData_HvStats_HyperVHypervisorRootVirtualProcessor`<br/>`Win32_PerfRawData_HvStats_HyperVHypervisorVirtualProcessor`<br/>`Win32_PerfRawData_NvspSwitchStats_HyperVVirtualSwitch`<br/>`Win32_PerfRawData_EthernetPerfProvider_HyperVLegacyNetworkAdapter`<br/>`Win32_PerfRawData_Counters_HyperVVirtualStorageDevice`<br/>`Win32_PerfRawData_NvspNicStats_HyperVVirtualNetworkAdapter`
Enabled by default? | No
## Flags
@@ -44,6 +44,9 @@ Name | Description | Type | Labels
`windows_hyperv_root_partition_virtual_tlb_pages` | _Not yet documented_ | counter | None
`windows_hyperv_hypervisor_virtual_processors` | _Not yet documented_ | counter | None
`windows_hyperv_hypervisor_logical_processors` | _Not yet documented_ | counter | None
`windows_hyperv_host_lp_guest_run_time_percent` | _Not yet documented_ | counter | `core`
`windows_hyperv_host_lp_hypervisor_run_time_percent` | _Not yet documented_ | counter | `core`
`windows_hyperv_host_lp_total_run_time_percent` | _Not yet documented_ | counter | `core`
`windows_hyperv_host_cpu_guest_run_time` | _Not yet documented_ | counter | `core`
`windows_hyperv_host_cpu_hypervisor_run_time` | _Not yet documented_ | counter | `core`
`windows_hyperv_host_cpu_remote_run_time` | _Not yet documented_ | counter | `core`
@@ -51,6 +54,16 @@ Name | Description | Type | Labels
`windows_hyperv_vm_cpu_guest_run_time` | _Not yet documented_ | counter | `vm`, `core`
`windows_hyperv_vm_cpu_hypervisor_run_time` | _Not yet documented_ | counter | `vm`, `core`
`windows_hyperv_vm_cpu_remote_run_time` | _Not yet documented_ | counter | `vm`, `core`
`windows_hyperv_vm_memory_added_total` | _Not yet documented_ | counter | `vm`
`windows_hyperv_vm_memory_pressure_average` | _Not yet documented_ | gauge | `vm`
`windows_hyperv_vm_memory_pressure_current` | _Not yet documented_ | counter | `vm`
`windows_hyperv_vm_memory_physical_guest_visible` | _Not yet documented_ | gauge | `vm`
`windows_hyperv_vm_memory_pressure_maximum` | _Not yet documented_ | gauge | `vm`
`windows_hyperv_vm_memory_add_operations_total` | _Not yet documented_ | counter | `vm`
`windows_hyperv_vm_memory_remove_operations_total` | _Not yet documented_ | counter | `vm`
`windows_hyperv_vm_memory_pressure_minumim` | _Not yet documented_ | gauge | `vm`
`windows_hyperv_vm_memory_physical` | _Not yet documented_ | gauge | `vm`
`windows_hyperv_vm_memory_removed_total` | _Not yet documented_ | counter | `vm`
`windows_hyperv_vm_cpu_total_run_time` | _Not yet documented_ | counter | `vm`, `core`
`windows_hyperv_vswitch_broadcast_packets_received_total` | _Not yet documented_ | counter | `vswitch`
`windows_hyperv_vswitch_broadcast_packets_sent_total` | _Not yet documented_ | counter | `vswitch`
@@ -108,6 +121,10 @@ Percent of physical CPU resources by the hosts themselves (on all monitored host
```
(sum by (instance)(rate(windows_hyperv_host_cpu_total_run_time{}[1m]))) / sum by (instance)(windows_cs_logical_processors{}) / 100000
```
Percent of physical CPU resources by the hypervisor (on all monitored hosts)
```
(sum by (instance)(rate(windows_hyperv_host_lp_total_run_time_percent{}[1m]))) / sum by (instance)(windows_hyperv_hypervisor_logical_processors{}) / 100000
```
## Alerting examples
_This collector does not yet have alerting examples, we would appreciate your help adding them!_

View File

@@ -30,105 +30,106 @@ If given, an application needs to *not* match the blacklist regexp in order for
Name | Description | Type | Labels
-----|-------------|------|-------
`windows_iis_current_anonymous_users` | _Not yet documented_ | counter | `site`
`windows_iis_current_anonymous_users` | The number of users who currently have an anonymous request pending with the web service | counter | `site`
`windows_iis_current_blocked_async_io_requests` | _Not yet documented_ | counter | `site`
`windows_iis_current_cgi_requests` | _Not yet documented_ | counter | `site`
`windows_iis_current_connections` | _Not yet documented_ | counter | `site`
`windows_iis_current_isapi_extension_requests` | _Not yet documented_ | counter | `site`
`windows_iis_current_non_anonymous_users` | _Not yet documented_ | counter | `site`
`windows_iis_received_bytes_total` | _Not yet documented_ | counter | `site`
`windows_iis_sent_bytes_total` | _Not yet documented_ | counter | `site`
`windows_iis_anonymous_users_total` | _Not yet documented_ | counter | `site`
`windows_iis_current_cgi_requests` | The number of CGI requests that are being processed simultaneously by the web service | counter | `site`
`windows_iis_current_connections` | The number of active connections to the web service | counter | `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 | counter | `site`
`windows_iis_current_non_anonymous_users` | The number of users who currently have a nonanonymous request pending with the web service | counter | `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_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_blocked_async_io_requests_total` | _Not yet documented_ | counter | `site`
`windows_iis_cgi_requests_total` | _Not yet documented_ | counter | `site`
`windows_iis_connection_attempts_all_instances_total` | _Not yet documented_ | counter | `site`
`windows_iis_requests_total` | _Not yet documented_ | counter | `site`, `method`
`windows_iis_files_received_total` | _Not yet documented_ | counter | `site`
`windows_iis_files_sent_total` | _Not yet documented_ | counter | `site`
`windows_iis_ipapi_extension_requests_total` | _Not yet documented_ | counter | `site`
`windows_iis_locked_errors_total` | _Not yet documented_ | counter | `site`
`windows_iis_logon_attempts_total` | _Not yet documented_ | counter | `site`
`windows_iis_non_anonymous_users_total` | _Not yet documented_ | counter | `site`
`windows_iis_not_found_errors_total` | _Not yet documented_ | 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_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_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_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_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_rejected_async_io_requests_total` | _Not yet documented_ | counter | `site`
`windows_iis_current_application_pool_state` | _Not yet documented_ | counter | `app`, `state`
`windows_iis_current_application_pool_start_time` | _Not yet documented_ | counter | `app`
`windows_iis_current_worker_processes` | _Not yet documented_ | counter | `app`
`windows_iis_maximum_worker_processes` | _Not yet documented_ | counter | `app`
`windows_iis_recent_worker_process_failures` | _Not yet documented_ | counter | `app`
`windows_iis_time_since_last_worker_process_failure` | _Not yet documented_ | counter | `app`
`windows_iis_total_application_pool_recycles` | _Not yet documented_ | counter | `app`
`windows_iis_total_application_pool_start_time` | _Not yet documented_ | counter | `app`
`windows_iis_total_worker_processes_created` | _Not yet documented_ | counter | `app`
`windows_iis_total_worker_process_failures` | _Not yet documented_ | counter | `app`
`windows_iis_total_worker_process_ping_failures` | _Not yet documented_ | counter | `app`
`windows_iis_total_worker_process_shutdown_failures` | _Not yet documented_ | counter | `app`
`windows_iis_total_worker_process_startup_failures` | _Not yet documented_ | counter | `app`
`windows_iis_worker_cache_active_flushed_entries` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_file_cache_memory_bytes` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_file_cache_max_memory_bytes` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_file_cache_flushes_total` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_file_cache_queries_total` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_file_cache_hits_total` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_file_cache_items` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_file_cache_items_total` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_file_cache_items_flushed_total` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_uri_cache_flushes_total` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_uri_cache_queries_total` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_uri_cache_hits_total` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_uri_cache_items` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_uri_cache_items_total` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_uri_cache_items_flushed_total` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_metadata_cache_items` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_metadata_cache_flushes_total` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_metadata_cache_queries_total` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_metadata_cache_hits_total` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_metadata_cache_items_cached_total` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_metadata_cache_items_flushed_total` | _Not yet documented_ | counter | `app`, `pid`
`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) | counter | `app`, `state`
`windows_iis_current_application_pool_start_time` | The unix timestamp for the application pool start time | counter | `app`
`windows_iis_current_worker_processes` | The current number of worker processes that are running in the application pool | counter | `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 | counter | `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 | counter | `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 | 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_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_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_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 | counter | `app`, `pid`
`windows_iis_worker_file_cache_memory_bytes` | Current 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_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_items` | Current number of files whose contents are present in user-mode cache | 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_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_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 | 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_metadata_cache_items` | Number of metadata information blocks currently present in user-mode cache | 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_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_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` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_output_cache_items` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_output_cache_memory_bytes` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_output_queries_total` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_output_cache_hits_total` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_output_cache_items_flushed_total` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_output_cache_flushes_total` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_threads` | _Not yet documented_ | counter | `app`, `pid`, `state`
`windows_iis_worker_max_threads` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_requests_total` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_current_requests` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_request_errors_total` | _Not yet documented_ | counter | `app`, `pid`, `status_code`
`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_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_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_threads` | Number of threads actively processing requests in the worker process | counter | `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_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_request_errors_total` | Total number of requests that returned an error | counter | `app`, `pid`, `status_code`
`windows_iis_worker_current_websocket_requests` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_websocket_connection_attempts_total` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_websocket_connection_accepted_total` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_worker_websocket_connection_rejected_total` | _Not yet documented_ | counter | `app`, `pid`
`windows_iis_server_cache_active_flushed_entries` | _Not yet documented_ | counter | None
`windows_iis_server_file_cache_memory_bytes` | _Not yet documented_ | counter | None
`windows_iis_server_file_cache_max_memory_bytes` | _Not yet documented_ | counter | None
`windows_iis_server_file_cache_flushes_total` | _Not yet documented_ | counter | None
`windows_iis_server_file_cache_queries_total` | _Not yet documented_ | counter | None
`windows_iis_server_file_cache_hits_total` | _Not yet documented_ | counter | None
`windows_iis_server_file_cache_items` | _Not yet documented_ | counter | None
`windows_iis_server_file_cache_items_total` | _Not yet documented_ | counter | None
`windows_iis_server_file_cache_items_flushed_total` | _Not yet documented_ | counter | None
`windows_iis_server_uri_cache_flushes_total` | _Not yet documented_ | counter | `mode`
`windows_iis_server_uri_cache_queries_total` | _Not yet documented_ | counter | `mode`
`windows_iis_server_uri_cache_hits_total` | _Not yet documented_ | counter | `mode`
`windows_iis_server_uri_cache_items` | _Not yet documented_ | counter | `mode`
`windows_iis_server_uri_cache_items_total` | _Not yet documented_ | counter | `mode`
`windows_iis_server_uri_cache_items_flushed_total` | _Not yet documented_ | counter | `mode`
`windows_iis_server_metadata_cache_items` | _Not yet documented_ | counter | None
`windows_iis_server_metadata_cache_flushes_total` | _Not yet documented_ | counter | None
`windows_iis_server_metadata_cache_queries_total` | _Not yet documented_ | counter | None
`windows_iis_server_metadata_cache_hits_total` | _Not yet documented_ | counter | None
`windows_iis_server_metadata_cache_items_cached_total` | _Not yet documented_ | counter | None
`windows_iis_server_metadata_cache_items_flushed_total` | _Not yet documented_ | 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 | 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_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_items` | Current number of files whose contents are present in cache | 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_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_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 | 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_metadata_cache_items` | Number of metadata information blocks currently present in cache | 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_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_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` | _Not yet documented_ | counter | None
`windows_iis_server_output_cache_items` | _Not yet documented_ | counter | None
`windows_iis_server_output_cache_memory_bytes` | _Not yet documented_ | counter | None
`windows_iis_server_output_cache_queries_total` | _Not yet documented_ | counter | None
`windows_iis_server_output_cache_hits_total` | _Not yet documented_ | counter | None
`windows_iis_server_output_cache_items_flushed_total` | _Not yet documented_ | counter | None
`windows_iis_server_output_cache_flushes_total` | _Not yet documented_ | 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_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_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
### Example metric
_This collector does not yet have explained examples, we would appreciate your help adding them!_

View File

@@ -8,6 +8,8 @@ Metric name prefix | `logon`
Classes | [`Win32_LogonSession`](https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-logonsession)
Enabled by default? | No
> :warning: **On some deployments, this collector seems to have some memory/timeout issues**: See [#583](https://github.com/prometheus-community/windows_exporter/issues/583)
## Flags
None

View File

@@ -20,35 +20,35 @@ Name | Description | Type | Labels
`windows_memory_available_bytes` | The amount of physical memory immediately available for allocation to a process or for system use. It is equal to the sum of memory assigned to the standby (cached), free and zero page lists | gauge | None
`windows_memory_cache_bytes` | Number of bytes currently being used by the file system cache | gauge | None
`windows_memory_cache_bytes_peak` | Maximum number of CacheBytes after the system was last restarted | gauge | None
`windows_memory_cache_faults_total` | Number of faults which occur when a page sought in the file system cache is not found there and must be retrieved from elsewhere in memory (soft fault) or from disk (hard fault) | gauge | None
`windows_memory_cache_faults_total` | Number of faults which occur when a page sought in the file system cache is not found there and must be retrieved from elsewhere in memory (soft fault) or from disk (hard fault) | counter | None
`windows_memory_commit_limit` | Amount of virtual memory, in bytes, that can be committed without having to extend the paging file(s) | gauge | None
`windows_memory_committed_bytes` | Amount of committed virtual memory, in bytes | gauge | None
`windows_memory_demand_zero_faults_total` | The number of zeroed pages required to satisfy faults. Zeroed pages, pages emptied of previously stored data and filled with zeros, are a security feature of Windows that prevent processes from seeing data stored by earlier processes that used the memory space | gauge | None
`windows_memory_free_and_zero_page_list_bytes` | _Not yet documented_ | gauge | None
`windows_memory_demand_zero_faults_total` | The number of zeroed pages required to satisfy faults. Zeroed pages, pages emptied of previously stored data and filled with zeros, are a security feature of Windows that prevent processes from seeing data stored by earlier processes that used the memory space | counter | None
`windows_memory_free_and_zero_page_list_bytes` | The amount of physical memory, in bytes, that is assigned to the free and zero page lists. This memory does not contain cached data. It is immediately available for allocation to a process or for system use | gauge | None
`windows_memory_free_system_page_table_entries` | Number of page table entries not being used by the system | gauge | None
`windows_memory_modified_page_list_bytes` | _Not yet documented_ | gauge | None
`windows_memory_page_faults_total` | Overall rate at which faulted pages are handled by the processor | gauge | None
`windows_memory_swap_page_reads_total` | Number of disk page reads (a single read operation reading several pages is still only counted once) | gauge | None
`windows_memory_swap_pages_read_total` | Number of pages read across all page reads (ie counting all pages read even if they are read in a single operation) | gauge | None
`windows_memory_swap_pages_written_total` | Number of pages written across all page writes (ie counting all pages written even if they are written in a single operation) | gauge | None
`windows_memory_swap_page_operations_total` | Total number of swap page read and writes (PagesPersec) | gauge | None
`windows_memory_swap_page_writes_total` | Number of disk page writes (a single write operation writing several pages is still only counted once) | gauge | None
`windows_memory_pool_nonpaged_allocs_total` | The number of calls to allocate space in the nonpaged pool. The nonpaged pool is an area of system memory area for objects that cannot be written to disk, and must remain in physical memory as long as they are allocated | gauge | None
`windows_memory_pool_nonpaged_bytes_total` | Number of bytes in the non-paged pool | gauge | None
`windows_memory_pool_paged_allocs_total` | Number of calls to allocate space in the paged pool, regardless of the amount of space allocated in each call | gauge | None
`windows_memory_modified_page_list_bytes` | The amount of physical memory, in bytes, that is assigned to the modified page list. This memory contains cached data and code that is not actively in use by processes, the system and the system cache. This memory needs to be written out before it will be available for allocation to a process or for system use | gauge | None
`windows_memory_page_faults_total` | Overall rate at which faulted pages are handled by the processor | counter | None
`windows_memory_swap_page_reads_total` | Number of disk page reads (a single read operation reading several pages is still only counted once) | counter | None
`windows_memory_swap_pages_read_total` | Number of pages read across all page reads (ie counting all pages read even if they are read in a single operation) | counter | None
`windows_memory_swap_pages_written_total` | Number of pages written across all page writes (ie counting all pages written even if they are written in a single operation) | counter | None
`windows_memory_swap_page_operations_total` | Total number of swap page read and writes (PagesPersec) | counter | None
`windows_memory_swap_page_writes_total` | Number of disk page writes (a single write operation writing several pages is still only counted once) | counter | None
`windows_memory_pool_nonpaged_allocs_total` | The number of calls to allocate space in the nonpaged pool. The nonpaged pool is an area of system memory area for objects that cannot be written to disk, and must remain in physical memory as long as they are allocated | counter | None
`windows_memory_pool_nonpaged_bytes` | Number of bytes in the non-paged pool, an area of the system virtual memory that is used for objects that cannot be written to disk, but must remain in physical memory as long as they are allocated | gauge | None
`windows_memory_pool_paged_allocs_total` | Number of calls to allocate space in the paged pool, regardless of the amount of space allocated in each call | counter | None
`windows_memory_pool_paged_bytes` | Number of bytes in the paged pool | gauge | None
`windows_memory_pool_paged_resident_bytes` | _Not yet documented_ | gauge | None
`windows_memory_standby_cache_core_bytes` | _Not yet documented_ | gauge | None
`windows_memory_standby_cache_normal_priority_bytes` | _Not yet documented_ | gauge | None
`windows_memory_standby_cache_reserve_bytes` | _Not yet documented_ | gauge | None
`windows_memory_system_cache_resident_bytes` | _Not yet documented_ | gauge | None
`windows_memory_system_code_resident_bytes` | _Not yet documented_ | gauge | None
`windows_memory_system_code_total_bytes` | _Not yet documented_ | gauge | None
`windows_memory_system_driver_resident_bytes` | _Not yet documented_ | gauge | None
`windows_memory_system_driver_total_bytes` | _Not yet documented_ | gauge | None
`windows_memory_transition_faults_total` | _Not yet documented_ | gauge | None
`windows_memory_transition_pages_repurposed_total` | _Not yet documented_ | gauge | None
`windows_memory_write_copies_total` | The number of page faults caused by attempting to write that were satisfied by copying the page from elsewhere in physical memory | gauge | None
`windows_memory_pool_paged_resident_bytes` | The size, in bytes, of the portion of the paged pool that is currently resident and active in physical memory. The paged pool is an area of the system virtual memory that is used for objects that can be written to disk when they are not being used | gauge | None
`windows_memory_standby_cache_core_bytes` | The amount of physical memory, in bytes, that is assigned to the core standby cache page lists. This memory contains cached data and code that is not actively in use by processes, the system and the system cache. It is immediately available for allocation to a process or for system use. If the system runs out of available free and zero memory, memory on lower priority standby cache page lists will be repurposed before memory on higher priority standby cache page lists | gauge | None
`windows_memory_standby_cache_normal_priority_bytes` | The amount of physical memory, in bytes, that is assigned to the normal priority standby cache page lists. This memory contains cached data and code that is not actively in use by processes, the system and the system cache. It is immediately available for allocation to a process or for system use. If the system runs out of available free and zero memory, memory on lower priority standby cache page lists will be repurposed before memory on higher priority standby cache page lists | gauge | None
`windows_memory_standby_cache_reserve_bytes` | The amount of physical memory, in bytes, that is assigned to the reserve standby cache page lists. This memory contains cached data and code that is not actively in use by processes, the system and the system cache. It is immediately available for allocation to a process or for system use. If the system runs out of available free and zero memory, memory on lower priority standby cache page lists will be repurposed before memory on higher priority standby cache page lists | gauge | None
`windows_memory_system_cache_resident_bytes` | The size, in bytes, of the portion of the system file cache which is currently resident and active in physical memory | gauge | None
`windows_memory_system_code_resident_bytes` | The size, in bytes, of the pageable operating system code that is currently resident and active in physical memory. This value is a component of Memory\\System Code Total Bytes. Memory\\System Code Resident Bytes (and Memory\\System Code Total Bytes) does not include code that must remain in physical memory and cannot be written to disk | gauge | None
`windows_memory_system_code_total_bytes` | The size, in bytes, of the pageable operating system code currently mapped into the system virtual address space. This value is calculated by summing the bytes in Ntoskrnl.exe, Hal.dll, the boot drivers, and file systems loaded by Ntldr/osloader. This counter does not include code that must remain in physical memory and cannot be written to disk | gauge | None
`windows_memory_system_driver_resident_bytes` | The size, in bytes, of the pageable physical memory being used by device drivers. It is the working set (physical memory area) of the drivers. This value is a component of Memory\\System Driver Total Bytes, which also includes driver memory that has been written to disk. Neither Memory\\System Driver Resident Bytes nor Memory\\System Driver Total Bytes includes memory that cannot be written to disk | gauge | None
`windows_memory_system_driver_total_bytes` | The size, in bytes, of the pageable virtual memory currently being used by device drivers. Pageable memory can be written to disk when it is not being used. It includes both physical memory (Memory\\System Driver Resident Bytes) and code and data paged to disk. It is a component of Memory\\System Code Total Bytes | gauge | None
`windows_memory_transition_faults_total` | Number of faults rate at which page faults are resolved by recovering pages that were being used by another process sharing the page, or were on the modified page list or the standby list, or were being written to disk at the time of the page fault. The pages were recovered without additional disk activity. Transition faults are counted in numbers of faults; because only one page is faulted in each operation, it is also equal to the number of pages faulted | counter | None
`windows_memory_transition_pages_repurposed_total` | Transition Pages RePurposed is the rate at which the number of transition cache pages were reused for a different purpose. These pages would have otherwise remained in the page cache to provide a (fast) soft fault (instead of retrieving it from backing store) in the event the page was accessed in the future | counter | None
`windows_memory_write_copies_total` | The number of page faults caused by attempting to write that were satisfied by copying the page from elsewhere in physical memory | counter | None
### Example metric
_This collector does not yet have explained examples, we would appreciate your help adding them!_

View File

@@ -0,0 +1,104 @@
# mscluster_cluster collector
The MSCluster_Cluster class is a dynamic WMI class that represents a cluster.
|||
-|-
Metric name prefix | `mscluster_cluster`
Classes | `MSCluster_Cluster`
Enabled by default? | No
## Flags
None
## Metrics
Name | Description | Type | Labels
-----|-------------|------|-------
`AddEvictDelay` | Provides access to the cluster's AddEvictDelay property, which is the number a seconds that a new node is delayed after an eviction of another node. | gauge | `name`
`AdminAccessPoint` | The type of the cluster administrative access point. | gauge | `name`
`AutoAssignNodeSite` | Determines whether or not the cluster will attempt to automatically assign nodes to sites based on networks and Active Directory Site information. | gauge | `name`
`AutoBalancerLevel` | Determines the level of aggressiveness of AutoBalancer. | gauge | `name`
`AutoBalancerMode` | Determines whether or not the auto balancer is enabled. | gauge | `name`
`BackupInProgress` | Indicates whether a backup is in progress. | gauge | `name`
`BlockCacheSize` | CSV BlockCache Size in MB. | gauge | `name`
`ClusSvcHangTimeout` | Controls how long the cluster network driver waits between Failover Cluster Service heartbeats before it determines that the Failover Cluster Service has stopped responding. | gauge | `name`
`ClusSvcRegroupOpeningTimeout` | Controls how long a node will wait on other nodes in the opening stage before deciding that they failed. | gauge | `name`
`ClusSvcRegroupPruningTimeout` | Controls how long the membership leader will wait to reach full connectivity between cluster nodes. | gauge | `name`
`ClusSvcRegroupStageTimeout` | Controls how long a node will wait on other nodes in a membership stage before deciding that they failed. | gauge | `name`
`ClusSvcRegroupTickInMilliseconds` | Controls how frequently the membership algorithm is sending periodic membership messages. | gauge | `name`
`ClusterEnforcedAntiAffinity` | Enables or disables hard enforcement of group anti-affinity classes. | gauge | `name`
`ClusterFunctionalLevel` | The functional level the cluster is currently running in. | gauge | `name`
`ClusterGroupWaitDelay` | Maximum time in seconds that a group waits for its preferred node to come online during cluster startup before coming online on a different node. | gauge | `name`
`ClusterLogLevel` | Controls the level of cluster logging. | gauge | `name`
`ClusterLogSize` | Controls the maximum size of the cluster log files on each of the nodes. | gauge | `name`
`ClusterUpgradeVersion` | Specifies the upgrade version the cluster is currently running in. | gauge | `name`
`CrossSiteDelay` | Controls how long the cluster network driver waits in milliseconds between sending Cluster Service heartbeats across sites. | gauge | `name`
`CrossSiteThreshold` | Controls how many Cluster Service heartbeats can be missed across sites before it determines that Cluster Service has stopped responding. | gauge | `name`
`CrossSubnetDelay` | Controls how long the cluster network driver waits in milliseconds between sending Cluster Service heartbeats across subnets. | gauge | `name`
`CrossSubnetThreshold` | Controls how many Cluster Service heartbeats can be missed across subnets before it determines that Cluster Service has stopped responding. | gauge | `name`
`CsvBalancer` | Whether automatic balancing for CSV is enabled. | gauge | `name`
`DatabaseReadWriteMode` | Sets the database read and write mode. | gauge | `name`
`DefaultNetworkRole` | Provides access to the cluster's DefaultNetworkRole property. | gauge | `name`
`DetectedCloudPlatform` | | gauge | `name`
`DetectManagedEvents` | | gauge | `name`
`DetectManagedEventsThreshold` | | gauge | `name`
`DisableGroupPreferredOwnerRandomization` | | gauge | `name`
`DrainOnShutdown` | Whether to drain the node when cluster service is being stopped. | gauge | `name`
`DynamicQuorumEnabled` | Allows cluster service to adjust node weights as needed to increase availability. | gauge | `name`
`EnableSharedVolumes` | Enables or disables cluster shared volumes on this cluster. | gauge | `name`
`FixQuorum` | Provides access to the cluster's FixQuorum property, which specifies if the cluster is in a fix quorum state. | gauge | `name`
`GracePeriodEnabled` | Whether the node grace period feature of this cluster is enabled. | gauge | `name`
`GracePeriodTimeout` | The grace period timeout in milliseconds. | gauge | `name`
`GroupDependencyTimeout` | The timeout after which a group will be brought online despite unsatisfied dependencies | gauge | `name`
`HangRecoveryAction` | Controls the action to take if the user-mode processes have stopped responding. | gauge | `name`
`IgnorePersistentStateOnStartup` | Provides access to the cluster's IgnorePersistentStateOnStartup property, which specifies whether the cluster will bring online groups that were online when the cluster was shut down. | gauge | `name`
`LogResourceControls` | Controls the logging of resource controls. | gauge | `name`
`LowerQuorumPriorityNodeId` | Specifies the Node ID that has a lower priority when voting for quorum is performed. If the quorum vote is split 50/50%, the specified node's vote would be ignored to break the tie. If this is not set then the cluster will pick a node at random to break the tie. | gauge | `name`
`MaxNumberOfNodes` | Indicates the maximum number of nodes that may participate in the Cluster. | gauge | `name`
`MessageBufferLength` | The maximum unacknowledged message count for GEM. | gauge | `name`
`MinimumNeverPreemptPriority` | Groups with this priority or higher cannot be preempted. | gauge | `name`
`MinimumPreemptorPriority` | Minimum priority a cluster group must have to be able to preempt another group. | gauge | `name`
`NetftIPSecEnabled` | Whether IPSec is enabled for cluster internal traffic. | gauge | `name`
`PlacementOptions` | Various option flags to modify default placement behavior. | gauge | `name`
`PlumbAllCrossSubnetRoutes` | Plumbs all possible cross subnet routes to all nodes. | gauge | `name`
`PreventQuorum` | Whether the cluster will ignore group persistent state on startup. | gauge | `name`
`QuarantineDuration` | The quarantine period timeout in milliseconds. | gauge | `name`
`QuarantineThreshold` | Number of node failures before it will be quarantined. | gauge | `name`
`QuorumArbitrationTimeMax` | Controls the maximum time necessary to decide the Quorum owner node. | gauge | `name`
`QuorumArbitrationTimeMin` | Controls the minimum time necessary to decide the Quorum owner node. | gauge | `name`
`QuorumLogFileSize` | This property is obsolete. | gauge | `name`
`QuorumTypeValue` | Get the current quorum type value. -1: Unknown; 1: Node; 2: FileShareWitness; 3: Storage; 4: None | gauge | `name`
`RequestReplyTimeout` | Controls the request reply time-out period. | gauge | `name`
`ResiliencyDefaultPeriod` | The default resiliency period, in seconds, for the cluster. | gauge | `name`
`ResiliencyLevel` | The resiliency level for the cluster. | gauge | `name`
`ResourceDllDeadlockPeriod` | This property is obsolete. | gauge | `name`
`RootMemoryReserved` | Controls the amount of memory reserved for the parent partition on all cluster nodes. | gauge | `name`
`RouteHistoryLength` | The history length for routes to help finding network issues. | gauge | `name`
`S2DBusTypes` | Bus types for storage spaces direct. | gauge | `name`
`S2DCacheDesiredState` | Desired state of the storage spaces direct cache. | gauge | `name`
`S2DCacheFlashReservePercent` | Percentage of allocated flash space to utilize when caching. | gauge | `name`
`S2DCachePageSizeKBytes` | Page size in KB used by S2D cache. | gauge | `name`
`S2DEnabled` | Whether direct attached storage (DAS) is enabled. | gauge | `name`
`S2DIOLatencyThreshold` | The I/O latency threshold for storage spaces direct. | gauge | `name`
`S2DOptimizations` | Optimization flags for storage spaces direct. | gauge | `name`
`SameSubnetDelay` | Controls how long the cluster network driver waits in milliseconds between sending Cluster Service heartbeats on the same subnet. | gauge | `name`
`SameSubnetThreshold` | Controls how many Cluster Service heartbeats can be missed on the same subnet before it determines that Cluster Service has stopped responding. | gauge | `name`
`SecurityLevel` | Controls the level of security that should apply to intracluster messages. 0: Clear Text; 1: Sign; 2: Encrypt | gauge | `name`
`SecurityLevelForStorage` | | gauge | `name`
`SharedVolumeVssWriterOperationTimeout` | CSV VSS Writer operation timeout in seconds. | gauge | `name`
`ShutdownTimeoutInMinutes` | The maximum time in minutes allowed for cluster resources to come offline during cluster service shutdown. | gauge | `name`
`UseClientAccessNetworksForSharedVolumes` | Whether the use of client access networks for cluster shared volumes feature of this cluster is enabled. 0: Disabled; 1: Enabled; 2: Auto | gauge | `name`
`WitnessDatabaseWriteTimeout` | Controls the maximum time in seconds that a cluster database write to a witness can take before the write is abandoned. | gauge | `name`
`WitnessDynamicWeight` | The weight of the configured witness. | gauge | `name`
`WitnessRestartInterval` | Controls the witness restart interval. | gauge | `name`
### 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

@@ -0,0 +1,32 @@
# mscluster_network collector
The MSCluster_Network class is a dynamic WMI class that represents cluster networks.
|||
-|-
Metric name prefix | `mscluster_network`
Classes | `MSCluster_Network`
Enabled by default? | No
## Flags
None
## Metrics
Name | Description | Type | Labels
-----|-------------|------|-------
`Characteristics` | Provides the characteristics of the network. The cluster defines characteristics only for resources. For a description of these characteristics, see [CLUSCTL_RESOURCE_GET_CHARACTERISTICS](https://msdn.microsoft.com/library/aa367466). | gauge | `name`
`Flags` | Provides access to the flags set for the network. The cluster defines flags only for resources. For a description of these flags, see [CLUSCTL_RESOURCE_GET_FLAGS](https://docs.microsoft.com/en-us/previous-versions/windows/desktop/mscs/clusctl-resource-get-flags). | gauge | `name`
`Metric` | The metric of a cluster network (networks with lower values are used first). If this value is set, then the AutoMetric property is set to false. | gauge | `name`
`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`
`State` | Provides the current state of the network. 1-1: Unknown; 0: Unavailable; 1: Down; 2: Partitioned; 3: Up | gauge | `name`
### 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

@@ -0,0 +1,41 @@
# mscluster_node collector
The MSCluster_Node class is a dynamic WMI class that represents a cluster node.
|||
-|-
Metric name prefix | `mscluster_node`
Classes | `MSCluster_Node`
Enabled by default? | No
## Flags
None
## Metrics
Name | Description | Type | Labels
-----|-------------|------|-------
`BuildNumber` | Provides access to the node's BuildNumber property. | gauge | `name`
`Characteristics` | Provides access to the characteristics set for the node. For a list of possible characteristics, see [CLUSCTL_NODE_GET_CHARACTERISTICS](https://docs.microsoft.com/en-us/previous-versions/windows/desktop/mscs/clusctl-node-get-characteristics). | gauge | `name`
`DetectedCloudPlatform` | The dynamic vote weight of the node adjusted by dynamic quorum feature. | gauge | `name`
`DynamicWeight` | The dynamic vote weight of the node adjusted by dynamic quorum feature. | gauge | `name`
`Flags` | Provides access to the flags set for the node. For a list of possible characteristics, see [CLUSCTL_NODE_GET_FLAGS](https://docs.microsoft.com/en-us/previous-versions/windows/desktop/mscs/clusctl-node-get-flags). | gauge | `name`
`MajorVersion` | Provides access to the node's MajorVersion property, which specifies the major portion of the Windows version installed. | gauge | `name`
`MinorVersion` | Provides access to the node's MinorVersion property, which specifies the minor portion of the Windows version installed. | gauge | `name`
`NeedsPreventQuorum` | Whether the cluster service on that node should be started with prevent quorum flag. | gauge | `name`
`NodeDrainStatus` | The current node drain status of a node. 0: Not Initiated; 1: In Progress; 2: Completed; 3: Failed | gauge | `name`
`NodeHighestVersion` | Provides access to the node's NodeHighestVersion property, which specifies the highest possible version of the cluster service with which the node can join or communicate. | gauge | `name`
`NodeLowestVersion` | Provides access to the node's NodeLowestVersion property, which specifies the lowest possible version of the cluster service with which the node can join or communicate. | gauge | `name`
`NodeWeight` | The vote weight of the node. | gauge | `name`
`State` | Returns the current state of a node. -1: Unknown; 0: Up; 1: Down; 2: Paused; 3: Joining | gauge | `name`
`StatusInformation` | The isolation or quarantine status of the node. | gauge | `name`
### 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

@@ -0,0 +1,43 @@
# mscluster_resource collector
The MSCluster_resource class is a dynamic WMI class that represents a cluster resource.
|||
-|-
Metric name prefix | `mscluster_resource`
Classes | `MSCluster_Resource`
Enabled by default? | No
## Flags
None
## Metrics
Name | Description | Type | Labels
-----|-------------|------|-------
`Characteristics` | Provides the characteristics of the object. The cluster defines characteristics only for resources. For a description of these characteristics, see [CLUSCTL_RESOURCE_GET_CHARACTERISTICS](https://docs.microsoft.com/en-us/previous-versions/windows/desktop/mscs/clusctl-resource-get-characteristics). | gauge | `type`, `owner_group`, `name`
`DeadlockTimeout` | Indicates the length of time to wait, in milliseconds, before declaring a deadlock in any call into a resource. | gauge | `type`, `owner_group`, `name`
`EmbeddedFailureAction` | The time, in milliseconds, that a resource should remain in a failed state before the Cluster service attempts to restart it. | gauge | `type`, `owner_group`, `name`
`Flags` | Provides access to the flags set for the object. The cluster defines flags only for resources. For a description of these flags, see [CLUSCTL_RESOURCE_GET_FLAGS](https://docs.microsoft.com/en-us/previous-versions/windows/desktop/mscs/clusctl-resource-get-flags). | gauge | `type`, `owner_group`, `name`
`IsAlivePollInterval` | Provides access to the resource's IsAlivePollInterval property, which is the recommended interval in milliseconds at which the Cluster Service should poll the resource to determine whether it is operational. If the property is set to 0xFFFFFFFF, the Cluster Service uses the IsAlivePollInterval property for the resource type associated with the resource. | gauge | `type`, `owner_group`, `name`
`LooksAlivePollInterval` | Provides access to the resource's LooksAlivePollInterval property, which is the recommended interval in milliseconds at which the Cluster Service should poll the resource to determine whether it appears operational. If the property is set to 0xFFFFFFFF, the Cluster Service uses the LooksAlivePollInterval property for the resource type associated with the resource. | gauge | `type`, `owner_group`, `name`
`MonitorProcessId` | Provides the process ID of the resource host service that is currently hosting the resource. | gauge | `type`, `owner_group`, `name`
`PendingTimeout` | Provides access to the resource's PendingTimeout property. If a resource cannot be brought online or taken offline in the number of milliseconds specified by the PendingTimeout property, the resource is forcibly terminated. | gauge | `type`, `owner_group`, `name`
`ResourceClass` | Gets or sets the resource class of a resource. 0: Unknown; 1: Storage; 2: Network; 32768: Unknown | gauge | `type`, `owner_group`, `name`
`RestartAction` | Provides access to the resource's RestartAction property, which is the action to be taken by the Cluster Service if the resource fails. | gauge | `type`, `owner_group`, `name`
`RestartDelay` | Indicates the time delay before a failed resource is restarted. | gauge | `type`, `owner_group`, `name`
`RestartPeriod` | Provides access to the resource's RestartPeriod property, which is interval of time, in milliseconds, during which a specified number of restart attempts can be made on a nonresponsive resource. | gauge | `type`, `owner_group`, `name`
`RestartThreshold` | Provides access to the resource's RestartThreshold property which is the maximum number of restart attempts that can be made on a resource within an interval defined by the RestartPeriod property before the Cluster Service initiates the action specified by the RestartAction property. | gauge | `type`, `owner_group`, `name`
`RetryPeriodOnFailure` | Provides access to the resource's RetryPeriodOnFailure property, which is the interval of time (in milliseconds) that a resource should remain in a failed state before the Cluster service attempts to restart it. | gauge | `type`, `owner_group`, `name`
`State` | The current state of the resource. -1: Unknown; 0: Inherited; 1: Initializing; 2: Online; 3: Offline; 4: Failed; 128: Pending; 129: Online Pending; 130: Offline Pending | gauge | `type`, `owner_group`, `name`
`Subclass` | Provides the list of references to nodes that can be the owner of this resource. | gauge | `type`, `owner_group`, `name`
### 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

@@ -0,0 +1,41 @@
# mscluster_resourcegroup collector
The MSCluster_ResourceGroup class is a dynamic WMI class that represents a cluster group.
|||
-|-
Metric name prefix | `mscluster_resourcegroup`
Classes | `MSCluster_ResourceGroup`
Enabled by default? | No
## Flags
None
## Metrics
Name | Description | Type | Labels
-----|-------------|------|-------
`AutoFailbackType` | Provides access to the group's AutoFailbackType property. | gauge | `name`
`Characteristics` | Provides the characteristics of the group. The cluster defines characteristics only for resources. For a description of these characteristics, see [CLUSCTL_RESOURCE_GET_CHARACTERISTICS](https://docs.microsoft.com/en-us/previous-versions/windows/desktop/mscs/clusctl-resource-get-characteristics). | gauge | `name`
`ColdStartSetting` | Indicates whether a group can start after a cluster cold start. | gauge | `name`
`DefaultOwner` | Number of the last node the resource group was activated on or explicitly moved to. | gauge | `name`
`FailbackWindowEnd` | The FailbackWindowEnd property provides the latest time that the group can be moved back to the node identified as its preferred node. | gauge | `name`
`FailbackWindowStart` | The FailbackWindowStart property provides the earliest time (that is, local time as kept by the cluster) that the group can be moved back to the node identified as its preferred node. | gauge | `name`
`FailoverPeriod` | The FailoverPeriod property specifies a number of hours during which a maximum number of failover attempts, specified by the FailoverThreshold property, can occur. | gauge | `name`
`FailoverThreshold` | The FailoverThreshold property specifies the maximum number of failover attempts. | gauge | `name`
`Flags` | Provides access to the flags set for the group. The cluster defines flags only for resources. For a description of these flags, see [CLUSCTL_RESOURCE_GET_FLAGS](https://docs.microsoft.com/en-us/previous-versions/windows/desktop/mscs/clusctl-resource-get-flags). | gauge | `name`
`GroupType` | The Type of the resource group. | gauge | `name`
`Priority` | Priority value of the resource group | gauge | `name`
`ResiliencyPeriod` | The resiliency period for this group, in seconds. | gauge | `name`
`State` | The current state of the resource group. -1: Unknown; 0: Online; 1: Offline; 2: Failed; 3: Partial Online; 4: Pending | gauge | `name`
`UpdateDomain` | | gauge | `name`
### 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

@@ -268,8 +268,8 @@ When you read the counter in perfmon you will get the the percentage pages found
This collector retrieves the two internal values separately. In order to calculate the Buffer Cache Hit Ratio in PromQL.
```
windows_mssql_bufman_buffer_cache_hits{instance="host:9182", exported_instance="MSSQLSERVER"} /
windows_mssql_bufman_buffer_cache_lookups{instance="host:9182", exported_instance="MSSQLSERVER"}
windows_mssql_bufman_buffer_cache_hits{instance="host:9182", mssql_instance="MSSQLSERVER"} /
windows_mssql_bufman_buffer_cache_lookups{instance="host:9182", mssql_instance="MSSQLSERVER"}
```
This principal can be used for following metrics too:

View File

@@ -16,7 +16,7 @@ None
Name | Description | Type | Labels
-----|-------------|------|-------
`windows_os_info` | Contains full product name & version in labels | gauge | `product`, `version`
`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_paging_limit_bytes` | Total number of bytes that can be stored in the operating system paging files. 0 (zero) indicates that there are no paging files | gauge | None
`windows_os_paging_free_bytes` | Number of bytes that can be mapped into the operating system paging files without causing any other pages to be swapped out | gauge | None
`windows_os_physical_memory_free_bytes` | Bytes of physical memory currently unused and available | gauge | None

View File

@@ -0,0 +1,67 @@
# scheduled_task collector
The scheduled_task collector exposes metrics about Windows Task Scheduler
|||
-|-
Metric name prefix | `scheduled_task`
Data source | OLE
Enabled by default? | No
## Flags
### `--collector.scheduled_task.whitelist`
If given, the path of the task needs to match the whitelist regexp in order for the corresponding metrics to be reported.
### `--collector.scheduled_task.blacklist`
If given, the path of the task needs to *not* match the blacklist regexp in order for the corresponding metrics to be reported.
## Metrics
Name | Description | Type | Labels
-----|-------------|------|-------
`windows_scheduled_task_last_result` | The result that was returned the last time the registered task was run | gauge | task
`windows_scheduled_task_missed_runs` | The number of times the registered task missed a scheduled run | gauge | task
`windows_scheduled_task_state` | The current state of a scheduled task | gauge | task, state
For the values of the `state` label, see below.
### State
A task can be in the following states:
- `disabled`
- `queued`
- `ready`
- `running`
- `unknown`
### Example metric
```
windows_scheduled_task_last_result{task="/Microsoft/Windows/Chkdsk/SyspartRepair"} 1
windows_scheduled_task_missed_runs{task="/Microsoft/Windows/Chkdsk/SyspartRepair"} 0
windows_scheduled_task_state{state="disabled",task="/Microsoft/Windows/Chkdsk/SyspartRepair"} 1
windows_scheduled_task_state{state="queued",task="/Microsoft/Windows/Chkdsk/SyspartRepair"} 0
windows_scheduled_task_state{state="ready",task="/Microsoft/Windows/Chkdsk/SyspartRepair"} 0
windows_scheduled_task_state{state="running",task="/Microsoft/Windows/Chkdsk/SyspartRepair"} 0
windows_scheduled_task_state{state="unknown",task="/Microsoft/Windows/Chkdsk/SyspartRepair"} 0
```
## Useful queries
_This collector does not yet have any useful queries added, we would appreciate your help adding them!_
## Alerting examples
**prometheus.rules**
```yaml
- alert: "WindowsScheduledTaskFailure"
expr: "windows_scheduled_task_last_result == 0"
for: "1d"
labels:
severity: "high"
annotations:
summary: "Scheduled Task Failed"
description: "Scheduled task '{{ $labels.task }}' failed for 1 day"
```

View File

@@ -5,6 +5,8 @@ collectors:
collector:
service:
services-where: Name='windows_exporter'
scheduled_task:
blacklist: /Microsoft/.+
log:
level: debug
scrape:

View File

@@ -4,24 +4,28 @@
package main
import (
//Its important that we do these first so that we can register with the windows service control ASAP to avoid timeouts
"github.com/prometheus-community/windows_exporter/initiate"
"github.com/prometheus-community/windows_exporter/log"
"encoding/json"
"fmt"
"net/http"
_ "net/http/pprof"
"os"
"os/user"
"sort"
"strconv"
"strings"
"sync"
"time"
"golang.org/x/sys/windows/svc"
"github.com/StackExchange/wmi"
"github.com/prometheus-community/windows_exporter/collector"
"github.com/prometheus-community/windows_exporter/config"
"github.com/prometheus-community/windows_exporter/log"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/collectors"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/prometheus/common/version"
"github.com/prometheus/exporter-toolkit/web"
@@ -48,7 +52,6 @@ type prometheusVersion struct {
const (
defaultCollectors = "cpu,cs,logical_disk,net,os,service,system,textfile"
defaultCollectorsPlaceholder = "[defaults]"
serviceName = "windows_exporter"
)
var (
@@ -287,7 +290,6 @@ func main() {
"Seconds to subtract from the timeout allowed by the client. Tune to allow for overhead or high loads.",
).Default("0.5").Float64()
)
log.AddFlags(kingpin.CommandLine)
kingpin.Version(version.Print("windows_exporter"))
kingpin.HelpFlag.Short('h')
@@ -295,7 +297,7 @@ func main() {
// Load values from configuration file(s). Executable flags must first be parsed, in order
// to load the specified file(s).
kingpin.Parse()
log.Debug("Logging has Started")
if *configFile != "" {
resolver, err := config.NewResolver(*configFile)
if err != nil {
@@ -325,26 +327,21 @@ func main() {
initWbem()
isService, err := svc.IsWindowsService()
if err != nil {
log.Fatal(err)
}
stopCh := make(chan bool)
if isService {
go func() {
err = svc.Run(serviceName, &windowsExporterService{stopCh: stopCh})
if err != nil {
log.Errorf("Failed to start service: %v", err)
}
}()
}
collectors, err := loadCollectors(*enabledCollectors)
if err != nil {
log.Fatalf("Couldn't load collectors: %s", err)
}
u, err := user.Current()
if err != nil {
log.Fatalf(err.Error())
}
log.Infof("Running as %v", u.Username)
if strings.Contains(u.Username, "ContainerAdministrator") || strings.Contains(u.Username, "ContainerUser") {
log.Warnf("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.")
}
log.Infof("Enabled collectors: %v", strings.Join(keys(collectors), ", "))
h := &metricsHandler{
@@ -409,7 +406,7 @@ func main() {
}()
for {
if <-stopCh {
if <-initiate.StopCh {
log.Info("Shutting down windows_exporter")
break
}
@@ -451,33 +448,6 @@ func withConcurrencyLimit(n int, next http.HandlerFunc) http.HandlerFunc {
}
}
type windowsExporterService struct {
stopCh chan<- bool
}
func (s *windowsExporterService) Execute(args []string, r <-chan svc.ChangeRequest, changes chan<- svc.Status) (ssec bool, errno uint32) {
const cmdsAccepted = svc.AcceptStop | svc.AcceptShutdown
changes <- svc.Status{State: svc.StartPending}
changes <- svc.Status{State: svc.Running, Accepts: cmdsAccepted}
loop:
for {
select {
case c := <-r:
switch c.Cmd {
case svc.Interrogate:
changes <- c.CurrentStatus
case svc.Stop, svc.Shutdown:
s.stopCh <- true
break loop
default:
log.Error(fmt.Sprintf("unexpected control request #%d", c))
}
}
}
changes <- svc.Status{State: svc.StopPending}
return
}
type metricsHandler struct {
timeoutMargin float64
collectorFactory func(timeout time.Duration, requestedCollectors []string) (error, *windowsCollector)
@@ -509,8 +479,8 @@ func (mh *metricsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
reg.MustRegister(wc)
reg.MustRegister(
prometheus.NewProcessCollector(prometheus.ProcessCollectorOpts{}),
prometheus.NewGoCollector(),
collectors.NewProcessCollector(collectors.ProcessCollectorOpts{}),
collectors.NewGoCollector(),
version.NewCollector("windows_exporter"),
)

16
go.mod
View File

@@ -3,18 +3,18 @@ module github.com/prometheus-community/windows_exporter
go 1.13
require (
github.com/Microsoft/hcsshim v0.9.2
github.com/Microsoft/hcsshim v0.9.4
github.com/StackExchange/wmi v0.0.0-20180725035823-b12b22c5341f
github.com/dimchansky/utfbom v1.1.1
github.com/go-kit/log v0.2.0
github.com/go-ole/go-ole v1.2.1 // indirect
github.com/go-kit/log v0.2.1
github.com/go-ole/go-ole v1.2.6
github.com/leoluk/perflib_exporter v0.1.1-0.20211204221052-9e3696429c20
github.com/prometheus/client_golang v1.12.1
github.com/prometheus/client_golang v1.13.0
github.com/prometheus/client_model v0.2.0
github.com/prometheus/common v0.32.1
github.com/prometheus/common v0.37.0
github.com/prometheus/exporter-toolkit v0.7.1
github.com/sirupsen/logrus v1.8.1
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9
github.com/sirupsen/logrus v1.9.0
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8
gopkg.in/alecthomas/kingpin.v2 v2.2.6
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
)

52
go.sum
View File

@@ -63,8 +63,8 @@ github.com/Microsoft/hcsshim v0.8.14/go.mod h1:NtVKoYxQuTLx6gEq0L96c9Ju4JbRJ4nY2
github.com/Microsoft/hcsshim v0.8.15/go.mod h1:x38A4YbHbdxJtc0sF6oIz+RG0npwSCAvn69iY6URG00=
github.com/Microsoft/hcsshim v0.8.16/go.mod h1:o5/SZqmR7x9JNKsW3pu+nqHm0MF8vbA+VxGOoXdC600=
github.com/Microsoft/hcsshim v0.8.21/go.mod h1:+w2gRZ5ReXQhFOrvSQeNfhrYB/dg3oDwTOcER2fw4I4=
github.com/Microsoft/hcsshim v0.9.2 h1:wB06W5aYFfUB3IvootYAY2WnOmIdgPGfqSI6tufQNnY=
github.com/Microsoft/hcsshim v0.9.2/go.mod h1:7pLA8lDk46WKDWlVsENo92gC0XFa8rbKfyFRBqxEbCc=
github.com/Microsoft/hcsshim v0.9.4 h1:mnUj0ivWy6UzbB1uLFqKR6F+ZyiDc7j4iGgHTpO+5+I=
github.com/Microsoft/hcsshim v0.9.4/go.mod h1:7pLA8lDk46WKDWlVsENo92gC0XFa8rbKfyFRBqxEbCc=
github.com/Microsoft/hcsshim/test v0.0.0-20201218223536-d3e5debf77da/go.mod h1:5hlzMzRKMLyo42nCZ9oml8AdTlq/0cvIaBv6tK1RehU=
github.com/Microsoft/hcsshim/test v0.0.0-20210227013316-43a75bb4edd3/go.mod h1:mw7qgWloBUl75W/gVH3cQszUg1+gUITj7D6NY7ywVnY=
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
@@ -288,8 +288,9 @@ github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3I
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
github.com/go-kit/log v0.2.0 h1:7i2K3eKTos3Vc0enKCfnVcgHh2olr/MyfboYq7cAcFw=
github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0=
github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU=
github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
@@ -297,8 +298,8 @@ github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNV
github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=
github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E=
github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8=
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0=
github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg=
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
@@ -369,8 +370,9 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-containerregistry v0.5.1/go.mod h1:Ct15B4yir3PLOP5jsy0GNeYVaIZs/MK/Jz5any1wFW0=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
@@ -559,8 +561,9 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn
github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g=
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0=
github.com/prometheus/client_golang v1.12.1 h1:ZiaPsmm9uiBeaSMRznKsCDNtPCS0T3JVDGF+06gjBzk=
github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY=
github.com/prometheus/client_golang v1.13.0 h1:b71QUfeo5M8gq2+evJdTPfZhYMAU0uKPkyPJ7TPsloU=
github.com/prometheus/client_golang v1.13.0/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ=
github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
@@ -576,8 +579,9 @@ github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB8
github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc=
github.com/prometheus/common v0.29.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls=
github.com/prometheus/common v0.31.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls=
github.com/prometheus/common v0.32.1 h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4=
github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls=
github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE=
github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA=
github.com/prometheus/exporter-toolkit v0.7.1 h1:c6RXaK8xBVercEeUQ4tRNL8UGWzDHfvj9dseo1FcK1Y=
github.com/prometheus/exporter-toolkit v0.7.1/go.mod h1:ZUBIj498ePooX9t/2xtDjeQYwvRpiPP2lh5u4iblj2g=
github.com/prometheus/procfs v0.0.0-20180125133057-cb4147076ac7/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
@@ -591,8 +595,9 @@ github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+Gx
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU=
github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo=
github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4=
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
@@ -610,8 +615,9 @@ github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMB
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
@@ -639,8 +645,9 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
@@ -779,15 +786,18 @@ golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210825183410-e898025ed96a h1:bRuuGXV8wwSdGTB+CtJf+FjgO1APK1CoO39T4BN/XBw=
golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f h1:oA4XRj0qtSt8Yo1Zms0CUlsT3KG69V2UGQWPBxujDmc=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c h1:pkQiBZBvdos9qq4wBAHqlzuZHEXo07pqV06ef90u1WI=
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b h1:clP8eMhB30EHdc0bd2Twtq6kgU7yl5ub2cQLSdrv1Dg=
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=
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-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -799,6 +809,7 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -874,17 +885,21 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 h1:XfKQ4OlFl8okEOr5UvAqFRVj8pY/4yfcXrddB8qAbU0=
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
@@ -947,7 +962,6 @@ golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
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 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.0.0-20160322025152-9bf6e6e569ff/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
@@ -1040,8 +1054,9 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U=
gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
@@ -1072,8 +1087,9 @@ gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
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 h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
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/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk=
gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8=

60
initiate/initiate.go Normal file
View File

@@ -0,0 +1,60 @@
//This package allows us to initiate Time Sensitive components (Like registering the windows service) as early as possible in the startup process
package initiate
import (
"fmt"
"github.com/prometheus-community/windows_exporter/log"
"golang.org/x/sys/windows/svc"
)
const (
serviceName = "windows_exporter"
)
type windowsExporterService struct {
stopCh chan<- bool
}
func (s *windowsExporterService) Execute(args []string, r <-chan svc.ChangeRequest, changes chan<- svc.Status) (ssec bool, errno uint32) {
const cmdsAccepted = svc.AcceptStop | svc.AcceptShutdown
changes <- svc.Status{State: svc.StartPending}
changes <- svc.Status{State: svc.Running, Accepts: cmdsAccepted}
loop:
for {
select {
case c := <-r:
switch c.Cmd {
case svc.Interrogate:
changes <- c.CurrentStatus
case svc.Stop, svc.Shutdown:
log.Debug("Service Stop Received")
s.stopCh <- true
break loop
default:
log.Error(fmt.Sprintf("unexpected control request #%d", c))
}
}
}
changes <- svc.Status{State: svc.StopPending}
return
}
var StopCh = make(chan bool)
func init() {
log.Debug("Checking if We are a service")
isService, err := svc.IsWindowsService()
if err != nil {
log.Fatal(err)
}
log.Debug("Attempting to start exporter service")
if isService {
go func() {
err = svc.Run(serviceName, &windowsExporterService{stopCh: StopCh})
if err != nil {
log.Errorf("Failed to start service: %v", err)
}
}()
}
}

92
kubernetes/kubernetes.md Normal file
View File

@@ -0,0 +1,92 @@
# windows_exporter on Kubernetes
With Kubernetes supporting HostProcess containers on Windows nodes (as of [v1.22](https://kubernetes.io/blog/2021/08/16/windows-hostprocess-containers/), it is useful to run the `windows_exporter` as a container on Windows to export metrics for your Prometheus implementation. Read the [Kubernetes HostProcess documentation](https://kubernetes.io/docs/tasks/configure-pod-container/create-hostprocess-pod/) for more information.
Requirements:
- Kubernetes 1.22+
- containerd 1.6 Beta+
- WindowsHostProcessContainers feature-gate turned on for `kube-apiserver` and `kubelet`
> IMPORTANT: This does not work unless you are specifically targeting Host Process Containers with Containerd (Docker doesn't have support). The image will build but will **not** be able to access the host.
## Container Image
The image is multi arch image (WS 2019, WS 2022) built on Windows. To build the images:
```
DOCKER_REPO=<your repo> make push-all
```
If you don't have a version of `make` on your Windows machine, You can use WSL to build the image with Windows Containers by creating a symbolic link to the docker cli and then override the docker command in the `Makefile`:
On Windows Powershell prompt:
```
New-Item -ItemType SymbolicLink -Path "c:\docker" -Target "C:\Program Files\Docker\Docker\resources\bin\docker.exe"
```
In WSL:
```
DOCKER_REPO=<your repo> DOCKER=/mnt/c/docker make push-all
```
## Kubernetes Quick Start
Before beginning you need to deploy the [prometheus operator](https://github.com/prometheus-operator/prometheus-operator) to your cluster. As a quick start, you can use a project like https://github.com/prometheus-operator/kube-prometheus. The export itself doesn't have any dependency on prometheus operator and the exporter image can be used in manual configurations.
### Windows Exporter DaemonSet
This create a deployment on every node. A config map is created for to handle the configuration of the Windows exporter with [configuration file](../README.md#using-a-configuration-file). Adjust the configuration file for the collectors you are interested in.
```bash
kubectl apply -f kubernetes/windows-exporter-daemonset.yaml
```
> Note: This example manifest deploys the latest bleeding edge image `ghcr.io/prometheus-community/windows-exporter:latest` built from the main branch. You should update this to use a released version which you can find at https://github.com/prometheus-community/windows_exporter/releases
#### Configuring the firewall
The firewall on the node needs to be configured to allow connections on the node: `New-NetFirewallRule -DisplayName 'windows-exporter' -Direction inbound -Profile Any -Action Allow -LocalPort 9182 -Protocol TCP`
You could do this by adding an init container but if you remove the deployment at a later date you will need to remove the firewall rule manually. The following could be added to the `windows-exporter-daemonset.yaml`:
```
apiVersion: apps/v1
kind: DaemonSet
spec:
template:
spec:
initContainers:
- name: configure-firewall
image: mcr.microsoft.com/windows/powershell:lts-nanoserver-1809
command: ["powershell"]
args: ["New-NetFirewallRule", "-DisplayName", "'windows-exporter'", "-Direction", "inbound", "-Profile", "Any", "-Action", "Allow", "-LocalPort", "9182", "-Protocol", "TCP"]
```
### Prometheus PodMonitor
Create the [Pod Monitor](https://prometheus-operator.dev/docs/operator/design/#podmonitor) to configure the scraping:
```bash
kubectl apply -f windows-exporter-podmonitor.yaml
```
### View Metrics
Open Prometheus with
```
kubectl --namespace monitoring port-forward svc/prometheus-k8s 9091:9090
```
Navigate to prometheus UI and add a query to see node cpu (replacing with your ip address)
```
sum by (mode) (irate(windows_cpu_time_total{instance="10.1.0.5:9182"}[5m]))
```
![windows cpu total time graph in prometheus ui](https://user-images.githubusercontent.com/648372/140547130-b535c766-6479-47d3-b2d3-cd8a551647df.png)
## Configuring TLS
It is possible to configure TLS of the solution using `--web.config.file`. Read more at https://github.com/prometheus/exporter-toolkit/blob/master/docs/web-configuration.md

View File

@@ -0,0 +1,61 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
labels:
app: windows-exporter
name: windows-exporter
namespace: monitoring
spec:
selector:
matchLabels:
app: windows-exporter
template:
metadata:
labels:
app: windows-exporter
spec:
securityContext:
windowsOptions:
hostProcess: true
runAsUserName: "NT AUTHORITY\\system"
hostNetwork: true
initContainers:
- name: configure-firewall
image: mcr.microsoft.com/windows/nanoserver:1809
command: ["powershell"]
args: ["New-NetFirewallRule", "-DisplayName", "'windows-exporter'", "-Direction", "inbound", "-Profile", "Any", "-Action", "Allow", "-LocalPort", "9182", "-Protocol", "TCP"]
containers:
- args:
- --config.file=%CONTAINER_SANDBOX_MOUNT_POINT%/config.yml
name: windows-exporter
image: ghcr.io/prometheus-community/windows-exporter:latest
imagePullPolicy: Always
ports:
- containerPort: 9182
hostPort: 9182
name: http
volumeMounts:
- name: windows-exporter-config
mountPath: /config.yml
subPath: config.yml
nodeSelector:
kubernetes.io/os: windows
volumes:
- name: windows-exporter-config
configMap:
name: windows-exporter-config
---
kind: ConfigMap
apiVersion: v1
metadata:
name: windows-exporter-config
namespace: monitoring
labels:
app: windows-exporter
data:
config.yml: |
collectors:
enabled: '[defaults],container'
collector:
service:
services-where: "Name='containerd' or Name='kubelet'"

View File

@@ -0,0 +1,15 @@
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
labels:
app: windows-exporter
name: windows-exporter
namespace: monitoring
spec:
jobLabel: windows-exporter
selector:
matchLabels:
app: windows-exporter
podMetricsEndpoints:
- port: http
scheme: http

View File

@@ -2,19 +2,21 @@ Param(
[Parameter(Mandatory=$true)]
$Class,
[Parameter(Mandatory=$false)]
$Namespace = "root/cimv2",
[Parameter(Mandatory=$false)]
$CollectorName = ($Class -replace 'Win32_PerfRawData_Perf',''),
[Parameter(Mandatory=$false)]
$ComputerName = "localhost",
[Parameter(Mandatory=$false)]
$Credential
[CimSession] $Session
)
$ErrorActionPreference = "Stop"
if($Credential -ne $null) {
$wmiObject = Get-CimInstance -ComputerName $ComputerName -Credential $Credential -Class $Class
if($null -ne $Session) {
$wmiObject = Get-CimInstance -CimSession $Session -Namespace $Namespace -Class $Class
}
else {
$wmiObject = Get-CimInstance -ComputerName $ComputerName -Class $Class
$wmiObject = Get-CimInstance -ComputerName $ComputerName -Namespace $Namespace -Class $Class
}
$members = $wmiObject `
@@ -22,6 +24,7 @@ $members = $wmiObject `
| Where-Object { $_.Definition -Match '^u?int' -and $_.Name -NotMatch '_' } `
| Select-Object Name, @{Name="Type";Expression={$_.Definition.Split(" ")[0]}}
$input = @{
"Namespace"=$Namespace;
"Class"=$Class;
"CollectorName"=$CollectorName;
"Members"=$members

View File

@@ -1,63 +1,9 @@
# HELP go_gc_cycles_automatic_gc_cycles_total Count of completed GC cycles generated by the Go runtime.
# TYPE go_gc_cycles_automatic_gc_cycles_total counter
# HELP go_gc_cycles_forced_gc_cycles_total Count of completed GC cycles forced by the application.
# TYPE go_gc_cycles_forced_gc_cycles_total counter
# HELP go_gc_cycles_total_gc_cycles_total Count of all completed GC cycles.
# TYPE go_gc_cycles_total_gc_cycles_total counter
# HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles.
# HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles.
# TYPE go_gc_duration_seconds summary
# HELP go_gc_heap_allocs_by_size_bytes_total Distribution of heap allocations by approximate size. Note that this does not include tiny objects as defined by /gc/heap/tiny/allocs:objects, only tiny blocks.
# TYPE go_gc_heap_allocs_by_size_bytes_total histogram
# HELP go_gc_heap_allocs_bytes_total Cumulative sum of memory allocated to the heap by the application.
# TYPE go_gc_heap_allocs_bytes_total counter
# HELP go_gc_heap_allocs_objects_total Cumulative count of heap allocations triggered by the application. Note that this does not include tiny objects as defined by /gc/heap/tiny/allocs:objects, only tiny blocks.
# TYPE go_gc_heap_allocs_objects_total counter
# HELP go_gc_heap_frees_by_size_bytes_total Distribution of freed heap allocations by approximate size. Note that this does not include tiny objects as defined by /gc/heap/tiny/allocs:objects, only tiny blocks.
# TYPE go_gc_heap_frees_by_size_bytes_total histogram
# HELP go_gc_heap_frees_bytes_total Cumulative sum of heap memory freed by the garbage collector.
# TYPE go_gc_heap_frees_bytes_total counter
# HELP go_gc_heap_frees_objects_total Cumulative count of heap allocations whose storage was freed by the garbage collector. Note that this does not include tiny objects as defined by /gc/heap/tiny/allocs:objects, only tiny blocks.
# TYPE go_gc_heap_frees_objects_total counter
# HELP go_gc_heap_goal_bytes Heap size target for the end of the GC cycle.
# TYPE go_gc_heap_goal_bytes gauge
# HELP go_gc_heap_objects_objects Number of objects, live or unswept, occupying heap memory.
# TYPE go_gc_heap_objects_objects gauge
# HELP go_gc_heap_tiny_allocs_objects_total Count of small allocations that are packed together into blocks. These allocations are counted separately from other allocations because each individual allocation is not tracked by the runtime, only their block. Each block is already accounted for in allocs-by-size and frees-by-size.
# TYPE go_gc_heap_tiny_allocs_objects_total counter
# HELP go_gc_pauses_seconds_total Distribution individual GC-related stop-the-world pause latencies.
# TYPE go_gc_pauses_seconds_total histogram
# HELP go_goroutines Number of goroutines that currently exist.
# TYPE go_goroutines gauge
# HELP go_info Information about the Go environment.
# TYPE go_info gauge
# HELP go_memory_classes_heap_free_bytes Memory that is completely free and eligible to be returned to the underlying system, but has not been. This metric is the runtime's estimate of free address space that is backed by physical memory.
# TYPE go_memory_classes_heap_free_bytes gauge
# HELP go_memory_classes_heap_objects_bytes Memory occupied by live objects and dead objects that have not yet been marked free by the garbage collector.
# TYPE go_memory_classes_heap_objects_bytes gauge
# HELP go_memory_classes_heap_released_bytes Memory that is completely free and has been returned to the underlying system. This metric is the runtime's estimate of free address space that is still mapped into the process, but is not backed by physical memory.
# TYPE go_memory_classes_heap_released_bytes gauge
# HELP go_memory_classes_heap_stacks_bytes Memory allocated from the heap that is reserved for stack space, whether or not it is currently in-use.
# TYPE go_memory_classes_heap_stacks_bytes gauge
# HELP go_memory_classes_heap_unused_bytes Memory that is reserved for heap objects but is not currently used to hold heap objects.
# TYPE go_memory_classes_heap_unused_bytes gauge
# HELP go_memory_classes_metadata_mcache_free_bytes Memory that is reserved for runtime mcache structures, but not in-use.
# TYPE go_memory_classes_metadata_mcache_free_bytes gauge
# HELP go_memory_classes_metadata_mcache_inuse_bytes Memory that is occupied by runtime mcache structures that are currently being used.
# TYPE go_memory_classes_metadata_mcache_inuse_bytes gauge
# HELP go_memory_classes_metadata_mspan_free_bytes Memory that is reserved for runtime mspan structures, but not in-use.
# TYPE go_memory_classes_metadata_mspan_free_bytes gauge
# HELP go_memory_classes_metadata_mspan_inuse_bytes Memory that is occupied by runtime mspan structures that are currently being used.
# TYPE go_memory_classes_metadata_mspan_inuse_bytes gauge
# HELP go_memory_classes_metadata_other_bytes Memory that is reserved for or used to hold runtime metadata.
# TYPE go_memory_classes_metadata_other_bytes gauge
# HELP go_memory_classes_os_stacks_bytes Stack memory allocated by the underlying operating system.
# TYPE go_memory_classes_os_stacks_bytes gauge
# HELP go_memory_classes_other_bytes Memory used by execution trace buffers, structures for debugging the runtime, finalizer and profiler specials, and more.
# TYPE go_memory_classes_other_bytes gauge
# HELP go_memory_classes_profiling_buckets_bytes Memory that is used by the stack trace hash map used for profiling.
# TYPE go_memory_classes_profiling_buckets_bytes gauge
# HELP go_memory_classes_total_bytes All memory mapped by the Go runtime into the current process as read-write. Note that this does not include memory mapped by code called via cgo or via the syscall package. Sum of all metrics in /memory/classes.
# TYPE go_memory_classes_total_bytes gauge
# HELP go_memstats_alloc_bytes Number of bytes allocated and still in use.
# TYPE go_memstats_alloc_bytes gauge
# HELP go_memstats_alloc_bytes_total Total number of bytes allocated, even if freed.
@@ -66,8 +12,6 @@
# TYPE go_memstats_buck_hash_sys_bytes gauge
# HELP go_memstats_frees_total Total number of frees.
# TYPE go_memstats_frees_total counter
# HELP go_memstats_gc_cpu_fraction The fraction of this program's available CPU time used by the GC since the program started.
# TYPE go_memstats_gc_cpu_fraction gauge
# HELP go_memstats_gc_sys_bytes Number of bytes used for garbage collection system metadata.
# TYPE go_memstats_gc_sys_bytes gauge
# HELP go_memstats_heap_alloc_bytes Number of heap bytes allocated and still in use.
@@ -106,10 +50,6 @@
# TYPE go_memstats_stack_sys_bytes gauge
# HELP go_memstats_sys_bytes Number of bytes obtained from system.
# TYPE go_memstats_sys_bytes gauge
# HELP go_sched_goroutines_goroutines Count of live goroutines.
# TYPE go_sched_goroutines_goroutines gauge
# HELP go_sched_latencies_seconds Distribution of the time goroutines have spent in the scheduler in a runnable state before actually running.
# TYPE go_sched_latencies_seconds histogram
# HELP go_threads Number of OS threads created.
# TYPE go_threads gauge
# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
@@ -143,7 +83,7 @@ test_alpha_total 42
# TYPE windows_cpu_parking_status gauge
# HELP windows_cpu_processor_performance Processor Performance is the average performance of the processor while it is executing instructions, as a percentage of the nominal performance of the processor. On some processors, Processor Performance may exceed 100%
# TYPE windows_cpu_processor_performance gauge
# HELP windows_cpu_time_total Time that processor spent in different modes (idle, user, system, ...)
# HELP windows_cpu_time_total Time that processor spent in different modes (dpc, idle, interrupt, privileged, user)
# TYPE windows_cpu_time_total counter
# HELP windows_cs_hostname Labeled system hostname information as provided by ComputerSystem.DNSHostName and ComputerSystem.Domain
# TYPE windows_cs_hostname gauge

View File

@@ -24,19 +24,27 @@ $skip_re = "^(go_|windows_exporter_build_info|windows_exporter_collector_duratio
# Use default collectors, port and address: http://localhost:9182/metrics
$exporter_proc = Start-Process `
-PassThru `
-FilePath .\windows_exporter.exe `
-FilePath ..\windows_exporter.exe `
-ArgumentList "--log.level=debug --collector.textfile.directory=$($textfile_dir)" `
-WindowStyle Hidden `
-RedirectStandardOutput "$($temp_dir)/windows_exporter.log" `
-RedirectStandardError "$($temp_dir)/windows_exporter_error.log"
# Give exporter some time to start
Start-Sleep 3
# Exporter can take some time to start
for ($i=1; $i -le 5; $i++) {
Start-Sleep 10
$netstat_output = netstat -anp tcp | Select-String 'listening'
if ($netstat_output -like '*:9182*') {
break
}
Write-Host "Waiting for exporter to start"
}
$response = Invoke-WebRequest -UseBasicParsing -URI http://127.0.0.1:9182/metrics
# Response output must be split and saved as UTF-8.
$response.content -split "[`r`n]"| Select-String -NotMatch $skip_re | Set-Content -Encoding utf8 "$($temp_dir)/e2e-output.txt"
Stop-Process $exporter_proc
Stop-Process -Id $exporter_proc.Id
$output_diff = Compare-Object (Get-Content 'e2e-output.txt') (Get-Content "$($temp_dir)/e2e-output.txt")
# Fail if differences in output are detected

124
tools/promtool.ps1 Normal file
View File

@@ -0,0 +1,124 @@
$ErrorActionPreference = 'Stop'
Set-StrictMode -Version 3
if (-not (Test-Path -Path '.\windows_exporter.exe')) {
Write-Output ".\windows_exporter.exe not found. Consider running \`go build\` first"
}
# Powershell pipes & Get-Content command rather unhelpfully add a carriage return at the end of the string, so
# passing the string as bytes is a messy but necessary workaround for processes that are sensitive to
# line endings, like promtool.
function Start-RawProcess {
param(
# String to pass to $CommandName via STDIN
[Parameter(Mandatory=$true)][String]$InputVar,
# Command to run
[Parameter(Mandatory=$true)][String]$CommandName,
# Arguments provided to $CommandName
[Parameter(Mandatory=$false)][String[]]$CommandArgs
)
# Buffer & initial size of MemoryStream
$BufferSize = 4096
# Convert text to bytes and write to MemoryStream
[byte[]]$InputBytes = [Text.Encoding]::UTF8.GetBytes($InputVar)
$MemStream = New-Object -TypeName System.IO.MemoryStream -ArgumentList $BufferSize
$MemStream.Write($InputBytes, 0, $InputBytes.Length)
[Void]$MemStream.Seek(0, 'Begin')
# Setup stdin\stdout redirection for our process
if ($CommandArgs) {
$StartInfo = New-Object -TypeName System.Diagnostics.ProcessStartInfo -Property @{
FileName = $CommandName
UseShellExecute = $false
RedirectStandardInput = $true
RedirectStandardError = $true
Arguments = $CommandArgs
}
} else {
$StartInfo = New-Object -TypeName System.Diagnostics.ProcessStartInfo -Property @{
FileName = $CommandName
UseShellExecute = $false
RedirectStandardInput = $true
RedirectStandardError = $true
}
}
# Create new process
$Process = New-Object -TypeName System.Diagnostics.Process
# Assign previously created StartInfo properties
$Process.StartInfo = $StartInfo
# Start process
[void]$Process.Start()
# Pipe data
$Buffer = New-Object -TypeName byte[] -ArgumentList $BufferSize
$StdinStream = $Process.StandardInput.BaseStream
try {
do {
$ReadCount = $MemStream.Read($Buffer, 0, $Buffer.Length)
$StdinStream.Write($Buffer, 0, $ReadCount)
$StdinStream.Flush()
}
while($ReadCount -gt 0)
}
catch
{
throw 'Error streaming buffer to STDIN'
} finally {
# Close streams
$StdinStream.Close()
$MemStream.Close()
}
$Process.WaitForExit()
if ($Process.ExitCode -ne 0) {
Write-Host $Process.StandardError.ReadToEnd()
}
return $Process.ExitCode
}
# cd to location of script
$script_path = $MyInvocation.MyCommand.Path
$working_dir = Split-Path $script_path
Push-Location $working_dir
$temp_dir = Join-Path $env:TEMP $(New-Guid) | ForEach-Object { mkdir $_ }
# Start process in background, awaiting HTTP requests.
# Listen on 9183/TCP, preventing conflicts with 9182/TCP used by end-to-end-test.ps1
# Not an issue when run individually, but will cause failures when run concurrently in CI.
$exporter_proc = Start-Process `
-PassThru `
-FilePath ..\windows_exporter.exe `
-ArgumentList '--telemetry.addr="127.0.0.1:9183" --log.level=debug' `
-WindowStyle Hidden `
-RedirectStandardOutput "$($temp_dir)/windows_exporter.log" `
-RedirectStandardError "$($temp_dir)/windows_exporter_error.log"
# Exporter can take some time to start
for ($i=1; $i -le 5; $i++) {
Start-Sleep 10
$netstat_output = netstat -anp tcp | Select-String 'listening'
if ($netstat_output -like '*:9183*') {
break
}
Write-Host "Waiting for exporter to start"
}
# Omit metrics from client_golang library; we're not responsible for these
$skip_re = "^[#]?\s*(HELP|TYPE)?\s*go_"
# Need to remove carriage returns, as promtool expects LF line endings
$output = ((Invoke-WebRequest -UseBasicParsing -URI http://127.0.0.1:9183/metrics).Content) -Split "`r?`n" | Select-String -NotMatch $skip_re | Join-String -Separator "`n"
# Join the split lines back to a single String (with LF line endings!)
$output = $output -Join "`n"
Stop-Process -Id $exporter_proc.Id
$ExitCode = Start-RawProcess -InputVar $output -CommandName promtool.exe -CommandArgs @("check metrics")
if ($ExitCode -ne 0) {
Write-Host "Promtool command returned exit code $($ExitCode). See output for details."
EXIT 1
}