mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-18 18:56:35 +00:00
Compare commits
11 Commits
v0.29.0-rc
...
v0.29.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
622813343f | ||
|
|
65d19f433e | ||
|
|
2d334e4df0 | ||
|
|
f442d6e22a | ||
|
|
d43f6ffdec | ||
|
|
9bea340c44 | ||
|
|
2635e5d8eb | ||
|
|
41ff5729df | ||
|
|
6097432d87 | ||
|
|
5f36a81613 | ||
|
|
2e4ba9984d |
22
.github/workflows/container_description.yml
vendored
22
.github/workflows/container_description.yml
vendored
@@ -33,25 +33,3 @@ jobs:
|
|||||||
# Empty string results in README-containers.md being pushed if it
|
# Empty string results in README-containers.md being pushed if it
|
||||||
# exists. Otherwise, README.md is pushed.
|
# exists. Otherwise, README.md is pushed.
|
||||||
readme_file: ''
|
readme_file: ''
|
||||||
|
|
||||||
PushQuayIoReadme:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: Push README to quay.io
|
|
||||||
if: github.repository_owner == 'prometheus' || github.repository_owner == 'prometheus-community' # Don't run this workflow on forks.
|
|
||||||
steps:
|
|
||||||
- name: git checkout
|
|
||||||
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
|
|
||||||
- name: Set quay.io org name
|
|
||||||
run: echo "DOCKER_REPO=$(echo quay.io/${GITHUB_REPOSITORY_OWNER} | tr -d '-')" >> $GITHUB_ENV
|
|
||||||
- name: Set quay.io repo name
|
|
||||||
run: echo "DOCKER_REPO_NAME=$(make docker-repo-name)" >> $GITHUB_ENV
|
|
||||||
- name: Push README to quay.io
|
|
||||||
uses: christian-korneck/update-container-description-action@d36005551adeaba9698d8d67a296bd16fa91f8e8 # v1
|
|
||||||
env:
|
|
||||||
DOCKER_APIKEY: ${{ secrets.QUAY_IO_API_TOKEN }}
|
|
||||||
with:
|
|
||||||
destination_container_repo: ${{ env.DOCKER_REPO_NAME }}
|
|
||||||
provider: quay
|
|
||||||
# Empty string results in README-containers.md being pushed if it
|
|
||||||
# exists. Otherwise, README.md is pushed.
|
|
||||||
readme_file: ''
|
|
||||||
|
|||||||
@@ -45,9 +45,6 @@ linters-settings:
|
|||||||
# Support string case: `camel`, `pascal`, `kebab`, `snake`, `upperSnake`, `goCamel`, `goPascal`, `goKebab`, `goSnake`, `upper`, `lower`, `header`
|
# Support string case: `camel`, `pascal`, `kebab`, `snake`, `upperSnake`, `goCamel`, `goPascal`, `goKebab`, `goSnake`, `upper`, `lower`, `header`
|
||||||
json: camel
|
json: camel
|
||||||
yaml: snake
|
yaml: snake
|
||||||
gomoddirectives:
|
|
||||||
replace-allow-list:
|
|
||||||
- github.com/prometheus/common # https://github.com/prometheus/common/pull/694
|
|
||||||
forbidigo:
|
forbidigo:
|
||||||
forbid:
|
forbid:
|
||||||
- "^(fmt\\.Print(|f|ln)|print|println)$"
|
- "^(fmt\\.Print(|f|ln)|print|println)$"
|
||||||
|
|||||||
26
README.md
26
README.md
@@ -14,35 +14,29 @@ Name | Description | Enabled by default
|
|||||||
[cache](docs/collector.cache.md) | Cache metrics |
|
[cache](docs/collector.cache.md) | Cache metrics |
|
||||||
[cpu](docs/collector.cpu.md) | CPU usage | ✓
|
[cpu](docs/collector.cpu.md) | CPU usage | ✓
|
||||||
[cpu_info](docs/collector.cpu_info.md) | CPU Information |
|
[cpu_info](docs/collector.cpu_info.md) | CPU Information |
|
||||||
[cs](docs/collector.cs.md) | "Computer System" metrics (system properties, num cpus/total memory) |
|
[cs](docs/collector.cs.md) | "Computer System" metrics (system properties, num cpus/total memory) |
|
||||||
[container](docs/collector.container.md) | Container metrics |
|
[container](docs/collector.container.md) | Container metrics |
|
||||||
[diskdrive](docs/collector.diskdrive.md) | Diskdrive metrics |
|
[diskdrive](docs/collector.diskdrive.md) | Diskdrive metrics |
|
||||||
[dfsr](docs/collector.dfsr.md) | DFSR metrics |
|
[dfsr](docs/collector.dfsr.md) | DFSR metrics |
|
||||||
[dhcp](docs/collector.dhcp.md) | DHCP Server |
|
[dhcp](docs/collector.dhcp.md) | DHCP Server |
|
||||||
[dns](docs/collector.dns.md) | DNS Server |
|
[dns](docs/collector.dns.md) | DNS Server |
|
||||||
[exchange](docs/collector.exchange.md) | Exchange metrics |
|
[exchange](docs/collector.exchange.md) | Exchange metrics |
|
||||||
|
[filetime](docs/collector.filetime.md) | FileTime metrics |
|
||||||
[fsrmquota](docs/collector.fsrmquota.md) | Microsoft File Server Resource Manager (FSRM) Quotas collector |
|
[fsrmquota](docs/collector.fsrmquota.md) | Microsoft File Server Resource Manager (FSRM) Quotas collector |
|
||||||
[hyperv](docs/collector.hyperv.md) | Hyper-V hosts |
|
[hyperv](docs/collector.hyperv.md) | Hyper-V hosts |
|
||||||
[iis](docs/collector.iis.md) | IIS sites and applications |
|
[iis](docs/collector.iis.md) | IIS sites and applications |
|
||||||
[license](docs/collector.license.md) | Windows license status |
|
[license](docs/collector.license.md) | Windows license status |
|
||||||
[logical_disk](docs/collector.logical_disk.md) | Logical disks, disk I/O | ✓
|
[logical_disk](docs/collector.logical_disk.md) | Logical disks, disk I/O | ✓
|
||||||
[logon](docs/collector.logon.md) | User logon sessions |
|
[logon](docs/collector.logon.md) | User logon sessions |
|
||||||
[memory](docs/collector.memory.md) | Memory usage metrics | ✓
|
[memory](docs/collector.memory.md) | Memory usage metrics | ✓
|
||||||
[mscluster](docs/collector.mscluster.md) | MSCluster metrics |
|
[mscluster](docs/collector.mscluster.md) | MSCluster metrics |
|
||||||
[msmq](docs/collector.msmq.md) | MSMQ queues |
|
[msmq](docs/collector.msmq.md) | MSMQ queues |
|
||||||
[mssql](docs/collector.mssql.md) | [SQL Server Performance Objects](https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/use-sql-server-objects#SQLServerPOs) metrics |
|
[mssql](docs/collector.mssql.md) | [SQL Server Performance Objects](https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/use-sql-server-objects#SQLServerPOs) metrics |
|
||||||
[netframework_clrexceptions](docs/collector.netframework_clrexceptions.md) | .NET Framework CLR Exceptions |
|
[netframework](docs/collector.netframework.md) | .NET Framework metrics |
|
||||||
[netframework_clrinterop](docs/collector.netframework_clrinterop.md) | .NET Framework Interop Metrics |
|
|
||||||
[netframework_clrjit](docs/collector.netframework_clrjit.md) | .NET Framework JIT metrics |
|
|
||||||
[netframework_clrloading](docs/collector.netframework_clrloading.md) | .NET Framework CLR Loading metrics |
|
|
||||||
[netframework_clrlocksandthreads](docs/collector.netframework_clrlocksandthreads.md) | .NET Framework locks and metrics threads |
|
|
||||||
[netframework_clrmemory](docs/collector.netframework_clrmemory.md) | .NET Framework Memory metrics |
|
|
||||||
[netframework_clrremoting](docs/collector.netframework_clrremoting.md) | .NET Framework Remoting metrics |
|
|
||||||
[netframework_clrsecurity](docs/collector.netframework_clrsecurity.md) | .NET Framework Security Check metrics |
|
|
||||||
[net](docs/collector.net.md) | Network interface I/O | ✓
|
[net](docs/collector.net.md) | Network interface I/O | ✓
|
||||||
[os](docs/collector.os.md) | OS metrics (memory, processes, users) | ✓
|
[os](docs/collector.os.md) | OS metrics (memory, processes, users) | ✓
|
||||||
[physical_disk](docs/collector.physical_disk.md) | physical disk metrics | ✓
|
[physical_disk](docs/collector.physical_disk.md) | physical disk metrics | ✓
|
||||||
[printer](docs/collector.printer.md) | Printer metrics |
|
[printer](docs/collector.printer.md) | Printer metrics |
|
||||||
[process](docs/collector.process.md) | Per-process metrics |
|
[process](docs/collector.process.md) | Per-process metrics |
|
||||||
[remote_fx](docs/collector.remote_fx.md) | RemoteFX protocol (RDP) metrics |
|
[remote_fx](docs/collector.remote_fx.md) | RemoteFX protocol (RDP) metrics |
|
||||||
[scheduled_task](docs/collector.scheduled_task.md) | Scheduled Tasks metrics |
|
[scheduled_task](docs/collector.scheduled_task.md) | Scheduled Tasks metrics |
|
||||||
@@ -99,9 +93,9 @@ The latest release can be downloaded from the [releases page](https://github.com
|
|||||||
|
|
||||||
Each release provides a .msi installer. The installer will setup the windows_exporter as a Windows service, as well as create an exception in the Windows Firewall.
|
Each release provides a .msi installer. The installer will setup the windows_exporter as a Windows service, as well as create an exception in the Windows Firewall.
|
||||||
|
|
||||||
If the installer is run without any parameters, the exporter will run with default settings for enabled collectors, ports, etc.
|
If the installer is run without any parameters, the exporter will run with default settings for enabled collectors, ports, etc.
|
||||||
|
|
||||||
The installer provides a configuration file to customize the exporter.
|
The installer provides a configuration file to customize the exporter.
|
||||||
|
|
||||||
The configuration file
|
The configuration file
|
||||||
* is located in the same directory as the exporter executable.
|
* is located in the same directory as the exporter executable.
|
||||||
@@ -163,7 +157,7 @@ msiexec /i <path-to-msi-file> ENABLED_COLLECTORS=os,service --% EXTRA_FLAGS="--c
|
|||||||
|
|
||||||
## Docker Implementation
|
## Docker Implementation
|
||||||
|
|
||||||
The windows_exporter can be run as a Docker container. The Docker image is available on
|
The windows_exporter can be run as a Docker container. The Docker image is available on
|
||||||
|
|
||||||
* [Docker Hub](https://hub.docker.com/r/prometheuscommunity/windows-exporter): `docker.io/prometheuscommunity/windows-exporter`
|
* [Docker Hub](https://hub.docker.com/r/prometheuscommunity/windows-exporter): `docker.io/prometheuscommunity/windows-exporter`
|
||||||
* [GitHub Container Registry](https://github.com/prometheus-community/windows_exporter/pkgs/container/windows-exporter): `ghcr.io/prometheus-community/windows-exporter`
|
* [GitHub Container Registry](https://github.com/prometheus-community/windows_exporter/pkgs/container/windows-exporter): `ghcr.io/prometheus-community/windows-exporter`
|
||||||
@@ -200,7 +194,7 @@ The prometheus metrics will be exposed on [localhost:9182](http://localhost:9182
|
|||||||
|
|
||||||
### Enable only service collector and specify a custom query
|
### Enable only service collector and specify a custom query
|
||||||
|
|
||||||
.\windows_exporter.exe --collectors.enabled "service" --collector.service.services-where "Name='windows_exporter'"
|
.\windows_exporter.exe --collectors.enabled "service" --collector.service.include="windows_exporter"
|
||||||
|
|
||||||
### Enable only process collector and specify a custom query
|
### Enable only process collector and specify a custom query
|
||||||
|
|
||||||
@@ -229,7 +223,7 @@ collectors:
|
|||||||
enabled: cpu,net,service
|
enabled: cpu,net,service
|
||||||
collector:
|
collector:
|
||||||
service:
|
service:
|
||||||
services-where: "Name='windows_exporter'"
|
include: windows_exporter
|
||||||
log:
|
log:
|
||||||
level: warn
|
level: warn
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -2,6 +2,6 @@ collectors:
|
|||||||
enabled: cpu,cpu_info,exchange,iis,logical_disk,logon,memory,net,os,process,remote_fx,service,system,tcp,time,terminal_services,textfile
|
enabled: cpu,cpu_info,exchange,iis,logical_disk,logon,memory,net,os,process,remote_fx,service,system,tcp,time,terminal_services,textfile
|
||||||
collector:
|
collector:
|
||||||
service:
|
service:
|
||||||
services-where: "Name='windows_exporter'"
|
include: "windows_exporter"
|
||||||
log:
|
log:
|
||||||
level: warn
|
level: warn
|
||||||
|
|||||||
@@ -25,14 +25,7 @@ This directory contains documentation of the collectors in the windows_exporter,
|
|||||||
- [`msmq`](collector.msmq.md)
|
- [`msmq`](collector.msmq.md)
|
||||||
- [`mssql`](collector.mssql.md)
|
- [`mssql`](collector.mssql.md)
|
||||||
- [`net`](collector.net.md)
|
- [`net`](collector.net.md)
|
||||||
- [`netframework_clrexceptions`](collector.netframework_clrexceptions.md)
|
- [`netframework`](collector.netframework.md)
|
||||||
- [`netframework_clrinterop`](collector.netframework_clrinterop.md)
|
|
||||||
- [`netframework_clrjit`](collector.netframework_clrjit.md)
|
|
||||||
- [`netframework_clrloading`](collector.netframework_clrloading.md)
|
|
||||||
- [`netframework_clrlocksandthreads`](collector.netframework_clrlocksandthreads.md)
|
|
||||||
- [`netframework_clrmemory`](collector.netframework_clrmemory.md)
|
|
||||||
- [`netframework_clrremoting`](collector.netframework_clrremoting.md)
|
|
||||||
- [`netframework_clrsecurity`](collector.netframework_clrsecurity.md)
|
|
||||||
- [`nps`](collector.nps.md)
|
- [`nps`](collector.nps.md)
|
||||||
- [`os`](collector.os.md)
|
- [`os`](collector.os.md)
|
||||||
- [`physical_disk`](collector.physical_disk.md)
|
- [`physical_disk`](collector.physical_disk.md)
|
||||||
|
|||||||
36
docs/collector.filetime.md
Normal file
36
docs/collector.filetime.md
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
# filetime collector
|
||||||
|
|
||||||
|
The filetime collector exposes modified timestamps of files in the filesystem.
|
||||||
|
|
||||||
|
The collector
|
||||||
|
|
||||||
|
|||
|
||||||
|
-|-
|
||||||
|
Metric name prefix | `filetime`
|
||||||
|
Enabled by default? | No
|
||||||
|
|
||||||
|
## Flags
|
||||||
|
|
||||||
|
### `--collectors.filetime.file-patterns`
|
||||||
|
Comma-separated list of file patterns. Each pattern is a glob pattern that can contain `*`, `?`, and `**` (recursive).
|
||||||
|
See https://github.com/bmatcuk/doublestar#patterns for an extended description of the pattern syntax.
|
||||||
|
|
||||||
|
## Metrics
|
||||||
|
|
||||||
|
Name | Description | Type | Labels
|
||||||
|
-----|-------------|------|-------
|
||||||
|
`windows_filetime_mtime_timestamp_seconds` | File modification time | gauge | `file`
|
||||||
|
|
||||||
|
### Example metric
|
||||||
|
|
||||||
|
```
|
||||||
|
# HELP windows_filetime_mtime_timestamp_seconds File modification time
|
||||||
|
# TYPE windows_filetime_mtime_timestamp_seconds gauge
|
||||||
|
windows_filetime_mtime_timestamp_seconds{file="C:\\Users\\admin\\Desktop\\Dashboard.lnk"} 1.726434517e+09
|
||||||
|
```
|
||||||
|
|
||||||
|
## Useful queries
|
||||||
|
_This collector does not yet have any useful queries added, we would appreciate your help adding them!_
|
||||||
|
|
||||||
|
## Alerting examples
|
||||||
|
_This collector does not yet have alerting examples, we would appreciate your help adding them!_
|
||||||
113
docs/collector.netframework.md
Normal file
113
docs/collector.netframework.md
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
# netframework collector
|
||||||
|
|
||||||
|
The netframework collector exposes metrics about dotnet framework.
|
||||||
|
|
||||||
|
| | |
|
||||||
|
|-------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|
| **Metric name prefix** | `netframework_clrexceptions` |
|
||||||
|
| **Classes** | `Win32_PerfRawData_NETFramework_NETCLRExceptions`, `Win32_PerfRawData_NETFramework_NETCLRInterop`, `Win32_PerfRawData_NETFramework_NETCLRJit`, `Win32_PerfRawData_NETFramework_NETCLRLoading`, `Win32_PerfRawData_NETFramework_NETCLRLocksAndThreads`, `Win32_PerfRawData_NETFramework_NETCLRMemory`, `Win32_PerfRawData_NETFramework_NETCLRRemoting`, `Win32_PerfRawData_NETFramework_NETCLRSecurity` |
|
||||||
|
| **Enabled by default?** | No |
|
||||||
|
|
||||||
|
## Flags
|
||||||
|
|
||||||
|
None
|
||||||
|
|
||||||
|
## Metrics
|
||||||
|
|
||||||
|
### CLR Exceptions
|
||||||
|
|
||||||
|
| Name | Description | Type | Labels |
|
||||||
|
|-----------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|-----------|
|
||||||
|
| `windows_netframework_clrexceptions_exceptions_thrown_total` | Displays the total number of exceptions thrown since the application started. This includes both .NET exceptions and unmanaged exceptions that are converted into .NET exceptions. | counter | `process` |
|
||||||
|
| `windows_netframework_clrexceptions_exceptions_filters_total` | Displays the total number of .NET exception filters executed. An exception filter evaluates regardless of whether an exception is handled. | counter | `process` |
|
||||||
|
| `windows_netframework_clrexceptions_exceptions_finallys_total` | Displays the total number of finally blocks executed. Only the finally blocks executed for an exception are counted; finally blocks on normal code paths are not counted by this counter. | counter | `process` |
|
||||||
|
| `windows_netframework_clrexceptions_throw_to_catch_depth_total` | Displays the total number of stack frames traversed, from the frame that threw the exception to the frame that handled the exception. | counter | `process` |
|
||||||
|
|
||||||
|
### CLR Interop
|
||||||
|
|
||||||
|
| Name | Description | Type | Labels |
|
||||||
|
|---------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|-----------|
|
||||||
|
| `windows_netframework_clrinterop_com_callable_wrappers_total` | Displays the current number of COM callable wrappers (CCWs). A CCW is a proxy for a managed object being referenced from an unmanaged COM client. | counter | `process` |
|
||||||
|
| `windows_netframework_clrinterop_interop_marshalling_total` | Displays the total number of times arguments and return values have been marshaled from managed to unmanaged code, and vice versa, since the application started. | counter | `process` |
|
||||||
|
| `windows_netframework_clrinterop_interop_stubs_created_total` | Displays the current number of stubs created by the common language runtime. Stubs are responsible for marshaling arguments and return values from managed to unmanaged code, and vice versa, during a COM interop call or a platform invoke call. | counter | `process` |
|
||||||
|
|
||||||
|
### CLR JIT
|
||||||
|
|
||||||
|
| Name | Description | Type | Labels |
|
||||||
|
|-----------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|-----------|
|
||||||
|
| `windows_netframework_clrjit_jit_methods_total` | Displays the total number of methods JIT-compiled since the application started. This counter does not include pre-JIT-compiled methods. | counter | `process` |
|
||||||
|
| `windows_netframework_clrjit_jit_time_percent` | Displays the percentage of time spent in JIT compilation. This counter is updated at the end of every JIT compilation phase. A JIT compilation phase occurs when a method and its dependencies are compiled. | gauge | `process` |
|
||||||
|
| `windows_netframework_clrjit_jit_standard_failures_total` | Displays the peak number of methods the JIT compiler has failed to compile since the application started. This failure can occur if the MSIL cannot be verified or if there is an internal error in the JIT compiler. | counter | `process` |
|
||||||
|
| `windows_netframework_clrjit_jit_il_bytes_total` | Displays the total number of Microsoft intermediate language (MSIL) bytes compiled by the just-in-time (JIT) compiler since the application started | counter | `process` |
|
||||||
|
|
||||||
|
### CLR Loading
|
||||||
|
|
||||||
|
| Name | Description | Type | Labels |
|
||||||
|
|-------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|-----------|
|
||||||
|
| `windows_netframework_clrloading_loader_heap_size_bytes` | Displays the current size, in bytes, of the memory committed by the class loader across all application domains. Committed memory is the physical space reserved in the disk paging file. | gauge | `process` |
|
||||||
|
| `windows_netframework_clrloading_appdomains_loaded_current` | Displays the current number of application domains loaded in this application. | gauge | `process` |
|
||||||
|
| `windows_netframework_clrloading_assemblies_loaded_current` | Displays the current number of assemblies loaded across all application domains in the currently running application. If the assembly is loaded as domain-neutral from multiple application domains, this counter is incremented only once. | gauge | `process` |
|
||||||
|
| `windows_netframework_clrloading_classes_loaded_current` | Displays the current number of classes loaded in all assemblies. | gauge | `process` |
|
||||||
|
| `windows_netframework_clrloading_appdomains_loaded_total` | Displays the peak number of application domains loaded since the application started. | counter | `process` |
|
||||||
|
| `windows_netframework_clrloading_appdomains_unloaded_total` | Displays the total number of application domains unloaded since the application started. If an application domain is loaded and unloaded multiple times, this counter increments each time the application domain is unloaded. | counter | `process` |
|
||||||
|
| `windows_netframework_clrloading_assemblies_loaded_total` | Displays the total number of assemblies loaded since the application started. If the assembly is loaded as domain-neutral from multiple application domains, this counter is incremented only once. | counter | `process` |
|
||||||
|
| `windows_netframework_clrloading_classes_loaded_total` | Displays the cumulative number of classes loaded in all assemblies since the application started. | counter | `process` |
|
||||||
|
| `windows_netframework_clrloading_class_load_failures_total` | Displays the peak number of classes that have failed to load since the application started. | counter | `process` |
|
||||||
|
|
||||||
|
### CLR Locks and Threads
|
||||||
|
|
||||||
|
| Name | Description | Type | Labels |
|
||||||
|
|----------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|-----------|
|
||||||
|
| `windows_netframework_clrlocksandthreads_current_queue_length` | Displays the total number of threads that are currently waiting to acquire a managed lock in the application. | gauge | `process` |
|
||||||
|
| `windows_netframework_clrlocksandthreads_current_logical_threads` | Displays the number of current managed thread objects in the application. This counter maintains the count of both running and stopped threads. | gauge | `process` |
|
||||||
|
| `windows_netframework_clrlocksandthreads_physical_threads_current` | Displays the number of native operating system threads created and owned by the common language runtime to act as underlying threads for managed thread objects. This counter's value does not include the threads used by the runtime in its internal operations; it is a subset of the threads in the operating system process. | gauge | `process` |
|
||||||
|
| `windows_netframework_clrlocksandthreads_recognized_threads_current` | Displays the number of threads that are currently recognized by the runtime. These threads are associated with a corresponding managed thread object. The runtime does not create these threads, but they have run inside the runtime at least once. | gauge | `process` |
|
||||||
|
| `windows_netframework_clrlocksandthreads_recognized_threads_total` | Displays the total number of threads that have been recognized by the runtime since the application started. These threads are associated with a corresponding managed thread object. The runtime does not create these threads, but they have run inside the runtime at least once. | counter | `process` |
|
||||||
|
| `windows_netframework_clrlocksandthreads_queue_length_total` | Displays the total number of threads that waited to acquire a managed lock since the application started. | counter | `process` |
|
||||||
|
| `windows_netframework_clrlocksandthreads_contentions_total` | Displays the total number of times that threads in the runtime have attempted to acquire a managed lock unsuccessfully. | counter | `process` |
|
||||||
|
|
||||||
|
### CLR Memory
|
||||||
|
|
||||||
|
| Name | Description | Type | Labels |
|
||||||
|
|----------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|-----------|
|
||||||
|
| `windows_netframework_clrmemory_allocated_bytes_total` | Displays the total number of bytes allocated on the garbage collection heap. | counter | `process` |
|
||||||
|
| `windows_netframework_clrmemory_finalization_survivors` | Displays the number of garbage-collected objects that survive a collection because they are waiting to be finalized. | gauge | `process` |
|
||||||
|
| `windows_netframework_clrmemory_heap_size_bytes` | Displays the maximum bytes that can be allocated; it does not indicate the current number of bytes allocated. | gauge | `process` |
|
||||||
|
| `windows_netframework_clrmemory_promoted_bytes` | Displays the bytes that were promoted from the generation to the next one during the last GC. Memory is promoted when it survives a garbage collection. | gauge | `process` |
|
||||||
|
| `windows_netframework_clrmemory_number_gc_handles` | Displays the current number of garbage collection handles in use. Garbage collection handles are handles to resources external to the common language runtime and the managed environment. | gauge | `process` |
|
||||||
|
| `windows_netframework_clrmemory_collections_total` | Displays the number of times the generation objects are garbage collected since the application started. | counter | `process` |
|
||||||
|
| `windows_netframework_clrmemory_induced_gc_total` | Displays the peak number of times garbage collection was performed because of an explicit call to GC.Collect. | counter | `process` |
|
||||||
|
| `windows_netframework_clrmemory_number_pinned_objects` | Displays the number of pinned objects encountered in the last garbage collection. | gauge | `process` |
|
||||||
|
| `windows_netframework_clrmemory_number_sink_blocksinuse` | Displays the current number of synchronization blocks in use. Synchronization blocks are per-object data structures allocated for storing synchronization information. They hold weak references to managed objects and must be scanned by the garbage collector. | gauge | `process` |
|
||||||
|
| `windows_netframework_clrmemory_committed_bytes` | Displays the amount of virtual memory, in bytes, currently committed by the garbage collector. Committed memory is the physical memory for which space has been reserved in the disk paging file. | gauge | `process` |
|
||||||
|
| `windows_netframework_clrmemory_reserved_bytes` | Displays the amount of virtual memory, in bytes, currently reserved by the garbage collector. Reserved memory is the virtual memory space reserved for the application when no disk or main memory pages have been used. | gauge | `process` |
|
||||||
|
| `windows_netframework_clrmemory_gc_time_percent` | Displays the percentage of time that was spent performing a garbage collection in the last sample. | gauge | `process` |
|
||||||
|
|
||||||
|
### CLR Remoting
|
||||||
|
|
||||||
|
| Name | Description | Type | Labels |
|
||||||
|
|-----------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------|---------|-----------|
|
||||||
|
| `windows_netframework_clrremoting_channels_total` | Displays the total number of remoting channels registered across all application domains since application started. | counter | `process` |
|
||||||
|
| `windows_netframework_clrremoting_context_bound_classes_loaded` | Displays the current number of context-bound classes that are loaded. | gauge | `process` |
|
||||||
|
| `windows_netframework_clrremoting_context_bound_objects_total` | Displays the total number of context-bound objects allocated. | counter | `process` |
|
||||||
|
| `windows_netframework_clrremoting_context_proxies_total` | Displays the total number of remoting proxy objects in this process since it started. | counter | `process` |
|
||||||
|
| `windows_netframework_clrremoting_contexts` | Displays the current number of remoting contexts in the application. | gauge | `process` |
|
||||||
|
| `windows_netframework_clrremoting_remote_calls_total` | Displays the total number of remote procedure calls invoked since the application started. | counter | `process` |
|
||||||
|
|
||||||
|
### CLR Security
|
||||||
|
|
||||||
|
| Name | Description | Type | Labels |
|
||||||
|
|-----------------------------------------------------------|-----------------------------------------------------------------------------------------------------------|---------|-----------|
|
||||||
|
| `windows_netframework_clrsecurity_link_time_checks_total` | Displays the total number of link-time code access security checks since the application started. | counter | `process` |
|
||||||
|
| `windows_netframework_clrsecurity_rt_checks_time_percent` | Displays the percentage of time spent performing runtime code access security checks in the last sample. | gauge | `process` |
|
||||||
|
| `windows_netframework_clrsecurity_stack_walk_depth` | Displays the depth of the stack during that last runtime code access security check. | gauge | `process` |
|
||||||
|
| `windows_netframework_clrsecurity_runtime_checks_total` | Displays the total number of runtime code access security checks performed since the application started. | counter | `process` |
|
||||||
|
|
||||||
|
### 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!_
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
# netframework_clrexceptions collector
|
|
||||||
|
|
||||||
The netframework_clrexceptions collector exposes metrics about CLR exceptions in the dotnet framework.
|
|
||||||
|
|
||||||
|||
|
|
||||||
-|-
|
|
||||||
Metric name prefix | `netframework_clrexceptions`
|
|
||||||
Classes | `Win32_PerfRawData_NETFramework_NETCLRExceptions`
|
|
||||||
Enabled by default? | No
|
|
||||||
|
|
||||||
## Flags
|
|
||||||
|
|
||||||
None
|
|
||||||
|
|
||||||
## Metrics
|
|
||||||
|
|
||||||
Name | Description | Type | Labels
|
|
||||||
-----|-------------|------|-------
|
|
||||||
`windows_netframework_clrexceptions_exceptions_thrown_total` | Displays the total number of exceptions thrown since the application started. This includes both .NET exceptions and unmanaged exceptions that are converted into .NET exceptions. | counter | `process`
|
|
||||||
`windows_netframework_clrexceptions_exceptions_filters_total` | Displays the total number of .NET exception filters executed. An exception filter evaluates regardless of whether an exception is handled. | counter | `process`
|
|
||||||
`windows_netframework_clrexceptions_exceptions_finallys_total` | Displays the total number of finally blocks executed. Only the finally blocks executed for an exception are counted; finally blocks on normal code paths are not counted by this counter. | counter | `process`
|
|
||||||
`windows_netframework_clrexceptions_throw_to_catch_depth_total` | Displays the total number of stack frames traversed, from the frame that threw the exception to the frame that handled the exception. | counter | `process`
|
|
||||||
|
|
||||||
### 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!_
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
# netframework_clrinterop collector
|
|
||||||
|
|
||||||
The netframework_clrinterop collector exposes metrics about interop between the dotnet framework and outside components.
|
|
||||||
|
|
||||||
|||
|
|
||||||
-|-
|
|
||||||
Metric name prefix | `netframework_clrinterop`
|
|
||||||
Classes | `Win32_PerfRawData_NETFramework_NETCLRInterop`
|
|
||||||
Enabled by default? | No
|
|
||||||
|
|
||||||
## Flags
|
|
||||||
|
|
||||||
None
|
|
||||||
|
|
||||||
## Metrics
|
|
||||||
|
|
||||||
Name | Description | Type | Labels
|
|
||||||
-----|-------------|------|-------
|
|
||||||
`windows_netframework_clrinterop_com_callable_wrappers_total` | Displays the current number of COM callable wrappers (CCWs). A CCW is a proxy for a managed object being referenced from an unmanaged COM client. | counter | `process`
|
|
||||||
`windows_netframework_clrinterop_interop_marshalling_total` | Displays the total number of times arguments and return values have been marshaled from managed to unmanaged code, and vice versa, since the application started. | counter | `process`
|
|
||||||
`windows_netframework_clrinterop_interop_stubs_created_total` | Displays the current number of stubs created by the common language runtime. Stubs are responsible for marshaling arguments and return values from managed to unmanaged code, and vice versa, during a COM interop call or a platform invoke call. | counter | `process`
|
|
||||||
|
|
||||||
### 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!_
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
# netframework_clrjit collector
|
|
||||||
|
|
||||||
The netframework_clrjit collector exposes metrics about the dotnet Just-in-Time compiler.
|
|
||||||
|
|
||||||
|||
|
|
||||||
-|-
|
|
||||||
Metric name prefix | `netframework_clrjit`
|
|
||||||
Classes | `Win32_PerfRawData_NETFramework_NETCLRJit`
|
|
||||||
Enabled by default? | No
|
|
||||||
|
|
||||||
## Flags
|
|
||||||
|
|
||||||
None
|
|
||||||
|
|
||||||
## Metrics
|
|
||||||
|
|
||||||
Name | Description | Type | Labels
|
|
||||||
-----|-------------|------|-------
|
|
||||||
`windows_netframework_clrjit_jit_methods_total` | Displays the total number of methods JIT-compiled since the application started. This counter does not include pre-JIT-compiled methods. | counter | `process`
|
|
||||||
`windows_netframework_clrjit_jit_time_percent` | Displays the percentage of time spent in JIT compilation. This counter is updated at the end of every JIT compilation phase. A JIT compilation phase occurs when a method and its dependencies are compiled. | gauge | `process`
|
|
||||||
`windows_netframework_clrjit_jit_standard_failures_total` | Displays the peak number of methods the JIT compiler has failed to compile since the application started. This failure can occur if the MSIL cannot be verified or if there is an internal error in the JIT compiler. | counter | `process`
|
|
||||||
`windows_netframework_clrjit_jit_il_bytes_total` | Displays the total number of Microsoft intermediate language (MSIL) bytes compiled by the just-in-time (JIT) compiler since the application started | counter | `process`
|
|
||||||
|
|
||||||
### 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!_
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
# netframework_clrloading collector
|
|
||||||
|
|
||||||
The netframework_clrloading collector exposes metrics about the dotnet loader.
|
|
||||||
|
|
||||||
|||
|
|
||||||
-|-
|
|
||||||
Metric name prefix | `netframework_clrloading`
|
|
||||||
Classes | `Win32_PerfRawData_NETFramework_NETCLRLoading`
|
|
||||||
Enabled by default? | No
|
|
||||||
|
|
||||||
## Flags
|
|
||||||
|
|
||||||
None
|
|
||||||
|
|
||||||
## Metrics
|
|
||||||
|
|
||||||
Name | Description | Type | Labels
|
|
||||||
-----|-------------|------|-------
|
|
||||||
`windows_netframework_clrloading_loader_heap_size_bytes` | Displays the current size, in bytes, of the memory committed by the class loader across all application domains. Committed memory is the physical space reserved in the disk paging file. | gauge | `process`
|
|
||||||
`windows_netframework_clrloading_appdomains_loaded_current` | Displays the current number of application domains loaded in this application. | gauge | `process`
|
|
||||||
`windows_netframework_clrloading_assemblies_loaded_current` | Displays the current number of assemblies loaded across all application domains in the currently running application. If the assembly is loaded as domain-neutral from multiple application domains, this counter is incremented only once. | gauge | `process`
|
|
||||||
`windows_netframework_clrloading_classes_loaded_current` | Displays the current number of classes loaded in all assemblies. | gauge | `process`
|
|
||||||
`windows_netframework_clrloading_appdomains_loaded_total` | Displays the peak number of application domains loaded since the application started. | counter | `process`
|
|
||||||
`windows_netframework_clrloading_appdomains_unloaded_total` | Displays the total number of application domains unloaded since the application started. If an application domain is loaded and unloaded multiple times, this counter increments each time the application domain is unloaded. | counter | `process`
|
|
||||||
`windows_netframework_clrloading_assemblies_loaded_total` | Displays the total number of assemblies loaded since the application started. If the assembly is loaded as domain-neutral from multiple application domains, this counter is incremented only once. | counter | `process`
|
|
||||||
`windows_netframework_clrloading_classes_loaded_total` | Displays the cumulative number of classes loaded in all assemblies since the application started. | counter | `process`
|
|
||||||
`windows_netframework_clrloading_class_load_failures_total` | Displays the peak number of classes that have failed to load since the application started. | counter | `process`
|
|
||||||
|
|
||||||
### 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!_
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
# netframework_clrlocksandthreads collector
|
|
||||||
|
|
||||||
The netframework_clrlocksandthreads collector exposes metrics about locks and threads in dotnet applications.
|
|
||||||
|
|
||||||
|||
|
|
||||||
-|-
|
|
||||||
Metric name prefix | `netframework_clrlocksandthreads`
|
|
||||||
Classes | `Win32_PerfRawData_NETFramework_NETCLRLocksAndThreads`
|
|
||||||
Enabled by default? | No
|
|
||||||
|
|
||||||
## Flags
|
|
||||||
|
|
||||||
None
|
|
||||||
|
|
||||||
## Metrics
|
|
||||||
|
|
||||||
Name | Description | Type | Labels
|
|
||||||
-----|-------------|------|-------
|
|
||||||
`windows_netframework_clrlocksandthreads_current_queue_length` | Displays the total number of threads that are currently waiting to acquire a managed lock in the application. | gauge | `process`
|
|
||||||
`windows_netframework_clrlocksandthreads_current_logical_threads` | Displays the number of current managed thread objects in the application. This counter maintains the count of both running and stopped threads. | gauge | `process`
|
|
||||||
`windows_netframework_clrlocksandthreads_physical_threads_current` | Displays the number of native operating system threads created and owned by the common language runtime to act as underlying threads for managed thread objects. This counter's value does not include the threads used by the runtime in its internal operations; it is a subset of the threads in the operating system process. | gauge | `process`
|
|
||||||
`windows_netframework_clrlocksandthreads_recognized_threads_current` | Displays the number of threads that are currently recognized by the runtime. These threads are associated with a corresponding managed thread object. The runtime does not create these threads, but they have run inside the runtime at least once. | gauge | `process`
|
|
||||||
`windows_netframework_clrlocksandthreads_recognized_threads_total` | Displays the total number of threads that have been recognized by the runtime since the application started. These threads are associated with a corresponding managed thread object. The runtime does not create these threads, but they have run inside the runtime at least once. | counter | `process`
|
|
||||||
`windows_netframework_clrlocksandthreads_queue_length_total` | Displays the total number of threads that waited to acquire a managed lock since the application started. | counter | `process`
|
|
||||||
`windows_netframework_clrlocksandthreads_contentions_total` | Displays the total number of times that threads in the runtime have attempted to acquire a managed lock unsuccessfully. | counter | `process`
|
|
||||||
|
|
||||||
### 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!_
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
# netframework_clrmemory collector
|
|
||||||
|
|
||||||
The netframework_clrmemory collector exposes metrics about memory in dotnet applications.
|
|
||||||
|
|
||||||
|||
|
|
||||||
-|-
|
|
||||||
Metric name prefix | `netframework_clrmemory`
|
|
||||||
Classes | `Win32_PerfRawData_NETFramework_NETCLRMemory`
|
|
||||||
Enabled by default? | No
|
|
||||||
|
|
||||||
## Flags
|
|
||||||
|
|
||||||
None
|
|
||||||
|
|
||||||
## Metrics
|
|
||||||
|
|
||||||
Name | Description | Type | Labels
|
|
||||||
-----|-------------|------|-------
|
|
||||||
`windows_netframework_clrmemory_allocated_bytes_total` | Displays the total number of bytes allocated on the garbage collection heap. | counter | `process`
|
|
||||||
`windows_netframework_clrmemory_finalization_survivors` | Displays the number of garbage-collected objects that survive a collection because they are waiting to be finalized. | gauge | `process`
|
|
||||||
`windows_netframework_clrmemory_heap_size_bytes` | Displays the maximum bytes that can be allocated; it does not indicate the current number of bytes allocated. | gauge | `process`
|
|
||||||
`windows_netframework_clrmemory_promoted_bytes` | Displays the bytes that were promoted from the generation to the next one during the last GC. Memory is promoted when it survives a garbage collection. | gauge | `process`
|
|
||||||
`windows_netframework_clrmemory_number_gc_handles` | Displays the current number of garbage collection handles in use. Garbage collection handles are handles to resources external to the common language runtime and the managed environment. | gauge | `process`
|
|
||||||
`windows_netframework_clrmemory_collections_total` | Displays the number of times the generation objects are garbage collected since the application started. | counter | `process`
|
|
||||||
`windows_netframework_clrmemory_induced_gc_total` | Displays the peak number of times garbage collection was performed because of an explicit call to GC.Collect. | counter | `process`
|
|
||||||
`windows_netframework_clrmemory_number_pinned_objects` | Displays the number of pinned objects encountered in the last garbage collection. | gauge | `process`
|
|
||||||
`windows_netframework_clrmemory_number_sink_blocksinuse` | Displays the current number of synchronization blocks in use. Synchronization blocks are per-object data structures allocated for storing synchronization information. They hold weak references to managed objects and must be scanned by the garbage collector. | gauge | `process`
|
|
||||||
`windows_netframework_clrmemory_committed_bytes` | Displays the amount of virtual memory, in bytes, currently committed by the garbage collector. Committed memory is the physical memory for which space has been reserved in the disk paging file. | gauge | `process`
|
|
||||||
`windows_netframework_clrmemory_reserved_bytes` | Displays the amount of virtual memory, in bytes, currently reserved by the garbage collector. Reserved memory is the virtual memory space reserved for the application when no disk or main memory pages have been used. | gauge | `process`
|
|
||||||
`windows_netframework_clrmemory_gc_time_percent` | Displays the percentage of time that was spent performing a garbage collection in the last sample. | gauge | `process`
|
|
||||||
|
|
||||||
### 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!_
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
# netframework_clrremoting collector
|
|
||||||
|
|
||||||
The netframework_clrremoting collector exposes metrics about dotnet remoting.
|
|
||||||
|
|
||||||
|||
|
|
||||||
-|-
|
|
||||||
Metric name prefix | `netframework_clrremoting`
|
|
||||||
Classes | `Win32_PerfRawData_NETFramework_NETCLRRemoting`
|
|
||||||
Enabled by default? | No
|
|
||||||
|
|
||||||
## Flags
|
|
||||||
|
|
||||||
None
|
|
||||||
|
|
||||||
## Metrics
|
|
||||||
|
|
||||||
Name | Description | Type | Labels
|
|
||||||
-----|-------------|------|-------
|
|
||||||
`windows_netframework_clrremoting_channels_total` | Displays the total number of remoting channels registered across all application domains since application started. | counter | `process`
|
|
||||||
`windows_netframework_clrremoting_context_bound_classes_loaded` | Displays the current number of context-bound classes that are loaded. | gauge | `process`
|
|
||||||
`windows_netframework_clrremoting_context_bound_objects_total` | Displays the total number of context-bound objects allocated. | counter | `process`
|
|
||||||
`windows_netframework_clrremoting_context_proxies_total` | Displays the total number of remoting proxy objects in this process since it started. | counter | `process`
|
|
||||||
`windows_netframework_clrremoting_contexts` | Displays the current number of remoting contexts in the application. | gauge | `process`
|
|
||||||
`windows_netframework_clrremoting_remote_calls_total` | Displays the total number of remote procedure calls invoked since the application started. | counter | `process`
|
|
||||||
|
|
||||||
### 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!_
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
# netframework_clrsecurity collector
|
|
||||||
|
|
||||||
The netframework_clrsecurity collector exposes metrics about security checks in dotnet applications
|
|
||||||
|
|
||||||
|||
|
|
||||||
-|-
|
|
||||||
Metric name prefix | `netframework_clrsecurity`
|
|
||||||
Classes | `Win32_PerfRawData_NETFramework_NETCLRSecurity`
|
|
||||||
Enabled by default? | No
|
|
||||||
|
|
||||||
## Flags
|
|
||||||
|
|
||||||
None
|
|
||||||
|
|
||||||
## Metrics
|
|
||||||
|
|
||||||
Name | Description | Type | Labels
|
|
||||||
-----|-------------|------|-------
|
|
||||||
`windows_netframework_clrsecurity_link_time_checks_total` | Displays the total number of link-time code access security checks since the application started. | counter | `process`
|
|
||||||
`windows_netframework_clrsecurity_rt_checks_time_percent` | Displays the percentage of time spent performing runtime code access security checks in the last sample. | gauge | `process`
|
|
||||||
`windows_netframework_clrsecurity_stack_walk_depth` | Displays the depth of the stack during that last runtime code access security check. | gauge | `process`
|
|
||||||
`windows_netframework_clrsecurity_runtime_checks_total` | Displays the total number of runtime code access security checks performed since the application started. | counter | `process`
|
|
||||||
|
|
||||||
### 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!_
|
|
||||||
@@ -4,7 +4,7 @@ collectors:
|
|||||||
enabled: cpu,cs,logical_disk,net,os,service,system
|
enabled: cpu,cs,logical_disk,net,os,service,system
|
||||||
collector:
|
collector:
|
||||||
service:
|
service:
|
||||||
services-where: Name='windows_exporter'
|
include: "windows_exporter"
|
||||||
scheduled_task:
|
scheduled_task:
|
||||||
include: /Microsoft/.+
|
include: /Microsoft/.+
|
||||||
log:
|
log:
|
||||||
|
|||||||
@@ -217,6 +217,10 @@ func run() int {
|
|||||||
|
|
||||||
logger.Info("Enabled collectors: " + strings.Join(enabledCollectorList, ", "))
|
logger.Info("Enabled collectors: " + strings.Join(enabledCollectorList, ", "))
|
||||||
|
|
||||||
|
if utils.PDHEnabled() {
|
||||||
|
logger.Info("Using performance data helper from PHD.dll for performance counter collection. This is in experimental state.")
|
||||||
|
}
|
||||||
|
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
mux.Handle("GET /health", httphandler.NewHealthHandler())
|
mux.Handle("GET /health", httphandler.NewHealthHandler())
|
||||||
mux.Handle("GET /version", httphandler.NewVersionHandler())
|
mux.Handle("GET /version", httphandler.NewVersionHandler())
|
||||||
|
|||||||
18
go.mod
18
go.mod
@@ -3,15 +3,15 @@ module github.com/prometheus-community/windows_exporter
|
|||||||
go 1.23
|
go 1.23
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/Microsoft/hcsshim v0.12.6
|
github.com/Microsoft/hcsshim v0.12.7
|
||||||
github.com/alecthomas/kingpin/v2 v2.4.0
|
github.com/alecthomas/kingpin/v2 v2.4.0
|
||||||
|
github.com/bmatcuk/doublestar/v4 v4.6.1
|
||||||
github.com/dimchansky/utfbom v1.1.1
|
github.com/dimchansky/utfbom v1.1.1
|
||||||
github.com/go-ole/go-ole v1.3.0
|
github.com/go-ole/go-ole v1.3.0
|
||||||
github.com/google/uuid v1.6.0
|
github.com/google/uuid v1.6.0
|
||||||
github.com/pkg/errors v0.9.1
|
github.com/prometheus/client_golang v1.20.4
|
||||||
github.com/prometheus/client_golang v1.20.3
|
|
||||||
github.com/prometheus/client_model v0.6.1
|
github.com/prometheus/client_model v0.6.1
|
||||||
github.com/prometheus/common v0.59.1
|
github.com/prometheus/common v0.59.2-0.20240918152650-14bac55a992f
|
||||||
github.com/prometheus/exporter-toolkit v0.13.0
|
github.com/prometheus/exporter-toolkit v0.13.0
|
||||||
github.com/stretchr/testify v1.9.0
|
github.com/stretchr/testify v1.9.0
|
||||||
github.com/yusufpapurcu/wmi v1.2.4
|
github.com/yusufpapurcu/wmi v1.2.4
|
||||||
@@ -30,11 +30,12 @@ require (
|
|||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||||
github.com/jpillora/backoff v1.0.0 // indirect
|
github.com/jpillora/backoff v1.0.0 // indirect
|
||||||
github.com/klauspost/compress v1.17.9 // indirect
|
github.com/klauspost/compress v1.17.10 // indirect
|
||||||
github.com/mdlayher/socket v0.5.1 // indirect
|
github.com/mdlayher/socket v0.5.1 // indirect
|
||||||
github.com/mdlayher/vsock v1.2.1 // indirect
|
github.com/mdlayher/vsock v1.2.1 // indirect
|
||||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||||
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
|
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
|
||||||
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
github.com/prometheus/procfs v0.15.1 // indirect
|
github.com/prometheus/procfs v0.15.1 // indirect
|
||||||
github.com/sirupsen/logrus v1.9.3 // indirect
|
github.com/sirupsen/logrus v1.9.3 // indirect
|
||||||
@@ -45,11 +46,8 @@ require (
|
|||||||
golang.org/x/oauth2 v0.23.0 // indirect
|
golang.org/x/oauth2 v0.23.0 // indirect
|
||||||
golang.org/x/sync v0.8.0 // indirect
|
golang.org/x/sync v0.8.0 // indirect
|
||||||
golang.org/x/text v0.18.0 // indirect
|
golang.org/x/text v0.18.0 // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20240924160255-9d4c2d233b61 // indirect
|
||||||
google.golang.org/grpc v1.66.0 // indirect
|
google.golang.org/grpc v1.67.0 // indirect
|
||||||
google.golang.org/protobuf v1.34.2 // indirect
|
google.golang.org/protobuf v1.34.2 // indirect
|
||||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
// https://github.com/prometheus/common/pull/694
|
|
||||||
replace github.com/prometheus/common v0.59.1 => github.com/jkroepke/prometheus-common v0.0.0-20240907211841-5f9af24b97ad
|
|
||||||
|
|||||||
26
go.sum
26
go.sum
@@ -2,14 +2,16 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT
|
|||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
|
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
|
||||||
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
|
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
|
||||||
github.com/Microsoft/hcsshim v0.12.6 h1:qEnZjoHXv+4/s0LmKZWE0/AiZmMWEIkFfWBSf1a0wlU=
|
github.com/Microsoft/hcsshim v0.12.7 h1:MP6R1spmjxTE4EU4J3YsrTxn8CjvN9qwjTKJXldFaRg=
|
||||||
github.com/Microsoft/hcsshim v0.12.6/go.mod h1:ZABCLVcvLMjIkzr9rUGcQ1QA0p0P3Ps+d3N1g2DsFfk=
|
github.com/Microsoft/hcsshim v0.12.7/go.mod h1:HPbAuJ9BvQYYZbB4yEQcyGIsTP5L4yHKeO9XO149AEM=
|
||||||
github.com/alecthomas/kingpin/v2 v2.4.0 h1:f48lwail6p8zpO1bC4TxtqACaGqHYA22qkHjHpqDjYY=
|
github.com/alecthomas/kingpin/v2 v2.4.0 h1:f48lwail6p8zpO1bC4TxtqACaGqHYA22qkHjHpqDjYY=
|
||||||
github.com/alecthomas/kingpin/v2 v2.4.0/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE=
|
github.com/alecthomas/kingpin/v2 v2.4.0/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE=
|
||||||
github.com/alecthomas/units v0.0.0-20240626203959-61d1e3462e30 h1:t3eaIm0rUkzbrIewtiFmMK5RXHej2XnoXNhxVsAYUfg=
|
github.com/alecthomas/units v0.0.0-20240626203959-61d1e3462e30 h1:t3eaIm0rUkzbrIewtiFmMK5RXHej2XnoXNhxVsAYUfg=
|
||||||
github.com/alecthomas/units v0.0.0-20240626203959-61d1e3462e30/go.mod h1:fvzegU4vN3H1qMT+8wDmzjAcDONcgo2/SZ/TyfdUOFs=
|
github.com/alecthomas/units v0.0.0-20240626203959-61d1e3462e30/go.mod h1:fvzegU4vN3H1qMT+8wDmzjAcDONcgo2/SZ/TyfdUOFs=
|
||||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||||
|
github.com/bmatcuk/doublestar/v4 v4.6.1 h1:FH9SifrbvJhnlQpztAx++wlkk70QBf0iBWDwNy7PA4I=
|
||||||
|
github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc=
|
||||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||||
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||||
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
@@ -59,12 +61,10 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN
|
|||||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/jkroepke/prometheus-common v0.0.0-20240907211841-5f9af24b97ad h1:sFDfDs4nDXjES8PdrFPiXeYt8dtaxn10M/Ebxe4IuiI=
|
|
||||||
github.com/jkroepke/prometheus-common v0.0.0-20240907211841-5f9af24b97ad/go.mod h1:GpWM7dewqmVYcd7SmRaiWVe9SSqjf0UrwnYnpEZNuT0=
|
|
||||||
github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA=
|
github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA=
|
||||||
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
|
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
|
||||||
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
|
github.com/klauspost/compress v1.17.10 h1:oXAz+Vh0PMUvJczoi+flxpnBEPxoER1IaAnU/NMPtT0=
|
||||||
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
|
github.com/klauspost/compress v1.17.10/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
|
||||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
@@ -83,11 +83,13 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
|||||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/prometheus/client_golang v1.20.3 h1:oPksm4K8B+Vt35tUhw6GbSNSgVlVSBH0qELP/7u83l4=
|
github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI=
|
||||||
github.com/prometheus/client_golang v1.20.3/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
|
github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
|
||||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||||
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
|
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
|
||||||
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
|
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
|
||||||
|
github.com/prometheus/common v0.59.2-0.20240918152650-14bac55a992f h1:3okwxT2ame6iNnOMGt2bH7JISqpwGn2KoMZ2bVFBQ6I=
|
||||||
|
github.com/prometheus/common v0.59.2-0.20240918152650-14bac55a992f/go.mod h1:GpWM7dewqmVYcd7SmRaiWVe9SSqjf0UrwnYnpEZNuT0=
|
||||||
github.com/prometheus/exporter-toolkit v0.13.0 h1:lmA0Q+8IaXgmFRKw09RldZmZdnvu9wwcDLIXGmTPw1c=
|
github.com/prometheus/exporter-toolkit v0.13.0 h1:lmA0Q+8IaXgmFRKw09RldZmZdnvu9wwcDLIXGmTPw1c=
|
||||||
github.com/prometheus/exporter-toolkit v0.13.0/go.mod h1:2uop99EZl80KdXhv/MxVI2181fMcwlsumFOqBecGkG0=
|
github.com/prometheus/exporter-toolkit v0.13.0/go.mod h1:2uop99EZl80KdXhv/MxVI2181fMcwlsumFOqBecGkG0=
|
||||||
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
|
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
|
||||||
@@ -161,15 +163,15 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7
|
|||||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20240924160255-9d4c2d233b61 h1:N9BgCIAUvn/M+p4NJccWPWb3BWh88+zyL0ll9HgbEeM=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20240924160255-9d4c2d233b61/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU=
|
||||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||||
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
||||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||||
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
|
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
|
||||||
google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c=
|
google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw=
|
||||||
google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y=
|
google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA=
|
||||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
Start="auto"
|
Start="auto"
|
||||||
Type="ownProcess"
|
Type="ownProcess"
|
||||||
Vital="yes"
|
Vital="yes"
|
||||||
Arguments="--log.file eventlog [ConfigFile_NonDefault][ConfigFile_Default] [CollectorsFlag] [ListenFlag] [MetricsPathFlag] [TextfileDirsFlag] [ExtraFlags]">
|
Arguments="--log.file eventlog [ConfigFileFlag] [CollectorsFlag] [ListenFlag] [MetricsPathFlag] [TextfileDirsFlag] [ExtraFlags]">
|
||||||
<util:ServiceConfig
|
<util:ServiceConfig
|
||||||
ResetPeriodInDays="1"
|
ResetPeriodInDays="1"
|
||||||
FirstFailureActionType="restart"
|
FirstFailureActionType="restart"
|
||||||
@@ -35,4 +35,4 @@
|
|||||||
<ComponentRef Id="CreateTextfileDirectory" />
|
<ComponentRef Id="CreateTextfileDirectory" />
|
||||||
</ComponentGroup>
|
</ComponentGroup>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
</Wix>
|
</Wix>
|
||||||
|
|||||||
@@ -41,9 +41,10 @@
|
|||||||
Value="amus" />
|
Value="amus" />
|
||||||
<SetProperty
|
<SetProperty
|
||||||
Id="CreateConfigFile"
|
Id="CreateConfigFile"
|
||||||
Value=""[%ComSpec]" /c TYPE NUL >>"[APPLICATIONFOLDER]config.yaml""
|
Value=""[%ComSpec]" /c TYPE NUL >>"[ConfigFile_NonDefault][ConfigFile_Default]""
|
||||||
Before="CreateConfigFile"
|
Before="CreateConfigFile"
|
||||||
Sequence="execute"
|
Sequence="execute"
|
||||||
|
Condition="ConfigFile_NonDefault OR ConfigFile_Default"
|
||||||
/>
|
/>
|
||||||
<CustomAction
|
<CustomAction
|
||||||
Id="CreateConfigFile"
|
Id="CreateConfigFile"
|
||||||
@@ -61,7 +62,7 @@
|
|||||||
Condition="Installed AND (NOT REMOVE) AND (NOT UPGRADINGPRODUCTCODE)"/>
|
Condition="Installed AND (NOT REMOVE) AND (NOT UPGRADINGPRODUCTCODE)"/>
|
||||||
<Custom Action="set_reinstall_all_property" Before="set_reinstallmode_property" Condition="MAINTENANCE"/>
|
<Custom Action="set_reinstall_all_property" Before="set_reinstallmode_property" Condition="MAINTENANCE"/>
|
||||||
<Custom Action="set_reinstallmode_property" Before="LaunchConditions" Condition="MAINTENANCE"/>
|
<Custom Action="set_reinstallmode_property" Before="LaunchConditions" Condition="MAINTENANCE"/>
|
||||||
<Custom Action="CreateConfigFile" Before="InstallServices" />
|
<Custom Action="CreateConfigFile" Before="InstallServices" Condition="ConfigFile_NonDefault OR ConfigFile_Default" />
|
||||||
</InstallExecuteSequence>
|
</InstallExecuteSequence>
|
||||||
|
|
||||||
<Media Id="1" Cabinet="windows_exporter.cab" EmbedCab="yes" />
|
<Media Id="1" Cabinet="windows_exporter.cab" EmbedCab="yes" />
|
||||||
@@ -74,8 +75,9 @@
|
|||||||
<SetProperty Id="ExtraFlags" After="InstallFiles" Sequence="execute" Value="[EXTRA_FLAGS]" Condition="EXTRA_FLAGS" />
|
<SetProperty Id="ExtraFlags" After="InstallFiles" Sequence="execute" Value="[EXTRA_FLAGS]" Condition="EXTRA_FLAGS" />
|
||||||
|
|
||||||
<Property Id="CONFIG_FILE" Secure="yes" Value="config.yaml" />
|
<Property Id="CONFIG_FILE" Secure="yes" Value="config.yaml" />
|
||||||
<SetProperty Id="ConfigFile_NonDefault" After="InstallFiles" Sequence="execute" Value="--config.file="[CONFIG_FILE]"" Condition="CONFIG_FILE AND CONFIG_FILE<>"config.yaml"" />
|
<SetProperty Id="ConfigFile_NonDefault" After="InstallFiles" Sequence="execute" Value="[CONFIG_FILE]" Condition="CONFIG_FILE AND CONFIG_FILE<>"config.yaml"" />
|
||||||
<SetProperty Id="ConfigFile_Default" After="InstallFiles" Sequence="execute" Value="--config.file="[APPLICATIONFOLDER]config.yaml"" Condition="CONFIG_FILE="config.yaml"" />
|
<SetProperty Id="ConfigFile_Default" After="InstallFiles" Sequence="execute" Value="[APPLICATIONFOLDER]config.yaml" Condition="CONFIG_FILE="config.yaml"" />
|
||||||
|
<SetProperty Id="ConfigFileFlag" After="InstallFiles" Sequence="execute" Value="--config.file="[ConfigFile_NonDefault][ConfigFile_Default]"" Condition="ConfigFile_NonDefault OR ConfigFile_Default" />
|
||||||
|
|
||||||
<Property Id="LISTEN_PORT" Secure="yes" Value="9182" />
|
<Property Id="LISTEN_PORT" Secure="yes" Value="9182" />
|
||||||
<SetProperty Id="ListenFlag" After="InstallFiles" Sequence="execute" Value="--web.listen-address [LISTEN_ADDR]:[LISTEN_PORT]" Condition="LISTEN_ADDR<>"" OR LISTEN_PORT<>9182" />
|
<SetProperty Id="ListenFlag" After="InstallFiles" Sequence="execute" Value="--web.listen-address [LISTEN_ADDR]:[LISTEN_PORT]" Condition="LISTEN_ADDR<>"" OR LISTEN_PORT<>9182" />
|
||||||
@@ -216,4 +218,4 @@
|
|||||||
</Component>
|
</Component>
|
||||||
</ComponentGroup>
|
</ComponentGroup>
|
||||||
</Package>
|
</Package>
|
||||||
</Wix>
|
</Wix>
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ spec:
|
|||||||
command: ["powershell"]
|
command: ["powershell"]
|
||||||
args: ["New-NetFirewallRule", "-DisplayName", "'windows-exporter'", "-Direction", "inbound", "-Profile", "Any", "-Action", "Allow", "-LocalPort", "9182", "-Protocol", "TCP"]
|
args: ["New-NetFirewallRule", "-DisplayName", "'windows-exporter'", "-Direction", "inbound", "-Profile", "Any", "-Action", "Allow", "-LocalPort", "9182", "-Protocol", "TCP"]
|
||||||
containers:
|
containers:
|
||||||
- args:
|
- args:
|
||||||
- --config.file=%CONTAINER_SANDBOX_MOUNT_POINT%/config.yml
|
- --config.file=%CONTAINER_SANDBOX_MOUNT_POINT%/config.yml
|
||||||
name: windows-exporter
|
name: windows-exporter
|
||||||
image: ghcr.io/prometheus-community/windows-exporter:latest
|
image: ghcr.io/prometheus-community/windows-exporter:latest
|
||||||
@@ -65,4 +65,4 @@ data:
|
|||||||
enabled: '[defaults],container'
|
enabled: '[defaults],container'
|
||||||
collector:
|
collector:
|
||||||
service:
|
service:
|
||||||
services-where: "Name='containerd' or Name='kubelet'"
|
include: "containerd|kubelet"
|
||||||
|
|||||||
2
pkg/collector/cache/cache.go
vendored
2
pkg/collector/cache/cache.go
vendored
@@ -3,10 +3,10 @@
|
|||||||
package cache
|
package cache
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
|
|
||||||
"github.com/alecthomas/kingpin/v2"
|
"github.com/alecthomas/kingpin/v2"
|
||||||
"github.com/pkg/errors"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/perflib"
|
"github.com/prometheus-community/windows_exporter/pkg/perflib"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/types"
|
"github.com/prometheus-community/windows_exporter/pkg/types"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import (
|
|||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/diskdrive"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/diskdrive"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/dns"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/dns"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/exchange"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/exchange"
|
||||||
|
"github.com/prometheus-community/windows_exporter/pkg/collector/filetime"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/fsrmquota"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/fsrmquota"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/hyperv"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/hyperv"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/iis"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/iis"
|
||||||
@@ -34,14 +35,7 @@ import (
|
|||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/msmq"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/msmq"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/mssql"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/mssql"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/net"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/net"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrexceptions"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrinterop"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrjit"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrloading"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrlocksandthreads"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrmemory"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrremoting"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrsecurity"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/nps"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/nps"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/os"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/os"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/perfdata"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/perfdata"
|
||||||
@@ -97,6 +91,7 @@ func NewWithConfig(config Config) *MetricCollectors {
|
|||||||
collectors[diskdrive.Name] = diskdrive.New(&config.DiskDrive)
|
collectors[diskdrive.Name] = diskdrive.New(&config.DiskDrive)
|
||||||
collectors[dns.Name] = dns.New(&config.DNS)
|
collectors[dns.Name] = dns.New(&config.DNS)
|
||||||
collectors[exchange.Name] = exchange.New(&config.Exchange)
|
collectors[exchange.Name] = exchange.New(&config.Exchange)
|
||||||
|
collectors[filetime.Name] = filetime.New(&config.Filetime)
|
||||||
collectors[fsrmquota.Name] = fsrmquota.New(&config.Fsrmquota)
|
collectors[fsrmquota.Name] = fsrmquota.New(&config.Fsrmquota)
|
||||||
collectors[hyperv.Name] = hyperv.New(&config.Hyperv)
|
collectors[hyperv.Name] = hyperv.New(&config.Hyperv)
|
||||||
collectors[iis.Name] = iis.New(&config.IIS)
|
collectors[iis.Name] = iis.New(&config.IIS)
|
||||||
@@ -108,14 +103,7 @@ func NewWithConfig(config Config) *MetricCollectors {
|
|||||||
collectors[msmq.Name] = msmq.New(&config.Msmq)
|
collectors[msmq.Name] = msmq.New(&config.Msmq)
|
||||||
collectors[mssql.Name] = mssql.New(&config.Mssql)
|
collectors[mssql.Name] = mssql.New(&config.Mssql)
|
||||||
collectors[net.Name] = net.New(&config.Net)
|
collectors[net.Name] = net.New(&config.Net)
|
||||||
collectors[netframework_clrexceptions.Name] = netframework_clrexceptions.New(&config.NetframeworkClrexceptions)
|
collectors[netframework.Name] = netframework.New(&config.NetFramework)
|
||||||
collectors[netframework_clrinterop.Name] = netframework_clrinterop.New(&config.NetframeworkClrinterop)
|
|
||||||
collectors[netframework_clrjit.Name] = netframework_clrjit.New(&config.NetframeworkClrjit)
|
|
||||||
collectors[netframework_clrloading.Name] = netframework_clrloading.New(&config.NetframeworkClrloading)
|
|
||||||
collectors[netframework_clrlocksandthreads.Name] = netframework_clrlocksandthreads.New(&config.NetframeworkClrlocksandthreads)
|
|
||||||
collectors[netframework_clrmemory.Name] = netframework_clrmemory.New(&config.NetframeworkClrmemory)
|
|
||||||
collectors[netframework_clrremoting.Name] = netframework_clrremoting.New(&config.NetframeworkClrremoting)
|
|
||||||
collectors[netframework_clrsecurity.Name] = netframework_clrsecurity.New(&config.NetframeworkClrsecurity)
|
|
||||||
collectors[nps.Name] = nps.New(&config.Nps)
|
collectors[nps.Name] = nps.New(&config.Nps)
|
||||||
collectors[os.Name] = os.New(&config.Os)
|
collectors[os.Name] = os.New(&config.Os)
|
||||||
collectors[perfdata.Name] = perfdata.New(&config.PerfData)
|
collectors[perfdata.Name] = perfdata.New(&config.PerfData)
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import (
|
|||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/diskdrive"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/diskdrive"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/dns"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/dns"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/exchange"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/exchange"
|
||||||
|
"github.com/prometheus-community/windows_exporter/pkg/collector/filetime"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/fsrmquota"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/fsrmquota"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/hyperv"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/hyperv"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/iis"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/iis"
|
||||||
@@ -25,14 +26,7 @@ import (
|
|||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/msmq"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/msmq"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/mssql"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/mssql"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/net"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/net"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrexceptions"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrinterop"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrjit"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrloading"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrlocksandthreads"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrmemory"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrremoting"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrsecurity"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/nps"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/nps"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/os"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/os"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/perfdata"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/perfdata"
|
||||||
@@ -57,116 +51,104 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
AD ad.Config `yaml:"ad"`
|
AD ad.Config `yaml:"ad"`
|
||||||
ADCS adcs.Config `yaml:"adcs"`
|
ADCS adcs.Config `yaml:"adcs"`
|
||||||
ADFS adfs.Config `yaml:"adfs"`
|
ADFS adfs.Config `yaml:"adfs"`
|
||||||
Cache cache.Config `yaml:"cache"`
|
Cache cache.Config `yaml:"cache"`
|
||||||
Container container.Config `yaml:"container"`
|
Container container.Config `yaml:"container"`
|
||||||
CPU cpu.Config `yaml:"cpu"`
|
CPU cpu.Config `yaml:"cpu"`
|
||||||
CPUInfo cpu_info.Config `yaml:"cpu_info"`
|
CPUInfo cpu_info.Config `yaml:"cpu_info"`
|
||||||
Cs cs.Config `yaml:"cs"`
|
Cs cs.Config `yaml:"cs"`
|
||||||
DFSR dfsr.Config `yaml:"dfsr"`
|
DFSR dfsr.Config `yaml:"dfsr"`
|
||||||
Dhcp dhcp.Config `yaml:"dhcp"`
|
Dhcp dhcp.Config `yaml:"dhcp"`
|
||||||
DiskDrive diskdrive.Config `yaml:"diskdrive"` //nolint:tagliatelle
|
DiskDrive diskdrive.Config `yaml:"diskdrive"` //nolint:tagliatelle
|
||||||
DNS dns.Config `yaml:"dns"`
|
DNS dns.Config `yaml:"dns"`
|
||||||
Exchange exchange.Config `yaml:"exchange"`
|
Exchange exchange.Config `yaml:"exchange"`
|
||||||
Fsrmquota fsrmquota.Config `yaml:"fsrmquota"`
|
Filetime filetime.Config `yaml:"filetime"`
|
||||||
Hyperv hyperv.Config `yaml:"hyperv"`
|
Fsrmquota fsrmquota.Config `yaml:"fsrmquota"`
|
||||||
IIS iis.Config `yaml:"iis"`
|
Hyperv hyperv.Config `yaml:"hyperv"`
|
||||||
License license.Config `yaml:"license"`
|
IIS iis.Config `yaml:"iis"`
|
||||||
LogicalDisk logical_disk.Config `yaml:"logical_disk"`
|
License license.Config `yaml:"license"`
|
||||||
Logon logon.Config `yaml:"logon"`
|
LogicalDisk logical_disk.Config `yaml:"logical_disk"`
|
||||||
Memory memory.Config `yaml:"memory"`
|
Logon logon.Config `yaml:"logon"`
|
||||||
Mscluster mscluster.Config `yaml:"mscluster"`
|
Memory memory.Config `yaml:"memory"`
|
||||||
Msmq msmq.Config `yaml:"msmq"`
|
Mscluster mscluster.Config `yaml:"mscluster"`
|
||||||
Mssql mssql.Config `yaml:"mssql"`
|
Msmq msmq.Config `yaml:"msmq"`
|
||||||
Net net.Config `yaml:"net"`
|
Mssql mssql.Config `yaml:"mssql"`
|
||||||
NetframeworkClrexceptions netframework_clrexceptions.Config `yaml:"netframework_clrexceptions"`
|
Net net.Config `yaml:"net"`
|
||||||
NetframeworkClrinterop netframework_clrinterop.Config `yaml:"netframework_clrinterop"`
|
NetFramework netframework.Config `yaml:"net_framework"`
|
||||||
NetframeworkClrjit netframework_clrjit.Config `yaml:"netframework_clrjit"`
|
Nps nps.Config `yaml:"nps"`
|
||||||
NetframeworkClrloading netframework_clrloading.Config `yaml:"netframework_clrloading"`
|
Os os.Config `yaml:"os"`
|
||||||
NetframeworkClrlocksandthreads netframework_clrlocksandthreads.Config `yaml:"netframework_clrlocksandthreads"`
|
PerfData perfdata.Config `yaml:"perf_data"`
|
||||||
NetframeworkClrmemory netframework_clrmemory.Config `yaml:"netframework_clrmemory"`
|
PhysicalDisk physical_disk.Config `yaml:"physical_disk"`
|
||||||
NetframeworkClrremoting netframework_clrremoting.Config `yaml:"netframework_clrremoting"`
|
Printer printer.Config `yaml:"printer"`
|
||||||
NetframeworkClrsecurity netframework_clrsecurity.Config `yaml:"netframework_clrsecurity"`
|
Process process.Config `yaml:"process"`
|
||||||
Nps nps.Config `yaml:"nps"`
|
RemoteFx remote_fx.Config `yaml:"remote_fx"`
|
||||||
Os os.Config `yaml:"os"`
|
ScheduledTask scheduled_task.Config `yaml:"scheduled_task"`
|
||||||
PerfData perfdata.Config `yaml:"perf_data"`
|
Service service.Config `yaml:"service"`
|
||||||
PhysicalDisk physical_disk.Config `yaml:"physical_disk"`
|
SMB smb.Config `yaml:"smb"`
|
||||||
Printer printer.Config `yaml:"printer"`
|
SMBClient smbclient.Config `yaml:"smbclient"` //nolint:tagliatelle
|
||||||
Process process.Config `yaml:"process"`
|
SMTP smtp.Config `yaml:"smtp"`
|
||||||
RemoteFx remote_fx.Config `yaml:"remote_fx"`
|
System system.Config `yaml:"system"`
|
||||||
ScheduledTask scheduled_task.Config `yaml:"scheduled_task"`
|
TeradiciPcoip teradici_pcoip.Config `yaml:"teradici_pcoip"`
|
||||||
Service service.Config `yaml:"service"`
|
TCP tcp.Config `yaml:"tcp"`
|
||||||
SMB smb.Config `yaml:"smb"`
|
TerminalServices terminal_services.Config `yaml:"terminal_services"`
|
||||||
SMBClient smbclient.Config `yaml:"smbclient"` //nolint:tagliatelle
|
Textfile textfile.Config `yaml:"textfile"`
|
||||||
SMTP smtp.Config `yaml:"smtp"`
|
Thermalzone thermalzone.Config `yaml:"thermalzone"`
|
||||||
System system.Config `yaml:"system"`
|
Time time.Config `yaml:"time"`
|
||||||
TeradiciPcoip teradici_pcoip.Config `yaml:"teradici_pcoip"`
|
Vmware vmware.Config `yaml:"vmware"`
|
||||||
TCP tcp.Config `yaml:"tcp"`
|
VmwareBlast vmware_blast.Config `yaml:"vmware_blast"`
|
||||||
TerminalServices terminal_services.Config `yaml:"terminal_services"`
|
|
||||||
Textfile textfile.Config `yaml:"textfile"`
|
|
||||||
Thermalzone thermalzone.Config `yaml:"thermalzone"`
|
|
||||||
Time time.Config `yaml:"time"`
|
|
||||||
Vmware vmware.Config `yaml:"vmware"`
|
|
||||||
VmwareBlast vmware_blast.Config `yaml:"vmware_blast"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConfigDefaults Is an interface to be used by the external libraries. It holds all ConfigDefaults form all collectors
|
// ConfigDefaults Is an interface to be used by the external libraries. It holds all ConfigDefaults form all collectors
|
||||||
//
|
//
|
||||||
//goland:noinspection GoUnusedGlobalVariable
|
//goland:noinspection GoUnusedGlobalVariable
|
||||||
var ConfigDefaults = Config{
|
var ConfigDefaults = Config{
|
||||||
AD: ad.ConfigDefaults,
|
AD: ad.ConfigDefaults,
|
||||||
ADCS: adcs.ConfigDefaults,
|
ADCS: adcs.ConfigDefaults,
|
||||||
ADFS: adfs.ConfigDefaults,
|
ADFS: adfs.ConfigDefaults,
|
||||||
Cache: cache.ConfigDefaults,
|
Cache: cache.ConfigDefaults,
|
||||||
Container: container.ConfigDefaults,
|
Container: container.ConfigDefaults,
|
||||||
CPU: cpu.ConfigDefaults,
|
CPU: cpu.ConfigDefaults,
|
||||||
CPUInfo: cpu_info.ConfigDefaults,
|
CPUInfo: cpu_info.ConfigDefaults,
|
||||||
Cs: cs.ConfigDefaults,
|
Cs: cs.ConfigDefaults,
|
||||||
DFSR: dfsr.ConfigDefaults,
|
DFSR: dfsr.ConfigDefaults,
|
||||||
Dhcp: dhcp.ConfigDefaults,
|
Dhcp: dhcp.ConfigDefaults,
|
||||||
DiskDrive: diskdrive.ConfigDefaults,
|
DiskDrive: diskdrive.ConfigDefaults,
|
||||||
DNS: dns.ConfigDefaults,
|
DNS: dns.ConfigDefaults,
|
||||||
Exchange: exchange.ConfigDefaults,
|
Exchange: exchange.ConfigDefaults,
|
||||||
Fsrmquota: fsrmquota.ConfigDefaults,
|
Filetime: filetime.ConfigDefaults,
|
||||||
Hyperv: hyperv.ConfigDefaults,
|
Fsrmquota: fsrmquota.ConfigDefaults,
|
||||||
IIS: iis.ConfigDefaults,
|
Hyperv: hyperv.ConfigDefaults,
|
||||||
License: license.ConfigDefaults,
|
IIS: iis.ConfigDefaults,
|
||||||
LogicalDisk: logical_disk.ConfigDefaults,
|
License: license.ConfigDefaults,
|
||||||
Logon: logon.ConfigDefaults,
|
LogicalDisk: logical_disk.ConfigDefaults,
|
||||||
Memory: memory.ConfigDefaults,
|
Logon: logon.ConfigDefaults,
|
||||||
Mscluster: mscluster.ConfigDefaults,
|
Memory: memory.ConfigDefaults,
|
||||||
Msmq: msmq.ConfigDefaults,
|
Mscluster: mscluster.ConfigDefaults,
|
||||||
Mssql: mssql.ConfigDefaults,
|
Msmq: msmq.ConfigDefaults,
|
||||||
Net: net.ConfigDefaults,
|
Mssql: mssql.ConfigDefaults,
|
||||||
NetframeworkClrexceptions: netframework_clrexceptions.ConfigDefaults,
|
Net: net.ConfigDefaults,
|
||||||
NetframeworkClrinterop: netframework_clrinterop.ConfigDefaults,
|
NetFramework: netframework.ConfigDefaults,
|
||||||
NetframeworkClrjit: netframework_clrjit.ConfigDefaults,
|
Nps: nps.ConfigDefaults,
|
||||||
NetframeworkClrloading: netframework_clrloading.ConfigDefaults,
|
Os: os.ConfigDefaults,
|
||||||
NetframeworkClrlocksandthreads: netframework_clrlocksandthreads.ConfigDefaults,
|
PerfData: perfdata.ConfigDefaults,
|
||||||
NetframeworkClrmemory: netframework_clrmemory.ConfigDefaults,
|
PhysicalDisk: physical_disk.ConfigDefaults,
|
||||||
NetframeworkClrremoting: netframework_clrremoting.ConfigDefaults,
|
Printer: printer.ConfigDefaults,
|
||||||
NetframeworkClrsecurity: netframework_clrsecurity.ConfigDefaults,
|
Process: process.ConfigDefaults,
|
||||||
Nps: nps.ConfigDefaults,
|
RemoteFx: remote_fx.ConfigDefaults,
|
||||||
Os: os.ConfigDefaults,
|
ScheduledTask: scheduled_task.ConfigDefaults,
|
||||||
PerfData: perfdata.ConfigDefaults,
|
Service: service.ConfigDefaults,
|
||||||
PhysicalDisk: physical_disk.ConfigDefaults,
|
SMB: smb.ConfigDefaults,
|
||||||
Printer: printer.ConfigDefaults,
|
SMBClient: smbclient.ConfigDefaults,
|
||||||
Process: process.ConfigDefaults,
|
SMTP: smtp.ConfigDefaults,
|
||||||
RemoteFx: remote_fx.ConfigDefaults,
|
System: system.ConfigDefaults,
|
||||||
ScheduledTask: scheduled_task.ConfigDefaults,
|
TeradiciPcoip: teradici_pcoip.ConfigDefaults,
|
||||||
Service: service.ConfigDefaults,
|
TCP: tcp.ConfigDefaults,
|
||||||
SMB: smb.ConfigDefaults,
|
TerminalServices: terminal_services.ConfigDefaults,
|
||||||
SMBClient: smbclient.ConfigDefaults,
|
Textfile: textfile.ConfigDefaults,
|
||||||
SMTP: smtp.ConfigDefaults,
|
Thermalzone: thermalzone.ConfigDefaults,
|
||||||
System: system.ConfigDefaults,
|
Time: time.ConfigDefaults,
|
||||||
TeradiciPcoip: teradici_pcoip.ConfigDefaults,
|
Vmware: vmware.ConfigDefaults,
|
||||||
TCP: tcp.ConfigDefaults,
|
VmwareBlast: vmware_blast.ConfigDefaults,
|
||||||
TerminalServices: terminal_services.ConfigDefaults,
|
|
||||||
Textfile: textfile.ConfigDefaults,
|
|
||||||
Thermalzone: thermalzone.ConfigDefaults,
|
|
||||||
Time: time.ConfigDefaults,
|
|
||||||
Vmware: vmware.ConfigDefaults,
|
|
||||||
VmwareBlast: vmware_blast.ConfigDefaults,
|
|
||||||
}
|
}
|
||||||
|
|||||||
28
pkg/collector/cpu/const.go
Normal file
28
pkg/collector/cpu/const.go
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
package cpu
|
||||||
|
|
||||||
|
// Processor performance counters.
|
||||||
|
const (
|
||||||
|
C1TimeSeconds = "% C1 Time"
|
||||||
|
C2TimeSeconds = "% C2 Time"
|
||||||
|
C3TimeSeconds = "% C3 Time"
|
||||||
|
C1TransitionsTotal = "C1 Transitions/sec"
|
||||||
|
C2TransitionsTotal = "C2 Transitions/sec"
|
||||||
|
C3TransitionsTotal = "C3 Transitions/sec"
|
||||||
|
ClockInterruptsTotal = "Clock Interrupts/sec"
|
||||||
|
DPCsQueuedTotal = "DPCs Queued/sec"
|
||||||
|
DPCTimeSeconds = "% DPC Time"
|
||||||
|
IdleBreakEventsTotal = "Idle Break Events/sec"
|
||||||
|
IdleTimeSeconds = "% Idle Time"
|
||||||
|
InterruptsTotal = "Interrupts/sec"
|
||||||
|
InterruptTimeSeconds = "% Interrupt Time"
|
||||||
|
ParkingStatus = "Parking Status"
|
||||||
|
PerformanceLimitPercent = "% Performance Limit"
|
||||||
|
PriorityTimeSeconds = "% Priority Time"
|
||||||
|
PrivilegedTimeSeconds = "% Privileged Time"
|
||||||
|
PrivilegedUtilitySeconds = "% Privileged Utility"
|
||||||
|
ProcessorFrequencyMHz = "Processor Frequency"
|
||||||
|
ProcessorPerformance = "% Processor Performance"
|
||||||
|
ProcessorTimeSeconds = "% Processor Time"
|
||||||
|
ProcessorUtilityRate = "% Processor Utility"
|
||||||
|
UserTimeSeconds = "% User Time"
|
||||||
|
)
|
||||||
@@ -3,12 +3,15 @@
|
|||||||
package cpu
|
package cpu
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/alecthomas/kingpin/v2"
|
"github.com/alecthomas/kingpin/v2"
|
||||||
|
"github.com/prometheus-community/windows_exporter/pkg/perfdata"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/perflib"
|
"github.com/prometheus-community/windows_exporter/pkg/perflib"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/types"
|
"github.com/prometheus-community/windows_exporter/pkg/types"
|
||||||
|
"github.com/prometheus-community/windows_exporter/pkg/utils"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
"github.com/yusufpapurcu/wmi"
|
"github.com/yusufpapurcu/wmi"
|
||||||
)
|
)
|
||||||
@@ -22,6 +25,8 @@ var ConfigDefaults = Config{}
|
|||||||
type Collector struct {
|
type Collector struct {
|
||||||
config Config
|
config Config
|
||||||
|
|
||||||
|
perfDataCollector *perfdata.Collector
|
||||||
|
|
||||||
logicalProcessors *prometheus.Desc
|
logicalProcessors *prometheus.Desc
|
||||||
cStateSecondsTotal *prometheus.Desc
|
cStateSecondsTotal *prometheus.Desc
|
||||||
timeTotal *prometheus.Desc
|
timeTotal *prometheus.Desc
|
||||||
@@ -59,6 +64,10 @@ func (c *Collector) GetName() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Collector) GetPerfCounter(_ *slog.Logger) ([]string, error) {
|
func (c *Collector) GetPerfCounter(_ *slog.Logger) ([]string, error) {
|
||||||
|
if utils.PDHEnabled() {
|
||||||
|
return []string{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
return []string{"Processor Information"}, nil
|
return []string{"Processor Information"}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,6 +76,41 @@ func (c *Collector) Close(_ *slog.Logger) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
|
func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
|
||||||
|
if utils.PDHEnabled() {
|
||||||
|
counters := []string{
|
||||||
|
C1TimeSeconds,
|
||||||
|
C2TimeSeconds,
|
||||||
|
C3TimeSeconds,
|
||||||
|
C1TransitionsTotal,
|
||||||
|
C2TransitionsTotal,
|
||||||
|
C3TransitionsTotal,
|
||||||
|
ClockInterruptsTotal,
|
||||||
|
DPCsQueuedTotal,
|
||||||
|
DPCTimeSeconds,
|
||||||
|
IdleBreakEventsTotal,
|
||||||
|
IdleTimeSeconds,
|
||||||
|
InterruptsTotal,
|
||||||
|
InterruptTimeSeconds,
|
||||||
|
ParkingStatus,
|
||||||
|
PerformanceLimitPercent,
|
||||||
|
PriorityTimeSeconds,
|
||||||
|
PrivilegedTimeSeconds,
|
||||||
|
PrivilegedUtilitySeconds,
|
||||||
|
ProcessorFrequencyMHz,
|
||||||
|
ProcessorPerformance,
|
||||||
|
ProcessorTimeSeconds,
|
||||||
|
ProcessorUtilityRate,
|
||||||
|
UserTimeSeconds,
|
||||||
|
}
|
||||||
|
|
||||||
|
var err error
|
||||||
|
|
||||||
|
c.perfDataCollector, err = perfdata.NewCollector("Processor Information", []string{"*"}, counters)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to create Processor Information collector: %w", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
c.logicalProcessors = prometheus.NewDesc(
|
c.logicalProcessors = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "logical_processor"),
|
prometheus.BuildFQName(types.Namespace, Name, "logical_processor"),
|
||||||
"Total number of logical processors",
|
"Total number of logical processors",
|
||||||
@@ -184,7 +228,11 @@ func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
|
|||||||
func (c *Collector) Collect(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
|
func (c *Collector) Collect(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
|
||||||
logger = logger.With(slog.String("collector", Name))
|
logger = logger.With(slog.String("collector", Name))
|
||||||
|
|
||||||
return c.CollectFull(ctx, logger, ch)
|
if utils.PDHEnabled() {
|
||||||
|
return c.collectPDH(ch)
|
||||||
|
}
|
||||||
|
|
||||||
|
return c.collectFull(ctx, logger, ch)
|
||||||
}
|
}
|
||||||
|
|
||||||
type perflibProcessorInformation struct {
|
type perflibProcessorInformation struct {
|
||||||
@@ -216,8 +264,7 @@ type perflibProcessorInformation struct {
|
|||||||
UserTimeSeconds float64 `perflib:"% User Time"`
|
UserTimeSeconds float64 `perflib:"% User Time"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Collector) CollectFull(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
|
func (c *Collector) collectFull(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
|
||||||
logger = logger.With(slog.String("collector", Name))
|
|
||||||
data := make([]perflibProcessorInformation, 0)
|
data := make([]perflibProcessorInformation, 0)
|
||||||
|
|
||||||
err := perflib.UnmarshalObject(ctx.PerfObjects["Processor Information"], &data, logger)
|
err := perflib.UnmarshalObject(ctx.PerfObjects["Processor Information"], &data, logger)
|
||||||
@@ -364,3 +411,143 @@ func (c *Collector) CollectFull(ctx *types.ScrapeContext, logger *slog.Logger, c
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Collector) collectPDH(ch chan<- prometheus.Metric) error {
|
||||||
|
data, err := c.perfDataCollector.Collect()
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to collect Processor Information metrics: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var coreCount float64
|
||||||
|
|
||||||
|
for core, coreData := range data {
|
||||||
|
coreCount++
|
||||||
|
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.cStateSecondsTotal,
|
||||||
|
prometheus.CounterValue,
|
||||||
|
coreData[C1TimeSeconds].FirstValue,
|
||||||
|
core, "c1",
|
||||||
|
)
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.cStateSecondsTotal,
|
||||||
|
prometheus.CounterValue,
|
||||||
|
coreData[C2TimeSeconds].FirstValue,
|
||||||
|
core, "c2",
|
||||||
|
)
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.cStateSecondsTotal,
|
||||||
|
prometheus.CounterValue,
|
||||||
|
coreData[C3TimeSeconds].FirstValue,
|
||||||
|
core, "c3",
|
||||||
|
)
|
||||||
|
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.timeTotal,
|
||||||
|
prometheus.CounterValue,
|
||||||
|
coreData[IdleTimeSeconds].FirstValue,
|
||||||
|
core, "idle",
|
||||||
|
)
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.timeTotal,
|
||||||
|
prometheus.CounterValue,
|
||||||
|
coreData[InterruptTimeSeconds].FirstValue,
|
||||||
|
core, "interrupt",
|
||||||
|
)
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.timeTotal,
|
||||||
|
prometheus.CounterValue,
|
||||||
|
coreData[DPCTimeSeconds].FirstValue,
|
||||||
|
core, "dpc",
|
||||||
|
)
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.timeTotal,
|
||||||
|
prometheus.CounterValue,
|
||||||
|
coreData[PrivilegedTimeSeconds].FirstValue,
|
||||||
|
core, "privileged",
|
||||||
|
)
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.timeTotal,
|
||||||
|
prometheus.CounterValue,
|
||||||
|
coreData[UserTimeSeconds].FirstValue,
|
||||||
|
core, "user",
|
||||||
|
)
|
||||||
|
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.interruptsTotal,
|
||||||
|
prometheus.CounterValue,
|
||||||
|
coreData[InterruptsTotal].FirstValue,
|
||||||
|
core,
|
||||||
|
)
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.dpcsTotal,
|
||||||
|
prometheus.CounterValue,
|
||||||
|
coreData[DPCsQueuedTotal].FirstValue,
|
||||||
|
core,
|
||||||
|
)
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.clockInterruptsTotal,
|
||||||
|
prometheus.CounterValue,
|
||||||
|
coreData[ClockInterruptsTotal].FirstValue,
|
||||||
|
core,
|
||||||
|
)
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.idleBreakEventsTotal,
|
||||||
|
prometheus.CounterValue,
|
||||||
|
coreData[IdleBreakEventsTotal].FirstValue,
|
||||||
|
core,
|
||||||
|
)
|
||||||
|
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.parkingStatus,
|
||||||
|
prometheus.GaugeValue,
|
||||||
|
coreData[ParkingStatus].FirstValue,
|
||||||
|
core,
|
||||||
|
)
|
||||||
|
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.processorFrequencyMHz,
|
||||||
|
prometheus.GaugeValue,
|
||||||
|
coreData[ProcessorFrequencyMHz].FirstValue,
|
||||||
|
core,
|
||||||
|
)
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.processorPerformance,
|
||||||
|
prometheus.CounterValue,
|
||||||
|
coreData[ProcessorPerformance].FirstValue,
|
||||||
|
core,
|
||||||
|
)
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.processorMPerf,
|
||||||
|
prometheus.CounterValue,
|
||||||
|
coreData[ProcessorPerformance].SecondValue,
|
||||||
|
core,
|
||||||
|
)
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.processorRTC,
|
||||||
|
prometheus.CounterValue,
|
||||||
|
coreData[ProcessorUtilityRate].SecondValue,
|
||||||
|
core,
|
||||||
|
)
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.processorUtility,
|
||||||
|
prometheus.CounterValue,
|
||||||
|
coreData[ProcessorUtilityRate].FirstValue,
|
||||||
|
core,
|
||||||
|
)
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.processorPrivilegedUtility,
|
||||||
|
prometheus.CounterValue,
|
||||||
|
coreData[PrivilegedUtilitySeconds].FirstValue,
|
||||||
|
core,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.logicalProcessors,
|
||||||
|
prometheus.GaugeValue,
|
||||||
|
coreCount,
|
||||||
|
)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
|
|||||||
// to the provided prometheus Metric channel.
|
// to the provided prometheus Metric channel.
|
||||||
func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
|
func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
|
||||||
logger = logger.With(slog.String("collector", Name))
|
logger = logger.With(slog.String("collector", Name))
|
||||||
|
|
||||||
if err := c.collect(ch); err != nil {
|
if err := c.collect(ch); err != nil {
|
||||||
logger.Error("failed collecting cs metrics",
|
logger.Error("failed collecting cs metrics",
|
||||||
slog.Any("err", err),
|
slog.Any("err", err),
|
||||||
|
|||||||
175
pkg/collector/filetime/filetime.go
Normal file
175
pkg/collector/filetime/filetime.go
Normal file
@@ -0,0 +1,175 @@
|
|||||||
|
//go:build windows
|
||||||
|
|
||||||
|
package filetime
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"log/slog"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"github.com/alecthomas/kingpin/v2"
|
||||||
|
"github.com/bmatcuk/doublestar/v4"
|
||||||
|
"github.com/prometheus-community/windows_exporter/pkg/types"
|
||||||
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
"github.com/yusufpapurcu/wmi"
|
||||||
|
)
|
||||||
|
|
||||||
|
const Name = "filetime"
|
||||||
|
|
||||||
|
type Config struct {
|
||||||
|
filePatterns []string
|
||||||
|
}
|
||||||
|
|
||||||
|
var ConfigDefaults = Config{
|
||||||
|
filePatterns: []string{},
|
||||||
|
}
|
||||||
|
|
||||||
|
// A Collector is a Prometheus Collector for collecting file times.
|
||||||
|
type Collector struct {
|
||||||
|
config Config
|
||||||
|
|
||||||
|
fileMTime *prometheus.Desc
|
||||||
|
}
|
||||||
|
|
||||||
|
func New(config *Config) *Collector {
|
||||||
|
if config == nil {
|
||||||
|
config = &ConfigDefaults
|
||||||
|
}
|
||||||
|
|
||||||
|
if config.filePatterns == nil {
|
||||||
|
config.filePatterns = ConfigDefaults.filePatterns
|
||||||
|
}
|
||||||
|
|
||||||
|
c := &Collector{
|
||||||
|
config: *config,
|
||||||
|
}
|
||||||
|
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewWithFlags(app *kingpin.Application) *Collector {
|
||||||
|
c := &Collector{
|
||||||
|
config: ConfigDefaults,
|
||||||
|
}
|
||||||
|
c.config.filePatterns = make([]string, 0)
|
||||||
|
|
||||||
|
var filePatterns string
|
||||||
|
|
||||||
|
app.Flag(
|
||||||
|
"collectors.filetime.file-patterns",
|
||||||
|
"Comma-separated list of file patterns. Each pattern is a glob pattern that can contain `*`, `?`, and `**` (recursive). See https://github.com/bmatcuk/doublestar#patterns",
|
||||||
|
).Default(strings.Join(ConfigDefaults.filePatterns, ",")).StringVar(&filePatterns)
|
||||||
|
|
||||||
|
app.Action(func(*kingpin.ParseContext) error {
|
||||||
|
// doublestar.Glob() requires forward slashes
|
||||||
|
c.config.filePatterns = strings.Split(filepath.ToSlash(filePatterns), ",")
|
||||||
|
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Collector) GetName() string {
|
||||||
|
return Name
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Collector) GetPerfCounter(_ *slog.Logger) ([]string, error) {
|
||||||
|
return []string{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Collector) Close(_ *slog.Logger) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
|
||||||
|
logger.Info("filetime collector is in an experimental state! It may subject to change.",
|
||||||
|
slog.String("collector", Name),
|
||||||
|
)
|
||||||
|
|
||||||
|
c.fileMTime = prometheus.NewDesc(
|
||||||
|
prometheus.BuildFQName(types.Namespace, Name, "mtime_timestamp_seconds"),
|
||||||
|
"File modification time",
|
||||||
|
[]string{"file"},
|
||||||
|
nil,
|
||||||
|
)
|
||||||
|
|
||||||
|
for _, filePattern := range c.config.filePatterns {
|
||||||
|
basePath, pattern := doublestar.SplitPattern(filePattern)
|
||||||
|
|
||||||
|
_, err := doublestar.Glob(os.DirFS(basePath), pattern, doublestar.WithFilesOnly())
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("invalid glob pattern: %w", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Collect sends the metric values for each metric
|
||||||
|
// to the provided prometheus Metric channel.
|
||||||
|
func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
|
||||||
|
logger = logger.With(slog.String("collector", Name))
|
||||||
|
|
||||||
|
return c.collectGlob(logger, ch)
|
||||||
|
}
|
||||||
|
|
||||||
|
// collectWin32 collects file times for each file path in the config. It using Win32 FindFirstFile and FindNextFile.
|
||||||
|
func (c *Collector) collectGlob(logger *slog.Logger, ch chan<- prometheus.Metric) error {
|
||||||
|
wg := sync.WaitGroup{}
|
||||||
|
|
||||||
|
for _, filePattern := range c.config.filePatterns {
|
||||||
|
wg.Add(1)
|
||||||
|
|
||||||
|
go func(filePattern string) {
|
||||||
|
defer wg.Done()
|
||||||
|
|
||||||
|
if err := c.collectGlobFilePath(logger, ch, filePattern); err != nil {
|
||||||
|
logger.Error("failed collecting metrics for filepath",
|
||||||
|
slog.String("filepath", filePattern),
|
||||||
|
slog.Any("err", err),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}(filePattern)
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Collector) collectGlobFilePath(logger *slog.Logger, ch chan<- prometheus.Metric, filePattern string) error {
|
||||||
|
basePath, pattern := doublestar.SplitPattern(filePattern)
|
||||||
|
basePathFS := os.DirFS(basePath)
|
||||||
|
|
||||||
|
matches, err := doublestar.Glob(basePathFS, pattern, doublestar.WithFilesOnly())
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to glob: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, match := range matches {
|
||||||
|
filePath := filepath.Join(basePath, match)
|
||||||
|
|
||||||
|
fileInfo, err := os.Stat(filePath)
|
||||||
|
if err != nil {
|
||||||
|
logger.Warn("failed to state file",
|
||||||
|
slog.String("file", filePath),
|
||||||
|
slog.Any("err", err),
|
||||||
|
)
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.fileMTime,
|
||||||
|
prometheus.GaugeValue,
|
||||||
|
float64(fileInfo.ModTime().UTC().Unix()),
|
||||||
|
filePath,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
12
pkg/collector/filetime/filetime_test.go
Normal file
12
pkg/collector/filetime/filetime_test.go
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
package filetime_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/prometheus-community/windows_exporter/pkg/collector/filetime"
|
||||||
|
"github.com/prometheus-community/windows_exporter/pkg/testutils"
|
||||||
|
)
|
||||||
|
|
||||||
|
func BenchmarkCollector(b *testing.B) {
|
||||||
|
testutils.FuncBenchmarkCollector(b, filetime.Name, filetime.NewWithFlags)
|
||||||
|
}
|
||||||
@@ -18,6 +18,7 @@ import (
|
|||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/diskdrive"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/diskdrive"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/dns"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/dns"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/exchange"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/exchange"
|
||||||
|
"github.com/prometheus-community/windows_exporter/pkg/collector/filetime"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/fsrmquota"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/fsrmquota"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/hyperv"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/hyperv"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/iis"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/iis"
|
||||||
@@ -29,14 +30,7 @@ import (
|
|||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/msmq"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/msmq"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/mssql"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/mssql"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/net"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/net"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrexceptions"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrinterop"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrjit"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrloading"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrlocksandthreads"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrmemory"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrremoting"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrsecurity"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/nps"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/nps"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/os"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/os"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/perfdata"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/perfdata"
|
||||||
@@ -67,59 +61,53 @@ func NewBuilderWithFlags[C Collector](fn BuilderWithFlags[C]) BuilderWithFlags[C
|
|||||||
}
|
}
|
||||||
|
|
||||||
var BuildersWithFlags = map[string]BuilderWithFlags[Collector]{
|
var BuildersWithFlags = map[string]BuilderWithFlags[Collector]{
|
||||||
ad.Name: NewBuilderWithFlags(ad.NewWithFlags),
|
ad.Name: NewBuilderWithFlags(ad.NewWithFlags),
|
||||||
adcs.Name: NewBuilderWithFlags(adcs.NewWithFlags),
|
adcs.Name: NewBuilderWithFlags(adcs.NewWithFlags),
|
||||||
adfs.Name: NewBuilderWithFlags(adfs.NewWithFlags),
|
adfs.Name: NewBuilderWithFlags(adfs.NewWithFlags),
|
||||||
cache.Name: NewBuilderWithFlags(cache.NewWithFlags),
|
cache.Name: NewBuilderWithFlags(cache.NewWithFlags),
|
||||||
container.Name: NewBuilderWithFlags(container.NewWithFlags),
|
container.Name: NewBuilderWithFlags(container.NewWithFlags),
|
||||||
cpu.Name: NewBuilderWithFlags(cpu.NewWithFlags),
|
cpu.Name: NewBuilderWithFlags(cpu.NewWithFlags),
|
||||||
cpu_info.Name: NewBuilderWithFlags(cpu_info.NewWithFlags),
|
cpu_info.Name: NewBuilderWithFlags(cpu_info.NewWithFlags),
|
||||||
cs.Name: NewBuilderWithFlags(cs.NewWithFlags),
|
cs.Name: NewBuilderWithFlags(cs.NewWithFlags),
|
||||||
dfsr.Name: NewBuilderWithFlags(dfsr.NewWithFlags),
|
dfsr.Name: NewBuilderWithFlags(dfsr.NewWithFlags),
|
||||||
dhcp.Name: NewBuilderWithFlags(dhcp.NewWithFlags),
|
dhcp.Name: NewBuilderWithFlags(dhcp.NewWithFlags),
|
||||||
diskdrive.Name: NewBuilderWithFlags(diskdrive.NewWithFlags),
|
diskdrive.Name: NewBuilderWithFlags(diskdrive.NewWithFlags),
|
||||||
dns.Name: NewBuilderWithFlags(dns.NewWithFlags),
|
dns.Name: NewBuilderWithFlags(dns.NewWithFlags),
|
||||||
exchange.Name: NewBuilderWithFlags(exchange.NewWithFlags),
|
exchange.Name: NewBuilderWithFlags(exchange.NewWithFlags),
|
||||||
fsrmquota.Name: NewBuilderWithFlags(fsrmquota.NewWithFlags),
|
filetime.Name: NewBuilderWithFlags(filetime.NewWithFlags),
|
||||||
hyperv.Name: NewBuilderWithFlags(hyperv.NewWithFlags),
|
fsrmquota.Name: NewBuilderWithFlags(fsrmquota.NewWithFlags),
|
||||||
iis.Name: NewBuilderWithFlags(iis.NewWithFlags),
|
hyperv.Name: NewBuilderWithFlags(hyperv.NewWithFlags),
|
||||||
license.Name: NewBuilderWithFlags(license.NewWithFlags),
|
iis.Name: NewBuilderWithFlags(iis.NewWithFlags),
|
||||||
logical_disk.Name: NewBuilderWithFlags(logical_disk.NewWithFlags),
|
license.Name: NewBuilderWithFlags(license.NewWithFlags),
|
||||||
logon.Name: NewBuilderWithFlags(logon.NewWithFlags),
|
logical_disk.Name: NewBuilderWithFlags(logical_disk.NewWithFlags),
|
||||||
memory.Name: NewBuilderWithFlags(memory.NewWithFlags),
|
logon.Name: NewBuilderWithFlags(logon.NewWithFlags),
|
||||||
mscluster.Name: NewBuilderWithFlags(mscluster.NewWithFlags),
|
memory.Name: NewBuilderWithFlags(memory.NewWithFlags),
|
||||||
msmq.Name: NewBuilderWithFlags(msmq.NewWithFlags),
|
mscluster.Name: NewBuilderWithFlags(mscluster.NewWithFlags),
|
||||||
mssql.Name: NewBuilderWithFlags(mssql.NewWithFlags),
|
msmq.Name: NewBuilderWithFlags(msmq.NewWithFlags),
|
||||||
net.Name: NewBuilderWithFlags(net.NewWithFlags),
|
mssql.Name: NewBuilderWithFlags(mssql.NewWithFlags),
|
||||||
netframework_clrexceptions.Name: NewBuilderWithFlags(netframework_clrexceptions.NewWithFlags),
|
net.Name: NewBuilderWithFlags(net.NewWithFlags),
|
||||||
netframework_clrinterop.Name: NewBuilderWithFlags(netframework_clrinterop.NewWithFlags),
|
netframework.Name: NewBuilderWithFlags(netframework.NewWithFlags),
|
||||||
netframework_clrjit.Name: NewBuilderWithFlags(netframework_clrjit.NewWithFlags),
|
nps.Name: NewBuilderWithFlags(nps.NewWithFlags),
|
||||||
netframework_clrloading.Name: NewBuilderWithFlags(netframework_clrloading.NewWithFlags),
|
os.Name: NewBuilderWithFlags(os.NewWithFlags),
|
||||||
netframework_clrlocksandthreads.Name: NewBuilderWithFlags(netframework_clrlocksandthreads.NewWithFlags),
|
perfdata.Name: NewBuilderWithFlags(perfdata.NewWithFlags),
|
||||||
netframework_clrmemory.Name: NewBuilderWithFlags(netframework_clrmemory.NewWithFlags),
|
physical_disk.Name: NewBuilderWithFlags(physical_disk.NewWithFlags),
|
||||||
netframework_clrremoting.Name: NewBuilderWithFlags(netframework_clrremoting.NewWithFlags),
|
printer.Name: NewBuilderWithFlags(printer.NewWithFlags),
|
||||||
netframework_clrsecurity.Name: NewBuilderWithFlags(netframework_clrsecurity.NewWithFlags),
|
process.Name: NewBuilderWithFlags(process.NewWithFlags),
|
||||||
nps.Name: NewBuilderWithFlags(nps.NewWithFlags),
|
remote_fx.Name: NewBuilderWithFlags(remote_fx.NewWithFlags),
|
||||||
os.Name: NewBuilderWithFlags(os.NewWithFlags),
|
scheduled_task.Name: NewBuilderWithFlags(scheduled_task.NewWithFlags),
|
||||||
perfdata.Name: NewBuilderWithFlags(perfdata.NewWithFlags),
|
service.Name: NewBuilderWithFlags(service.NewWithFlags),
|
||||||
physical_disk.Name: NewBuilderWithFlags(physical_disk.NewWithFlags),
|
smb.Name: NewBuilderWithFlags(smb.NewWithFlags),
|
||||||
printer.Name: NewBuilderWithFlags(printer.NewWithFlags),
|
smbclient.Name: NewBuilderWithFlags(smbclient.NewWithFlags),
|
||||||
process.Name: NewBuilderWithFlags(process.NewWithFlags),
|
smtp.Name: NewBuilderWithFlags(smtp.NewWithFlags),
|
||||||
remote_fx.Name: NewBuilderWithFlags(remote_fx.NewWithFlags),
|
system.Name: NewBuilderWithFlags(system.NewWithFlags),
|
||||||
scheduled_task.Name: NewBuilderWithFlags(scheduled_task.NewWithFlags),
|
teradici_pcoip.Name: NewBuilderWithFlags(teradici_pcoip.NewWithFlags),
|
||||||
service.Name: NewBuilderWithFlags(service.NewWithFlags),
|
tcp.Name: NewBuilderWithFlags(tcp.NewWithFlags),
|
||||||
smb.Name: NewBuilderWithFlags(smb.NewWithFlags),
|
terminal_services.Name: NewBuilderWithFlags(terminal_services.NewWithFlags),
|
||||||
smbclient.Name: NewBuilderWithFlags(smbclient.NewWithFlags),
|
textfile.Name: NewBuilderWithFlags(textfile.NewWithFlags),
|
||||||
smtp.Name: NewBuilderWithFlags(smtp.NewWithFlags),
|
thermalzone.Name: NewBuilderWithFlags(thermalzone.NewWithFlags),
|
||||||
system.Name: NewBuilderWithFlags(system.NewWithFlags),
|
time.Name: NewBuilderWithFlags(time.NewWithFlags),
|
||||||
teradici_pcoip.Name: NewBuilderWithFlags(teradici_pcoip.NewWithFlags),
|
vmware.Name: NewBuilderWithFlags(vmware.NewWithFlags),
|
||||||
tcp.Name: NewBuilderWithFlags(tcp.NewWithFlags),
|
vmware_blast.Name: NewBuilderWithFlags(vmware_blast.NewWithFlags),
|
||||||
terminal_services.Name: NewBuilderWithFlags(terminal_services.NewWithFlags),
|
|
||||||
textfile.Name: NewBuilderWithFlags(textfile.NewWithFlags),
|
|
||||||
thermalzone.Name: NewBuilderWithFlags(thermalzone.NewWithFlags),
|
|
||||||
time.Name: NewBuilderWithFlags(time.NewWithFlags),
|
|
||||||
vmware.Name: NewBuilderWithFlags(vmware.NewWithFlags),
|
|
||||||
vmware_blast.Name: NewBuilderWithFlags(vmware_blast.NewWithFlags),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func Available() []string {
|
func Available() []string {
|
||||||
|
|||||||
@@ -298,9 +298,5 @@ func (c *Collector) Collect(_ *types.ScrapeContext, _ *slog.Logger, ch chan<- pr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(errs) > 0 {
|
return errors.Join(errs...)
|
||||||
return errors.Join(errs...)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|||||||
245
pkg/collector/netframework/netframework.go
Normal file
245
pkg/collector/netframework/netframework.go
Normal file
@@ -0,0 +1,245 @@
|
|||||||
|
//go:build windows
|
||||||
|
|
||||||
|
package netframework
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"log/slog"
|
||||||
|
"slices"
|
||||||
|
|
||||||
|
"github.com/alecthomas/kingpin/v2"
|
||||||
|
"github.com/prometheus-community/windows_exporter/pkg/types"
|
||||||
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
"github.com/yusufpapurcu/wmi"
|
||||||
|
)
|
||||||
|
|
||||||
|
const Name = "netframework"
|
||||||
|
|
||||||
|
type Config struct {
|
||||||
|
CollectorsEnabled []string `yaml:"collectors_enabled"`
|
||||||
|
}
|
||||||
|
|
||||||
|
var ConfigDefaults = Config{
|
||||||
|
CollectorsEnabled: []string{
|
||||||
|
collectorClrExceptions,
|
||||||
|
collectorClrInterop,
|
||||||
|
collectorClrJIT,
|
||||||
|
collectorClrLoading,
|
||||||
|
collectorClrLocksAndThreads,
|
||||||
|
collectorClrMemory,
|
||||||
|
collectorClrRemoting,
|
||||||
|
collectorClrSecurity,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
collectorClrExceptions = "clrexceptions"
|
||||||
|
collectorClrInterop = "clrinterop"
|
||||||
|
collectorClrJIT = "clrjit"
|
||||||
|
collectorClrLoading = "clrloading"
|
||||||
|
collectorClrLocksAndThreads = "clrlocksandthreads"
|
||||||
|
collectorClrMemory = "clrmemory"
|
||||||
|
collectorClrRemoting = "clrremoting"
|
||||||
|
collectorClrSecurity = "clrsecurity"
|
||||||
|
)
|
||||||
|
|
||||||
|
// A Collector is a Prometheus Collector for WMI Win32_PerfRawData_NETFramework_NETCLRExceptions metrics.
|
||||||
|
type Collector struct {
|
||||||
|
config Config
|
||||||
|
wmiClient *wmi.Client
|
||||||
|
|
||||||
|
// clrexceptions
|
||||||
|
numberOfExceptionsThrown *prometheus.Desc
|
||||||
|
numberOfFilters *prometheus.Desc
|
||||||
|
numberOfFinally *prometheus.Desc
|
||||||
|
throwToCatchDepth *prometheus.Desc
|
||||||
|
|
||||||
|
// clrinterop
|
||||||
|
numberOfCCWs *prometheus.Desc
|
||||||
|
numberOfMarshalling *prometheus.Desc
|
||||||
|
numberOfStubs *prometheus.Desc
|
||||||
|
|
||||||
|
// clrjit
|
||||||
|
numberOfMethodsJitted *prometheus.Desc
|
||||||
|
timeInJit *prometheus.Desc
|
||||||
|
standardJitFailures *prometheus.Desc
|
||||||
|
totalNumberOfILBytesJitted *prometheus.Desc
|
||||||
|
|
||||||
|
// clrloading
|
||||||
|
bytesInLoaderHeap *prometheus.Desc
|
||||||
|
currentAppDomains *prometheus.Desc
|
||||||
|
currentAssemblies *prometheus.Desc
|
||||||
|
currentClassesLoaded *prometheus.Desc
|
||||||
|
totalAppDomains *prometheus.Desc
|
||||||
|
totalAppDomainsUnloaded *prometheus.Desc
|
||||||
|
totalAssemblies *prometheus.Desc
|
||||||
|
totalClassesLoaded *prometheus.Desc
|
||||||
|
totalNumberOfLoadFailures *prometheus.Desc
|
||||||
|
|
||||||
|
// clrlocksandthreads
|
||||||
|
currentQueueLength *prometheus.Desc
|
||||||
|
numberOfCurrentLogicalThreads *prometheus.Desc
|
||||||
|
numberOfCurrentPhysicalThreads *prometheus.Desc
|
||||||
|
numberOfCurrentRecognizedThreads *prometheus.Desc
|
||||||
|
numberOfTotalRecognizedThreads *prometheus.Desc
|
||||||
|
queueLengthPeak *prometheus.Desc
|
||||||
|
totalNumberOfContentions *prometheus.Desc
|
||||||
|
|
||||||
|
// clrmemory
|
||||||
|
allocatedBytes *prometheus.Desc
|
||||||
|
finalizationSurvivors *prometheus.Desc
|
||||||
|
heapSize *prometheus.Desc
|
||||||
|
promotedBytes *prometheus.Desc
|
||||||
|
numberGCHandles *prometheus.Desc
|
||||||
|
numberCollections *prometheus.Desc
|
||||||
|
numberInducedGC *prometheus.Desc
|
||||||
|
numberOfPinnedObjects *prometheus.Desc
|
||||||
|
numberOfSinkBlocksInUse *prometheus.Desc
|
||||||
|
numberTotalCommittedBytes *prometheus.Desc
|
||||||
|
numberTotalReservedBytes *prometheus.Desc
|
||||||
|
timeInGC *prometheus.Desc
|
||||||
|
|
||||||
|
// clrremoting
|
||||||
|
channels *prometheus.Desc
|
||||||
|
contextBoundClassesLoaded *prometheus.Desc
|
||||||
|
contextBoundObjects *prometheus.Desc
|
||||||
|
contextProxies *prometheus.Desc
|
||||||
|
contexts *prometheus.Desc
|
||||||
|
totalRemoteCalls *prometheus.Desc
|
||||||
|
|
||||||
|
// clrsecurity
|
||||||
|
numberLinkTimeChecks *prometheus.Desc
|
||||||
|
timeInRTChecks *prometheus.Desc
|
||||||
|
stackWalkDepth *prometheus.Desc
|
||||||
|
totalRuntimeChecks *prometheus.Desc
|
||||||
|
}
|
||||||
|
|
||||||
|
func New(config *Config) *Collector {
|
||||||
|
if config == nil {
|
||||||
|
config = &ConfigDefaults
|
||||||
|
}
|
||||||
|
|
||||||
|
c := &Collector{
|
||||||
|
config: *config,
|
||||||
|
}
|
||||||
|
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewWithFlags(_ *kingpin.Application) *Collector {
|
||||||
|
return &Collector{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Collector) GetName() string {
|
||||||
|
return Name
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Collector) GetPerfCounter(_ *slog.Logger) ([]string, error) {
|
||||||
|
return []string{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Collector) Close(_ *slog.Logger) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
|
||||||
|
if wmiClient == nil || wmiClient.SWbemServicesClient == nil {
|
||||||
|
return errors.New("wmiClient or SWbemServicesClient is nil")
|
||||||
|
}
|
||||||
|
|
||||||
|
c.wmiClient = wmiClient
|
||||||
|
|
||||||
|
if slices.Contains(c.config.CollectorsEnabled, collectorClrExceptions) {
|
||||||
|
c.buildClrExceptions()
|
||||||
|
}
|
||||||
|
|
||||||
|
if slices.Contains(c.config.CollectorsEnabled, collectorClrInterop) {
|
||||||
|
c.buildClrInterop()
|
||||||
|
}
|
||||||
|
|
||||||
|
if slices.Contains(c.config.CollectorsEnabled, collectorClrJIT) {
|
||||||
|
c.buildClrJIT()
|
||||||
|
}
|
||||||
|
|
||||||
|
if slices.Contains(c.config.CollectorsEnabled, collectorClrLoading) {
|
||||||
|
c.buildClrLoading()
|
||||||
|
}
|
||||||
|
|
||||||
|
if slices.Contains(c.config.CollectorsEnabled, collectorClrLocksAndThreads) {
|
||||||
|
c.buildClrLocksAndThreads()
|
||||||
|
}
|
||||||
|
|
||||||
|
if slices.Contains(c.config.CollectorsEnabled, collectorClrMemory) {
|
||||||
|
c.buildClrMemory()
|
||||||
|
}
|
||||||
|
|
||||||
|
if slices.Contains(c.config.CollectorsEnabled, collectorClrRemoting) {
|
||||||
|
c.buildClrRemoting()
|
||||||
|
}
|
||||||
|
|
||||||
|
if slices.Contains(c.config.CollectorsEnabled, collectorClrSecurity) {
|
||||||
|
c.buildClrSecurity()
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Collect sends the metric values for each metric
|
||||||
|
// to the provided prometheus Metric channel.
|
||||||
|
func (c *Collector) Collect(_ *types.ScrapeContext, _ *slog.Logger, ch chan<- prometheus.Metric) error {
|
||||||
|
var (
|
||||||
|
err error
|
||||||
|
errs []error
|
||||||
|
)
|
||||||
|
|
||||||
|
if slices.Contains(c.config.CollectorsEnabled, collectorClrExceptions) {
|
||||||
|
if err = c.collectClrExceptions(ch); err != nil {
|
||||||
|
errs = append(errs, fmt.Errorf("failed to collect %s metrics: %w", collectorClrExceptions, err))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if slices.Contains(c.config.CollectorsEnabled, collectorClrInterop) {
|
||||||
|
if err = c.collectClrInterop(ch); err != nil {
|
||||||
|
errs = append(errs, fmt.Errorf("failed to collect %s metrics: %w", collectorClrInterop, err))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if slices.Contains(c.config.CollectorsEnabled, collectorClrJIT) {
|
||||||
|
if err = c.collectClrJIT(ch); err != nil {
|
||||||
|
errs = append(errs, fmt.Errorf("failed to collect %s metrics: %w", collectorClrJIT, err))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if slices.Contains(c.config.CollectorsEnabled, collectorClrLoading) {
|
||||||
|
if err = c.collectClrLoading(ch); err != nil {
|
||||||
|
errs = append(errs, fmt.Errorf("failed to collect %s metrics: %w", collectorClrLoading, err))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if slices.Contains(c.config.CollectorsEnabled, collectorClrLocksAndThreads) {
|
||||||
|
if err = c.collectClrLocksAndThreads(ch); err != nil {
|
||||||
|
errs = append(errs, fmt.Errorf("failed to collect %s metrics: %w", collectorClrLocksAndThreads, err))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if slices.Contains(c.config.CollectorsEnabled, collectorClrMemory) {
|
||||||
|
if err = c.collectClrMemory(ch); err != nil {
|
||||||
|
errs = append(errs, fmt.Errorf("failed to collect %s metrics: %w", collectorClrMemory, err))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if slices.Contains(c.config.CollectorsEnabled, collectorClrRemoting) {
|
||||||
|
if err = c.collectClrRemoting(ch); err != nil {
|
||||||
|
errs = append(errs, fmt.Errorf("failed to collect %s metrics: %w", collectorClrRemoting, err))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if slices.Contains(c.config.CollectorsEnabled, collectorClrSecurity) {
|
||||||
|
if err = c.collectClrSecurity(ch); err != nil {
|
||||||
|
errs = append(errs, fmt.Errorf("failed to collect %s metrics: %w", collectorClrSecurity, err))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return errors.Join(errs...)
|
||||||
|
}
|
||||||
@@ -1,68 +1,13 @@
|
|||||||
//go:build windows
|
//go:build windows
|
||||||
|
|
||||||
package netframework_clrexceptions
|
package netframework
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"log/slog"
|
|
||||||
|
|
||||||
"github.com/alecthomas/kingpin/v2"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/types"
|
"github.com/prometheus-community/windows_exporter/pkg/types"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
"github.com/yusufpapurcu/wmi"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const Name = "netframework_clrexceptions"
|
func (c *Collector) buildClrExceptions() {
|
||||||
|
|
||||||
type Config struct{}
|
|
||||||
|
|
||||||
var ConfigDefaults = Config{}
|
|
||||||
|
|
||||||
// A Collector is a Prometheus Collector for WMI Win32_PerfRawData_NETFramework_NETCLRExceptions metrics.
|
|
||||||
type Collector struct {
|
|
||||||
config Config
|
|
||||||
wmiClient *wmi.Client
|
|
||||||
|
|
||||||
numberOfExceptionsThrown *prometheus.Desc
|
|
||||||
numberOfFilters *prometheus.Desc
|
|
||||||
numberOfFinally *prometheus.Desc
|
|
||||||
throwToCatchDepth *prometheus.Desc
|
|
||||||
}
|
|
||||||
|
|
||||||
func New(config *Config) *Collector {
|
|
||||||
if config == nil {
|
|
||||||
config = &ConfigDefaults
|
|
||||||
}
|
|
||||||
|
|
||||||
c := &Collector{
|
|
||||||
config: *config,
|
|
||||||
}
|
|
||||||
|
|
||||||
return c
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewWithFlags(_ *kingpin.Application) *Collector {
|
|
||||||
return &Collector{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) GetName() string {
|
|
||||||
return Name
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) GetPerfCounter(_ *slog.Logger) ([]string, error) {
|
|
||||||
return []string{}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) Close(_ *slog.Logger) error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
|
|
||||||
if wmiClient == nil || wmiClient.SWbemServicesClient == nil {
|
|
||||||
return errors.New("wmiClient or SWbemServicesClient is nil")
|
|
||||||
}
|
|
||||||
|
|
||||||
c.wmiClient = wmiClient
|
|
||||||
c.numberOfExceptionsThrown = prometheus.NewDesc(
|
c.numberOfExceptionsThrown = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "exceptions_thrown_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "exceptions_thrown_total"),
|
||||||
"Displays the total number of exceptions thrown since the application started. This includes both .NET exceptions and unmanaged exceptions that are converted into .NET exceptions.",
|
"Displays the total number of exceptions thrown since the application started. This includes both .NET exceptions and unmanaged exceptions that are converted into .NET exceptions.",
|
||||||
@@ -87,23 +32,6 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
|
|||||||
[]string{"process"},
|
[]string{"process"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Collect sends the metric values for each metric
|
|
||||||
// to the provided prometheus Metric channel.
|
|
||||||
func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
|
|
||||||
logger = logger.With(slog.String("collector", Name))
|
|
||||||
if err := c.collect(ch); err != nil {
|
|
||||||
logger.Error("failed collecting win32_perfrawdata_netframework_netclrexceptions metrics",
|
|
||||||
slog.Any("err", err),
|
|
||||||
)
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Win32_PerfRawData_NETFramework_NETCLRExceptions struct {
|
type Win32_PerfRawData_NETFramework_NETCLRExceptions struct {
|
||||||
@@ -116,7 +44,7 @@ type Win32_PerfRawData_NETFramework_NETCLRExceptions struct {
|
|||||||
ThrowToCatchDepthPersec uint32
|
ThrowToCatchDepthPersec uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Collector) collect(ch chan<- prometheus.Metric) error {
|
func (c *Collector) collectClrExceptions(ch chan<- prometheus.Metric) error {
|
||||||
var dst []Win32_PerfRawData_NETFramework_NETCLRExceptions
|
var dst []Win32_PerfRawData_NETFramework_NETCLRExceptions
|
||||||
if err := c.wmiClient.Query("SELECT * FROM Win32_PerfRawData_NETFramework_NETCLRExceptions", &dst); err != nil {
|
if err := c.wmiClient.Query("SELECT * FROM Win32_PerfRawData_NETFramework_NETCLRExceptions", &dst); err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -1,67 +1,13 @@
|
|||||||
//go:build windows
|
//go:build windows
|
||||||
|
|
||||||
package netframework_clrinterop
|
package netframework
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"log/slog"
|
|
||||||
|
|
||||||
"github.com/alecthomas/kingpin/v2"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/types"
|
"github.com/prometheus-community/windows_exporter/pkg/types"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
"github.com/yusufpapurcu/wmi"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const Name = "netframework_clrinterop"
|
func (c *Collector) buildClrInterop() {
|
||||||
|
|
||||||
type Config struct{}
|
|
||||||
|
|
||||||
var ConfigDefaults = Config{}
|
|
||||||
|
|
||||||
// A Collector is a Prometheus Collector for WMI Win32_PerfRawData_NETFramework_NETCLRInterop metrics.
|
|
||||||
type Collector struct {
|
|
||||||
config Config
|
|
||||||
wmiClient *wmi.Client
|
|
||||||
|
|
||||||
numberOfCCWs *prometheus.Desc
|
|
||||||
numberOfMarshalling *prometheus.Desc
|
|
||||||
numberOfStubs *prometheus.Desc
|
|
||||||
}
|
|
||||||
|
|
||||||
func New(config *Config) *Collector {
|
|
||||||
if config == nil {
|
|
||||||
config = &ConfigDefaults
|
|
||||||
}
|
|
||||||
|
|
||||||
c := &Collector{
|
|
||||||
config: *config,
|
|
||||||
}
|
|
||||||
|
|
||||||
return c
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewWithFlags(_ *kingpin.Application) *Collector {
|
|
||||||
return &Collector{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) GetName() string {
|
|
||||||
return Name
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) GetPerfCounter(_ *slog.Logger) ([]string, error) {
|
|
||||||
return []string{}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) Close(_ *slog.Logger) error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
|
|
||||||
if wmiClient == nil || wmiClient.SWbemServicesClient == nil {
|
|
||||||
return errors.New("wmiClient or SWbemServicesClient is nil")
|
|
||||||
}
|
|
||||||
|
|
||||||
c.wmiClient = wmiClient
|
|
||||||
c.numberOfCCWs = prometheus.NewDesc(
|
c.numberOfCCWs = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "com_callable_wrappers_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "com_callable_wrappers_total"),
|
||||||
"Displays the current number of COM callable wrappers (CCWs). A CCW is a proxy for a managed object being referenced from an unmanaged COM client.",
|
"Displays the current number of COM callable wrappers (CCWs). A CCW is a proxy for a managed object being referenced from an unmanaged COM client.",
|
||||||
@@ -80,23 +26,6 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
|
|||||||
[]string{"process"},
|
[]string{"process"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Collect sends the metric values for each metric
|
|
||||||
// to the provided prometheus Metric channel.
|
|
||||||
func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
|
|
||||||
logger = logger.With(slog.String("collector", Name))
|
|
||||||
if err := c.collect(ch); err != nil {
|
|
||||||
logger.Error("failed collecting win32_perfrawdata_netframework_netclrinterop metrics",
|
|
||||||
slog.Any("err", err),
|
|
||||||
)
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Win32_PerfRawData_NETFramework_NETCLRInterop struct {
|
type Win32_PerfRawData_NETFramework_NETCLRInterop struct {
|
||||||
@@ -109,7 +38,7 @@ type Win32_PerfRawData_NETFramework_NETCLRInterop struct {
|
|||||||
NumberofTLBimportsPersec uint32
|
NumberofTLBimportsPersec uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Collector) collect(ch chan<- prometheus.Metric) error {
|
func (c *Collector) collectClrInterop(ch chan<- prometheus.Metric) error {
|
||||||
var dst []Win32_PerfRawData_NETFramework_NETCLRInterop
|
var dst []Win32_PerfRawData_NETFramework_NETCLRInterop
|
||||||
if err := c.wmiClient.Query("SELECT * FROM Win32_PerfRawData_NETFramework_NETCLRInterop", &dst); err != nil {
|
if err := c.wmiClient.Query("SELECT * FROM Win32_PerfRawData_NETFramework_NETCLRInterop", &dst); err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -1,62 +1,13 @@
|
|||||||
//go:build windows
|
//go:build windows
|
||||||
|
|
||||||
package netframework_clrjit
|
package netframework
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log/slog"
|
|
||||||
|
|
||||||
"github.com/alecthomas/kingpin/v2"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/types"
|
"github.com/prometheus-community/windows_exporter/pkg/types"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
"github.com/yusufpapurcu/wmi"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const Name = "netframework_clrjit"
|
func (c *Collector) buildClrJIT() {
|
||||||
|
|
||||||
type Config struct{}
|
|
||||||
|
|
||||||
var ConfigDefaults = Config{}
|
|
||||||
|
|
||||||
// A Collector is a Prometheus Collector for WMI Win32_PerfRawData_NETFramework_NETCLRJit metrics.
|
|
||||||
type Collector struct {
|
|
||||||
config Config
|
|
||||||
wmiClient *wmi.Client
|
|
||||||
|
|
||||||
numberOfMethodsJitted *prometheus.Desc
|
|
||||||
timeInJit *prometheus.Desc
|
|
||||||
standardJitFailures *prometheus.Desc
|
|
||||||
totalNumberOfILBytesJitted *prometheus.Desc
|
|
||||||
}
|
|
||||||
|
|
||||||
func New(config *Config) *Collector {
|
|
||||||
if config == nil {
|
|
||||||
config = &ConfigDefaults
|
|
||||||
}
|
|
||||||
|
|
||||||
c := &Collector{
|
|
||||||
config: *config,
|
|
||||||
}
|
|
||||||
|
|
||||||
return c
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewWithFlags(_ *kingpin.Application) *Collector {
|
|
||||||
return &Collector{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) GetName() string {
|
|
||||||
return Name
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) GetPerfCounter(_ *slog.Logger) ([]string, error) {
|
|
||||||
return []string{}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) Close(_ *slog.Logger) error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
|
|
||||||
c.numberOfMethodsJitted = prometheus.NewDesc(
|
c.numberOfMethodsJitted = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "jit_methods_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "jit_methods_total"),
|
||||||
"Displays the total number of methods JIT-compiled since the application started. This counter does not include pre-JIT-compiled methods.",
|
"Displays the total number of methods JIT-compiled since the application started. This counter does not include pre-JIT-compiled methods.",
|
||||||
@@ -81,23 +32,6 @@ func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
|
|||||||
[]string{"process"},
|
[]string{"process"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Collect sends the metric values for each metric
|
|
||||||
// to the provided prometheus Metric channel.
|
|
||||||
func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
|
|
||||||
logger = logger.With(slog.String("collector", Name))
|
|
||||||
if err := c.collect(ch); err != nil {
|
|
||||||
logger.Error("failed collecting win32_perfrawdata_netframework_netclrjit metrics",
|
|
||||||
slog.Any("err", err),
|
|
||||||
)
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Win32_PerfRawData_NETFramework_NETCLRJit struct {
|
type Win32_PerfRawData_NETFramework_NETCLRJit struct {
|
||||||
@@ -112,7 +46,7 @@ type Win32_PerfRawData_NETFramework_NETCLRJit struct {
|
|||||||
TotalNumberofILBytesJitted uint32
|
TotalNumberofILBytesJitted uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Collector) collect(ch chan<- prometheus.Metric) error {
|
func (c *Collector) collectClrJIT(ch chan<- prometheus.Metric) error {
|
||||||
var dst []Win32_PerfRawData_NETFramework_NETCLRJit
|
var dst []Win32_PerfRawData_NETFramework_NETCLRJit
|
||||||
if err := c.wmiClient.Query("SELECT * FROM Win32_PerfRawData_NETFramework_NETCLRJit", &dst); err != nil {
|
if err := c.wmiClient.Query("SELECT * FROM Win32_PerfRawData_NETFramework_NETCLRJit", &dst); err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -1,74 +1,13 @@
|
|||||||
//go:build windows
|
//go:build windows
|
||||||
|
|
||||||
package netframework_clrloading
|
package netframework
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"log/slog"
|
|
||||||
|
|
||||||
"github.com/alecthomas/kingpin/v2"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/types"
|
"github.com/prometheus-community/windows_exporter/pkg/types"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
"github.com/yusufpapurcu/wmi"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const Name = "netframework_clrloading"
|
func (c *Collector) buildClrLoading() {
|
||||||
|
|
||||||
type Config struct{}
|
|
||||||
|
|
||||||
var ConfigDefaults = Config{}
|
|
||||||
|
|
||||||
// A Collector is a Prometheus Collector for WMI Win32_PerfRawData_NETFramework_NETCLRLoading metrics.
|
|
||||||
type Collector struct {
|
|
||||||
config Config
|
|
||||||
wmiClient *wmi.Client
|
|
||||||
|
|
||||||
bytesInLoaderHeap *prometheus.Desc
|
|
||||||
currentAppDomains *prometheus.Desc
|
|
||||||
currentAssemblies *prometheus.Desc
|
|
||||||
currentClassesLoaded *prometheus.Desc
|
|
||||||
totalAppDomains *prometheus.Desc
|
|
||||||
totalAppDomainsUnloaded *prometheus.Desc
|
|
||||||
totalAssemblies *prometheus.Desc
|
|
||||||
totalClassesLoaded *prometheus.Desc
|
|
||||||
totalNumberOfLoadFailures *prometheus.Desc
|
|
||||||
}
|
|
||||||
|
|
||||||
func New(config *Config) *Collector {
|
|
||||||
if config == nil {
|
|
||||||
config = &ConfigDefaults
|
|
||||||
}
|
|
||||||
|
|
||||||
c := &Collector{
|
|
||||||
config: *config,
|
|
||||||
}
|
|
||||||
|
|
||||||
return c
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewWithFlags(_ *kingpin.Application) *Collector {
|
|
||||||
return &Collector{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) GetName() string {
|
|
||||||
return Name
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) GetPerfCounter(_ *slog.Logger) ([]string, error) {
|
|
||||||
return []string{}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) Close(_ *slog.Logger) error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
|
|
||||||
if wmiClient == nil || wmiClient.SWbemServicesClient == nil {
|
|
||||||
return errors.New("wmiClient or SWbemServicesClient is nil")
|
|
||||||
}
|
|
||||||
|
|
||||||
c.wmiClient = wmiClient
|
|
||||||
|
|
||||||
c.bytesInLoaderHeap = prometheus.NewDesc(
|
c.bytesInLoaderHeap = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "loader_heap_size_bytes"),
|
prometheus.BuildFQName(types.Namespace, Name, "loader_heap_size_bytes"),
|
||||||
"Displays the current size, in bytes, of the memory committed by the class loader across all application domains. Committed memory is the physical space reserved in the disk paging file.",
|
"Displays the current size, in bytes, of the memory committed by the class loader across all application domains. Committed memory is the physical space reserved in the disk paging file.",
|
||||||
@@ -123,23 +62,6 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
|
|||||||
[]string{"process"},
|
[]string{"process"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Collect sends the metric values for each metric
|
|
||||||
// to the provided prometheus Metric channel.
|
|
||||||
func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
|
|
||||||
logger = logger.With(slog.String("collector", Name))
|
|
||||||
if err := c.collect(ch); err != nil {
|
|
||||||
logger.Error("failed collecting win32_perfrawdata_netframework_netclrloading metrics",
|
|
||||||
slog.Any("err", err),
|
|
||||||
)
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Win32_PerfRawData_NETFramework_NETCLRLoading struct {
|
type Win32_PerfRawData_NETFramework_NETCLRLoading struct {
|
||||||
@@ -163,7 +85,7 @@ type Win32_PerfRawData_NETFramework_NETCLRLoading struct {
|
|||||||
TotalNumberofLoadFailures uint32
|
TotalNumberofLoadFailures uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Collector) collect(ch chan<- prometheus.Metric) error {
|
func (c *Collector) collectClrLoading(ch chan<- prometheus.Metric) error {
|
||||||
var dst []Win32_PerfRawData_NETFramework_NETCLRLoading
|
var dst []Win32_PerfRawData_NETFramework_NETCLRLoading
|
||||||
if err := c.wmiClient.Query("SELECT * FROM Win32_PerfRawData_NETFramework_NETCLRLoading", &dst); err != nil {
|
if err := c.wmiClient.Query("SELECT * FROM Win32_PerfRawData_NETFramework_NETCLRLoading", &dst); err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -1,72 +1,13 @@
|
|||||||
//go:build windows
|
//go:build windows
|
||||||
|
|
||||||
package netframework_clrlocksandthreads
|
package netframework
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"log/slog"
|
|
||||||
|
|
||||||
"github.com/alecthomas/kingpin/v2"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/types"
|
"github.com/prometheus-community/windows_exporter/pkg/types"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
"github.com/yusufpapurcu/wmi"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const Name = "netframework_clrlocksandthreads"
|
func (c *Collector) buildClrLocksAndThreads() {
|
||||||
|
|
||||||
type Config struct{}
|
|
||||||
|
|
||||||
var ConfigDefaults = Config{}
|
|
||||||
|
|
||||||
// A Collector is a Prometheus Collector for WMI Win32_PerfRawData_NETFramework_NETCLRLocksAndThreads metrics.
|
|
||||||
type Collector struct {
|
|
||||||
config Config
|
|
||||||
wmiClient *wmi.Client
|
|
||||||
|
|
||||||
currentQueueLength *prometheus.Desc
|
|
||||||
numberOfCurrentLogicalThreads *prometheus.Desc
|
|
||||||
numberOfCurrentPhysicalThreads *prometheus.Desc
|
|
||||||
numberOfCurrentRecognizedThreads *prometheus.Desc
|
|
||||||
numberOfTotalRecognizedThreads *prometheus.Desc
|
|
||||||
queueLengthPeak *prometheus.Desc
|
|
||||||
totalNumberOfContentions *prometheus.Desc
|
|
||||||
}
|
|
||||||
|
|
||||||
func New(config *Config) *Collector {
|
|
||||||
if config == nil {
|
|
||||||
config = &ConfigDefaults
|
|
||||||
}
|
|
||||||
|
|
||||||
c := &Collector{
|
|
||||||
config: *config,
|
|
||||||
}
|
|
||||||
|
|
||||||
return c
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewWithFlags(_ *kingpin.Application) *Collector {
|
|
||||||
return &Collector{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) GetName() string {
|
|
||||||
return Name
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) GetPerfCounter(_ *slog.Logger) ([]string, error) {
|
|
||||||
return []string{}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) Close(_ *slog.Logger) error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
|
|
||||||
if wmiClient == nil || wmiClient.SWbemServicesClient == nil {
|
|
||||||
return errors.New("wmiClient or SWbemServicesClient is nil")
|
|
||||||
}
|
|
||||||
|
|
||||||
c.wmiClient = wmiClient
|
|
||||||
|
|
||||||
c.currentQueueLength = prometheus.NewDesc(
|
c.currentQueueLength = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "current_queue_length"),
|
prometheus.BuildFQName(types.Namespace, Name, "current_queue_length"),
|
||||||
"Displays the total number of threads that are currently waiting to acquire a managed lock in the application.",
|
"Displays the total number of threads that are currently waiting to acquire a managed lock in the application.",
|
||||||
@@ -109,23 +50,6 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
|
|||||||
[]string{"process"},
|
[]string{"process"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Collect sends the metric values for each metric
|
|
||||||
// to the provided prometheus Metric channel.
|
|
||||||
func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
|
|
||||||
logger = logger.With(slog.String("collector", Name))
|
|
||||||
if err := c.collect(ch); err != nil {
|
|
||||||
logger.Error("failed collecting win32_perfrawdata_netframework_netclrlocksandthreads metrics",
|
|
||||||
slog.Any("err", err),
|
|
||||||
)
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Win32_PerfRawData_NETFramework_NETCLRLocksAndThreads struct {
|
type Win32_PerfRawData_NETFramework_NETCLRLocksAndThreads struct {
|
||||||
@@ -143,7 +67,7 @@ type Win32_PerfRawData_NETFramework_NETCLRLocksAndThreads struct {
|
|||||||
TotalNumberofContentions uint32
|
TotalNumberofContentions uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Collector) collect(ch chan<- prometheus.Metric) error {
|
func (c *Collector) collectClrLocksAndThreads(ch chan<- prometheus.Metric) error {
|
||||||
var dst []Win32_PerfRawData_NETFramework_NETCLRLocksAndThreads
|
var dst []Win32_PerfRawData_NETFramework_NETCLRLocksAndThreads
|
||||||
if err := c.wmiClient.Query("SELECT * FROM Win32_PerfRawData_NETFramework_NETCLRLocksAndThreads", &dst); err != nil {
|
if err := c.wmiClient.Query("SELECT * FROM Win32_PerfRawData_NETFramework_NETCLRLocksAndThreads", &dst); err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -1,77 +1,13 @@
|
|||||||
//go:build windows
|
//go:build windows
|
||||||
|
|
||||||
package netframework_clrmemory
|
package netframework
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"log/slog"
|
|
||||||
|
|
||||||
"github.com/alecthomas/kingpin/v2"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/types"
|
"github.com/prometheus-community/windows_exporter/pkg/types"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
"github.com/yusufpapurcu/wmi"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const Name = "netframework_clrmemory"
|
func (c *Collector) buildClrMemory() {
|
||||||
|
|
||||||
type Config struct{}
|
|
||||||
|
|
||||||
var ConfigDefaults = Config{}
|
|
||||||
|
|
||||||
// A Collector is a Prometheus Collector for WMI Win32_PerfRawData_NETFramework_NETCLRMemory metrics.
|
|
||||||
type Collector struct {
|
|
||||||
config Config
|
|
||||||
wmiClient *wmi.Client
|
|
||||||
|
|
||||||
allocatedBytes *prometheus.Desc
|
|
||||||
finalizationSurvivors *prometheus.Desc
|
|
||||||
heapSize *prometheus.Desc
|
|
||||||
promotedBytes *prometheus.Desc
|
|
||||||
numberGCHandles *prometheus.Desc
|
|
||||||
numberCollections *prometheus.Desc
|
|
||||||
numberInducedGC *prometheus.Desc
|
|
||||||
numberOfPinnedObjects *prometheus.Desc
|
|
||||||
numberOfSinkBlocksInUse *prometheus.Desc
|
|
||||||
numberTotalCommittedBytes *prometheus.Desc
|
|
||||||
numberTotalReservedBytes *prometheus.Desc
|
|
||||||
timeInGC *prometheus.Desc
|
|
||||||
}
|
|
||||||
|
|
||||||
func New(config *Config) *Collector {
|
|
||||||
if config == nil {
|
|
||||||
config = &ConfigDefaults
|
|
||||||
}
|
|
||||||
|
|
||||||
c := &Collector{
|
|
||||||
config: *config,
|
|
||||||
}
|
|
||||||
|
|
||||||
return c
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewWithFlags(_ *kingpin.Application) *Collector {
|
|
||||||
return &Collector{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) GetName() string {
|
|
||||||
return Name
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) GetPerfCounter(_ *slog.Logger) ([]string, error) {
|
|
||||||
return []string{}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) Close(_ *slog.Logger) error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
|
|
||||||
if wmiClient == nil || wmiClient.SWbemServicesClient == nil {
|
|
||||||
return errors.New("wmiClient or SWbemServicesClient is nil")
|
|
||||||
}
|
|
||||||
|
|
||||||
c.wmiClient = wmiClient
|
|
||||||
|
|
||||||
c.allocatedBytes = prometheus.NewDesc(
|
c.allocatedBytes = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "allocated_bytes_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "allocated_bytes_total"),
|
||||||
"Displays the total number of bytes allocated on the garbage collection heap.",
|
"Displays the total number of bytes allocated on the garbage collection heap.",
|
||||||
@@ -144,23 +80,6 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
|
|||||||
[]string{"process"},
|
[]string{"process"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Collect sends the metric values for each metric
|
|
||||||
// to the provided prometheus Metric channel.
|
|
||||||
func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
|
|
||||||
logger = logger.With(slog.String("collector", Name))
|
|
||||||
if err := c.collect(ch); err != nil {
|
|
||||||
logger.Error("failed collecting win32_perfrawdata_netframework_netclrmemory metrics",
|
|
||||||
slog.Any("err", err),
|
|
||||||
)
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Win32_PerfRawData_NETFramework_NETCLRMemory struct {
|
type Win32_PerfRawData_NETFramework_NETCLRMemory struct {
|
||||||
@@ -197,7 +116,7 @@ type Win32_PerfRawData_NETFramework_NETCLRMemory struct {
|
|||||||
PromotedMemoryfromGen1 uint64
|
PromotedMemoryfromGen1 uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Collector) collect(ch chan<- prometheus.Metric) error {
|
func (c *Collector) collectClrMemory(ch chan<- prometheus.Metric) error {
|
||||||
var dst []Win32_PerfRawData_NETFramework_NETCLRMemory
|
var dst []Win32_PerfRawData_NETFramework_NETCLRMemory
|
||||||
if err := c.wmiClient.Query("SELECT * FROM Win32_PerfRawData_NETFramework_NETCLRMemory", &dst); err != nil {
|
if err := c.wmiClient.Query("SELECT * FROM Win32_PerfRawData_NETFramework_NETCLRMemory", &dst); err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -1,71 +1,13 @@
|
|||||||
//go:build windows
|
//go:build windows
|
||||||
|
|
||||||
package netframework_clrremoting
|
package netframework
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"log/slog"
|
|
||||||
|
|
||||||
"github.com/alecthomas/kingpin/v2"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/types"
|
"github.com/prometheus-community/windows_exporter/pkg/types"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
"github.com/yusufpapurcu/wmi"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const Name = "netframework_clrremoting"
|
func (c *Collector) buildClrRemoting() {
|
||||||
|
|
||||||
type Config struct{}
|
|
||||||
|
|
||||||
var ConfigDefaults = Config{}
|
|
||||||
|
|
||||||
// A Collector is a Prometheus Collector for WMI Win32_PerfRawData_NETFramework_NETCLRRemoting metrics.
|
|
||||||
type Collector struct {
|
|
||||||
config Config
|
|
||||||
wmiClient *wmi.Client
|
|
||||||
|
|
||||||
channels *prometheus.Desc
|
|
||||||
contextBoundClassesLoaded *prometheus.Desc
|
|
||||||
contextBoundObjects *prometheus.Desc
|
|
||||||
contextProxies *prometheus.Desc
|
|
||||||
contexts *prometheus.Desc
|
|
||||||
totalRemoteCalls *prometheus.Desc
|
|
||||||
}
|
|
||||||
|
|
||||||
func New(config *Config) *Collector {
|
|
||||||
if config == nil {
|
|
||||||
config = &ConfigDefaults
|
|
||||||
}
|
|
||||||
|
|
||||||
c := &Collector{
|
|
||||||
config: *config,
|
|
||||||
}
|
|
||||||
|
|
||||||
return c
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewWithFlags(_ *kingpin.Application) *Collector {
|
|
||||||
return &Collector{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) GetName() string {
|
|
||||||
return Name
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) GetPerfCounter(_ *slog.Logger) ([]string, error) {
|
|
||||||
return []string{}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) Close(_ *slog.Logger) error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
|
|
||||||
if wmiClient == nil || wmiClient.SWbemServicesClient == nil {
|
|
||||||
return errors.New("wmiClient or SWbemServicesClient is nil")
|
|
||||||
}
|
|
||||||
|
|
||||||
c.wmiClient = wmiClient
|
|
||||||
|
|
||||||
c.channels = prometheus.NewDesc(
|
c.channels = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "channels_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "channels_total"),
|
||||||
"Displays the total number of remoting channels registered across all application domains since application started.",
|
"Displays the total number of remoting channels registered across all application domains since application started.",
|
||||||
@@ -102,23 +44,6 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
|
|||||||
[]string{"process"},
|
[]string{"process"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Collect sends the metric values for each metric
|
|
||||||
// to the provided prometheus Metric channel.
|
|
||||||
func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
|
|
||||||
logger = logger.With(slog.String("collector", Name))
|
|
||||||
if err := c.collect(ch); err != nil {
|
|
||||||
logger.Error("failed collecting win32_perfrawdata_netframework_netclrremoting metrics",
|
|
||||||
slog.Any("err", err),
|
|
||||||
)
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Win32_PerfRawData_NETFramework_NETCLRRemoting struct {
|
type Win32_PerfRawData_NETFramework_NETCLRRemoting struct {
|
||||||
@@ -133,7 +58,7 @@ type Win32_PerfRawData_NETFramework_NETCLRRemoting struct {
|
|||||||
TotalRemoteCalls uint32
|
TotalRemoteCalls uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Collector) collect(ch chan<- prometheus.Metric) error {
|
func (c *Collector) collectClrRemoting(ch chan<- prometheus.Metric) error {
|
||||||
var dst []Win32_PerfRawData_NETFramework_NETCLRRemoting
|
var dst []Win32_PerfRawData_NETFramework_NETCLRRemoting
|
||||||
if err := c.wmiClient.Query("SELECT * FROM Win32_PerfRawData_NETFramework_NETCLRRemoting", &dst); err != nil {
|
if err := c.wmiClient.Query("SELECT * FROM Win32_PerfRawData_NETFramework_NETCLRRemoting", &dst); err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -1,68 +1,13 @@
|
|||||||
//go:build windows
|
//go:build windows
|
||||||
|
|
||||||
package netframework_clrsecurity
|
package netframework
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"log/slog"
|
|
||||||
|
|
||||||
"github.com/alecthomas/kingpin/v2"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/types"
|
"github.com/prometheus-community/windows_exporter/pkg/types"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
"github.com/yusufpapurcu/wmi"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const Name = "netframework_clrsecurity"
|
func (c *Collector) buildClrSecurity() {
|
||||||
|
|
||||||
type Config struct{}
|
|
||||||
|
|
||||||
var ConfigDefaults = Config{}
|
|
||||||
|
|
||||||
// A Collector is a Prometheus Collector for WMI Win32_PerfRawData_NETFramework_NETCLRSecurity metrics.
|
|
||||||
type Collector struct {
|
|
||||||
config Config
|
|
||||||
wmiClient *wmi.Client
|
|
||||||
|
|
||||||
numberLinkTimeChecks *prometheus.Desc
|
|
||||||
timeInRTChecks *prometheus.Desc
|
|
||||||
stackWalkDepth *prometheus.Desc
|
|
||||||
totalRuntimeChecks *prometheus.Desc
|
|
||||||
}
|
|
||||||
|
|
||||||
func New(config *Config) *Collector {
|
|
||||||
if config == nil {
|
|
||||||
config = &ConfigDefaults
|
|
||||||
}
|
|
||||||
|
|
||||||
c := &Collector{
|
|
||||||
config: *config,
|
|
||||||
}
|
|
||||||
|
|
||||||
return c
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewWithFlags(_ *kingpin.Application) *Collector {
|
|
||||||
return &Collector{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) GetName() string {
|
|
||||||
return Name
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) GetPerfCounter(_ *slog.Logger) ([]string, error) {
|
|
||||||
return []string{}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) Close(_ *slog.Logger) error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
|
|
||||||
if wmiClient == nil || wmiClient.SWbemServicesClient == nil {
|
|
||||||
return errors.New("wmiClient or SWbemServicesClient is nil")
|
|
||||||
}
|
|
||||||
|
|
||||||
c.wmiClient = wmiClient
|
|
||||||
c.numberLinkTimeChecks = prometheus.NewDesc(
|
c.numberLinkTimeChecks = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "link_time_checks_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "link_time_checks_total"),
|
||||||
"Displays the total number of link-time code access security checks since the application started.",
|
"Displays the total number of link-time code access security checks since the application started.",
|
||||||
@@ -87,23 +32,6 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
|
|||||||
[]string{"process"},
|
[]string{"process"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Collect sends the metric values for each metric
|
|
||||||
// to the provided prometheus Metric channel.
|
|
||||||
func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
|
|
||||||
logger = logger.With(slog.String("collector", Name))
|
|
||||||
if err := c.collect(ch); err != nil {
|
|
||||||
logger.Error("failed collecting win32_perfrawdata_netframework_netclrsecurity metrics",
|
|
||||||
slog.Any("err", err),
|
|
||||||
)
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Win32_PerfRawData_NETFramework_NETCLRSecurity struct {
|
type Win32_PerfRawData_NETFramework_NETCLRSecurity struct {
|
||||||
@@ -117,7 +45,7 @@ type Win32_PerfRawData_NETFramework_NETCLRSecurity struct {
|
|||||||
TotalRuntimeChecks uint32
|
TotalRuntimeChecks uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Collector) collect(ch chan<- prometheus.Metric) error {
|
func (c *Collector) collectClrSecurity(ch chan<- prometheus.Metric) error {
|
||||||
var dst []Win32_PerfRawData_NETFramework_NETCLRSecurity
|
var dst []Win32_PerfRawData_NETFramework_NETCLRSecurity
|
||||||
if err := c.wmiClient.Query("SELECT * FROM Win32_PerfRawData_NETFramework_NETCLRSecurity", &dst); err != nil {
|
if err := c.wmiClient.Query("SELECT * FROM Win32_PerfRawData_NETFramework_NETCLRSecurity", &dst); err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
package netframework_clrexceptions_test
|
package netframework_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrexceptions"
|
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework"
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/testutils"
|
"github.com/prometheus-community/windows_exporter/pkg/testutils"
|
||||||
)
|
)
|
||||||
|
|
||||||
func BenchmarkCollector(b *testing.B) {
|
func BenchmarkCollector(b *testing.B) {
|
||||||
// No context name required as Collector source is WMI
|
// No context name required as Collector source is WMI
|
||||||
testutils.FuncBenchmarkCollector(b, netframework_clrexceptions.Name, netframework_clrexceptions.NewWithFlags)
|
testutils.FuncBenchmarkCollector(b, netframework.Name, netframework.NewWithFlags)
|
||||||
}
|
}
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package netframework_clrinterop_test
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrinterop"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/testutils"
|
|
||||||
)
|
|
||||||
|
|
||||||
func BenchmarkCollector(b *testing.B) {
|
|
||||||
// No context name required as collector source is WMI
|
|
||||||
testutils.FuncBenchmarkCollector(b, netframework_clrinterop.Name, netframework_clrinterop.NewWithFlags)
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package netframework_clrjit_test
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrjit"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/testutils"
|
|
||||||
)
|
|
||||||
|
|
||||||
func BenchmarkCollector(b *testing.B) {
|
|
||||||
// No context name required as collector source is WMI
|
|
||||||
testutils.FuncBenchmarkCollector(b, netframework_clrjit.Name, netframework_clrjit.NewWithFlags)
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package netframework_clrloading_test
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrloading"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/testutils"
|
|
||||||
)
|
|
||||||
|
|
||||||
func BenchmarkCollector(b *testing.B) {
|
|
||||||
// No context name required as collector source is WMI
|
|
||||||
testutils.FuncBenchmarkCollector(b, netframework_clrloading.Name, netframework_clrloading.NewWithFlags)
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package netframework_clrlocksandthreads_test
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrlocksandthreads"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/testutils"
|
|
||||||
)
|
|
||||||
|
|
||||||
func BenchmarkCollector(b *testing.B) {
|
|
||||||
// No context name required as collector source is WMI
|
|
||||||
testutils.FuncBenchmarkCollector(b, netframework_clrlocksandthreads.Name, netframework_clrlocksandthreads.NewWithFlags)
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package netframework_clrmemory_test
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrmemory"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/testutils"
|
|
||||||
)
|
|
||||||
|
|
||||||
func BenchmarkCollector(b *testing.B) {
|
|
||||||
// No context name required as collector source is WMI
|
|
||||||
testutils.FuncBenchmarkCollector(b, netframework_clrmemory.Name, netframework_clrmemory.NewWithFlags)
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package netframework_clrremoting_test
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrremoting"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/testutils"
|
|
||||||
)
|
|
||||||
|
|
||||||
func BenchmarkCollector(b *testing.B) {
|
|
||||||
// No context name required as collector source is WMI
|
|
||||||
testutils.FuncBenchmarkCollector(b, netframework_clrremoting.Name, netframework_clrremoting.NewWithFlags)
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package netframework_clrsecurity_test
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/collector/netframework_clrsecurity"
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/testutils"
|
|
||||||
)
|
|
||||||
|
|
||||||
func BenchmarkCollector(b *testing.B) {
|
|
||||||
// No context name required as collector source is WMI
|
|
||||||
testutils.FuncBenchmarkCollector(b, netframework_clrsecurity.Name, netframework_clrsecurity.NewWithFlags)
|
|
||||||
}
|
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
package collector
|
package collector
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"sync"
|
"sync"
|
||||||
@@ -164,37 +165,65 @@ func (p *Prometheus) Collect(ch chan<- prometheus.Metric) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Prometheus) execute(name string, c Collector, ctx *types.ScrapeContext, ch chan<- prometheus.Metric) collectorStatusCode {
|
func (p *Prometheus) execute(name string, c Collector, scrapeCtx *types.ScrapeContext, ch chan<- prometheus.Metric) collectorStatusCode {
|
||||||
var (
|
var (
|
||||||
err error
|
err error
|
||||||
duration time.Duration
|
numMetrics int
|
||||||
timeout atomic.Bool
|
duration time.Duration
|
||||||
|
timeout atomic.Bool
|
||||||
)
|
)
|
||||||
|
|
||||||
// bufCh is a buffer channel to store the metrics
|
// bufCh is a buffer channel to store the metrics
|
||||||
// This is needed because once timeout is reached, the prometheus registry channel is closed.
|
// This is needed because once timeout is reached, the prometheus registry channel is closed.
|
||||||
bufCh := make(chan prometheus.Metric, 10)
|
bufCh := make(chan prometheus.Metric, 1000)
|
||||||
errCh := make(chan error, 1)
|
errCh := make(chan error, 1)
|
||||||
|
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), p.maxScrapeDuration)
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
// Execute the collector
|
// Execute the collector
|
||||||
go func() {
|
go func() {
|
||||||
errCh <- c.Collect(ctx, p.logger, bufCh)
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
p.logger.Error("panic in collector "+name,
|
||||||
|
slog.Any("panic", r),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
errCh <- c.Collect(scrapeCtx, p.logger, bufCh)
|
||||||
|
|
||||||
close(bufCh)
|
close(bufCh)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
wg := sync.WaitGroup{}
|
||||||
|
wg.Add(1)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
defer func() {
|
defer func() {
|
||||||
// This prevents a panic from race-condition when closing the ch channel too early.
|
// This prevents a panic from race-condition when closing the ch channel too early.
|
||||||
_ = recover()
|
_ = recover()
|
||||||
|
|
||||||
|
wg.Done()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Pass metrics to the prometheus registry
|
// Pass metrics to the prometheus registry
|
||||||
// If timeout is reached, the channel is closed.
|
// If timeout is reached, the channel is closed.
|
||||||
// This will cause a panic if we try to write to it.
|
// This will cause a panic if we try to write to it.
|
||||||
for m := range bufCh {
|
for {
|
||||||
if !timeout.Load() {
|
select {
|
||||||
ch <- m
|
case <-ctx.Done():
|
||||||
|
return
|
||||||
|
case m, ok := <-bufCh:
|
||||||
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if !timeout.Load() {
|
||||||
|
ch <- m
|
||||||
|
|
||||||
|
numMetrics++
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
@@ -204,6 +233,8 @@ func (p *Prometheus) execute(name string, c Collector, ctx *types.ScrapeContext,
|
|||||||
// Wait for the collector to finish or timeout
|
// Wait for the collector to finish or timeout
|
||||||
select {
|
select {
|
||||||
case err = <-errCh:
|
case err = <-errCh:
|
||||||
|
wg.Wait() // Wait for the buffer channel to be closed and empty
|
||||||
|
|
||||||
duration = time.Since(t)
|
duration = time.Since(t)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
p.collectorScrapeDurationDesc,
|
p.collectorScrapeDurationDesc,
|
||||||
@@ -211,7 +242,7 @@ func (p *Prometheus) execute(name string, c Collector, ctx *types.ScrapeContext,
|
|||||||
duration.Seconds(),
|
duration.Seconds(),
|
||||||
name,
|
name,
|
||||||
)
|
)
|
||||||
case <-time.After(p.maxScrapeDuration):
|
case <-ctx.Done():
|
||||||
timeout.Store(true)
|
timeout.Store(true)
|
||||||
|
|
||||||
duration = time.Since(t)
|
duration = time.Since(t)
|
||||||
@@ -222,20 +253,27 @@ func (p *Prometheus) execute(name string, c Collector, ctx *types.ScrapeContext,
|
|||||||
name,
|
name,
|
||||||
)
|
)
|
||||||
|
|
||||||
p.logger.Warn(fmt.Sprintf("collector %s timeouted after %s", name, p.maxScrapeDuration))
|
p.logger.Warn(fmt.Sprintf("collector %s timeouted after %s, resulting in %d metrics", name, p.maxScrapeDuration, numMetrics))
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
// Drain channel in case of premature return to not leak a goroutine.
|
||||||
|
//nolint:revive
|
||||||
|
for range bufCh {
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
return pending
|
return pending
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
p.logger.Error(fmt.Sprintf("collector %s failed after %s", name, p.maxScrapeDuration),
|
p.logger.Error(fmt.Sprintf("collector %s failed after %s, resulting in %d metrics", name, duration, numMetrics),
|
||||||
slog.Any("err", err),
|
slog.Any("err", err),
|
||||||
)
|
)
|
||||||
|
|
||||||
return failed
|
return failed
|
||||||
}
|
}
|
||||||
|
|
||||||
p.logger.Error(fmt.Sprintf("collector %s succeeded after %s", name, p.maxScrapeDuration))
|
p.logger.Debug(fmt.Sprintf("collector %s succeeded after %s, resulting in %d metrics", name, duration, numMetrics))
|
||||||
|
|
||||||
return success
|
return success
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -186,6 +186,7 @@ func (c *Collector) Collect() (map[string]map[string]CounterValues, error) {
|
|||||||
|
|
||||||
// This is a workaround for the issue with the elapsed time counter type.
|
// This is a workaround for the issue with the elapsed time counter type.
|
||||||
// Source: https://github.com/prometheus-community/windows_exporter/pull/335/files#diff-d5d2528f559ba2648c2866aec34b1eaa5c094dedb52bd0ff22aa5eb83226bd8dR76-R83
|
// Source: https://github.com/prometheus-community/windows_exporter/pull/335/files#diff-d5d2528f559ba2648c2866aec34b1eaa5c094dedb52bd0ff22aa5eb83226bd8dR76-R83
|
||||||
|
// Ref: https://learn.microsoft.com/en-us/windows/win32/perfctrs/calculating-counter-values
|
||||||
|
|
||||||
switch counter.Type {
|
switch counter.Type {
|
||||||
case PERF_ELAPSED_TIME:
|
case PERF_ELAPSED_TIME:
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
package utils
|
package utils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/prometheus-community/windows_exporter/pkg/types"
|
"github.com/prometheus-community/windows_exporter/pkg/types"
|
||||||
@@ -26,3 +27,11 @@ func ExpandEnabledCollectors(enabled string) []string {
|
|||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func PDHEnabled() bool {
|
||||||
|
if v, ok := os.LookupEnv("WINDOWS_EXPORTER_PERF_COUNTERS_ENGINE"); ok && v == "pdh" {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user