mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-08 05:56:37 +00:00
Compare commits
12 Commits
v0.29.0-rc
...
v0.29.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65d19f433e | ||
|
|
2d334e4df0 | ||
|
|
f442d6e22a | ||
|
|
d43f6ffdec | ||
|
|
9bea340c44 | ||
|
|
2635e5d8eb | ||
|
|
41ff5729df | ||
|
|
6097432d87 | ||
|
|
5f36a81613 | ||
|
|
2e4ba9984d | ||
|
|
fb275a06fe | ||
|
|
064ea74b6f |
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
|
||||
# exists. Otherwise, README.md is pushed.
|
||||
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: ''
|
||||
|
||||
17
.github/workflows/release.yml
vendored
17
.github/workflows/release.yml
vendored
@@ -26,6 +26,9 @@ jobs:
|
||||
runs-on: windows-2022
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: '0'
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
@@ -88,12 +91,6 @@ jobs:
|
||||
|
||||
Get-ChildItem -Path output
|
||||
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: windows_exporter_binaries
|
||||
path: output\windows_exporter-*.exe
|
||||
|
||||
- name: Build Release Artifacts
|
||||
run: |
|
||||
$ErrorActionPreference = "Stop"
|
||||
@@ -109,6 +106,14 @@ jobs:
|
||||
|
||||
promu checksum output\
|
||||
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: windows_exporter_binaries
|
||||
path: |
|
||||
output\windows_exporter-*.exe
|
||||
output\windows_exporter-*.msi
|
||||
|
||||
- name: Build Docker Artifacts
|
||||
run: make build-all
|
||||
env:
|
||||
|
||||
@@ -45,9 +45,6 @@ linters-settings:
|
||||
# Support string case: `camel`, `pascal`, `kebab`, `snake`, `upperSnake`, `goCamel`, `goPascal`, `goKebab`, `goSnake`, `upper`, `lower`, `header`
|
||||
json: camel
|
||||
yaml: snake
|
||||
gomoddirectives:
|
||||
replace-allow-list:
|
||||
- github.com/prometheus/common # https://github.com/prometheus/common/pull/694
|
||||
forbidigo:
|
||||
forbid:
|
||||
- "^(fmt\\.Print(|f|ln)|print|println)$"
|
||||
|
||||
72
README.md
72
README.md
@@ -14,35 +14,29 @@ Name | Description | Enabled by default
|
||||
[cache](docs/collector.cache.md) | Cache metrics |
|
||||
[cpu](docs/collector.cpu.md) | CPU usage | ✓
|
||||
[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 |
|
||||
[diskdrive](docs/collector.diskdrive.md) | Diskdrive metrics |
|
||||
[dfsr](docs/collector.dfsr.md) | DFSR metrics |
|
||||
[dhcp](docs/collector.dhcp.md) | DHCP Server |
|
||||
[dns](docs/collector.dns.md) | DNS Server |
|
||||
[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 |
|
||||
[hyperv](docs/collector.hyperv.md) | Hyper-V hosts |
|
||||
[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 | ✓
|
||||
[logon](docs/collector.logon.md) | User logon sessions |
|
||||
[memory](docs/collector.memory.md) | Memory usage metrics | ✓
|
||||
[mscluster](docs/collector.mscluster.md) | MSCluster metrics |
|
||||
[msmq](docs/collector.msmq.md) | MSMQ queues |
|
||||
[mssql](docs/collector.mssql.md) | [SQL Server Performance Objects](https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/use-sql-server-objects#SQLServerPOs) metrics |
|
||||
[netframework_clrexceptions](docs/collector.netframework_clrexceptions.md) | .NET Framework CLR Exceptions |
|
||||
[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 |
|
||||
[netframework](docs/collector.netframework.md) | .NET Framework metrics |
|
||||
[net](docs/collector.net.md) | Network interface I/O | ✓
|
||||
[os](docs/collector.os.md) | OS metrics (memory, processes, users) | ✓
|
||||
[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 |
|
||||
[remote_fx](docs/collector.remote_fx.md) | RemoteFX protocol (RDP) 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.
|
||||
|
||||
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
|
||||
* is located in the same directory as the exporter executable.
|
||||
@@ -110,52 +104,60 @@ The configuration file
|
||||
|
||||
The following parameters are available:
|
||||
|
||||
| Name | Description |
|
||||
|----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `ENABLED_COLLECTORS` | As the `--collectors.enabled` flag, provide a comma-separated list of enabled collectors |
|
||||
| `LISTEN_ADDR` | The IP address to bind to. Defaults to an empty string. (any local address) |
|
||||
| `LISTEN_PORT` | The port to bind to. Defaults to `9182`. |
|
||||
| `METRICS_PATH` | The path at which to serve metrics. Defaults to `/metrics` |
|
||||
| `TEXTFILE_DIRS` | Use the `--collector.textfile.directories` flag to specify one or more directories, separated by commas, where the collector should read text files containing metrics |
|
||||
| `REMOTE_ADDR` | Allows setting comma separated remote IP addresses for the Windows Firewall exception (allow list). Defaults to an empty string (any remote address). |
|
||||
| `EXTRA_FLAGS` | Allows passing full CLI flags. Defaults to an empty string. |
|
||||
| `ADDLOCAL` | Enables features within the windows_exporter installer. Supported values: `FirewallException` |
|
||||
| `REMOVE` | Disables features within the windows_exporter installer. Supported values: `FirewallException` |
|
||||
| Name | Description |
|
||||
|----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `ENABLED_COLLECTORS` | As the `--collectors.enabled` flag, provide a comma-separated list of enabled collectors |
|
||||
| `CONFIG_FILE` | Use the `--config.file` flag to specify a config file. If empty, no config file will be set. The special value `config.yaml` set the path to the config.yaml at install dir | |
|
||||
| `LISTEN_ADDR` | The IP address to bind to. Defaults to an empty string. (any local address) |
|
||||
| `LISTEN_PORT` | The port to bind to. Defaults to `9182`. |
|
||||
| `METRICS_PATH` | The path at which to serve metrics. Defaults to `/metrics` |
|
||||
| `TEXTFILE_DIRS` | Use the `--collector.textfile.directories` flag to specify one or more directories, separated by commas, where the collector should read text files containing metrics |
|
||||
| `REMOTE_ADDR` | Allows setting comma separated remote IP addresses for the Windows Firewall exception (allow list). Defaults to an empty string (any remote address). |
|
||||
| `EXTRA_FLAGS` | Allows passing full CLI flags. Defaults to an empty string. For `--collectors.enabled` and `--config.file`, use the specialized properties `ENABLED_COLLECTORS` and `CONFIG_FILE` |
|
||||
| `ADDLOCAL` | Enables features within the windows_exporter installer. Supported values: `FirewallException` |
|
||||
| `REMOVE` | Disables features within the windows_exporter installer. Supported values: `FirewallException` |
|
||||
|
||||
Parameters are sent to the installer via `msiexec`. Example invocations:
|
||||
Parameters are sent to the installer via `msiexec`.
|
||||
On PowerShell, the `--%` should be passed before defining properties.
|
||||
|
||||
Example invocations:
|
||||
|
||||
```powershell
|
||||
msiexec /i <path-to-msi-file> ENABLED_COLLECTORS=os,iis LISTEN_PORT=5000
|
||||
msiexec /i <path-to-msi-file> --% ENABLED_COLLECTORS=os,iis LISTEN_PORT=5000
|
||||
```
|
||||
|
||||
Example service collector with a custom query.
|
||||
```powershell
|
||||
msiexec /i <path-to-msi-file> ENABLED_COLLECTORS=os,service --% EXTRA_FLAGS="--collector.service.services-where ""Name LIKE 'sql%'"""
|
||||
msiexec /i <path-to-msi-file> --% ENABLED_COLLECTORS=os,service EXTRA_FLAGS="--collectors.exchange.enabled=""ADAccessProcesses"""
|
||||
```
|
||||
|
||||
Define a config file.
|
||||
```powershell
|
||||
msiexec /i <path-to-msi-file> --% CONFIG_FILE="D:\config.yaml"
|
||||
```
|
||||
|
||||
On some older versions of Windows,
|
||||
you may need to surround parameter values with double quotes to get the installation command parsing properly:
|
||||
```powershell
|
||||
msiexec /i C:\Users\Administrator\Downloads\windows_exporter.msi ENABLED_COLLECTORS="ad,iis,logon,memory,process,tcp,textfile,thermalzone" TEXTFILE_DIRS="C:\custom_metrics\"
|
||||
msiexec /i C:\Users\Administrator\Downloads\windows_exporter.msi --% ENABLED_COLLECTORS="ad,iis,logon,memory,process,tcp,textfile,thermalzone" TEXTFILE_DIRS="C:\custom_metrics\"
|
||||
```
|
||||
|
||||
To install the exporter with creating a firewall exception, use the following command:
|
||||
|
||||
```powershell
|
||||
msiexec /i <path-to-msi-file> ADDLOCAL=FirewallException
|
||||
msiexec /i <path-to-msi-file> --% ADDLOCAL=FirewallException
|
||||
```
|
||||
|
||||
|
||||
Powershell versions 7.3 and above require [PSNativeCommandArgumentPassing](https://learn.microsoft.com/en-us/powershell/scripting/learn/experimental-features?view=powershell-7.3) to be set to `Legacy` when using `--% EXTRA_FLAGS`:
|
||||
PowerShell versions 7.3 and above require [PSNativeCommandArgumentPassing](https://learn.microsoft.com/en-us/powershell/scripting/learn/experimental-features?view=powershell-7.3) to be set to `Legacy` when using `--% EXTRA_FLAGS`:
|
||||
|
||||
```powershell
|
||||
$PSNativeCommandArgumentPassing = 'Legacy'
|
||||
msiexec /i <path-to-msi-file> ENABLED_COLLECTORS=os,service --% EXTRA_FLAGS="--collector.service.services-where ""Name LIKE 'sql%'"""
|
||||
msiexec /i <path-to-msi-file> ENABLED_COLLECTORS=os,service --% EXTRA_FLAGS="--collectors.exchange.enabled=""ADAccessProcesses"""
|
||||
```
|
||||
|
||||
## 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`
|
||||
* [GitHub Container Registry](https://github.com/prometheus-community/windows_exporter/pkgs/container/windows-exporter): `ghcr.io/prometheus-community/windows-exporter`
|
||||
@@ -192,7 +194,7 @@ The prometheus metrics will be exposed on [localhost:9182](http://localhost:9182
|
||||
|
||||
### 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
|
||||
|
||||
@@ -221,7 +223,7 @@ collectors:
|
||||
enabled: cpu,net,service
|
||||
collector:
|
||||
service:
|
||||
services-where: "Name='windows_exporter'"
|
||||
include: windows_exporter
|
||||
log:
|
||||
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
|
||||
collector:
|
||||
service:
|
||||
services-where: "Name='windows_exporter'"
|
||||
include: "windows_exporter"
|
||||
log:
|
||||
level: warn
|
||||
level: warn
|
||||
|
||||
@@ -25,14 +25,7 @@ This directory contains documentation of the collectors in the windows_exporter,
|
||||
- [`msmq`](collector.msmq.md)
|
||||
- [`mssql`](collector.mssql.md)
|
||||
- [`net`](collector.net.md)
|
||||
- [`netframework_clrexceptions`](collector.netframework_clrexceptions.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)
|
||||
- [`netframework`](collector.netframework.md)
|
||||
- [`nps`](collector.nps.md)
|
||||
- [`os`](collector.os.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!_
|
||||
@@ -72,20 +72,20 @@ windows_service_start_mode{name="dcsvc",start_mode="manual"} 1
|
||||
windows_service_start_mode{name="dcsvc",start_mode="system"} 0
|
||||
# HELP windows_service_state The state of the service (State)
|
||||
# TYPE windows_service_state gauge
|
||||
windows_service_state{name="Themes",status="continue pending"} 0
|
||||
windows_service_state{name="Themes",status="pause pending"} 0
|
||||
windows_service_state{name="Themes",status="paused"} 0
|
||||
windows_service_state{name="Themes",status="running"} 1
|
||||
windows_service_state{name="Themes",status="start pending"} 0
|
||||
windows_service_state{name="Themes",status="stop pending"} 0
|
||||
windows_service_state{name="Themes",status="stopped"} 0
|
||||
windows_service_state{name="dcsvc",status="continue pending"} 0
|
||||
windows_service_state{name="dcsvc",status="pause pending"} 0
|
||||
windows_service_state{name="dcsvc",status="paused"} 0
|
||||
windows_service_state{name="dcsvc",status="running"} 0
|
||||
windows_service_state{name="dcsvc",status="start pending"} 0
|
||||
windows_service_state{name="dcsvc",status="stop pending"} 0
|
||||
windows_service_state{name="dcsvc",status="stopped"} 1
|
||||
windows_service_state{name="Themes",state="continue pending"} 0
|
||||
windows_service_state{name="Themes",state="pause pending"} 0
|
||||
windows_service_state{name="Themes",state="paused"} 0
|
||||
windows_service_state{name="Themes",state="running"} 1
|
||||
windows_service_state{name="Themes",state="start pending"} 0
|
||||
windows_service_state{name="Themes",state="stop pending"} 0
|
||||
windows_service_state{name="Themes",state="stopped"} 0
|
||||
windows_service_state{name="dcsvc",state="continue pending"} 0
|
||||
windows_service_state{name="dcsvc",state="pause pending"} 0
|
||||
windows_service_state{name="dcsvc",state="paused"} 0
|
||||
windows_service_state{name="dcsvc",state="running"} 0
|
||||
windows_service_state{name="dcsvc",state="start pending"} 0
|
||||
windows_service_state{name="dcsvc",state="stop pending"} 0
|
||||
windows_service_state{name="dcsvc",state="stopped"} 1
|
||||
```
|
||||
|
||||
## Useful queries
|
||||
|
||||
@@ -4,7 +4,7 @@ collectors:
|
||||
enabled: cpu,cs,logical_disk,net,os,service,system
|
||||
collector:
|
||||
service:
|
||||
services-where: Name='windows_exporter'
|
||||
include: "windows_exporter"
|
||||
scheduled_task:
|
||||
include: /Microsoft/.+
|
||||
log:
|
||||
|
||||
@@ -217,6 +217,10 @@ func run() int {
|
||||
|
||||
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.Handle("GET /health", httphandler.NewHealthHandler())
|
||||
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
|
||||
|
||||
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/bmatcuk/doublestar/v4 v4.6.1
|
||||
github.com/dimchansky/utfbom v1.1.1
|
||||
github.com/go-ole/go-ole v1.3.0
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/prometheus/client_golang v1.20.3
|
||||
github.com/prometheus/client_golang v1.20.4
|
||||
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/stretchr/testify v1.9.0
|
||||
github.com/yusufpapurcu/wmi v1.2.4
|
||||
@@ -30,11 +30,12 @@ require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // 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/vsock v1.2.1 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // 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/prometheus/procfs v0.15.1 // 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/sync v0.8.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/grpc v1.66.0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240924160255-9d4c2d233b61 // indirect
|
||||
google.golang.org/grpc v1.67.0 // indirect
|
||||
google.golang.org/protobuf v1.34.2 // 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/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
|
||||
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
|
||||
github.com/Microsoft/hcsshim v0.12.6 h1:qEnZjoHXv+4/s0LmKZWE0/AiZmMWEIkFfWBSf1a0wlU=
|
||||
github.com/Microsoft/hcsshim v0.12.6/go.mod h1:ZABCLVcvLMjIkzr9rUGcQ1QA0p0P3Ps+d3N1g2DsFfk=
|
||||
github.com/Microsoft/hcsshim v0.12.7 h1:MP6R1spmjxTE4EU4J3YsrTxn8CjvN9qwjTKJXldFaRg=
|
||||
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/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE=
|
||||
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/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||
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/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||
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.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
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/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
|
||||
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
|
||||
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
|
||||
github.com/klauspost/compress v1.17.10 h1:oXAz+Vh0PMUvJczoi+flxpnBEPxoER1IaAnU/NMPtT0=
|
||||
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/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
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/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
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.3/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
|
||||
github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI=
|
||||
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.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
|
||||
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/go.mod h1:2uop99EZl80KdXhv/MxVI2181fMcwlsumFOqBecGkG0=
|
||||
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-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ=
|
||||
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 h1:N9BgCIAUvn/M+p4NJccWPWb3BWh88+zyL0ll9HgbEeM=
|
||||
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.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
|
||||
google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c=
|
||||
google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y=
|
||||
google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw=
|
||||
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-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
Start="auto"
|
||||
Type="ownProcess"
|
||||
Vital="yes"
|
||||
Arguments="--log.file eventlog --config.file="[APPLICATIONFOLDER]config.yaml" [CollectorsFlag] [ListenFlag] [MetricsPathFlag] [TextfileDirsFlag] [ExtraFlags]">
|
||||
Arguments="--log.file eventlog [ConfigFileFlag] [CollectorsFlag] [ListenFlag] [MetricsPathFlag] [TextfileDirsFlag] [ExtraFlags]">
|
||||
<util:ServiceConfig
|
||||
ResetPeriodInDays="1"
|
||||
FirstFailureActionType="restart"
|
||||
@@ -35,4 +35,4 @@
|
||||
<ComponentRef Id="CreateTextfileDirectory" />
|
||||
</ComponentGroup>
|
||||
</Fragment>
|
||||
</Wix>
|
||||
</Wix>
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
<?ifndef Version?>
|
||||
<?error Version must be defined?>
|
||||
<?endif?>
|
||||
<?if $(sys.BUILDARCH)=x64 ?>
|
||||
<?define PlatformProgramFiles = "ProgramFiles64Folder" ?>
|
||||
<?else?>
|
||||
<?error Platform $(var.Platform) is not supported?>
|
||||
<?if $(sys.BUILDARCH) = x64 or $(sys.BUILDARCH) = arm64 ?>
|
||||
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
|
||||
<?else ?>
|
||||
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
|
||||
<?endif?>
|
||||
|
||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
|
||||
@@ -41,9 +41,10 @@
|
||||
Value="amus" />
|
||||
<SetProperty
|
||||
Id="CreateConfigFile"
|
||||
Value=""[%ComSpec]" /c TYPE NUL >>"[APPLICATIONFOLDER]config.yaml""
|
||||
Value=""[%ComSpec]" /c TYPE NUL >>"[ConfigFile_NonDefault][ConfigFile_Default]""
|
||||
Before="CreateConfigFile"
|
||||
Sequence="execute"
|
||||
Condition="ConfigFile_NonDefault OR ConfigFile_Default"
|
||||
/>
|
||||
<CustomAction
|
||||
Id="CreateConfigFile"
|
||||
@@ -61,18 +62,23 @@
|
||||
Condition="Installed AND (NOT REMOVE) AND (NOT UPGRADINGPRODUCTCODE)"/>
|
||||
<Custom Action="set_reinstall_all_property" Before="set_reinstallmode_property" Condition="MAINTENANCE"/>
|
||||
<Custom Action="set_reinstallmode_property" Before="LaunchConditions" Condition="MAINTENANCE"/>
|
||||
<Custom Action="CreateConfigFile" Before="InstallServices" />
|
||||
<Custom Action="CreateConfigFile" Before="InstallServices" Condition="ConfigFile_NonDefault OR ConfigFile_Default" />
|
||||
</InstallExecuteSequence>
|
||||
|
||||
<Media Id="1" Cabinet="windows_exporter.cab" EmbedCab="yes" />
|
||||
<MajorUpgrade Schedule="afterInstallInitialize" DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit." AllowSameVersionUpgrades="yes" />
|
||||
|
||||
<Property Id="ENABLED_COLLECTORS" Secure="yes" Value="[defaults]" />
|
||||
<Property Id="ENABLED_COLLECTORS" Secure="yes" />
|
||||
<SetProperty Id="CollectorsFlag" After="InstallFiles" Sequence="execute" Value="--collectors.enabled [ENABLED_COLLECTORS]" Condition="ENABLED_COLLECTORS" />
|
||||
|
||||
<Property Id="EXTRA_FLAGS" Secure="yes" />
|
||||
<SetProperty Id="ExtraFlags" After="InstallFiles" Sequence="execute" Value="[EXTRA_FLAGS]" Condition="EXTRA_FLAGS" />
|
||||
|
||||
<Property Id="CONFIG_FILE" Secure="yes" Value="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="[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" />
|
||||
<SetProperty Id="ListenFlag" After="InstallFiles" Sequence="execute" Value="--web.listen-address [LISTEN_ADDR]:[LISTEN_PORT]" Condition="LISTEN_ADDR<>"" OR LISTEN_PORT<>9182" />
|
||||
|
||||
@@ -132,15 +138,19 @@
|
||||
<!-- Edit box for property input -->
|
||||
<!-- cpu,cs,logical_disk,physical_disk,net,os,service,system -->
|
||||
<Control Id="PropertyEdit_ENABLED_COLLECTORS_Title1" Type="Text" X="25" Y="55" Width="300" Height="15" Transparent="yes" NoPrefix="yes" Text="Comma-separated list of collectors to use. Use '[\[]defaults[\]]' as a placeholder for all" />
|
||||
<Control Id="PropertyEdit_ENABLED_COLLECTORS_Title2" Type="Text" X="25" Y="65" Width="300" Height="15" Transparent="yes" NoPrefix="yes" Text="the collectors enabled by default." />
|
||||
<Control Id="PropertyEdit_ENABLED_COLLECTORS_Title2" Type="Text" X="25" Y="65" Width="300" Height="15" Transparent="yes" NoPrefix="yes" Text="the collectors enabled by default. If value is empty, the exporter default will be used." />
|
||||
<Control Id="PropertyEdit_ENABLED_COLLECTORS" Type="Edit" X="24" Y="77" Width="300" Height="18" Property="ENABLED_COLLECTORS" Text="[ENABLED_COLLECTORS]" Indirect="no" />
|
||||
|
||||
<Control Id="PropertyEdit_EXTRA_FLAGS_Title" Type="Text" X="25" Y="100" Width="210" Height="15" Transparent="yes" NoPrefix="yes" Text="Additional command line flags" />
|
||||
<Control Id="PropertyEdit_EXTRA_FLAGS_Title" Type="Text" X="25" Y="100" Width="300" Height="15" Transparent="yes" NoPrefix="yes" Text="Additional command line flags" />
|
||||
<Control Id="PropertyEdit_EXTRA_FLAGS" Type="Edit" X="24" Y="112" Width="300" Height="18" Property="EXTRA_FLAGS" Text="[EXTRA_FLAGS]" Indirect="no" />
|
||||
|
||||
<Control Id="PropertyEdit_LISTEN_PORT_Title" Type="Text" X="25" Y="135" Width="210" Height="15" Transparent="yes" NoPrefix="yes" Text="Port to listen" />
|
||||
<Control Id="PropertyEdit_LISTEN_PORT_Title" Type="Text" X="25" Y="135" Width="300" Height="15" Transparent="yes" NoPrefix="yes" Text="Port to listen" />
|
||||
<Control Id="PropertyEdit_LISTEN_PORT" Type="Edit" X="24" Y="147" Width="300" Height="18" Property="LISTEN_PORT" Text="[LISTEN_PORT]" Indirect="no" />
|
||||
|
||||
<Control Id="PropertyEdit_CONFIG_FILE_Title1" Type="Text" X="25" Y="170" Width="300" Height="15" Transparent="yes" NoPrefix="yes" Text="Path to config file. If empty, no config will be used. If set to 'config.yaml', " />
|
||||
<Control Id="PropertyEdit_CONFIG_FILE_Title2" Type="Text" X="25" Y="180" Width="300" Height="15" Transparent="yes" NoPrefix="yes" Text="then the config.yaml at the install path will be used." />
|
||||
<Control Id="PropertyEdit_CONFIG_FILE" Type="Edit" X="24" Y="192" Width="300" Height="18" Property="CONFIG_FILE" Text="[CONFIG_FILE]" Indirect="no" />
|
||||
|
||||
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)">
|
||||
<Publish Event="NewDialog" Value="VerifyReadyDlg" />
|
||||
</Control>
|
||||
@@ -208,4 +218,4 @@
|
||||
</Component>
|
||||
</ComponentGroup>
|
||||
</Package>
|
||||
</Wix>
|
||||
</Wix>
|
||||
|
||||
@@ -32,7 +32,7 @@ spec:
|
||||
command: ["powershell"]
|
||||
args: ["New-NetFirewallRule", "-DisplayName", "'windows-exporter'", "-Direction", "inbound", "-Profile", "Any", "-Action", "Allow", "-LocalPort", "9182", "-Protocol", "TCP"]
|
||||
containers:
|
||||
- args:
|
||||
- args:
|
||||
- --config.file=%CONTAINER_SANDBOX_MOUNT_POINT%/config.yml
|
||||
name: windows-exporter
|
||||
image: ghcr.io/prometheus-community/windows-exporter:latest
|
||||
@@ -65,4 +65,4 @@ data:
|
||||
enabled: '[defaults],container'
|
||||
collector:
|
||||
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
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"log/slog"
|
||||
|
||||
"github.com/alecthomas/kingpin/v2"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prometheus-community/windows_exporter/pkg/perflib"
|
||||
"github.com/prometheus-community/windows_exporter/pkg/types"
|
||||
"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/dns"
|
||||
"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/hyperv"
|
||||
"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/mssql"
|
||||
"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_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/netframework"
|
||||
"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/perfdata"
|
||||
@@ -97,6 +91,7 @@ func NewWithConfig(config Config) *MetricCollectors {
|
||||
collectors[diskdrive.Name] = diskdrive.New(&config.DiskDrive)
|
||||
collectors[dns.Name] = dns.New(&config.DNS)
|
||||
collectors[exchange.Name] = exchange.New(&config.Exchange)
|
||||
collectors[filetime.Name] = filetime.New(&config.Filetime)
|
||||
collectors[fsrmquota.Name] = fsrmquota.New(&config.Fsrmquota)
|
||||
collectors[hyperv.Name] = hyperv.New(&config.Hyperv)
|
||||
collectors[iis.Name] = iis.New(&config.IIS)
|
||||
@@ -108,14 +103,7 @@ func NewWithConfig(config Config) *MetricCollectors {
|
||||
collectors[msmq.Name] = msmq.New(&config.Msmq)
|
||||
collectors[mssql.Name] = mssql.New(&config.Mssql)
|
||||
collectors[net.Name] = net.New(&config.Net)
|
||||
collectors[netframework_clrexceptions.Name] = netframework_clrexceptions.New(&config.NetframeworkClrexceptions)
|
||||
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[netframework.Name] = netframework.New(&config.NetFramework)
|
||||
collectors[nps.Name] = nps.New(&config.Nps)
|
||||
collectors[os.Name] = os.New(&config.Os)
|
||||
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/dns"
|
||||
"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/hyperv"
|
||||
"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/mssql"
|
||||
"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_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/netframework"
|
||||
"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/perfdata"
|
||||
@@ -57,116 +51,104 @@ import (
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
AD ad.Config `yaml:"ad"`
|
||||
ADCS adcs.Config `yaml:"adcs"`
|
||||
ADFS adfs.Config `yaml:"adfs"`
|
||||
Cache cache.Config `yaml:"cache"`
|
||||
Container container.Config `yaml:"container"`
|
||||
CPU cpu.Config `yaml:"cpu"`
|
||||
CPUInfo cpu_info.Config `yaml:"cpu_info"`
|
||||
Cs cs.Config `yaml:"cs"`
|
||||
DFSR dfsr.Config `yaml:"dfsr"`
|
||||
Dhcp dhcp.Config `yaml:"dhcp"`
|
||||
DiskDrive diskdrive.Config `yaml:"diskdrive"` //nolint:tagliatelle
|
||||
DNS dns.Config `yaml:"dns"`
|
||||
Exchange exchange.Config `yaml:"exchange"`
|
||||
Fsrmquota fsrmquota.Config `yaml:"fsrmquota"`
|
||||
Hyperv hyperv.Config `yaml:"hyperv"`
|
||||
IIS iis.Config `yaml:"iis"`
|
||||
License license.Config `yaml:"license"`
|
||||
LogicalDisk logical_disk.Config `yaml:"logical_disk"`
|
||||
Logon logon.Config `yaml:"logon"`
|
||||
Memory memory.Config `yaml:"memory"`
|
||||
Mscluster mscluster.Config `yaml:"mscluster"`
|
||||
Msmq msmq.Config `yaml:"msmq"`
|
||||
Mssql mssql.Config `yaml:"mssql"`
|
||||
Net net.Config `yaml:"net"`
|
||||
NetframeworkClrexceptions netframework_clrexceptions.Config `yaml:"netframework_clrexceptions"`
|
||||
NetframeworkClrinterop netframework_clrinterop.Config `yaml:"netframework_clrinterop"`
|
||||
NetframeworkClrjit netframework_clrjit.Config `yaml:"netframework_clrjit"`
|
||||
NetframeworkClrloading netframework_clrloading.Config `yaml:"netframework_clrloading"`
|
||||
NetframeworkClrlocksandthreads netframework_clrlocksandthreads.Config `yaml:"netframework_clrlocksandthreads"`
|
||||
NetframeworkClrmemory netframework_clrmemory.Config `yaml:"netframework_clrmemory"`
|
||||
NetframeworkClrremoting netframework_clrremoting.Config `yaml:"netframework_clrremoting"`
|
||||
NetframeworkClrsecurity netframework_clrsecurity.Config `yaml:"netframework_clrsecurity"`
|
||||
Nps nps.Config `yaml:"nps"`
|
||||
Os os.Config `yaml:"os"`
|
||||
PerfData perfdata.Config `yaml:"perf_data"`
|
||||
PhysicalDisk physical_disk.Config `yaml:"physical_disk"`
|
||||
Printer printer.Config `yaml:"printer"`
|
||||
Process process.Config `yaml:"process"`
|
||||
RemoteFx remote_fx.Config `yaml:"remote_fx"`
|
||||
ScheduledTask scheduled_task.Config `yaml:"scheduled_task"`
|
||||
Service service.Config `yaml:"service"`
|
||||
SMB smb.Config `yaml:"smb"`
|
||||
SMBClient smbclient.Config `yaml:"smbclient"` //nolint:tagliatelle
|
||||
SMTP smtp.Config `yaml:"smtp"`
|
||||
System system.Config `yaml:"system"`
|
||||
TeradiciPcoip teradici_pcoip.Config `yaml:"teradici_pcoip"`
|
||||
TCP tcp.Config `yaml:"tcp"`
|
||||
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"`
|
||||
AD ad.Config `yaml:"ad"`
|
||||
ADCS adcs.Config `yaml:"adcs"`
|
||||
ADFS adfs.Config `yaml:"adfs"`
|
||||
Cache cache.Config `yaml:"cache"`
|
||||
Container container.Config `yaml:"container"`
|
||||
CPU cpu.Config `yaml:"cpu"`
|
||||
CPUInfo cpu_info.Config `yaml:"cpu_info"`
|
||||
Cs cs.Config `yaml:"cs"`
|
||||
DFSR dfsr.Config `yaml:"dfsr"`
|
||||
Dhcp dhcp.Config `yaml:"dhcp"`
|
||||
DiskDrive diskdrive.Config `yaml:"diskdrive"` //nolint:tagliatelle
|
||||
DNS dns.Config `yaml:"dns"`
|
||||
Exchange exchange.Config `yaml:"exchange"`
|
||||
Filetime filetime.Config `yaml:"filetime"`
|
||||
Fsrmquota fsrmquota.Config `yaml:"fsrmquota"`
|
||||
Hyperv hyperv.Config `yaml:"hyperv"`
|
||||
IIS iis.Config `yaml:"iis"`
|
||||
License license.Config `yaml:"license"`
|
||||
LogicalDisk logical_disk.Config `yaml:"logical_disk"`
|
||||
Logon logon.Config `yaml:"logon"`
|
||||
Memory memory.Config `yaml:"memory"`
|
||||
Mscluster mscluster.Config `yaml:"mscluster"`
|
||||
Msmq msmq.Config `yaml:"msmq"`
|
||||
Mssql mssql.Config `yaml:"mssql"`
|
||||
Net net.Config `yaml:"net"`
|
||||
NetFramework netframework.Config `yaml:"net_framework"`
|
||||
Nps nps.Config `yaml:"nps"`
|
||||
Os os.Config `yaml:"os"`
|
||||
PerfData perfdata.Config `yaml:"perf_data"`
|
||||
PhysicalDisk physical_disk.Config `yaml:"physical_disk"`
|
||||
Printer printer.Config `yaml:"printer"`
|
||||
Process process.Config `yaml:"process"`
|
||||
RemoteFx remote_fx.Config `yaml:"remote_fx"`
|
||||
ScheduledTask scheduled_task.Config `yaml:"scheduled_task"`
|
||||
Service service.Config `yaml:"service"`
|
||||
SMB smb.Config `yaml:"smb"`
|
||||
SMBClient smbclient.Config `yaml:"smbclient"` //nolint:tagliatelle
|
||||
SMTP smtp.Config `yaml:"smtp"`
|
||||
System system.Config `yaml:"system"`
|
||||
TeradiciPcoip teradici_pcoip.Config `yaml:"teradici_pcoip"`
|
||||
TCP tcp.Config `yaml:"tcp"`
|
||||
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
|
||||
//
|
||||
//goland:noinspection GoUnusedGlobalVariable
|
||||
var ConfigDefaults = Config{
|
||||
AD: ad.ConfigDefaults,
|
||||
ADCS: adcs.ConfigDefaults,
|
||||
ADFS: adfs.ConfigDefaults,
|
||||
Cache: cache.ConfigDefaults,
|
||||
Container: container.ConfigDefaults,
|
||||
CPU: cpu.ConfigDefaults,
|
||||
CPUInfo: cpu_info.ConfigDefaults,
|
||||
Cs: cs.ConfigDefaults,
|
||||
DFSR: dfsr.ConfigDefaults,
|
||||
Dhcp: dhcp.ConfigDefaults,
|
||||
DiskDrive: diskdrive.ConfigDefaults,
|
||||
DNS: dns.ConfigDefaults,
|
||||
Exchange: exchange.ConfigDefaults,
|
||||
Fsrmquota: fsrmquota.ConfigDefaults,
|
||||
Hyperv: hyperv.ConfigDefaults,
|
||||
IIS: iis.ConfigDefaults,
|
||||
License: license.ConfigDefaults,
|
||||
LogicalDisk: logical_disk.ConfigDefaults,
|
||||
Logon: logon.ConfigDefaults,
|
||||
Memory: memory.ConfigDefaults,
|
||||
Mscluster: mscluster.ConfigDefaults,
|
||||
Msmq: msmq.ConfigDefaults,
|
||||
Mssql: mssql.ConfigDefaults,
|
||||
Net: net.ConfigDefaults,
|
||||
NetframeworkClrexceptions: netframework_clrexceptions.ConfigDefaults,
|
||||
NetframeworkClrinterop: netframework_clrinterop.ConfigDefaults,
|
||||
NetframeworkClrjit: netframework_clrjit.ConfigDefaults,
|
||||
NetframeworkClrloading: netframework_clrloading.ConfigDefaults,
|
||||
NetframeworkClrlocksandthreads: netframework_clrlocksandthreads.ConfigDefaults,
|
||||
NetframeworkClrmemory: netframework_clrmemory.ConfigDefaults,
|
||||
NetframeworkClrremoting: netframework_clrremoting.ConfigDefaults,
|
||||
NetframeworkClrsecurity: netframework_clrsecurity.ConfigDefaults,
|
||||
Nps: nps.ConfigDefaults,
|
||||
Os: os.ConfigDefaults,
|
||||
PerfData: perfdata.ConfigDefaults,
|
||||
PhysicalDisk: physical_disk.ConfigDefaults,
|
||||
Printer: printer.ConfigDefaults,
|
||||
Process: process.ConfigDefaults,
|
||||
RemoteFx: remote_fx.ConfigDefaults,
|
||||
ScheduledTask: scheduled_task.ConfigDefaults,
|
||||
Service: service.ConfigDefaults,
|
||||
SMB: smb.ConfigDefaults,
|
||||
SMBClient: smbclient.ConfigDefaults,
|
||||
SMTP: smtp.ConfigDefaults,
|
||||
System: system.ConfigDefaults,
|
||||
TeradiciPcoip: teradici_pcoip.ConfigDefaults,
|
||||
TCP: tcp.ConfigDefaults,
|
||||
TerminalServices: terminal_services.ConfigDefaults,
|
||||
Textfile: textfile.ConfigDefaults,
|
||||
Thermalzone: thermalzone.ConfigDefaults,
|
||||
Time: time.ConfigDefaults,
|
||||
Vmware: vmware.ConfigDefaults,
|
||||
VmwareBlast: vmware_blast.ConfigDefaults,
|
||||
AD: ad.ConfigDefaults,
|
||||
ADCS: adcs.ConfigDefaults,
|
||||
ADFS: adfs.ConfigDefaults,
|
||||
Cache: cache.ConfigDefaults,
|
||||
Container: container.ConfigDefaults,
|
||||
CPU: cpu.ConfigDefaults,
|
||||
CPUInfo: cpu_info.ConfigDefaults,
|
||||
Cs: cs.ConfigDefaults,
|
||||
DFSR: dfsr.ConfigDefaults,
|
||||
Dhcp: dhcp.ConfigDefaults,
|
||||
DiskDrive: diskdrive.ConfigDefaults,
|
||||
DNS: dns.ConfigDefaults,
|
||||
Exchange: exchange.ConfigDefaults,
|
||||
Filetime: filetime.ConfigDefaults,
|
||||
Fsrmquota: fsrmquota.ConfigDefaults,
|
||||
Hyperv: hyperv.ConfigDefaults,
|
||||
IIS: iis.ConfigDefaults,
|
||||
License: license.ConfigDefaults,
|
||||
LogicalDisk: logical_disk.ConfigDefaults,
|
||||
Logon: logon.ConfigDefaults,
|
||||
Memory: memory.ConfigDefaults,
|
||||
Mscluster: mscluster.ConfigDefaults,
|
||||
Msmq: msmq.ConfigDefaults,
|
||||
Mssql: mssql.ConfigDefaults,
|
||||
Net: net.ConfigDefaults,
|
||||
NetFramework: netframework.ConfigDefaults,
|
||||
Nps: nps.ConfigDefaults,
|
||||
Os: os.ConfigDefaults,
|
||||
PerfData: perfdata.ConfigDefaults,
|
||||
PhysicalDisk: physical_disk.ConfigDefaults,
|
||||
Printer: printer.ConfigDefaults,
|
||||
Process: process.ConfigDefaults,
|
||||
RemoteFx: remote_fx.ConfigDefaults,
|
||||
ScheduledTask: scheduled_task.ConfigDefaults,
|
||||
Service: service.ConfigDefaults,
|
||||
SMB: smb.ConfigDefaults,
|
||||
SMBClient: smbclient.ConfigDefaults,
|
||||
SMTP: smtp.ConfigDefaults,
|
||||
System: system.ConfigDefaults,
|
||||
TeradiciPcoip: teradici_pcoip.ConfigDefaults,
|
||||
TCP: tcp.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
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"strings"
|
||||
|
||||
"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/types"
|
||||
"github.com/prometheus-community/windows_exporter/pkg/utils"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/yusufpapurcu/wmi"
|
||||
)
|
||||
@@ -22,6 +25,8 @@ var ConfigDefaults = Config{}
|
||||
type Collector struct {
|
||||
config Config
|
||||
|
||||
perfDataCollector *perfdata.Collector
|
||||
|
||||
logicalProcessors *prometheus.Desc
|
||||
cStateSecondsTotal *prometheus.Desc
|
||||
timeTotal *prometheus.Desc
|
||||
@@ -59,6 +64,10 @@ func (c *Collector) GetName() string {
|
||||
}
|
||||
|
||||
func (c *Collector) GetPerfCounter(_ *slog.Logger) ([]string, error) {
|
||||
if utils.PDHEnabled() {
|
||||
return []string{}, 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 {
|
||||
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(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "logical_processor"),
|
||||
"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 {
|
||||
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 {
|
||||
@@ -216,8 +264,7 @@ type perflibProcessorInformation struct {
|
||||
UserTimeSeconds float64 `perflib:"% User Time"`
|
||||
}
|
||||
|
||||
func (c *Collector) CollectFull(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
|
||||
logger = logger.With(slog.String("collector", Name))
|
||||
func (c *Collector) collectFull(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
|
||||
data := make([]perflibProcessorInformation, 0)
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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.
|
||||
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 cs metrics",
|
||||
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/dns"
|
||||
"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/hyperv"
|
||||
"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/mssql"
|
||||
"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_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/netframework"
|
||||
"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/perfdata"
|
||||
@@ -67,59 +61,53 @@ func NewBuilderWithFlags[C Collector](fn BuilderWithFlags[C]) BuilderWithFlags[C
|
||||
}
|
||||
|
||||
var BuildersWithFlags = map[string]BuilderWithFlags[Collector]{
|
||||
ad.Name: NewBuilderWithFlags(ad.NewWithFlags),
|
||||
adcs.Name: NewBuilderWithFlags(adcs.NewWithFlags),
|
||||
adfs.Name: NewBuilderWithFlags(adfs.NewWithFlags),
|
||||
cache.Name: NewBuilderWithFlags(cache.NewWithFlags),
|
||||
container.Name: NewBuilderWithFlags(container.NewWithFlags),
|
||||
cpu.Name: NewBuilderWithFlags(cpu.NewWithFlags),
|
||||
cpu_info.Name: NewBuilderWithFlags(cpu_info.NewWithFlags),
|
||||
cs.Name: NewBuilderWithFlags(cs.NewWithFlags),
|
||||
dfsr.Name: NewBuilderWithFlags(dfsr.NewWithFlags),
|
||||
dhcp.Name: NewBuilderWithFlags(dhcp.NewWithFlags),
|
||||
diskdrive.Name: NewBuilderWithFlags(diskdrive.NewWithFlags),
|
||||
dns.Name: NewBuilderWithFlags(dns.NewWithFlags),
|
||||
exchange.Name: NewBuilderWithFlags(exchange.NewWithFlags),
|
||||
fsrmquota.Name: NewBuilderWithFlags(fsrmquota.NewWithFlags),
|
||||
hyperv.Name: NewBuilderWithFlags(hyperv.NewWithFlags),
|
||||
iis.Name: NewBuilderWithFlags(iis.NewWithFlags),
|
||||
license.Name: NewBuilderWithFlags(license.NewWithFlags),
|
||||
logical_disk.Name: NewBuilderWithFlags(logical_disk.NewWithFlags),
|
||||
logon.Name: NewBuilderWithFlags(logon.NewWithFlags),
|
||||
memory.Name: NewBuilderWithFlags(memory.NewWithFlags),
|
||||
mscluster.Name: NewBuilderWithFlags(mscluster.NewWithFlags),
|
||||
msmq.Name: NewBuilderWithFlags(msmq.NewWithFlags),
|
||||
mssql.Name: NewBuilderWithFlags(mssql.NewWithFlags),
|
||||
net.Name: NewBuilderWithFlags(net.NewWithFlags),
|
||||
netframework_clrexceptions.Name: NewBuilderWithFlags(netframework_clrexceptions.NewWithFlags),
|
||||
netframework_clrinterop.Name: NewBuilderWithFlags(netframework_clrinterop.NewWithFlags),
|
||||
netframework_clrjit.Name: NewBuilderWithFlags(netframework_clrjit.NewWithFlags),
|
||||
netframework_clrloading.Name: NewBuilderWithFlags(netframework_clrloading.NewWithFlags),
|
||||
netframework_clrlocksandthreads.Name: NewBuilderWithFlags(netframework_clrlocksandthreads.NewWithFlags),
|
||||
netframework_clrmemory.Name: NewBuilderWithFlags(netframework_clrmemory.NewWithFlags),
|
||||
netframework_clrremoting.Name: NewBuilderWithFlags(netframework_clrremoting.NewWithFlags),
|
||||
netframework_clrsecurity.Name: NewBuilderWithFlags(netframework_clrsecurity.NewWithFlags),
|
||||
nps.Name: NewBuilderWithFlags(nps.NewWithFlags),
|
||||
os.Name: NewBuilderWithFlags(os.NewWithFlags),
|
||||
perfdata.Name: NewBuilderWithFlags(perfdata.NewWithFlags),
|
||||
physical_disk.Name: NewBuilderWithFlags(physical_disk.NewWithFlags),
|
||||
printer.Name: NewBuilderWithFlags(printer.NewWithFlags),
|
||||
process.Name: NewBuilderWithFlags(process.NewWithFlags),
|
||||
remote_fx.Name: NewBuilderWithFlags(remote_fx.NewWithFlags),
|
||||
scheduled_task.Name: NewBuilderWithFlags(scheduled_task.NewWithFlags),
|
||||
service.Name: NewBuilderWithFlags(service.NewWithFlags),
|
||||
smb.Name: NewBuilderWithFlags(smb.NewWithFlags),
|
||||
smbclient.Name: NewBuilderWithFlags(smbclient.NewWithFlags),
|
||||
smtp.Name: NewBuilderWithFlags(smtp.NewWithFlags),
|
||||
system.Name: NewBuilderWithFlags(system.NewWithFlags),
|
||||
teradici_pcoip.Name: NewBuilderWithFlags(teradici_pcoip.NewWithFlags),
|
||||
tcp.Name: NewBuilderWithFlags(tcp.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),
|
||||
ad.Name: NewBuilderWithFlags(ad.NewWithFlags),
|
||||
adcs.Name: NewBuilderWithFlags(adcs.NewWithFlags),
|
||||
adfs.Name: NewBuilderWithFlags(adfs.NewWithFlags),
|
||||
cache.Name: NewBuilderWithFlags(cache.NewWithFlags),
|
||||
container.Name: NewBuilderWithFlags(container.NewWithFlags),
|
||||
cpu.Name: NewBuilderWithFlags(cpu.NewWithFlags),
|
||||
cpu_info.Name: NewBuilderWithFlags(cpu_info.NewWithFlags),
|
||||
cs.Name: NewBuilderWithFlags(cs.NewWithFlags),
|
||||
dfsr.Name: NewBuilderWithFlags(dfsr.NewWithFlags),
|
||||
dhcp.Name: NewBuilderWithFlags(dhcp.NewWithFlags),
|
||||
diskdrive.Name: NewBuilderWithFlags(diskdrive.NewWithFlags),
|
||||
dns.Name: NewBuilderWithFlags(dns.NewWithFlags),
|
||||
exchange.Name: NewBuilderWithFlags(exchange.NewWithFlags),
|
||||
filetime.Name: NewBuilderWithFlags(filetime.NewWithFlags),
|
||||
fsrmquota.Name: NewBuilderWithFlags(fsrmquota.NewWithFlags),
|
||||
hyperv.Name: NewBuilderWithFlags(hyperv.NewWithFlags),
|
||||
iis.Name: NewBuilderWithFlags(iis.NewWithFlags),
|
||||
license.Name: NewBuilderWithFlags(license.NewWithFlags),
|
||||
logical_disk.Name: NewBuilderWithFlags(logical_disk.NewWithFlags),
|
||||
logon.Name: NewBuilderWithFlags(logon.NewWithFlags),
|
||||
memory.Name: NewBuilderWithFlags(memory.NewWithFlags),
|
||||
mscluster.Name: NewBuilderWithFlags(mscluster.NewWithFlags),
|
||||
msmq.Name: NewBuilderWithFlags(msmq.NewWithFlags),
|
||||
mssql.Name: NewBuilderWithFlags(mssql.NewWithFlags),
|
||||
net.Name: NewBuilderWithFlags(net.NewWithFlags),
|
||||
netframework.Name: NewBuilderWithFlags(netframework.NewWithFlags),
|
||||
nps.Name: NewBuilderWithFlags(nps.NewWithFlags),
|
||||
os.Name: NewBuilderWithFlags(os.NewWithFlags),
|
||||
perfdata.Name: NewBuilderWithFlags(perfdata.NewWithFlags),
|
||||
physical_disk.Name: NewBuilderWithFlags(physical_disk.NewWithFlags),
|
||||
printer.Name: NewBuilderWithFlags(printer.NewWithFlags),
|
||||
process.Name: NewBuilderWithFlags(process.NewWithFlags),
|
||||
remote_fx.Name: NewBuilderWithFlags(remote_fx.NewWithFlags),
|
||||
scheduled_task.Name: NewBuilderWithFlags(scheduled_task.NewWithFlags),
|
||||
service.Name: NewBuilderWithFlags(service.NewWithFlags),
|
||||
smb.Name: NewBuilderWithFlags(smb.NewWithFlags),
|
||||
smbclient.Name: NewBuilderWithFlags(smbclient.NewWithFlags),
|
||||
smtp.Name: NewBuilderWithFlags(smtp.NewWithFlags),
|
||||
system.Name: NewBuilderWithFlags(system.NewWithFlags),
|
||||
teradici_pcoip.Name: NewBuilderWithFlags(teradici_pcoip.NewWithFlags),
|
||||
tcp.Name: NewBuilderWithFlags(tcp.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 {
|
||||
|
||||
@@ -298,9 +298,5 @@ func (c *Collector) Collect(_ *types.ScrapeContext, _ *slog.Logger, ch chan<- pr
|
||||
}
|
||||
}
|
||||
|
||||
if len(errs) > 0 {
|
||||
return errors.Join(errs...)
|
||||
}
|
||||
|
||||
return nil
|
||||
return errors.Join(errs...)
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
package netframework_clrexceptions
|
||||
package netframework
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"log/slog"
|
||||
|
||||
"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_clrexceptions"
|
||||
|
||||
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
|
||||
func (c *Collector) buildClrExceptions() {
|
||||
c.numberOfExceptionsThrown = prometheus.NewDesc(
|
||||
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.",
|
||||
@@ -87,23 +32,6 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
|
||||
[]string{"process"},
|
||||
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 {
|
||||
@@ -116,7 +44,7 @@ type Win32_PerfRawData_NETFramework_NETCLRExceptions struct {
|
||||
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
|
||||
if err := c.wmiClient.Query("SELECT * FROM Win32_PerfRawData_NETFramework_NETCLRExceptions", &dst); err != nil {
|
||||
return err
|
||||
@@ -1,67 +1,13 @@
|
||||
//go:build windows
|
||||
|
||||
package netframework_clrinterop
|
||||
package netframework
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"log/slog"
|
||||
|
||||
"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_clrinterop"
|
||||
|
||||
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
|
||||
func (c *Collector) buildClrInterop() {
|
||||
c.numberOfCCWs = prometheus.NewDesc(
|
||||
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.",
|
||||
@@ -80,23 +26,6 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
|
||||
[]string{"process"},
|
||||
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 {
|
||||
@@ -109,7 +38,7 @@ type Win32_PerfRawData_NETFramework_NETCLRInterop struct {
|
||||
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
|
||||
if err := c.wmiClient.Query("SELECT * FROM Win32_PerfRawData_NETFramework_NETCLRInterop", &dst); err != nil {
|
||||
return err
|
||||
@@ -1,62 +1,13 @@
|
||||
//go:build windows
|
||||
|
||||
package netframework_clrjit
|
||||
package netframework
|
||||
|
||||
import (
|
||||
"log/slog"
|
||||
|
||||
"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_clrjit"
|
||||
|
||||
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 {
|
||||
func (c *Collector) buildClrJIT() {
|
||||
c.numberOfMethodsJitted = prometheus.NewDesc(
|
||||
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.",
|
||||
@@ -81,23 +32,6 @@ func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
|
||||
[]string{"process"},
|
||||
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 {
|
||||
@@ -112,7 +46,7 @@ type Win32_PerfRawData_NETFramework_NETCLRJit struct {
|
||||
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
|
||||
if err := c.wmiClient.Query("SELECT * FROM Win32_PerfRawData_NETFramework_NETCLRJit", &dst); err != nil {
|
||||
return err
|
||||
@@ -1,74 +1,13 @@
|
||||
//go:build windows
|
||||
|
||||
package netframework_clrloading
|
||||
package netframework
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"log/slog"
|
||||
|
||||
"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_clrloading"
|
||||
|
||||
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
|
||||
|
||||
func (c *Collector) buildClrLoading() {
|
||||
c.bytesInLoaderHeap = prometheus.NewDesc(
|
||||
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.",
|
||||
@@ -123,23 +62,6 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
|
||||
[]string{"process"},
|
||||
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 {
|
||||
@@ -163,7 +85,7 @@ type Win32_PerfRawData_NETFramework_NETCLRLoading struct {
|
||||
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
|
||||
if err := c.wmiClient.Query("SELECT * FROM Win32_PerfRawData_NETFramework_NETCLRLoading", &dst); err != nil {
|
||||
return err
|
||||
@@ -1,72 +1,13 @@
|
||||
//go:build windows
|
||||
|
||||
package netframework_clrlocksandthreads
|
||||
package netframework
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"log/slog"
|
||||
|
||||
"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_clrlocksandthreads"
|
||||
|
||||
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
|
||||
|
||||
func (c *Collector) buildClrLocksAndThreads() {
|
||||
c.currentQueueLength = prometheus.NewDesc(
|
||||
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.",
|
||||
@@ -109,23 +50,6 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
|
||||
[]string{"process"},
|
||||
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 {
|
||||
@@ -143,7 +67,7 @@ type Win32_PerfRawData_NETFramework_NETCLRLocksAndThreads struct {
|
||||
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
|
||||
if err := c.wmiClient.Query("SELECT * FROM Win32_PerfRawData_NETFramework_NETCLRLocksAndThreads", &dst); err != nil {
|
||||
return err
|
||||
@@ -1,77 +1,13 @@
|
||||
//go:build windows
|
||||
|
||||
package netframework_clrmemory
|
||||
package netframework
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"log/slog"
|
||||
|
||||
"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_clrmemory"
|
||||
|
||||
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
|
||||
|
||||
func (c *Collector) buildClrMemory() {
|
||||
c.allocatedBytes = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "allocated_bytes_total"),
|
||||
"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"},
|
||||
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 {
|
||||
@@ -197,7 +116,7 @@ type Win32_PerfRawData_NETFramework_NETCLRMemory struct {
|
||||
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
|
||||
if err := c.wmiClient.Query("SELECT * FROM Win32_PerfRawData_NETFramework_NETCLRMemory", &dst); err != nil {
|
||||
return err
|
||||
@@ -1,71 +1,13 @@
|
||||
//go:build windows
|
||||
|
||||
package netframework_clrremoting
|
||||
package netframework
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"log/slog"
|
||||
|
||||
"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_clrremoting"
|
||||
|
||||
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
|
||||
|
||||
func (c *Collector) buildClrRemoting() {
|
||||
c.channels = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "channels_total"),
|
||||
"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"},
|
||||
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 {
|
||||
@@ -133,7 +58,7 @@ type Win32_PerfRawData_NETFramework_NETCLRRemoting struct {
|
||||
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
|
||||
if err := c.wmiClient.Query("SELECT * FROM Win32_PerfRawData_NETFramework_NETCLRRemoting", &dst); err != nil {
|
||||
return err
|
||||
@@ -1,68 +1,13 @@
|
||||
//go:build windows
|
||||
|
||||
package netframework_clrsecurity
|
||||
package netframework
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"log/slog"
|
||||
|
||||
"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_clrsecurity"
|
||||
|
||||
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
|
||||
func (c *Collector) buildClrSecurity() {
|
||||
c.numberLinkTimeChecks = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "link_time_checks_total"),
|
||||
"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"},
|
||||
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 {
|
||||
@@ -117,7 +45,7 @@ type Win32_PerfRawData_NETFramework_NETCLRSecurity struct {
|
||||
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
|
||||
if err := c.wmiClient.Query("SELECT * FROM Win32_PerfRawData_NETFramework_NETCLRSecurity", &dst); err != nil {
|
||||
return err
|
||||
@@ -1,13 +1,13 @@
|
||||
package netframework_clrexceptions_test
|
||||
package netframework_test
|
||||
|
||||
import (
|
||||
"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"
|
||||
)
|
||||
|
||||
func BenchmarkCollector(b *testing.B) {
|
||||
// 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
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"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 (
|
||||
err error
|
||||
duration time.Duration
|
||||
timeout atomic.Bool
|
||||
err error
|
||||
numMetrics int
|
||||
duration time.Duration
|
||||
timeout atomic.Bool
|
||||
)
|
||||
|
||||
// bufCh is a buffer channel to store the metrics
|
||||
// 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)
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), p.maxScrapeDuration)
|
||||
defer cancel()
|
||||
|
||||
// Execute the collector
|
||||
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)
|
||||
}()
|
||||
|
||||
wg := sync.WaitGroup{}
|
||||
wg.Add(1)
|
||||
|
||||
go func() {
|
||||
defer func() {
|
||||
// This prevents a panic from race-condition when closing the ch channel too early.
|
||||
_ = recover()
|
||||
|
||||
wg.Done()
|
||||
}()
|
||||
|
||||
// Pass metrics to the prometheus registry
|
||||
// If timeout is reached, the channel is closed.
|
||||
// This will cause a panic if we try to write to it.
|
||||
for m := range bufCh {
|
||||
if !timeout.Load() {
|
||||
ch <- m
|
||||
for {
|
||||
select {
|
||||
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
|
||||
select {
|
||||
case err = <-errCh:
|
||||
wg.Wait() // Wait for the buffer channel to be closed and empty
|
||||
|
||||
duration = time.Since(t)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
p.collectorScrapeDurationDesc,
|
||||
@@ -211,7 +242,7 @@ func (p *Prometheus) execute(name string, c Collector, ctx *types.ScrapeContext,
|
||||
duration.Seconds(),
|
||||
name,
|
||||
)
|
||||
case <-time.After(p.maxScrapeDuration):
|
||||
case <-ctx.Done():
|
||||
timeout.Store(true)
|
||||
|
||||
duration = time.Since(t)
|
||||
@@ -222,20 +253,27 @@ func (p *Prometheus) execute(name string, c Collector, ctx *types.ScrapeContext,
|
||||
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
|
||||
}
|
||||
|
||||
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),
|
||||
)
|
||||
|
||||
return failed
|
||||
}
|
||||
|
||||
p.logger.Error(fmt.Sprintf("collector %s succeeded after %s", name, p.maxScrapeDuration))
|
||||
p.logger.Info(fmt.Sprintf("collector %s succeeded after %s, resulting in %d metrics", name, duration, numMetrics))
|
||||
|
||||
return success
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
|
||||
c.state = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "state"),
|
||||
"The state of the service (State)",
|
||||
[]string{"name", "status"},
|
||||
[]string{"name", "state"},
|
||||
nil,
|
||||
)
|
||||
c.startMode = prometheus.NewDesc(
|
||||
|
||||
@@ -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.
|
||||
// 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 {
|
||||
case PERF_ELAPSED_TIME:
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/pkg/types"
|
||||
@@ -26,3 +27,11 @@ func ExpandEnabledCollectors(enabled string) []string {
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func PDHEnabled() bool {
|
||||
if v, ok := os.LookupEnv("WINDOWS_EXPORTER_PERF_COUNTERS_ENGINE"); ok && v == "pdh" {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -298,13 +298,13 @@ windows_service_start_mode{name="Themes",start_mode="manual"} 0
|
||||
windows_service_start_mode{name="Themes",start_mode="system"} 0
|
||||
# HELP windows_service_state The state of the service (State)
|
||||
# TYPE windows_service_state gauge
|
||||
windows_service_state{name="Themes",status="continue pending"} 0
|
||||
windows_service_state{name="Themes",status="pause pending"} 0
|
||||
windows_service_state{name="Themes",status="paused"} 0
|
||||
windows_service_state{name="Themes",status="running"} 1
|
||||
windows_service_state{name="Themes",status="start pending"} 0
|
||||
windows_service_state{name="Themes",status="stop pending"} 0
|
||||
windows_service_state{name="Themes",status="stopped"} 0
|
||||
windows_service_state{name="Themes",state="continue pending"} 0
|
||||
windows_service_state{name="Themes",state="pause pending"} 0
|
||||
windows_service_state{name="Themes",state="paused"} 0
|
||||
windows_service_state{name="Themes",state="running"} 1
|
||||
windows_service_state{name="Themes",state="start pending"} 0
|
||||
windows_service_state{name="Themes",state="stop pending"} 0
|
||||
windows_service_state{name="Themes",state="stopped"} 0
|
||||
# HELP windows_system_context_switches_total Total number of context switches (WMI source: PerfOS_System.ContextSwitchesPersec)
|
||||
# TYPE windows_system_context_switches_total counter
|
||||
# HELP windows_system_exception_dispatches_total Total number of exceptions dispatched (WMI source: PerfOS_System.ExceptionDispatchesPersec)
|
||||
|
||||
Reference in New Issue
Block a user