mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-08 05:56:37 +00:00
Compare commits
92 Commits
v0.29.1
...
v0.30.0-rc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a2db81494e | ||
|
|
64bf0a6551 | ||
|
|
40b6f53479 | ||
|
|
ca04ad8fd2 | ||
|
|
fd55ac4894 | ||
|
|
c8eeb595c0 | ||
|
|
1a4c6c5ce7 | ||
|
|
fd76be38e0 | ||
|
|
eff124250f | ||
|
|
1badb34506 | ||
|
|
f9e41294c3 | ||
|
|
86ace68978 | ||
|
|
e812584f27 | ||
|
|
1ecc340659 | ||
|
|
4c0574536f | ||
|
|
26d6dddf25 | ||
|
|
75c6a4c182 | ||
|
|
a602d7be9d | ||
|
|
4534c2a6ae | ||
|
|
3b378136f5 | ||
|
|
85845f4780 | ||
|
|
fdee2d8613 | ||
|
|
8c90961c10 | ||
|
|
2335fba18a | ||
|
|
c6ee794598 | ||
|
|
9f29fc8a9c | ||
|
|
e6a15d4ec4 | ||
|
|
6206b695c6 | ||
|
|
b209ab6d6a | ||
|
|
78bd720e88 | ||
|
|
a4ec0a96f1 | ||
|
|
7a9a4e5831 | ||
|
|
df8513ab8e | ||
|
|
1956330ac4 | ||
|
|
baa4dc16ae | ||
|
|
d13d726453 | ||
|
|
31bcf42473 | ||
|
|
f332361723 | ||
|
|
b4f50c542c | ||
|
|
b53f18bcc6 | ||
|
|
eeb7955f5e | ||
|
|
55181f5bac | ||
|
|
e6c9253f15 | ||
|
|
b26ae86992 | ||
|
|
004f8da0ef | ||
|
|
65f41b3582 | ||
|
|
be67d853aa | ||
|
|
bf233ad3e3 | ||
|
|
45d3eabab9 | ||
|
|
c4f5d58a3e | ||
|
|
582d8dd29c | ||
|
|
abc5388cab | ||
|
|
fd9eb6d877 | ||
|
|
bad8ba225a | ||
|
|
ce2df385a6 | ||
|
|
92b7e445e1 | ||
|
|
332b0a8a1c | ||
|
|
73755b8bfe | ||
|
|
25d90212ce | ||
|
|
d1517d8398 | ||
|
|
7500ad6a83 | ||
|
|
a0159b333e | ||
|
|
22fdb33b4c | ||
|
|
f46f9082f9 | ||
|
|
028f7aa823 | ||
|
|
545bf77326 | ||
|
|
90ac0b269e | ||
|
|
72df5154fc | ||
|
|
4ee03c4528 | ||
|
|
2ef1a5fdf1 | ||
|
|
efb20b1e31 | ||
|
|
ab33f3c49c | ||
|
|
5952c51a39 | ||
|
|
2a9a11bd01 | ||
|
|
79baf9921d | ||
|
|
7e9976efd3 | ||
|
|
5d95610c84 | ||
|
|
bcfe6df24d | ||
|
|
70156cd106 | ||
|
|
e6ef2de40c | ||
|
|
0a78909cf6 | ||
|
|
2155d34779 | ||
|
|
1caef5cc12 | ||
|
|
14910efd4f | ||
|
|
48e0e11063 | ||
|
|
996080c1e9 | ||
|
|
e6aaf91df1 | ||
|
|
b67b930ffc | ||
|
|
a1defadf1e | ||
|
|
01e809315c | ||
|
|
798bf32dec | ||
|
|
622813343f |
2
.github/workflows/pr-check.yaml
vendored
2
.github/workflows/pr-check.yaml
vendored
@@ -37,7 +37,7 @@ jobs:
|
||||
- name: check
|
||||
run: |
|
||||
PR_TITLE_PREFIX=$(echo "$PR_TITLE" | cut -d':' -f1)
|
||||
if [[ -d "pkg/collector/$PR_TITLE_PREFIX" ]] ||[[ -d "pkg/$PR_TITLE_PREFIX" ]] || [[ -d "$PR_TITLE_PREFIX" ]] || [[ "$PR_TITLE_PREFIX" == "chore" ]] || [[ "$PR_TITLE_PREFIX" == "chore(docs)" ]] || [[ "$PR_TITLE_PREFIX" == "chore(deps)" ]] || [[ "$PR_TITLE_PREFIX" == "*" ]] || [[ "$PR_TITLE_PREFIX" == "Synchronize common files from prometheus/prometheus" ]]; then
|
||||
if [[ -d "internal/collector/$PR_TITLE_PREFIX" ]] || [[ -d "internal/$PR_TITLE_PREFIX" ]] || [[ -d "pkg/$PR_TITLE_PREFIX" ]] || [[ -d "$PR_TITLE_PREFIX" ]] || [[ "$PR_TITLE_PREFIX" == "docs" ]] || [[ "$PR_TITLE_PREFIX" == "ci" ]] || [[ "$PR_TITLE_PREFIX" == "revert" ]] || [[ "$PR_TITLE_PREFIX" == "fix" ]] || [[ "$PR_TITLE_PREFIX" == "feat" ]] || [[ "$PR_TITLE_PREFIX" == "chore" ]] || [[ "$PR_TITLE_PREFIX" == "chore(docs)" ]] || [[ "$PR_TITLE_PREFIX" == "chore(deps)" ]] || [[ "$PR_TITLE_PREFIX" == "*" ]] || [[ "$PR_TITLE_PREFIX" == "Synchronize common files from prometheus/prometheus" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
115
.github/workflows/release.yml
vendored
115
.github/workflows/release.yml
vendored
@@ -6,6 +6,7 @@ on:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
release:
|
||||
types:
|
||||
- published
|
||||
@@ -16,10 +17,7 @@ permissions:
|
||||
packages: write
|
||||
|
||||
env:
|
||||
VERSION_PROMU: '0.14.0'
|
||||
VERSION_CONTAINERD: '1.7.21'
|
||||
VERSION_BUILDKIT: '0.15.2'
|
||||
VERSION_BUILDX: '0.16.2'
|
||||
VERSION_PROMU: '0.17.0'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -33,27 +31,6 @@ jobs:
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
|
||||
# https://github.com/pl4nty/Windows-Containers/blob/Main/helpful_tools/Install-BuildKit-GitHubActions/workflow.yaml
|
||||
- name: Setup containerd
|
||||
run: |
|
||||
curl.exe -L https://github.com/containerd/containerd/releases/download/v${{ env.VERSION_CONTAINERD }}/containerd-${{ env.VERSION_CONTAINERD }}-windows-amd64.tar.gz -o containerd.tar.gz
|
||||
tar.exe xvf containerd.tar.gz
|
||||
.\bin\containerd.exe --register-service
|
||||
Start-Service containerd
|
||||
- name: Setup BuildKit
|
||||
run: |
|
||||
curl.exe -L https://github.com/moby/buildkit/releases/download/v${{ env.VERSION_BUILDKIT }}/buildkit-v${{ env.VERSION_BUILDKIT }}.windows-amd64.tar.gz -o buildkit.tar.gz
|
||||
tar.exe xvf buildkit.tar.gz
|
||||
|
||||
.\bin\buildkitd.exe --register-service
|
||||
Start-Service buildkitd
|
||||
- name: Setup Docker Buildx
|
||||
run: |
|
||||
curl.exe -L https://github.com/docker/buildx/releases/download/v${{ env.VERSION_BUILDX }}/buildx-v${{ env.VERSION_BUILDX }}.windows-amd64.exe -o $env:ProgramData\Docker\cli-plugins\docker-buildx.exe
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
driver: remote
|
||||
endpoint: npipe:////./pipe/buildkitd
|
||||
- name: Install WiX
|
||||
run: dotnet tool install --global wix
|
||||
|
||||
@@ -75,32 +52,32 @@ jobs:
|
||||
- name: Build
|
||||
run: |
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
|
||||
$Version = git describe --tags --always
|
||||
$Version = $Version -replace 'v', ''
|
||||
# '+' symbols are invalid characters in image tags
|
||||
$Version = $Version -replace '\+', '_'
|
||||
$Version | Set-Content VERSION -PassThru
|
||||
|
||||
|
||||
make build-all
|
||||
|
||||
|
||||
# GH requires all files to have different names, so add version/arch to differentiate
|
||||
foreach($Arch in "amd64", "arm64") {
|
||||
Move-Item output\$Arch\windows_exporter.exe output\windows_exporter-$Version-$Arch.exe
|
||||
}
|
||||
|
||||
|
||||
Get-ChildItem -Path output
|
||||
|
||||
- name: Build Release Artifacts
|
||||
run: |
|
||||
$ErrorActionPreference = "Stop"
|
||||
$Version = Get-Content VERSION
|
||||
|
||||
|
||||
foreach($Arch in "amd64", "arm64") {
|
||||
Write-Host "Building windows_exporter $Version msi for $Arch"
|
||||
.\installer\build.ps1 -PathToExecutable .\output\windows_exporter-$Version-$Arch.exe -Version $Version -Arch "$Arch"
|
||||
}
|
||||
|
||||
|
||||
Move-Item installer\*.msi output\
|
||||
Get-ChildItem -Path output\
|
||||
|
||||
@@ -114,16 +91,27 @@ jobs:
|
||||
output\windows_exporter-*.exe
|
||||
output\windows_exporter-*.msi
|
||||
|
||||
- name: Build Docker Artifacts
|
||||
run: make build-all
|
||||
- name: Release
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
env:
|
||||
VERSION: >-
|
||||
${{
|
||||
startsWith(github.ref, 'refs/tags/') && 'latest' ||
|
||||
(
|
||||
github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || github.ref_name
|
||||
)
|
||||
}}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
$TagName = $env:GITHUB_REF -replace 'refs/tags/', ''
|
||||
Get-ChildItem -Path output\* -Include @('windows_exporter*.msi', 'windows_exporter*.exe', 'sha256sums.txt') | Foreach-Object {gh release upload $TagName $_}
|
||||
docker:
|
||||
name: Build docker images
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: '0'
|
||||
|
||||
- name: Download Artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: windows_exporter_binaries
|
||||
|
||||
- name: Login to Docker Hub
|
||||
if: ${{ github.event_name != 'pull_request' }}
|
||||
@@ -137,8 +125,8 @@ jobs:
|
||||
# uses: docker/login-action@v3
|
||||
# with:
|
||||
# registry: quay.io
|
||||
# username: 'robot'
|
||||
# password: ${{ secrets.QUAY_IO_API_TOKEN }}
|
||||
# username: ${{ secrets.QUAY_USER }}
|
||||
# password: ${{ secrets.QUAY_PASS }}
|
||||
|
||||
- name: Login to GitHub container registry
|
||||
if: ${{ github.event_name != 'pull_request' }}
|
||||
@@ -148,19 +136,32 @@ jobs:
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Push Latest image
|
||||
if: ${{ github.event_name != 'pull_request' }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
VERSION: ${{ startsWith(github.ref, 'refs/tags/') && 'latest' || github.ref_name }}
|
||||
run: |
|
||||
make push-all
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
ghcr.io/prometheus-community/windows-exporter
|
||||
docker.io/prometheuscommunity/windows-exporter
|
||||
# quay.io/prometheuscommunity/windows-exporter
|
||||
tags: |
|
||||
type=semver,pattern={{version}}
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
labels: |
|
||||
org.opencontainers.image.title=windows_exporter
|
||||
org.opencontainers.image.description=A Prometheus exporter for Windows machines.
|
||||
org.opencontainers.image.vendor=The Prometheus Community
|
||||
org.opencontainers.image.licenses=MIT
|
||||
|
||||
- name: Release
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
$TagName = $env:GITHUB_REF -replace 'refs/tags/', ''
|
||||
Get-ChildItem -Path output\* -Include @('windows_exporter*.msi', 'windows_exporter*.exe', 'sha256sums.txt') | Foreach-Object {gh release upload $TagName $_}
|
||||
make push-all
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
platforms: windows/amd64
|
||||
|
||||
2
.github/workflows/spelling.yml
vendored
2
.github/workflows/spelling.yml
vendored
@@ -23,4 +23,4 @@ jobs:
|
||||
check_filenames: true
|
||||
# When using this Action in other repos, the --skip option below can be removed
|
||||
skip: ./.git,go.mod,go.sum
|
||||
ignore_words_list: calle
|
||||
ignore_words_list: calle,Entires
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -8,4 +8,5 @@ output/
|
||||
*.syso
|
||||
installer/*.msi
|
||||
installer/*.wixpdb
|
||||
local/
|
||||
local/
|
||||
!.idea/inspectionProfiles/Project_Default.xml
|
||||
|
||||
@@ -11,11 +11,12 @@ linters:
|
||||
- exportloopref
|
||||
- fatcontext
|
||||
- funlen
|
||||
- gochecknoglobals
|
||||
- gocognit
|
||||
- goconst
|
||||
- gocyclo
|
||||
- godot
|
||||
- gomnd
|
||||
- paralleltest
|
||||
- lll
|
||||
- maintidx
|
||||
- mnd
|
||||
@@ -24,16 +25,20 @@ linters:
|
||||
- wrapcheck
|
||||
|
||||
run:
|
||||
timeout: 5m
|
||||
timeout: 15m
|
||||
|
||||
output:
|
||||
sort-results: true
|
||||
|
||||
linters-settings:
|
||||
gosec:
|
||||
excludes:
|
||||
- G101 # Potential hardcoded credentials
|
||||
- G115 # integer overflow conversion
|
||||
|
||||
gci:
|
||||
sections:
|
||||
- prefix(github.com/prometheus-community/windows_exporter/pkg/initiate)
|
||||
- prefix(github.com/prometheus-community/windows_exporter/internal/windowsservice)
|
||||
- standard # Standard section: captures all standard packages.
|
||||
- default # Default section: contains all imports that could not be matched to another section type.
|
||||
custom-order: true
|
||||
@@ -48,7 +53,7 @@ linters-settings:
|
||||
forbidigo:
|
||||
forbid:
|
||||
- "^(fmt\\.Print(|f|ln)|print|println)$"
|
||||
- p: "^syscall\\..*$"
|
||||
- p: "^syscall\\.(.{1,7}|.{7}[^N]|.{9,})$"
|
||||
msg: use golang.org/x/sys/windows instead of syscall
|
||||
- p: "^windows\\.NewLazyDLL$"
|
||||
msg: use NewLazySystemDLL instead NewLazyDLL
|
||||
@@ -82,7 +87,3 @@ issues:
|
||||
- text: "don't use ALL_CAPS in Go names; use CamelCase"
|
||||
linters:
|
||||
- revive
|
||||
- path: pkg/perflib/
|
||||
linters:
|
||||
- godox
|
||||
- stylecheck
|
||||
|
||||
@@ -2,11 +2,13 @@ go:
|
||||
# Whenever the Go version is updated here,
|
||||
# .github/workflows should also be updated.
|
||||
version: 1.23
|
||||
cgo: false
|
||||
repository:
|
||||
path: github.com/prometheus-community/windows_exporter
|
||||
build:
|
||||
binaries:
|
||||
- name: windows_exporter
|
||||
path: ./cmd/windows_exporter
|
||||
tags:
|
||||
all:
|
||||
- trimpath
|
||||
@@ -21,4 +23,5 @@ tarball:
|
||||
- LICENSE
|
||||
crossbuild:
|
||||
platforms:
|
||||
- windows
|
||||
- windows/amd64
|
||||
- windows/arm64
|
||||
|
||||
13
.run/all.run.xml
Normal file
13
.run/all.run.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="all" type="GoApplicationRunConfiguration" factoryName="Go Application" folderName="run">
|
||||
<module name="windows_exporter" />
|
||||
<working_directory value="$PROJECT_DIR$" />
|
||||
<parameters value="--web.listen-address=127.0.0.1:9182 --log.level=info --collectors.enabled=ad,adcs,adfs,cache,container,cpu,cpu_info,cs,dfsr,dhcp,diskdrive,dns,exchange,filetime,fsrmquota,hyperv,iis,license,logical_disk,logon,memory,mscluster,msmq,mssql,net,netframework,nps,os,pagefile,perfdata,physical_disk,printer,process,remote_fx,scheduled_task,service,smb,smbclient,smtp,system,tcp,terminal_services,thermalzone,time,udp,update,vmware --debug.enabled" />
|
||||
<sudo value="true" />
|
||||
<kind value="PACKAGE" />
|
||||
<package value="github.com/prometheus-community/windows_exporter/cmd/windows_exporter" />
|
||||
<directory value="$PROJECT_DIR$" />
|
||||
<filePath value="$PROJECT_DIR$/exporter.go" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
16
Dockerfile
16
Dockerfile
@@ -1,9 +1,13 @@
|
||||
# Note this image doesn't really matter for hostprocess but it is good to build per OS version
|
||||
# the files in the image are copied to $env:CONTAINER_SANDBOX_MOUNT_POINT on the host
|
||||
# but the file system is the Host NOT the container
|
||||
ARG BASE="mcr.microsoft.com/windows/nanoserver:ltsc2022"
|
||||
# mcr.microsoft.com/oss/kubernetes/windows-host-process-containers-base-image:v1.0.0
|
||||
# Using this image as a base for HostProcess containers has a few advantages over using other base images for Windows containers including:
|
||||
# - Smaller image size
|
||||
# - OS compatibility (works on any Windows version that supports containers)
|
||||
|
||||
# This image MUST be built with docker buildx build (buildx) command on a Linux system.
|
||||
# Ref: https://github.com/microsoft/windows-host-process-containers-base-image
|
||||
|
||||
ARG BASE="mcr.microsoft.com/oss/kubernetes/windows-host-process-containers-base-image:v1.0.0"
|
||||
FROM $BASE
|
||||
|
||||
ENV PATH="C:\Windows\system32;C:\Windows;"
|
||||
COPY output/amd64/windows_exporter.exe /windows_exporter.exe
|
||||
COPY windows_exporter*-amd64.exe /windows_exporter.exe
|
||||
ENTRYPOINT ["windows_exporter.exe"]
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
# Build this Docker Image on any platform with
|
||||
# docker buildx build -t a --platform=windows/amd64 .
|
||||
|
||||
ARG BASE=mcr.microsoft.com/oss/kubernetes/windows-host-process-containers-base-image:v1.0.0
|
||||
|
||||
FROM --platform=$BUILDPLATFORM golang:1.21 as builder
|
||||
ARG TARGETARCH
|
||||
ARG TARGETOS
|
||||
|
||||
# Get dependencies
|
||||
WORKDIR /w
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
RUN go install github.com/prometheus/promu@latest
|
||||
|
||||
# Build windows_exporter
|
||||
COPY . ./
|
||||
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH make windows_exporter.exe
|
||||
|
||||
FROM $BASE
|
||||
COPY --from=builder /w/windows_exporter.exe /windows_exporter.exe
|
||||
ENTRYPOINT ["windows_exporter.exe"]
|
||||
30
Makefile
30
Makefile
@@ -29,14 +29,14 @@ test:
|
||||
go test -v ./...
|
||||
|
||||
bench:
|
||||
go test -v -bench='benchmarkcollector' ./pkg/collector/{cpu,logical_disk,physical_disk,logon,memory,net,printer,process,service,system,tcp,time}
|
||||
go test -v -bench='benchmarkcollector' ./internal/collectors/{cpu,logical_disk,physical_disk,logon,memory,net,printer,process,service,system,tcp,time}
|
||||
|
||||
lint:
|
||||
golangci-lint -c .golangci.yaml run
|
||||
|
||||
.PHONY: e2e-test
|
||||
e2e-test: windows_exporter.exe
|
||||
pwsh -NonInteractive -ExecutionPolicy Bypass -File .\tools\end-to-end-test.ps1
|
||||
powershell -NonInteractive -ExecutionPolicy Bypass -File .\tools\end-to-end-test.ps1
|
||||
|
||||
.PHONY: promtool
|
||||
promtool: windows_exporter.exe
|
||||
@@ -64,31 +64,19 @@ build-hostprocess:
|
||||
sub-build-%:
|
||||
$(MAKE) OS=$* build-image
|
||||
|
||||
build-all: $(addprefix sub-build-,$(ALL_OS)) build-hostprocess
|
||||
|
||||
push:
|
||||
set -x; \
|
||||
for docker_repo in ${DOCKER_REPO}; do \
|
||||
for osversion in ${ALL_OS}; do \
|
||||
$(DOCKER) tag local/$(DOCKER_IMAGE_NAME):$(VERSION)-$${osversion} $${docker_repo}/$(DOCKER_IMAGE_NAME):$(VERSION)-$${osversion}; \
|
||||
$(DOCKER) push $${docker_repo}/$(DOCKER_IMAGE_NAME):$(VERSION)-$${osversion}; \
|
||||
$(DOCKER) manifest create --amend $${docker_repo}/$(DOCKER_IMAGE_NAME):$(VERSION) $${docker_repo}/$(DOCKER_IMAGE_NAME):$(VERSION)-$${osversion}; \
|
||||
full_version=`$(DOCKER) manifest inspect $(BASE_IMAGE):$${osversion} | grep "os.version" | head -n 1 | awk -F\" '{print $$4}'` || true; \
|
||||
$(DOCKER) manifest annotate --os windows --arch amd64 --os-version $${full_version} $${docker_repo}/$(DOCKER_IMAGE_NAME):$(VERSION) $${docker_repo}/$(DOCKER_IMAGE_NAME):$(VERSION)-$${osversion}; \
|
||||
done; \
|
||||
$(DOCKER) manifest push --purge $${docker_repo}/$(DOCKER_IMAGE_NAME):$(VERSION); \
|
||||
build-all: crossbuild
|
||||
@for docker_repo in ${DOCKER_REPO}; do \
|
||||
echo $(DOCKER) buildx build -f Dockerfile -t $${docker_repo}/$(DOCKER_IMAGE_NAME):$(VERSION) .; \
|
||||
done
|
||||
|
||||
# We can't load the image into the local docker store, so we have to build and push it in one go
|
||||
push-hostprocess:
|
||||
set -x; \
|
||||
for docker_repo in ${DOCKER_REPO}; do \
|
||||
$(DOCKER) buildx build --push --build-arg=BASE=mcr.microsoft.com/oss/kubernetes/windows-host-process-containers-base-image:v1.0.0 -f Dockerfile -t $${docker_repo}/$(DOCKER_IMAGE_NAME):$(VERSION)-hostprocess .; \
|
||||
push:
|
||||
@for docker_repo in ${DOCKER_REPO}; do \
|
||||
echo $(DOCKER) buildx build --push -f Dockerfile -t $${docker_repo}/$(DOCKER_IMAGE_NAME):$(VERSION) .; \
|
||||
done
|
||||
|
||||
.PHONY: push-all
|
||||
push-all: build-all
|
||||
$(MAKE) DOCKER_REPO="$(ALL_DOCKER_REPOS)" push # push-hostprocess - disabled until it works on Windows
|
||||
$(MAKE) DOCKER_REPO="$(ALL_DOCKER_REPOS)" push
|
||||
|
||||
# Mandatory target for container description sync action
|
||||
.PHONY: docker-repo-name
|
||||
|
||||
49
README.md
49
README.md
@@ -1,6 +1,12 @@
|
||||
# windows_exporter
|
||||
|
||||

|
||||
[](https://github.com/prometheus-community/windows_exporter)
|
||||
[](https://github.com/prometheus-community/windows_exporter)
|
||||
[](https://github.com/prometheus-community/windows_exporter/blob/master/LICENSE.txt)
|
||||
[](https://github.com/prometheus-community/windows_exporter/releases/latest)
|
||||
[](https://github.com/prometheus-community/windows_exporter/stargazers)
|
||||
[](https://github.com/prometheus-community/windows_exporter/releases/latest)
|
||||
[](https://goreportcard.com/report/github.com/prometheus-community/windows_exporter)
|
||||
|
||||
A Prometheus exporter for Windows machines.
|
||||
|
||||
@@ -35,6 +41,8 @@ Name | Description | Enabled by default
|
||||
[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) | ✓
|
||||
[pagefile](docs/collector.pagefile.md) | pagefile metrics |
|
||||
[perfdata](docs/collector.perfdata.md) | Custom perfdata metrics |
|
||||
[physical_disk](docs/collector.physical_disk.md) | physical disk metrics | ✓
|
||||
[printer](docs/collector.printer.md) | Printer metrics |
|
||||
[process](docs/collector.process.md) | Per-process metrics |
|
||||
@@ -46,12 +54,12 @@ Name | Description | Enabled by default
|
||||
[smtp](docs/collector.smtp.md) | IIS SMTP Server |
|
||||
[system](docs/collector.system.md) | System calls | ✓
|
||||
[tcp](docs/collector.tcp.md) | TCP connections |
|
||||
[teradici_pcoip](docs/collector.teradici_pcoip.md) | [Teradici PCoIP](https://www.teradici.com/web-help/pcoip_wmi_specs/) session metrics |
|
||||
[time](docs/collector.time.md) | Windows Time Service |
|
||||
[thermalzone](docs/collector.thermalzone.md) | Thermal information
|
||||
[terminal_services](docs/collector.terminal_services.md) | Terminal services (RDS)
|
||||
[textfile](docs/collector.textfile.md) | Read prometheus metrics from a text file |
|
||||
[vmware_blast](docs/collector.vmware_blast.md) | VMware Blast session metrics |
|
||||
[thermalzone](docs/collector.thermalzone.md) | Thermal information |
|
||||
[time](docs/collector.time.md) | Windows Time Service |
|
||||
[udp](docs/collector.udp.md) | UDP connections |
|
||||
[update](docs/collector.update.md) | Windows Update Service |
|
||||
[vmware](docs/collector.vmware.md) | Performance counters installed by the Vmware Guest agent |
|
||||
|
||||
See the linked documentation on each collector for more information on reported metrics, configuration settings and usage examples.
|
||||
@@ -75,17 +83,18 @@ This can be useful for having different Prometheus servers collect specific metr
|
||||
|
||||
windows_exporter accepts flags to configure certain behaviours. The ones configuring the global behaviour of the exporter are listed below, while collector-specific ones are documented in the respective collector documentation above.
|
||||
|
||||
| Flag | Description | Default value |
|
||||
|--------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
|
||||
| `--web.listen-address` | host:port for exporter. | `:9182` |
|
||||
| `--telemetry.path` | URL path for surfacing collected metrics. | `/metrics` |
|
||||
| `--telemetry.max-requests` | Maximum number of concurrent requests. 0 to disable. | `5` |
|
||||
| `--collectors.enabled` | Comma-separated list of collectors to use. Use `[defaults]` as a placeholder which gets expanded containing all the collectors enabled by default." | `[defaults]` |
|
||||
| `--collectors.print` | If true, print available collectors and exit. | |
|
||||
| `--scrape.timeout-margin` | Seconds to subtract from the timeout allowed by the client. Tune to allow for overhead or high loads. | `0.5` |
|
||||
| `--web.config.file` | A [web config][web_config] for setting up TLS and Auth | None |
|
||||
| `--config.file` | [Using a config file](#using-a-configuration-file) from path or URL | None |
|
||||
| `--config.file.insecure-skip-verify` | Skip TLS when loading config file from URL | false |
|
||||
| Flag | Description | Default value |
|
||||
|--------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
|
||||
| `--web.listen-address` | host:port for exporter. | `:9182` |
|
||||
| `--telemetry.path` | URL path for surfacing collected metrics. | `/metrics` |
|
||||
| `--telemetry.max-requests` | Maximum number of concurrent requests. 0 to disable. | `5` |
|
||||
| `--collectors.enabled` | Comma-separated list of collectors to use. Use `[defaults]` as a placeholder which gets expanded containing all the collectors enabled by default." | `[defaults]` |
|
||||
| `--collectors.print` | If true, print available collectors and exit. | |
|
||||
| `--scrape.timeout-margin` | Seconds to subtract from the timeout allowed by the client. Tune to allow for overhead or high loads. | `0.5` |
|
||||
| `--web.config.file` | A [web config][web_config] for setting up TLS and Auth | None |
|
||||
| `--config.file` | [Using a config file](#using-a-configuration-file) from path or URL | None |
|
||||
| `--config.file.insecure-skip-verify` | Skip TLS when loading config file from URL | false |
|
||||
| `--log.file` | Output file of log messages. One of [stdout, stderr, eventlog, \<path to log file>]<br>**NOTE:** The MSI installer will add a default argument to the installed service setting this to eventlog | stderr |
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -190,6 +199,14 @@ Windows Server 2012 and 2012R2 are supported as best-effort only, but not guaran
|
||||
|
||||
The prometheus metrics will be exposed on [localhost:9182](http://localhost:9182)
|
||||
|
||||
### HTTP Endpoints
|
||||
|
||||
windows_exporter provides the following HTTP endpoints:
|
||||
|
||||
* `/metrics`: Exposes metrics in the [Prometheus text format](https://prometheus.io/docs/instrumenting/exposition_formats/).
|
||||
* `/health`: Returns 200 OK when the exporter is running.
|
||||
* `/debug/pprof/`: Exposes the [pprof](https://golang.org/pkg/net/http/pprof/) endpoints. Only, if `--debug.enabled` is set.
|
||||
|
||||
## Examples
|
||||
|
||||
### Enable only service collector and specify a custom query
|
||||
|
||||
195
cmd/windows_exporter/doc.go
Normal file
195
cmd/windows_exporter/doc.go
Normal file
@@ -0,0 +1,195 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
/*
|
||||
The main package for the windows_exporter executable.
|
||||
|
||||
usage: windows_exporter [<flags>]
|
||||
|
||||
A metrics collector for Windows.
|
||||
|
||||
Flags:
|
||||
|
||||
-h, --[no-]help Show context-sensitive help (also try
|
||||
--help-long and --help-man).
|
||||
--config.file=CONFIG.FILE YAML configuration file to use. Values set in
|
||||
this file will be overridden by CLI flags.
|
||||
--[no-]config.file.insecure-skip-verify
|
||||
Skip TLS verification in loading YAML
|
||||
configuration.
|
||||
--web.listen-address=:9182 ...
|
||||
Addresses on which to expose metrics and web
|
||||
interface. Repeatable for multiple addresses.
|
||||
Examples: `:9100` or `[::1]:9100` for http,
|
||||
`vsock://:9100` for vsock
|
||||
--web.config.file="" Path to configuration file that can
|
||||
enable TLS or authentication. See:
|
||||
https://github.com/prometheus/exporter-toolkit/blob/master/docs/web-configuration.md
|
||||
--telemetry.path="/metrics"
|
||||
URL path for surfacing collected metrics.
|
||||
--[no-]web.disable-exporter-metrics
|
||||
Exclude metrics about the exporter itself
|
||||
(promhttp_*, process_*, go_*).
|
||||
--telemetry.max-requests=5
|
||||
Maximum number of concurrent requests. 0 to
|
||||
disable.
|
||||
--collectors.enabled="cpu,cs,memory,logical_disk,physical_disk,net,os,service,system"
|
||||
Comma-separated list of collectors to use.
|
||||
Use '[defaults]' as a placeholder for all the
|
||||
collectors enabled by default.
|
||||
--scrape.timeout-margin=0.5
|
||||
Seconds to subtract from the timeout allowed by
|
||||
the client. Tune to allow for overhead or high
|
||||
loads.
|
||||
--[no-]debug.enabled If true, windows_exporter will expose debug
|
||||
endpoints under /debug/pprof.
|
||||
--process.priority="normal"
|
||||
Priority of the exporter process. Higher
|
||||
priorities may improve exporter responsiveness
|
||||
during periods of system load. Can be one of
|
||||
["realtime", "high", "abovenormal", "normal",
|
||||
"belownormal", "low"]
|
||||
--log.level=info Only log messages with the given severity or
|
||||
above. One of: [debug, info, warn, error]
|
||||
--log.format=logfmt Output format of log messages. One of: [logfmt,
|
||||
json]
|
||||
--log.file=stderr Output file of log messages. One of [stdout,
|
||||
stderr, eventlog, <path to log file>]
|
||||
--[no-]version Show application version.
|
||||
--collector.scheduled_task.exclude=""
|
||||
Regexp of tasks to exclude. Task path must
|
||||
both match include and not match exclude to be
|
||||
included.
|
||||
--collector.scheduled_task.include=".+"
|
||||
Regexp of tasks to include. Task path must
|
||||
both match include and not match exclude to be
|
||||
included.
|
||||
--[no-]collector.updates.online
|
||||
Whether to search for updates online.
|
||||
--collector.updates.scrape-interval=6h0m0s
|
||||
Define the interval of scraping Windows Update
|
||||
information.
|
||||
--[no-]collector.exchange.list
|
||||
List the collectors along with their perflib
|
||||
object name/ids
|
||||
--collector.exchange.enabled="ADAccessProcesses,TransportQueues,HttpProxy,ActiveSync,AvailabilityService,OutlookWebAccess,Autodiscover,WorkloadManagement,RpcClientAccess,MapiHttpEmsmdb"
|
||||
Comma-separated list of collectors to use.
|
||||
Defaults to all, if not specified.
|
||||
--collector.net.nic-exclude=""
|
||||
Regexp of NIC:s to exclude. NIC name must
|
||||
both match include and not match exclude to be
|
||||
included.
|
||||
--collector.net.nic-include=".+"
|
||||
Regexp of NIC:s to include. NIC name must
|
||||
both match include and not match exclude to be
|
||||
included.
|
||||
--collector.net.enabled="metrics,nic_addresses"
|
||||
Comma-separated list of collectors to use.
|
||||
Defaults to all, if not specified.
|
||||
--collector.mscluster.enabled="cluster,network,node,resource,resourcegroup"
|
||||
Comma-separated list of collectors to use.
|
||||
--collector.mssql.enabled="accessmethods,availreplica,bufman,databases,dbreplica,genstats,locks,memmgr,sqlerrors,sqlstats,transactions,waitstats"
|
||||
Comma-separated list of collectors to use.
|
||||
--collector.mssql.port=1433
|
||||
Port of MSSQL server used for
|
||||
windows_mssql_info metric.
|
||||
--collector.physical_disk.disk-exclude=""
|
||||
Regexp of disks to exclude. Disk number must
|
||||
both match include and not match exclude to be
|
||||
included.
|
||||
--collector.physical_disk.disk-include=".+"
|
||||
Regexp of disks to include. Disk number must
|
||||
both match include and not match exclude to be
|
||||
included.
|
||||
--collector.textfile.directories="C:\\Users\\Jan\\GolandProjects\\windows_exporter\\textfile_inputs"
|
||||
Directory or Directories to read text files
|
||||
with metrics from.
|
||||
--collector.filetime.file-patterns=""
|
||||
Comma-separated list of file patterns.
|
||||
Each pattern is a glob pattern that can
|
||||
contain `*`, `?`, and `**` (recursive). See
|
||||
https://github.com/bmatcuk/doublestar#patterns
|
||||
--collector.iis.app-exclude=""
|
||||
Regexp of apps to exclude. App name must both
|
||||
match include and not match exclude to be
|
||||
included.
|
||||
--collector.iis.app-include=".+"
|
||||
Regexp of apps to include. App name must both
|
||||
match include and not match exclude to be
|
||||
included.
|
||||
--collector.iis.site-exclude=""
|
||||
Regexp of sites to exclude. Site name must
|
||||
both match include and not match exclude to be
|
||||
included.
|
||||
--collector.iis.site-include=".+"
|
||||
Regexp of sites to include. Site name must
|
||||
both match include and not match exclude to be
|
||||
included.
|
||||
--collector.perfdata.objects=""
|
||||
Objects of performance data to observe.
|
||||
See docs for more information on how to use
|
||||
this flag. By default, no objects are observed.
|
||||
--collector.printer.include=".+"
|
||||
Regular expression to match printers to collect
|
||||
metrics for
|
||||
--collector.printer.exclude=""
|
||||
Regular expression to match printers to exclude
|
||||
--collector.process.exclude=""
|
||||
Regexp of processes to exclude. Process name
|
||||
must both match include and not match exclude
|
||||
to be included.
|
||||
--collector.process.include=".+"
|
||||
Regexp of processes to include. Process name
|
||||
must both match include and not match exclude
|
||||
to be included.
|
||||
--[no-]collector.process.iis
|
||||
Enable IIS worker process name queries.
|
||||
May cause the collector to leak memory.
|
||||
--collector.hyperv.enabled="datastore,dynamic_memory_balancer,dynamic_memory_vm,hypervisor_logical_processor,hypervisor_root_partition,hypervisor_root_virtual_processor,hypervisor_virtual_processor,legacy_network_adapter,virtual_machine_health_summary,virtual_machine_vid_partition,virtual_network_adapter,virtual_network_adapter_drop_reasons,virtual_smb,virtual_storage_device,virtual_switch"
|
||||
Comma-separated list of collectors to use.
|
||||
--collector.logical_disk.volume-exclude=""
|
||||
Regexp of volumes to exclude. Volume name must
|
||||
both match include and not match exclude to be
|
||||
included.
|
||||
--collector.logical_disk.volume-include=".+"
|
||||
Regexp of volumes to include. Volume name must
|
||||
both match include and not match exclude to be
|
||||
included.
|
||||
--collector.smtp.server-exclude=""
|
||||
Regexp of virtual servers to exclude. Server
|
||||
name must both match include and not match
|
||||
exclude to be included.
|
||||
--collector.smtp.server-include=".+"
|
||||
Regexp of virtual servers to include. Server
|
||||
name must both match include and not match
|
||||
exclude to be included.
|
||||
--collector.tcp.enabled="metrics,connections_state"
|
||||
Comma-separated list of collectors to use.
|
||||
Defaults to all, if not specified.
|
||||
--collector.dfsr.sources-enabled="connection,folder,volume"
|
||||
Comma-separated list of DFSR Perflib sources to
|
||||
use.
|
||||
--collector.service.exclude=""
|
||||
Regexp of service to exclude. Service name (not
|
||||
the display name!) must both match include and
|
||||
not match exclude to be included.
|
||||
--collector.service.include=".+"
|
||||
Regexp of service to include. Process name (not
|
||||
the display name!) must both match include and
|
||||
not match exclude to be included.
|
||||
--collector.time.enabled="system_time,ntp"
|
||||
Comma-separated list of collectors to use.
|
||||
Defaults to all, if not specified. ntp may not
|
||||
available on all systems.
|
||||
*/
|
||||
package main
|
||||
@@ -1,3 +1,16 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
//go:generate go run github.com/tc-hib/go-winres@v0.3.3 make --product-version=git-tag --file-version=git-tag --arch=amd64,arm64
|
||||
@@ -8,7 +21,7 @@ package main
|
||||
//nolint:gofumpt
|
||||
import (
|
||||
// Its important that we do these first so that we can register with the Windows service control ASAP to avoid timeouts.
|
||||
"github.com/prometheus-community/windows_exporter/pkg/initiate"
|
||||
"github.com/prometheus-community/windows_exporter/internal/windowsservice"
|
||||
|
||||
"context"
|
||||
"errors"
|
||||
@@ -20,39 +33,40 @@ import (
|
||||
"os/signal"
|
||||
"os/user"
|
||||
"runtime"
|
||||
"sort"
|
||||
"slices"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/alecthomas/kingpin/v2"
|
||||
"github.com/prometheus-community/windows_exporter/internal/config"
|
||||
"github.com/prometheus-community/windows_exporter/internal/httphandler"
|
||||
"github.com/prometheus-community/windows_exporter/internal/log"
|
||||
"github.com/prometheus-community/windows_exporter/internal/log/flag"
|
||||
"github.com/prometheus-community/windows_exporter/internal/utils"
|
||||
"github.com/prometheus-community/windows_exporter/pkg/collector"
|
||||
"github.com/prometheus-community/windows_exporter/pkg/config"
|
||||
"github.com/prometheus-community/windows_exporter/pkg/httphandler"
|
||||
winlog "github.com/prometheus-community/windows_exporter/pkg/log"
|
||||
"github.com/prometheus-community/windows_exporter/pkg/log/flag"
|
||||
"github.com/prometheus-community/windows_exporter/pkg/types"
|
||||
"github.com/prometheus-community/windows_exporter/pkg/utils"
|
||||
"github.com/prometheus/common/version"
|
||||
"github.com/prometheus/exporter-toolkit/web"
|
||||
webflag "github.com/prometheus/exporter-toolkit/web/kingpinflag"
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
// Mapping of priority names to uin32 values required by windows.SetPriorityClass.
|
||||
var priorityStringToInt = map[string]uint32{
|
||||
"realtime": windows.REALTIME_PRIORITY_CLASS,
|
||||
"high": windows.HIGH_PRIORITY_CLASS,
|
||||
"abovenormal": windows.ABOVE_NORMAL_PRIORITY_CLASS,
|
||||
"normal": windows.NORMAL_PRIORITY_CLASS,
|
||||
"belownormal": windows.BELOW_NORMAL_PRIORITY_CLASS,
|
||||
"low": windows.IDLE_PRIORITY_CLASS,
|
||||
}
|
||||
|
||||
func main() {
|
||||
os.Exit(run())
|
||||
exitCode := run()
|
||||
|
||||
// If we are running as a service, we need to signal the service control manager that we are done.
|
||||
if !windowsservice.IsService {
|
||||
os.Exit(exitCode)
|
||||
}
|
||||
|
||||
windowsservice.ExitCodeCh <- exitCode
|
||||
|
||||
// Wait for the service control manager to signal that we are done.
|
||||
<-windowsservice.StopCh
|
||||
}
|
||||
|
||||
func run() int {
|
||||
startTime := time.Now()
|
||||
|
||||
app := kingpin.New("windows_exporter", "A metrics collector for Windows.")
|
||||
|
||||
var (
|
||||
@@ -73,18 +87,10 @@ func run() int {
|
||||
"web.disable-exporter-metrics",
|
||||
"Exclude metrics about the exporter itself (promhttp_*, process_*, go_*).",
|
||||
).Bool()
|
||||
maxRequests = app.Flag(
|
||||
"telemetry.max-requests",
|
||||
"Maximum number of concurrent requests. 0 to disable.",
|
||||
).Default("5").Int()
|
||||
enabledCollectors = app.Flag(
|
||||
"collectors.enabled",
|
||||
"Comma-separated list of collectors to use. Use '[defaults]' as a placeholder for all the collectors enabled by default.").
|
||||
Default(types.DefaultCollectors).String()
|
||||
printCollectors = app.Flag(
|
||||
"collectors.print",
|
||||
"If true, print available collectors and exit.",
|
||||
).Bool()
|
||||
Default(collector.DefaultCollectors).String()
|
||||
timeoutMargin = app.Flag(
|
||||
"scrape.timeout-margin",
|
||||
"Seconds to subtract from the timeout allowed by the client. Tune to allow for overhead or high loads.",
|
||||
@@ -99,8 +105,15 @@ func run() int {
|
||||
).Default("normal").String()
|
||||
)
|
||||
|
||||
winlogConfig := &winlog.Config{}
|
||||
flag.AddFlags(app, winlogConfig)
|
||||
logFile := &log.AllowedFile{}
|
||||
|
||||
_ = logFile.Set("stdout")
|
||||
if windowsservice.IsService {
|
||||
_ = logFile.Set("eventlog")
|
||||
}
|
||||
|
||||
logConfig := &log.Config{File: logFile}
|
||||
flag.AddFlags(app, logConfig)
|
||||
|
||||
app.Version(version.Print("windows_exporter"))
|
||||
app.HelpFlag.Short('h')
|
||||
@@ -119,7 +132,7 @@ func run() int {
|
||||
return 1
|
||||
}
|
||||
|
||||
logger, err := winlog.New(winlogConfig)
|
||||
logger, err := log.New(logConfig)
|
||||
if err != nil {
|
||||
//nolint:sloglint // we do not have an logger yet
|
||||
slog.Error("failed to create logger",
|
||||
@@ -161,7 +174,7 @@ func run() int {
|
||||
return 1
|
||||
}
|
||||
|
||||
logger, err = winlog.New(winlogConfig)
|
||||
logger, err = log.New(logConfig)
|
||||
if err != nil {
|
||||
//nolint:sloglint // we do not have an logger yet
|
||||
slog.Error("failed to create logger",
|
||||
@@ -174,60 +187,42 @@ func run() int {
|
||||
|
||||
logger.Debug("Logging has Started")
|
||||
|
||||
if *printCollectors {
|
||||
printCollectorsToStdout()
|
||||
if err = setPriorityWindows(logger, os.Getpid(), *processPriority); err != nil {
|
||||
logger.Error("failed to set process priority",
|
||||
slog.Any("err", err),
|
||||
)
|
||||
|
||||
return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
// Only set process priority if a non-default and valid value has been set
|
||||
if priority, ok := priorityStringToInt[*processPriority]; ok && priority != windows.NORMAL_PRIORITY_CLASS {
|
||||
logger.Debug("setting process priority to " + *processPriority)
|
||||
enabledCollectorList := expandEnabledCollectors(*enabledCollectors)
|
||||
if err := collectors.Enable(enabledCollectorList); err != nil {
|
||||
logger.Error("couldn't enable collectors",
|
||||
slog.Any("err", err),
|
||||
)
|
||||
|
||||
if err = setPriorityWindows(os.Getpid(), priority); err != nil {
|
||||
logger.Error("failed to set process priority",
|
||||
slog.Any("err", err),
|
||||
)
|
||||
|
||||
return 1
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
enabledCollectorList := utils.ExpandEnabledCollectors(*enabledCollectors)
|
||||
collectors.Enable(enabledCollectorList)
|
||||
|
||||
// Initialize collectors before loading
|
||||
if err = collectors.Build(logger); err != nil {
|
||||
logger.Error("Couldn't load collectors",
|
||||
slog.Any("err", err),
|
||||
)
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
if err = collectors.SetPerfCounterQuery(logger); err != nil {
|
||||
logger.Error("Couldn't set performance counter query",
|
||||
slog.Any("err", err),
|
||||
)
|
||||
|
||||
return 1
|
||||
for _, err := range utils.SplitError(err) {
|
||||
logger.Warn("couldn't initialize collector",
|
||||
slog.Any("err", err),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
logCurrentUser(logger)
|
||||
|
||||
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())
|
||||
mux.Handle("GET "+*metricsPath, httphandler.New(logger, collectors, &httphandler.Options{
|
||||
DisableExporterMetrics: *disableExporterMetrics,
|
||||
TimeoutMargin: *timeoutMargin,
|
||||
MaxRequests: *maxRequests,
|
||||
}))
|
||||
|
||||
if *debugEnabled {
|
||||
@@ -238,7 +233,7 @@ func run() int {
|
||||
mux.HandleFunc("GET /debug/pprof/trace", pprof.Trace)
|
||||
}
|
||||
|
||||
logger.Info("Starting windows_exporter",
|
||||
logger.Info(fmt.Sprintf("starting windows_exporter in %s", time.Since(startTime)),
|
||||
slog.String("version", version.Version),
|
||||
slog.String("branch", version.Branch),
|
||||
slog.String("revision", version.GetRevision()),
|
||||
@@ -262,7 +257,7 @@ func run() int {
|
||||
errCh <- err
|
||||
}
|
||||
|
||||
errCh <- nil
|
||||
close(errCh)
|
||||
}()
|
||||
|
||||
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, os.Kill)
|
||||
@@ -271,7 +266,7 @@ func run() int {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
logger.Info("Shutting down windows_exporter via kill signal")
|
||||
case <-initiate.StopCh:
|
||||
case <-windowsservice.StopCh:
|
||||
logger.Info("Shutting down windows_exporter via service control")
|
||||
case err := <-errCh:
|
||||
if err != nil {
|
||||
@@ -293,32 +288,44 @@ func run() int {
|
||||
return 0
|
||||
}
|
||||
|
||||
func printCollectorsToStdout() {
|
||||
collectorNames := collector.Available()
|
||||
sort.Strings(collectorNames)
|
||||
|
||||
fmt.Println("Available collectors:") //nolint:forbidigo
|
||||
|
||||
for _, n := range collectorNames {
|
||||
fmt.Printf(" - %s\n", n) //nolint:forbidigo
|
||||
}
|
||||
}
|
||||
|
||||
func logCurrentUser(logger *slog.Logger) {
|
||||
if u, err := user.Current(); err == nil {
|
||||
logger.Info("Running as " + u.Username)
|
||||
|
||||
if strings.Contains(u.Username, "ContainerAdministrator") || strings.Contains(u.Username, "ContainerUser") {
|
||||
logger.Warn("Running as a preconfigured Windows Container user. This may mean you do not have Windows HostProcess containers configured correctly and some functionality will not work as expected.")
|
||||
}
|
||||
u, err := user.Current()
|
||||
if err != nil {
|
||||
logger.Warn("Unable to determine which user is running this exporter. More info: https://github.com/golang/go/issues/37348",
|
||||
slog.Any("err", err),
|
||||
)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
logger.Warn("Unable to determine which user is running this exporter. More info: https://github.com/golang/go/issues/37348")
|
||||
logger.Info("Running as " + u.Username)
|
||||
|
||||
if strings.Contains(u.Username, "ContainerAdministrator") || strings.Contains(u.Username, "ContainerUser") {
|
||||
logger.Warn("Running as a preconfigured Windows Container user. This may mean you do not have Windows HostProcess containers configured correctly and some functionality will not work as expected.")
|
||||
}
|
||||
}
|
||||
|
||||
func setPriorityWindows(pid int, priority uint32) error {
|
||||
// setPriorityWindows sets the priority of the current process to the specified value.
|
||||
func setPriorityWindows(logger *slog.Logger, pid int, priority string) error {
|
||||
// Mapping of priority names to uin32 values required by windows.SetPriorityClass.
|
||||
priorityStringToInt := map[string]uint32{
|
||||
"realtime": windows.REALTIME_PRIORITY_CLASS,
|
||||
"high": windows.HIGH_PRIORITY_CLASS,
|
||||
"abovenormal": windows.ABOVE_NORMAL_PRIORITY_CLASS,
|
||||
"normal": windows.NORMAL_PRIORITY_CLASS,
|
||||
"belownormal": windows.BELOW_NORMAL_PRIORITY_CLASS,
|
||||
"low": windows.IDLE_PRIORITY_CLASS,
|
||||
}
|
||||
|
||||
winPriority, ok := priorityStringToInt[priority]
|
||||
|
||||
// Only set process priority if a non-default and valid value has been set
|
||||
if !ok || winPriority != windows.NORMAL_PRIORITY_CLASS {
|
||||
return nil
|
||||
}
|
||||
|
||||
logger.Debug("setting process priority to " + priority)
|
||||
|
||||
// https://learn.microsoft.com/en-us/windows/win32/procthread/process-security-and-access-rights
|
||||
handle, err := windows.OpenProcess(
|
||||
windows.STANDARD_RIGHTS_REQUIRED|windows.SYNCHRONIZE|windows.SPECIFIC_RIGHTS_ALL,
|
||||
@@ -328,7 +335,7 @@ func setPriorityWindows(pid int, priority uint32) error {
|
||||
return fmt.Errorf("failed to open own process: %w", err)
|
||||
}
|
||||
|
||||
if err = windows.SetPriorityClass(handle, priority); err != nil {
|
||||
if err = windows.SetPriorityClass(handle, winPriority); err != nil {
|
||||
return fmt.Errorf("failed to set priority class: %w", err)
|
||||
}
|
||||
|
||||
@@ -338,3 +345,9 @@ func setPriorityWindows(pid int, priority uint32) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func expandEnabledCollectors(enabled string) []string {
|
||||
expanded := strings.ReplaceAll(enabled, "[defaults]", collector.DefaultCollectors)
|
||||
|
||||
return slices.Compact(strings.Split(expanded, ","))
|
||||
}
|
||||
BIN
cmd/windows_exporter/winres/icon.png
Normal file
BIN
cmd/windows_exporter/winres/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
56
cmd/windows_exporter/winres/winres.json
Normal file
56
cmd/windows_exporter/winres/winres.json
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"RT_GROUP_ICON": {
|
||||
"APP": {
|
||||
"0000": [
|
||||
"icon.png"
|
||||
]
|
||||
}
|
||||
},
|
||||
"RT_MANIFEST": {
|
||||
"#1": {
|
||||
"0409": {
|
||||
"description": "A Prometheus exporter for Windows machines.",
|
||||
"minimum-os": "win7",
|
||||
"execution-level": "as invoker",
|
||||
"ui-access": false,
|
||||
"auto-elevate": false,
|
||||
"dpi-awareness": "system",
|
||||
"disable-theming": false,
|
||||
"disable-window-filtering": false,
|
||||
"high-resolution-scrolling-aware": false,
|
||||
"ultra-high-resolution-scrolling-aware": false,
|
||||
"long-path-aware": false,
|
||||
"printer-driver-isolation": false,
|
||||
"gdi-scaling": false,
|
||||
"segment-heap": false,
|
||||
"use-common-controls-v6": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"RT_VERSION": {
|
||||
"#1": {
|
||||
"0000": {
|
||||
"fixed": {
|
||||
"file_version": "0.0.0.0",
|
||||
"product_version": "0.0.0.0"
|
||||
},
|
||||
"info": {
|
||||
"0409": {
|
||||
"Comments": "",
|
||||
"CompanyName": "Prometheus Community",
|
||||
"FileDescription": "A Prometheus exporter for Windows machines.",
|
||||
"FileVersion": "",
|
||||
"InternalName": "windows_exporter",
|
||||
"LegalCopyright": "",
|
||||
"LegalTrademarks": "",
|
||||
"OriginalFilename": "",
|
||||
"PrivateBuild": "",
|
||||
"ProductName": "windows_exporter",
|
||||
"ProductVersion": "",
|
||||
"SpecialBuild": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
# example configuration file for windows_exporter
|
||||
|
||||
collectors:
|
||||
enabled: cpu,cpu_info,exchange,iis,logical_disk,logon,memory,net,os,process,remote_fx,service,system,tcp,time,terminal_services,textfile
|
||||
collector:
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
{{ template "head" . }}
|
||||
|
||||
{{ template "prom_content_head" . }}
|
||||
<h1>Node Overview - {{ reReplaceAll "(.*?://)([^:/]+?)(:\\d+)?/.*" "$2" .Params.instance }}</h1>
|
||||
|
||||
<h3>CPU Usage</h3>
|
||||
<div id="cpuGraph"></div>
|
||||
<script>
|
||||
new PromConsole.Graph({
|
||||
node: document.querySelector("#cpuGraph"),
|
||||
expr: "sum by (mode)(irate(windows_cpu_time_total{job='node',instance='{{ .Params.instance }}',mode!='idle'}[5m]))",
|
||||
renderer: 'area',
|
||||
max: {{ with printf "count(count by (cpu)(windows_cpu_time_total{job='node',instance='%s'}))" .Params.instance | query }}{{ . | first | value }}{{ else}}undefined{{end}},
|
||||
yAxisFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
|
||||
yHoverFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
|
||||
yTitle: 'Cores'
|
||||
})
|
||||
</script>
|
||||
|
||||
<h3>Network Utilization</h3>
|
||||
<div id="networkioGraph"></div>
|
||||
<script>
|
||||
new PromConsole.Graph({
|
||||
node: document.querySelector("#networkioGraph"),
|
||||
expr: [
|
||||
"irate(windows_net_bytes_sent_total{job='node',instance='{{ .Params.instance }}',nic!~'^isatap_ec2_internal'}[5m])",
|
||||
"irate(windows_net_bytes_received_total{job='node',instance='{{ .Params.instance }}',nic!~'^isatap_ec2_internal'}[5m])",
|
||||
],
|
||||
min: 0,
|
||||
name: [ 'sent', 'received' ],
|
||||
yAxisFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
|
||||
yHoverFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
|
||||
yUnits: "B",
|
||||
yTitle: 'Network IO'
|
||||
})
|
||||
</script>
|
||||
|
||||
<h3>Disk I/O Utilization</h3>
|
||||
<div id="diskioGraph"></div>
|
||||
<script>
|
||||
new PromConsole.Graph({
|
||||
node: document.querySelector("#diskioGraph"),
|
||||
expr: [
|
||||
"100 - irate(windows_logical_disk_idle_seconds_total{job='node',instance='{{ .Params.instance }}',volume!~'^HarddiskVolume.*$'}[5m]) * 100",
|
||||
],
|
||||
min: 0,
|
||||
name: '[[ volume ]]',
|
||||
yAxisFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
|
||||
yHoverFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
|
||||
yUnits: "%",
|
||||
yTitle: 'Disk I/O Utilization'
|
||||
})
|
||||
</script>
|
||||
|
||||
<h3>Memory</h3>
|
||||
<div id="memoryGraph"></div>
|
||||
<script>
|
||||
new PromConsole.Graph({
|
||||
node: document.querySelector("#memoryGraph"),
|
||||
renderer: 'area',
|
||||
expr: [
|
||||
"windows_cs_physical_memory_bytes{job='node',instance='{{ .Params.instance }}'}",
|
||||
"windows_os_physical_memory_free_bytes{job='node',instance='{{ .Params.instance }}'}",
|
||||
"windows_cs_physical_memory__bytes{job='node',instance='{{ .Params.instance }}'} - windows_os_physical_memory_free_bytes{job='node',instance='{{.Params.instance}}'}",
|
||||
"windows_os_virtual_memory_bytes{job='node',instance='{{ .Params.instance }}'}",
|
||||
],
|
||||
name: ["Physical", "Free", "Used", "Virtual"],
|
||||
min: 0,
|
||||
yUnits: "B",
|
||||
yAxisFormatter: PromConsole.NumberFormatter.humanize1024,
|
||||
yHoverFormatter: PromConsole.NumberFormatter.humanize1024,
|
||||
yTitle: 'Memory'
|
||||
})
|
||||
</script>
|
||||
|
||||
{{ template "prom_right_table_head" }}
|
||||
<tr><th colspan="2">Overview</th></tr>
|
||||
<tr>
|
||||
<td>User CPU</td>
|
||||
<td>{{ template "prom_query_drilldown" (args (printf "sum(irate(windows_cpu_time_total{job='node',instance='%s',mode='user'}[5m])) * 100 / count(count by (cpu)(windows_cpu_time_total{job='node',instance='%s'}))" .Params.instance .Params.instance) "%" "printf.1f") }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Privileged CPU</td>
|
||||
<td>{{ template "prom_query_drilldown" (args (printf "sum(irate(windows_cpu_time_total{job='node',instance='%s',mode='privileged'}[5m])) * 100 / count(count by (cpu)(windows_cpu_time_total{job='node',instance='%s'}))" .Params.instance .Params.instance) "%" "printf.1f") }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Memory Total</td>
|
||||
<td>{{ template "prom_query_drilldown" (args (printf "windows_cs_physical_memory_bytes{job='node',instance='%s'}" .Params.instance) "B" "humanize1024") }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Memory Free</td>
|
||||
<td>{{ template "prom_query_drilldown" (args (printf "windows_os_physical_memory_free_bytes{job='node',instance='%s'}" .Params.instance) "B" "humanize1024") }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2">Network</th>
|
||||
</tr>
|
||||
{{ range printf "windows_net_bytes_received_total{job='node',instance='%s',nic!='isatap_ec2_internal'}" .Params.instance | query | sortByLabel "nic" }}
|
||||
<tr>
|
||||
<td>{{ .Labels.nic }} Received</td>
|
||||
<td>{{ template "prom_query_drilldown" (args (printf "irate(windows_net_bytes_received_total{job='node',instance='%s',nic='%s'}[5m])" .Labels.instance .Labels.nic) "B/s" "humanize") }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ .Labels.nic }} Transmitted</td>
|
||||
<td>{{ template "prom_query_drilldown" (args (printf "irate(windows_net_bytes_sent_total{job='node',instance='%s',nic='%s'}[5m])" .Labels.instance .Labels.nic) "B/s" "humanize") }}</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2">Disks</th>
|
||||
</tr>
|
||||
{{ range printf "windows_logical_disk_size_bytes{job='node',instance='%s',volume!~'^HarddiskVolume.*$'}" .Params.instance | query | sortByLabel "volume" }}
|
||||
<tr>
|
||||
<td>{{ .Labels.volume }} Utilization</td>
|
||||
<td>{{ template "prom_query_drilldown" (args (printf "100 - irate(windows_logical_disk_idle_seconds_total{job='node',instance='%s',volume='%s'}[5m]) * 100" .Labels.instance .Labels.volume) "%" "printf.1f") }}</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{ range printf "windows_logical_disk_size_bytes{job='node',instance='%s',volume!~'^HarddiskVolume.*$'}" .Params.instance | query | sortByLabel "volume" }}
|
||||
<tr>
|
||||
<td>{{ .Labels.volume }} Throughput</td>
|
||||
<td>{{ template "prom_query_drilldown" (args (printf "irate(windows_logical_disk_read_bytes_total{job='node',instance='%s',volume='%s'}[5m]) + irate(windows_logical_disk_write_bytes_total{job='node',instance='%s',volume='%s'}[5m])" .Labels.instance .Labels.volume .Labels.instance .Labels.volume) "B/s" "humanize") }}</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
<tr>
|
||||
<th colspan="2">Filesystem Fullness</th>
|
||||
</tr>
|
||||
{{ define "roughlyNearZero" }}
|
||||
{{ if gt .1 . }}~0{{ else }}{{ printf "%.1f" . }}{{ end }}
|
||||
{{ end }}
|
||||
{{ range printf "windows_logical_disk_size_bytes{job='node',instance='%s',volume!~'^HarddiskVolume.*$'}" .Params.instance | query | sortByLabel "volume" }}
|
||||
<tr>
|
||||
<td>{{ .Labels.volume }}</td>
|
||||
<td>{{ template "prom_query_drilldown" (args (printf "100 - windows_logical_disk_free_bytes{job='node',instance='%s',volume='%s'} / windows_logical_disk_size_bytes{job='node'} * 100" .Labels.instance .Labels.volume) "%" "roughlyNearZero") }}</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</tr>
|
||||
{{ template "prom_right_table_tail" }}
|
||||
|
||||
{{ template "prom_content_tail" . }}
|
||||
|
||||
{{ template "tail" }}
|
||||
@@ -37,10 +37,10 @@ This directory contains documentation of the collectors in the windows_exporter,
|
||||
- [`smtp`](collector.smtp.md)
|
||||
- [`system`](collector.system.md)
|
||||
- [`tcp`](collector.tcp.md)
|
||||
- [`teradici_pcoip`](collector.teradici_pcoip.md)
|
||||
- [`terminal_services`](collector.terminal_services.md)
|
||||
- [`textfile`](collector.textfile.md)
|
||||
- [`thermalzone`](collector.thermalzone.md)
|
||||
- [`time`](collector.time.md)
|
||||
- [`udp`](collector.udp.md)
|
||||
- [`update`](collector.update.md)
|
||||
- [`vmware`](collector.vmware.md)
|
||||
- [`vmware_blast`](collector.vmware_blast.md)
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
# exchange collector
|
||||
|
||||
The exchange collector collects metrics from MS Exchange hosts through perflib
|
||||
The exchange collector collects metrics from MS Exchange hosts through Performance Counter
|
||||
=======
|
||||
|
||||
|
||||
|||
|
||||
-|-
|
||||
Metric name prefix | `exchange`
|
||||
Classes | [Win32_PerfRawData_MSExchangeADAccess_MSExchangeADAccessProcesses](https://docs.microsoft.com/en-us/exchange/)<br/> [Win32_PerfRawData_MSExchangeTransportQueues_MSExchangeTransportQueues](https://docs.microsoft.com/en-us/exchange/)<br/> [Win32_PerfRawData_ESE_MSExchangeDatabaseInstances](https://docs.microsoft.com/en-us/exchange/)<br/> [Win32_PerfRawData_MSExchangeHttpProxy_MSExchangeHttpProxy](https://docs.microsoft.com/en-us/exchange/)<br/> [Win32_PerfRawData_MSExchangeActiveSync_MSExchangeActiveSync](https://docs.microsoft.com/en-us/exchange/)<br/> [Win32_PerfRawData_MSExchangeAvailabilityService_MSExchangeAvailabilityService](https://docs.microsoft.com/en-us/exchange/)<br/> [Win32_PerfRawData_MSExchangeOWA_MSExchangeOWA](https://docs.microsoft.com/en-us/exchange/)<br/> [Win32_PerfRawData_MSExchangeAutodiscover_MSExchangeAutodiscover](https://docs.microsoft.com/en-us/exchange/)<br/> [Win32_PerfRawData_MSExchangeWorkloadManagementWorkloads_MSExchangeWorkloadManagementWorkloads](https://docs.microsoft.com/en-us/exchange/)<br/> [Win32_PerfRawData_MSExchangeRpcClientAccess_MSExchangeRpcClientAccess](https://docs.microsoft.com/en-us/exchange/)<br/>
|
||||
Enabled by default? | No
|
||||
| | |
|
||||
|---------------------|---------------------|
|
||||
| Metric name prefix | `exchange` |
|
||||
| Source | Performance Counter |
|
||||
| Enabled by default? | No |
|
||||
|
||||
## Flags
|
||||
|
||||
@@ -19,45 +18,56 @@ Lists the Perflib Objects that are queried for data along with the perlfib objec
|
||||
Comma-separated list of collectors to use, for example: `--collectors.exchange.enabled=AvailabilityService,OutlookWebAccess`. Matching is case-sensitive. Depending on the exchange installation not all performance counters are available. Use `--collectors.exchange.list` to obtain a list of supported collectors.
|
||||
|
||||
## Metrics
|
||||
Name | Description
|
||||
--------------|---------------
|
||||
`windows_exchange_rpc_avg_latency_sec` | The latency (sec), averaged for the past 1024 packets
|
||||
`windows_exchange_rpc_requests` | Number of client requests currently being processed by the RPC Client Access service
|
||||
`windows_exchange_rpc_active_user_count` | Number of unique users that have shown some kind of activity in the last 2 minutes
|
||||
`windows_exchange_rpc_connection_count` | Total number of client connections maintained
|
||||
`windows_exchange_rpc_operations_total` | The rate at which RPC operations occur
|
||||
`windows_exchange_rpc_user_count` | Number of users
|
||||
`windows_exchange_ldap_read_time_sec` | Time (sec) to send an LDAP read request and receive a response
|
||||
`windows_exchange_ldap_search_time_sec` | Time (sec) to send an LDAP search request and receive a response
|
||||
`windows_exchange_ldap_write_time_sec` | Time (sec) to send an LDAP Add/Modify/Delete request and receive a response
|
||||
`windows_exchange_ldap_timeout_errors_total` | Total number of LDAP timeout errors
|
||||
`windows_exchange_ldap_long_running_ops_per_sec` | Long Running LDAP operations per second
|
||||
`windows_exchange_transport_queues_external_active_remote_delivery` | External Active Remote Delivery Queue length
|
||||
`windows_exchange_transport_queues_internal_active_remote_delivery` | Internal Active Remote Delivery Queue length
|
||||
`windows_exchange_transport_queues_active_mailbox_delivery` | Active Mailbox Delivery Queue length
|
||||
`windows_exchange_transport_queues_retry_mailbox_delivery` | Retry Mailbox Delivery Queue length
|
||||
`windows_exchange_transport_queues_unreachable` | Unreachable Queue length
|
||||
`windows_exchange_transport_queues_external_largest_delivery` | External Largest Delivery Queue length
|
||||
`windows_exchange_transport_queues_internal_largest_delivery` | Internal Largest Delivery Queue length
|
||||
`windows_exchange_transport_queues_poison` | Poison Queue length
|
||||
`windows_exchange_http_proxy_mailbox_server_locator_avg_latency_sec` | Average latency (sec) of MailboxServerLocator web service calls
|
||||
`windows_exchange_http_proxy_avg_auth_latency` | Average time spent authenticating CAS requests over the last 200 samples
|
||||
`windows_exchange_http_proxy_outstanding_proxy_requests` | Number of concurrent outstanding proxy requests
|
||||
`windows_exchange_http_proxy_requests_total` | Number of proxy requests processed each second
|
||||
`windows_exchange_avail_service_requests_per_sec` | Number of requests serviced per second
|
||||
`windows_exchange_owa_current_unique_users` | Number of unique users currently logged on to Outlook Web App
|
||||
`windows_exchange_owa_requests_total` | Number of requests handled by Outlook Web App per second
|
||||
`windows_exchange_autodiscover_requests_total` | Number of autodiscover service requests processed each second
|
||||
`windows_exchange_workload_active_tasks` | Number of active tasks currently running in the background for workload management
|
||||
`windows_exchange_workload_completed_tasks` | Number of workload management tasks that have been completed
|
||||
`windows_exchange_workload_queued_tasks` | Number of workload management tasks that are currently queued up waiting to be processed
|
||||
`windows_exchange_workload_yielded_tasks` | The total number of tasks that have been yielded by a workload
|
||||
`windows_exchange_workload_is_active` | Active indicates whether the workload is in an active (1) or paused (0) state
|
||||
`windows_exchange_activesync_requests_total` | Num HTTP requests received from the client via ASP.NET per sec. Shows Current user load
|
||||
`windows_exchange_http_proxy_avg_cas_proccessing_latency_sec` | Average latency (sec) of CAS processing time over the last 200 reqs
|
||||
`windows_exchange_http_proxy_mailbox_proxy_failure_rate` | % of failures between this CAS and MBX servers over the last 200 sample
|
||||
`windows_exchange_activesync_ping_cmds_pending` | Number of ping commands currently pending in the queue
|
||||
`windows_exchange_activesync_sync_cmds_total` | Number of sync commands processed per second. Clients use this command to synchronize items within a folder
|
||||
| Name | Description |
|
||||
|-----------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|
|
||||
| `windows_exchange_rpc_avg_latency_sec` | The latency (sec), averaged for the past 1024 packets |
|
||||
| `windows_exchange_rpc_requests` | Number of client requests currently being processed by the RPC Client Access service |
|
||||
| `windows_exchange_rpc_active_user_count` | Number of unique users that have shown some kind of activity in the last 2 minutes |
|
||||
| `windows_exchange_rpc_connection_count` | Total number of client connections maintained |
|
||||
| `windows_exchange_rpc_operations_total` | The rate at which RPC operations occur |
|
||||
| `windows_exchange_rpc_user_count` | Number of users |
|
||||
| `windows_exchange_ldap_read_time_sec` | Time (sec) to send an LDAP read request and receive a response |
|
||||
| `windows_exchange_ldap_search_time_sec` | Time (sec) to send an LDAP search request and receive a response |
|
||||
| `windows_exchange_ldap_write_time_sec` | Time (sec) to send an LDAP Add/Modify/Delete request and receive a response |
|
||||
| `windows_exchange_ldap_timeout_errors_total` | Total number of LDAP timeout errors |
|
||||
| `windows_exchange_ldap_long_running_ops_per_sec` | Long Running LDAP operations per second |
|
||||
| `windows_exchange_transport_queues_external_active_remote_delivery` | External Active Remote Delivery Queue length |
|
||||
| `windows_exchange_transport_queues_internal_active_remote_delivery` | Internal Active Remote Delivery Queue length |
|
||||
| `windows_exchange_transport_queues_active_mailbox_delivery` | Active Mailbox Delivery Queue length |
|
||||
| `windows_exchange_transport_queues_retry_mailbox_delivery` | Retry Mailbox Delivery Queue length |
|
||||
| `windows_exchange_transport_queues_unreachable` | Unreachable Queue length |
|
||||
| `windows_exchange_transport_queues_external_largest_delivery` | External Largest Delivery Queue length |
|
||||
| `windows_exchange_transport_queues_internal_largest_delivery` | Internal Largest Delivery Queue length |
|
||||
| `windows_exchange_transport_queues_poison` | Poison Queue length |
|
||||
| `windows_exchange_transport_queues_messages_queued_for_delivery_total` | Messages Queued For Delivery Total |
|
||||
| `windows_exchange_transport_queues_messages_submitted_total` | Messages Submitted Total |
|
||||
| `windows_exchange_transport_queues_messages_delayed_total` | Messages Delayed Total |
|
||||
| `windows_exchange_transport_queues_messages_completed_delivery_total` | Messages Completed Delivery Total |
|
||||
| `windows_exchange_transport_queues_shadow_queue_length` | Shadow Queue Length |
|
||||
| `windows_exchange_transport_queues_submission_queue_length` | Submission Queue Length |
|
||||
| `windows_exchange_transport_queues_delay_queue_length` | Delay Queue Length |
|
||||
| `windows_exchange_transport_queues_items_completed_delivery_total` | Items Completed Delivery Total |
|
||||
| `windows_exchange_transport_queues_items_queued_for_delivery_expired_total` | Items Queued For Delivery Expired Total |
|
||||
| `windows_exchange_transport_queues_items_queued_for_delivery_total` | Items Queued For Delivery Total |
|
||||
| `windows_exchange_transport_queues_items_resubmitted_total` | Items Resubmitted Total |
|
||||
| `windows_exchange_http_proxy_mailbox_server_locator_avg_latency_sec` | Average latency (sec) of MailboxServerLocator web service calls |
|
||||
| `windows_exchange_http_proxy_avg_auth_latency` | Average time spent authenticating CAS requests over the last 200 samples |
|
||||
| `windows_exchange_http_proxy_outstanding_proxy_requests` | Number of concurrent outstanding proxy requests |
|
||||
| `windows_exchange_http_proxy_requests_total` | Number of proxy requests processed each second |
|
||||
| `windows_exchange_avail_service_requests_per_sec` | Number of requests serviced per second |
|
||||
| `windows_exchange_owa_current_unique_users` | Number of unique users currently logged on to Outlook Web App |
|
||||
| `windows_exchange_owa_requests_total` | Number of requests handled by Outlook Web App per second |
|
||||
| `windows_exchange_autodiscover_requests_total` | Number of autodiscover service requests processed each second |
|
||||
| `windows_exchange_workload_active_tasks` | Number of active tasks currently running in the background for workload management |
|
||||
| `windows_exchange_workload_completed_tasks` | Number of workload management tasks that have been completed |
|
||||
| `windows_exchange_workload_queued_tasks` | Number of workload management tasks that are currently queued up waiting to be processed |
|
||||
| `windows_exchange_workload_yielded_tasks` | The total number of tasks that have been yielded by a workload |
|
||||
| `windows_exchange_workload_is_active` | Active indicates whether the workload is in an active (1) or paused (0) state |
|
||||
| `windows_exchange_activesync_requests_total` | Num HTTP requests received from the client via ASP.NET per sec. Shows Current user load |
|
||||
| `windows_exchange_http_proxy_avg_cas_proccessing_latency_sec` | Average latency (sec) of CAS processing time over the last 200 reqs |
|
||||
| `windows_exchange_http_proxy_mailbox_proxy_failure_rate` | % of failures between this CAS and MBX servers over the last 200 sample |
|
||||
| `windows_exchange_activesync_ping_cmds_pending` | Number of ping commands currently pending in the queue |
|
||||
| `windows_exchange_activesync_sync_cmds_total` | Number of sync commands processed per second. Clients use this command to synchronize items within a folder |
|
||||
|
||||
### Example metric
|
||||
_This collector does not yet have explained examples, we would appreciate your help adding them!_
|
||||
|
||||
@@ -2,110 +2,262 @@
|
||||
|
||||
The hyperv collector exposes metrics about the Hyper-V hypervisor
|
||||
|
||||
|||
|
||||
-|-
|
||||
Metric name prefix | `hyperv`
|
||||
Classes | `Win32_PerfRawData_VmmsVirtualMachineStats_HyperVVirtualMachineHealthSummary`<br/>`Win32_PerfRawData_VidPerfProvider_HyperVVMVidPartition`<br/>`Win32_PerfRawData_HvStats_HyperVHypervisorRootPartition`<br/>`Win32_PerfRawData_HvStats_HyperVHypervisor`<br/>`Win32_PerfRawData_HvStats_HyperVHypervisorLogicalProcessor`<br/>`Win32_PerfRawData_HvStats_HyperVHypervisorRootVirtualProcessor`<br/>`Win32_PerfRawData_HvStats_HyperVHypervisorVirtualProcessor`<br/>`Win32_PerfRawData_NvspSwitchStats_HyperVVirtualSwitch`<br/>`Win32_PerfRawData_EthernetPerfProvider_HyperVLegacyNetworkAdapter`<br/>`Win32_PerfRawData_Counters_HyperVVirtualStorageDevice`<br/>`Win32_PerfRawData_NvspNicStats_HyperVVirtualNetworkAdapter`
|
||||
Enabled by default? | No
|
||||
| | |
|
||||
|---------------------|----------------------|
|
||||
| Metric name prefix | `hyperv` |
|
||||
| Source | Performance counters |
|
||||
| Enabled by default? | No |
|
||||
|
||||
## Flags
|
||||
|
||||
None
|
||||
### `--collectors.hyperv.enabled`
|
||||
Comma-separated list of collectors to use, for example:
|
||||
`--collectors.hyperv.enabled=dynamic_memory_balancer,dynamic_memory_vm,hypervisor_logical_processor,hypervisor_root_partition,hypervisor_root_virtual_processor,hypervisor_virtual_processor,legacy_network_adapter,virtual_machine_health_summary,virtual_machine_vid_partition,virtual_network_adapter,virtual_storage_device,virtual_switch`.
|
||||
Matching is case-sensitive.
|
||||
|
||||
## Metrics
|
||||
|
||||
Name | Description | Type | Labels
|
||||
-----|-------------|------|-------
|
||||
`windows_hyperv_health_critical` | _Not yet documented_ | counter | None
|
||||
`windows_hyperv_health_ok` | _Not yet documented_ | counter | None
|
||||
`windows_hyperv_vid_physical_pages_allocated` | _Not yet documented_ | counter | `vm`
|
||||
`windows_hyperv_vid_preferred_numa_node_index` | _Not yet documented_ | counter | `vm`
|
||||
`windows_hyperv_vid_remote_physical_pages` | _Not yet documented_ | counter | `vm`
|
||||
`windows_hyperv_root_partition_address_spaces` | _Not yet documented_ | counter | None
|
||||
`windows_hyperv_root_partition_attached_devices` | _Not yet documented_ | counter | None
|
||||
`windows_hyperv_root_partition_deposited_pages` | _Not yet documented_ | counter | None
|
||||
`windows_hyperv_root_partition_device_dma_errors` | _Not yet documented_ | counter | None
|
||||
`windows_hyperv_root_partition_device_interrupt_errors` | _Not yet documented_ | counter | None
|
||||
`windows_hyperv_root_partition_device_interrupt_mappings` | _Not yet documented_ | counter | None
|
||||
`windows_hyperv_root_partition_device_interrupt_throttle_events` | _Not yet documented_ | counter | None
|
||||
`windows_hyperv_root_partition_preferred_numa_node_index` | _Not yet documented_ | counter | None
|
||||
`windows_hyperv_root_partition_gpa_space_modifications` | _Not yet documented_ | counter | None
|
||||
`windows_hyperv_root_partition_io_tlb_flush_cost` | _Not yet documented_ | counter | None
|
||||
`windows_hyperv_root_partition_io_tlb_flush` | _Not yet documented_ | counter | None
|
||||
`windows_hyperv_root_partition_recommended_virtual_tlb_size` | _Not yet documented_ | counter | None
|
||||
`windows_hyperv_root_partition_physical_pages_allocated` | _Not yet documented_ | counter | None
|
||||
`windows_hyperv_root_partition_1G_device_pages` | _Not yet documented_ | counter | None
|
||||
`windows_hyperv_root_partition_1G_gpa_pages` | _Not yet documented_ | counter | None
|
||||
`windows_hyperv_root_partition_2M_device_pages` | _Not yet documented_ | counter | None
|
||||
`windows_hyperv_root_partition_2M_gpa_pages` | _Not yet documented_ | counter | None
|
||||
`windows_hyperv_root_partition_4K_device_pages` | _Not yet documented_ | counter | None
|
||||
`windows_hyperv_root_partition_4K_gpa_pages` | _Not yet documented_ | counter | None
|
||||
`windows_hyperv_root_partition_virtual_tlb_flush_entires` | _Not yet documented_ | counter | None
|
||||
`windows_hyperv_root_partition_virtual_tlb_pages` | _Not yet documented_ | counter | None
|
||||
`windows_hyperv_hypervisor_virtual_processors` | _Not yet documented_ | counter | None
|
||||
`windows_hyperv_hypervisor_logical_processors` | _Not yet documented_ | counter | None
|
||||
`windows_hyperv_host_lp_guest_run_time_percent` | _Not yet documented_ | counter | `core`
|
||||
`windows_hyperv_host_lp_hypervisor_run_time_percent` | _Not yet documented_ | counter | `core`
|
||||
`windows_hyperv_host_lp_total_run_time_percent` | _Not yet documented_ | counter | `core`
|
||||
`windows_hyperv_host_cpu_guest_run_time` | _Not yet documented_ | counter | `core`
|
||||
`windows_hyperv_host_cpu_hypervisor_run_time` | _Not yet documented_ | counter | `core`
|
||||
`windows_hyperv_host_cpu_remote_run_time` | _Not yet documented_ | counter | `core`
|
||||
`windows_hyperv_host_cpu_total_run_time` | _Not yet documented_ | counter | `core`
|
||||
`windows_hyperv_host_cpu_wait_time_per_dispatch_total` | _Not yet documented_ | counter | `core`
|
||||
`windows_hyperv_vm_cpu_guest_run_time` | _Not yet documented_ | counter | `vm`, `core`
|
||||
`windows_hyperv_vm_cpu_hypervisor_run_time` | _Not yet documented_ | counter | `vm`, `core`
|
||||
`windows_hyperv_vm_cpu_remote_run_time` | _Not yet documented_ | counter | `vm`, `core`
|
||||
`windows_hyperv_vm_cpu_wait_time_per_dispatch_total` | _Not yet documented_ | counter | `vm`, `core`
|
||||
`windows_hyperv_vm_memory_added_total` | _Not yet documented_ | counter | `vm`
|
||||
`windows_hyperv_vm_memory_pressure_average` | _Not yet documented_ | gauge | `vm`
|
||||
`windows_hyperv_vm_memory_pressure_current` | _Not yet documented_ | counter | `vm`
|
||||
`windows_hyperv_vm_memory_physical_guest_visible` | _Not yet documented_ | gauge | `vm`
|
||||
`windows_hyperv_vm_memory_pressure_maximum` | _Not yet documented_ | gauge | `vm`
|
||||
`windows_hyperv_vm_memory_add_operations_total` | _Not yet documented_ | counter | `vm`
|
||||
`windows_hyperv_vm_memory_remove_operations_total` | _Not yet documented_ | counter | `vm`
|
||||
`windows_hyperv_vm_memory_pressure_minumim` | _Not yet documented_ | gauge | `vm`
|
||||
`windows_hyperv_vm_memory_physical` | _Not yet documented_ | gauge | `vm`
|
||||
`windows_hyperv_vm_memory_removed_total` | _Not yet documented_ | counter | `vm`
|
||||
`windows_hyperv_vm_cpu_total_run_time` | _Not yet documented_ | counter | `vm`, `core`
|
||||
`windows_hyperv_vswitch_broadcast_packets_received_total` | _Not yet documented_ | counter | `vswitch`
|
||||
`windows_hyperv_vswitch_broadcast_packets_sent_total` | _Not yet documented_ | counter | `vswitch`
|
||||
`windows_hyperv_vswitch_bytes_total` | _Not yet documented_ | counter | `vswitch`
|
||||
`windows_hyperv_vswitch_bytes_received_total` | _Not yet documented_ | counter | `vswitch`
|
||||
`windows_hyperv_vswitch_bytes_sent_total` | _Not yet documented_ | counter | `vswitch`
|
||||
`windows_hyperv_vswitch_directed_packets_received_total` | _Not yet documented_ | counter | `vswitch`
|
||||
`windows_hyperv_vswitch_directed_packets_send_total` | _Not yet documented_ | counter | `vswitch`
|
||||
`windows_hyperv_vswitch_dropped_packets_incoming_total` | _Not yet documented_ | counter | `vswitch`
|
||||
`windows_hyperv_vswitch_dropped_packets_outcoming_total` | _Not yet documented_ | counter | `vswitch`
|
||||
`windows_hyperv_vswitch_extensions_dropped_packets_incoming_total` | _Not yet documented_ | counter | `vswitch`
|
||||
`windows_hyperv_vswitch_extensions_dropped_packets_outcoming_total` | _Not yet documented_ | counter | `vswitch`
|
||||
`windows_hyperv_vswitch_learned_mac_addresses_total` | _Not yet documented_ | counter | `vswitch`
|
||||
`windows_hyperv_vswitch_multicast_packets_received_total` | _Not yet documented_ | counter | `vswitch`
|
||||
`windows_hyperv_vswitch_multicast_packets_sent_total` | _Not yet documented_ | counter | `vswitch`
|
||||
`windows_hyperv_vswitch_number_of_send_channel_moves_total` | _Not yet documented_ | counter | `vswitch`
|
||||
`windows_hyperv_vswitch_number_of_vmq_moves_total` | _Not yet documented_ | counter | `vswitch`
|
||||
`windows_hyperv_vswitch_packets_flooded_total` | _Not yet documented_ | counter | `vswitch`
|
||||
`windows_hyperv_vswitch_packets_total` | _Not yet documented_ | counter | `vswitch`
|
||||
`windows_hyperv_vswitch_packets_received_total` | _Not yet documented_ | counter | `vswitch`
|
||||
`windows_hyperv_vswitch_packets_sent_total` | _Not yet documented_ | counter | `vswitch`
|
||||
`windows_hyperv_vswitch_purged_mac_addresses_total` | _Not yet documented_ | counter | `vswitch`
|
||||
`windows_hyperv_ethernet_bytes_dropped` | _Not yet documented_ | counter | `adapter`
|
||||
`windows_hyperv_ethernet_bytes_received` | _Not yet documented_ | counter | `adapter`
|
||||
`windows_hyperv_ethernet_bytes_sent` | _Not yet documented_ | counter | `adapter`
|
||||
`windows_hyperv_ethernet_frames_dropped` | _Not yet documented_ | counter | `adapter`
|
||||
`windows_hyperv_ethernet_frames_received` | _Not yet documented_ | counter | `adapter`
|
||||
`windows_hyperv_ethernet_frames_sent` | _Not yet documented_ | counter | `adapter`
|
||||
`windows_hyperv_vm_device_error_count` | _Not yet documented_ | counter | `vm_device`
|
||||
`windows_hyperv_vm_device_queue_length` | _Not yet documented_ | counter | `vm_device`
|
||||
`windows_hyperv_vm_device_bytes_read` | _Not yet documented_ | counter | `vm_device`
|
||||
`windows_hyperv_vm_device_operations_read` | _Not yet documented_ | counter | `vm_device`
|
||||
`windows_hyperv_vm_device_bytes_written` | _Not yet documented_ | counter | `vm_device`
|
||||
`windows_hyperv_vm_device_operations_written` | _Not yet documented_ | counter | `vm_device`
|
||||
`windows_hyperv_vm_interface_bytes_received` | _Not yet documented_ | counter | `vm_interface`
|
||||
`windows_hyperv_vm_interface_bytes_sent` | _Not yet documented_ | counter | `vm_interface`
|
||||
`windows_hyperv_vm_interface_packets_incoming_dropped` | _Not yet documented_ | counter | `vm_interface`
|
||||
`windows_hyperv_vm_interface_packets_outgoing_dropped` | _Not yet documented_ | counter | `vm_interface`
|
||||
`windows_hyperv_vm_interface_packets_received` | _Not yet documented_ | counter | `vm_interface`
|
||||
`windows_hyperv_vm_interface_packets_sent` | _Not yet documented_ | counter | `vm_interface`
|
||||
### Hyper-V Datastore
|
||||
### Hyper-V Datastore Metrics Documentation
|
||||
|
||||
This documentation outlines the available metrics for monitoring Hyper-V Datastore performance and resource usage using Prometheus. All metrics are prefixed with `windows_hyperv_datastore`.
|
||||
|
||||
| Metric Name | Description | Type | Labels |
|
||||
|------------------------------------------------------------------------|---------------------------------------------------------------------------------|---------|-----------|
|
||||
| `windows_hyperv_datastore_fragmentation_ratio` | Represents the fragmentation ratio of the DataStore. | gauge | datastore |
|
||||
| `windows_hyperv_datastore_sector_size_bytes` | Represents the sector size of the DataStore in bytes. | gauge | datastore |
|
||||
| `windows_hyperv_datastore_data_alignment_bytes` | Represents the data alignment of the DataStore in bytes. | gauge | datastore |
|
||||
| `windows_hyperv_datastore_current_replay_log_size_bytes` | Represents the current replay log size of the DataStore in bytes. | gauge | datastore |
|
||||
| `windows_hyperv_datastore_available_entries` | Represents the number of available entries inside object tables. | gauge | datastore |
|
||||
| `windows_hyperv_datastore_empty_entries` | Represents the number of empty entries inside object tables. | gauge | datastore |
|
||||
| `windows_hyperv_datastore_free_bytes` | Represents the number of free bytes inside key tables. | gauge | datastore |
|
||||
| `windows_hyperv_datastore_data_end_bytes` | Represents the data end of the DataStore in bytes. | gauge | datastore |
|
||||
| `windows_hyperv_datastore_file_objects` | Represents the number of file objects in the DataStore. | gauge | datastore |
|
||||
| `windows_hyperv_datastore_object_tables` | Represents the number of object tables in the DataStore. | gauge | datastore |
|
||||
| `windows_hyperv_datastore_key_tables` | Represents the number of key tables in the DataStore. | gauge | datastore |
|
||||
| `windows_hyperv_datastore_file_data_size_bytes` | Represents the file data size in bytes of the DataStore. | gauge | datastore |
|
||||
| `windows_hyperv_datastore_table_data_size_bytes` | Represents the table data size in bytes of the DataStore. | gauge | datastore |
|
||||
| `windows_hyperv_datastore_names_size_bytes` | Represents the names size in bytes of the DataStore. | gauge | datastore |
|
||||
| `windows_hyperv_datastore_number_of_keys` | Represents the number of keys in the DataStore. | gauge | datastore |
|
||||
| `windows_hyperv_datastore_reconnect_latency_microseconds` | Represents the reconnect latency in microseconds of the DataStore. | gauge | datastore |
|
||||
| `windows_hyperv_datastore_disconnect_count` | Represents the disconnect count of the DataStore. | counter | datastore |
|
||||
| `windows_hyperv_datastore_write_to_file_byte_latency_microseconds` | Represents the write-to-file byte latency in microseconds of the DataStore. | gauge | datastore |
|
||||
| `windows_hyperv_datastore_write_to_file_byte_count` | Represents the write-to-file byte count of the DataStore. | counter | datastore |
|
||||
| `windows_hyperv_datastore_write_to_file_count` | Represents the write-to-file count of the DataStore. | counter | datastore |
|
||||
| `windows_hyperv_datastore_read_from_file_byte_latency_microseconds` | Represents the read-from-file byte latency in microseconds of the DataStore. | gauge | datastore |
|
||||
| `windows_hyperv_datastore_read_from_file_byte_count` | Represents the read-from-file byte count of the DataStore. | counter | datastore |
|
||||
| `windows_hyperv_datastore_read_from_file_count` | Represents the read-from-file count of the DataStore. | counter | datastore |
|
||||
| `windows_hyperv_datastore_write_to_storage_byte_latency_microseconds` | Represents the write-to-storage byte latency in microseconds of the DataStore. | gauge | datastore |
|
||||
| `windows_hyperv_datastore_write_to_storage_byte_count` | Represents the write-to-storage byte count of the DataStore. | counter | datastore |
|
||||
| `windows_hyperv_datastore_write_to_storage_count` | Represents the write-to-storage count of the DataStore. | counter | datastore |
|
||||
| `windows_hyperv_datastore_read_from_storage_byte_latency_microseconds` | Represents the read-from-storage byte latency in microseconds of the DataStore. | gauge | datastore |
|
||||
| `windows_hyperv_datastore_read_from_storage_byte_count` | Represents the read-from-storage byte count of the DataStore. | counter | datastore |
|
||||
| `windows_hyperv_datastore_read_from_storage_count` | Represents the read-from-storage count of the DataStore. | counter | datastore |
|
||||
| `windows_hyperv_datastore_commit_byte_latency_microseconds` | Represents the commit byte latency in microseconds of the DataStore. | gauge | datastore |
|
||||
| `windows_hyperv_datastore_commit_byte_count` | Represents the commit byte count of the DataStore. | counter | datastore |
|
||||
| `windows_hyperv_datastore_commit_count` | Represents the commit count of the DataStore. | counter | datastore |
|
||||
| `windows_hyperv_datastore_cache_update_operation_latency_microseconds` | Represents the cache update operation latency in microseconds of the DataStore. | gauge | datastore |
|
||||
| `windows_hyperv_datastore_cache_update_operation_count` | Represents the cache update operation count of the DataStore. | counter | datastore |
|
||||
| `windows_hyperv_datastore_commit_operation_latency_microseconds` | Represents the commit operation latency in microseconds of the DataStore. | gauge | datastore |
|
||||
| `windows_hyperv_datastore_commit_operation_count` | Represents the commit operation count of the DataStore. | counter | datastore |
|
||||
| `windows_hyperv_datastore_compact_operation_latency_microseconds` | Represents the compact operation latency in microseconds of the DataStore. | gauge | datastore |
|
||||
| `windows_hyperv_datastore_compact_operation_count` | Represents the compact operation count of the DataStore. | counter | datastore |
|
||||
| `windows_hyperv_datastore_load_file_operation_latency_microseconds` | Represents the load file operation latency in microseconds of the DataStore. | gauge | datastore |
|
||||
| `windows_hyperv_datastore_load_file_operation_count` | Represents the load file operation count of the DataStore. | counter | datastore |
|
||||
| `windows_hyperv_datastore_remove_operation_latency_microseconds` | Represents the remove operation latency in microseconds of the DataStore. | gauge | datastore |
|
||||
| `windows_hyperv_datastore_remove_operation_count` | Represents the remove operation count of the DataStore. | counter | datastore |
|
||||
| `windows_hyperv_datastore_query_size_operation_latency_microseconds` | Represents the query size operation latency in microseconds of the DataStore. | gauge | datastore |
|
||||
| `windows_hyperv_datastore_query_size_operation_count` | Represents the query size operation count of the DataStore. | counter | datastore |
|
||||
| `windows_hyperv_datastore_set_operation_latency_microseconds` | Represents the set operation latency in microseconds of the DataStore. | gauge | datastore |
|
||||
| `windows_hyperv_datastore_set_operation_count` | Represents the set operation count of the DataStore. | counter | datastore |
|
||||
|
||||
### Hyper-V Dynamic Memory Balancer
|
||||
|
||||
Some metrics explained: https://learn.microsoft.com/en-us/archive/blogs/chrisavis/monitoring-dynamic-memory-in-windows-server-hyper-v-2012
|
||||
|
||||
| Name | Description | Type | Labels |
|
||||
|-------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------|-------|------------|
|
||||
| `windows_hyperv_dynamic_memory_balancer_available_memory_bytes` | Represents the amount of memory left on the node. | gauge | `balancer` |
|
||||
| `windows_hyperv_dynamic_memory_balancer_available_memory_for_balancing_bytes` | Represents the available memory for balancing purposes. | gauge | `balancer` |
|
||||
| `windows_hyperv_dynamic_memory_balancer_average_pressure_ratio` | Represents the average system pressure on the balancer node among all balanced objects. | gauge | `balancer` |
|
||||
| `windows_hyperv_dynamic_memory_balancer_system_current_pressure_ratio` | Represents the current pressure in the system. | gauge | `balancer` |
|
||||
|
||||
|
||||
### Hyper-V Dynamic Memory VM
|
||||
|
||||
| Name | Description | Type | Labels |
|
||||
|------------------------------------------------------------------------|-----------------------------------------------------------------------------------|---------|--------|
|
||||
| `windows_hyperv_dynamic_memory_vm_added_bytes_total` | Represents the cumulative amount of memory added to the VM. | counter | `vm` |
|
||||
| `windows_hyperv_dynamic_memory_vm_pressure_current_ratio` | Represents the current pressure in the VM. | gauge | `vm` |
|
||||
| `windows_hyperv_dynamic_memory_vm_guest_available_bytes` | Represents the current amount of available memory in the VM (reported by the VM). | gauge | `vm` |
|
||||
| `windows_hyperv_dynamic_memory_vm_guest_visible_physical_memory_bytes` | Represents the amount of memory visible in the VM | gauge | `vm` |
|
||||
| `windows_hyperv_dynamic_memory_vm_pressure_maximum_ratio` | Represents the maximum pressure band in the VM. | gauge | `vm` |
|
||||
| `windows_hyperv_dynamic_memory_vm_add_operations_total` | Represents the total number of add operations for the VM. | counter | `vm` |
|
||||
| `windows_hyperv_dynamic_memory_vm_remove_operations_total` | Represents the total number of remove operations for the VM. | counter | `vm` |
|
||||
| `windows_hyperv_dynamic_memory_vm_pressure_minimum_ratio` | Represents the minimum pressure band in the VM. | gauge | `vm` |
|
||||
| `windows_hyperv_dynamic_memory_vm_physical` | Represents the current amount of memory in the VM. | gauge | `vm` |
|
||||
| `windows_hyperv_dynamic_memory_vm_removed_bytes_total` | Represents the cumulative amount of memory removed from the VM. | counter | `vm` |
|
||||
|
||||
### Hyper-V Hypervisor Logical Processor
|
||||
|
||||
| Name | Description | Type | Labels |
|
||||
|----------------------------------------------------------------------|------------------------------------------------------------------------|---------|----------------|
|
||||
| `windows_hyperv_hypervisor_logical_processor_time_total` | Time that processor spent in different modes (hypervisor, guest, idle) | counter | `core`.`state` |
|
||||
| `windows_hyperv_hypervisor_logical_processor_context_switches_total` | The rate of virtual processor context switches on the processor. | counter | `core` |
|
||||
|
||||
### Hyper-V Hypervisor Root Partition
|
||||
|
||||
| Name | Description | Type | Labels |
|
||||
|------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|---------|--------|
|
||||
| `windows_hyperv_root_partition_address_spaces` | The number of address spaces in the virtual TLB of the partition | gauge | None |
|
||||
| `windows_hyperv_root_partition_attached_devices` | The number of devices attached to the partition | gauge | None |
|
||||
| `windows_hyperv_root_partition_deposited_pages` | The number of pages deposited into the partition | gauge | None |
|
||||
| `windows_hyperv_root_partition_device_dma_errors` | An indicator of illegal DMA requests generated by all devices assigned to the partition | gauge | None |
|
||||
| `windows_hyperv_root_partition_device_interrupt_errors` | An indicator of illegal interrupt requests generated by all devices assigned to the partition | gauge | None |
|
||||
| `windows_hyperv_root_partition_device_interrupt_mappings` | The number of device interrupt mappings used by the partition | gauge | None |
|
||||
| `windows_hyperv_root_partition_device_interrupt_throttle_events` | The number of times an interrupt from a device assigned to the partition was temporarily throttled because the device was generating too many interrupts | gauge | None |
|
||||
| `windows_hyperv_root_partition_preferred_numa_node_index` | The number of pages present in the GPA space of the partition (zero for root partition) | gauge | None |
|
||||
| `windows_hyperv_root_partition_gpa_space_modifications` | The rate of modifications to the GPA space of the partition | counter | None |
|
||||
| `windows_hyperv_root_partition_io_tlb_flush_cost` | The average time (in nanoseconds) spent processing an I/O TLB flush | gauge | None |
|
||||
| `windows_hyperv_root_partition_io_tlb_flush` | The rate of flushes of I/O TLBs of the partition | counter | None |
|
||||
| `windows_hyperv_root_partition_recommended_virtual_tlb_size` | The recommended number of pages to be deposited for the virtual TLB | gauge | None |
|
||||
| `windows_hyperv_root_partition_physical_pages_allocated` | The number of timer interrupts skipped for the partition | gauge | None |
|
||||
| `windows_hyperv_root_partition_1G_device_pages` | The number of 1G pages present in the device space of the partition | gauge | None |
|
||||
| `windows_hyperv_root_partition_1G_gpa_pages` | The number of 1G pages present in the GPA space of the partition | gauge | None |
|
||||
| `windows_hyperv_root_partition_2M_device_pages` | The number of 2M pages present in the device space of the partition | gauge | None |
|
||||
| `windows_hyperv_root_partition_2M_gpa_pages` | The number of 2M pages present in the GPA space of the partition | gauge | None |
|
||||
| `windows_hyperv_root_partition_4K_device_pages` | The number of 4K pages present in the device space of the partition | gauge | None |
|
||||
| `windows_hyperv_root_partition_4K_gpa_pages` | The number of 4K pages present in the GPA space of the partition | gauge | None |
|
||||
| `windows_hyperv_root_partition_virtual_tlb_flush_entries` | The rate of flushes of the entire virtual TLB | counter | None |
|
||||
| `windows_hyperv_root_partition_virtual_tlb_pages` | The number of pages used by the virtual TLB of the partition | gauge | None |
|
||||
|
||||
|
||||
### Hyper-V Hypervisor Root Virtual Processor
|
||||
|
||||
| Name | Description | Type | Labels |
|
||||
|---------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------|---------|----------------|
|
||||
| `windows_hyperv_hypervisor_root_virtual_processor_time_total` | Time that processor spent in different modes (hypervisor, guest_run, guest_idle, remote, total) | counter | `core`.`state` |
|
||||
| `windows_hyperv_hypervisor_root_virtual_cpu_wait_time_per_dispatch_total` | The average time (in nanoseconds) spent waiting for a virtual processor to be dispatched onto a logical processor | counter | `core` |
|
||||
|
||||
|
||||
### Hyper-V Legacy Network Adapter
|
||||
|
||||
| Name | Description | Type | Labels |
|
||||
|---------------------------------------------------------------|-------------------------------------------------------------------------|---------|-----------|
|
||||
| `windows_hyperv_legacy_network_adapter_bytes_dropped_total` | Bytes Dropped is the number of bytes dropped on the network adapter | counter | `adapter` |
|
||||
| `windows_hyperv_legacy_network_adapter_bytes_received_total` | Bytes received is the number of bytes received on the network adapter | counter | `adapter` |
|
||||
| `windows_hyperv_legacy_network_adapter_bytes_sent_total` | Bytes sent is the number of bytes sent over the network adapter | counter | `adapter` |
|
||||
| `windows_hyperv_legacy_network_adapter_frames_dropped_total` | Frames Dropped is the number of frames dropped on the network adapter | counter | `adapter` |
|
||||
| `windows_hyperv_legacy_network_adapter_frames_received_total` | Frames received is the number of frames received on the network adapter | counter | `adapter` |
|
||||
| `windows_hyperv_legacy_network_adapter_frames_sent_total` | Frames sent is the number of frames sent over the network adapter | counter | `adapter` |
|
||||
|
||||
|
||||
### Hyper-V Hypervisor Virtual Processor
|
||||
|
||||
| Name | Description | Type | Labels |
|
||||
|--------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------|---------|--------------|
|
||||
| `windows_hyperv_hypervisor_virtual_processor_time_total` | Time that processor spent in different modes (hypervisor, guest_run, guest_idle, remote) | counter | `vm`, `core` |
|
||||
| `windows_hyperv_hypervisor_virtual_processor_total_run_time_total` | Time that processor spent | counter | `vm`, `core` |
|
||||
| `windows_hyperv_hypervisor_virtual_processor_cpu_wait_time_per_dispatch_total` | The average time (in nanoseconds) spent waiting for a virtual processor to be dispatched onto a logical processor. | counter | `vm`, `core` |
|
||||
|
||||
### Hyper-V Virtual Network Adapter
|
||||
|
||||
| Name | Description | Type | Labels |
|
||||
|-------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|---------|-----------|
|
||||
| `windows_hyperv_virtual_network_adapter_received_bytes_total` | Represents the total number of bytes received per second by the network adapter | counter | `adapter` |
|
||||
| `windows_hyperv_virtual_network_adapter_sent_bytes_total` | Represents the total number of bytes sent per second by the network adapter | counter | `adapter` |
|
||||
| `windows_hyperv_virtual_network_adapter_incoming_dropped_packets_total` | Represents the total number of dropped packets per second in the incoming direction of the network adapter | counter | `adapter` |
|
||||
| `windows_hyperv_virtual_network_adapter_outgoing_dropped_packets_total` | Represents the total number of dropped packets per second in the outgoing direction of the network adapter | counter | `adapter` |
|
||||
| `windows_hyperv_virtual_network_adapter_received_packets_total` | Represents the total number of packets received per second by the network adapter | counter | `adapter` |
|
||||
| `windows_hyperv_virtual_network_adapter_sent_packets_total` | Represents the total number of packets sent per second by the network adapter | counter | `adapter` |
|
||||
|
||||
### Hyper-V Virtual Network Adapter Drop Reasons
|
||||
|
||||
| Name | Description | Type | Labels |
|
||||
|-------------------------------------------------------|----------------------------------------------|---------|--------------------------------|
|
||||
| `windows_hyperv_virtual_network_adapter_drop_reasons` | Hyper-V Virtual Network Adapter Drop Reasons | counter | `adapter`,`direction`,`reason` |
|
||||
|
||||
### Hyper-V Virtual SMB
|
||||
|
||||
| Name | Description | Type | Labels |
|
||||
|-------------------------------------------------------|-----------------------------------------------------------------------------------|---------|------------|
|
||||
| `windows_hyperv_virtual_smb_direct_mapped_sections` | Represents the number of direct-mapped sections in the virtual SMB` | gauge | `instance` |
|
||||
| `windows_hyperv_virtual_smb_direct_mapped_pages` | Represents the number of direct-mapped pages in the virtual SMB` | gauge | `instance` |
|
||||
| `windows_hyperv_virtual_smb_write_bytes_rdma` | Represents the number of bytes written per second using RDMA in the virtual SMB` | counter | `instance` |
|
||||
| `windows_hyperv_virtual_smb_write_bytes` | Represents the number of bytes written per second in the virtual SMB` | counter | `instance` |
|
||||
| `windows_hyperv_virtual_smb_read_bytes_rdma` | Represents the number of bytes read per second using RDMA in the virtual SMB` | counter | `instance` |
|
||||
| `windows_hyperv_virtual_smb_read_bytes` | Represents the number of bytes read per second in the virtual SMB` | counter | `instance` |
|
||||
| `windows_hyperv_virtual_smb_flush_requests` | Represents the number of flush requests per second in the virtual SMB` | counter | `instance` |
|
||||
| `windows_hyperv_virtual_smb_write_requests_rdma` | Represents the number of write requests per second using RDMA in the virtual SMB` | counter | `instance` |
|
||||
| `windows_hyperv_virtual_smb_write_requests` | Represents the number of write requests per second in the virtual SMB` | counter | `instance` |
|
||||
| `windows_hyperv_virtual_smb_read_requests_rdma` | Represents the number of read requests per second using RDMA in the virtual SMB` | counter | `instance` |
|
||||
| `windows_hyperv_virtual_smb_read_requests` | Represents the number of read requests per second in the virtual SMB` | counter | `instance` |
|
||||
| `windows_hyperv_virtual_smb_current_pending_requests` | Represents the current number of pending requests in the virtual SMB` | gauge | `instance` |
|
||||
| `windows_hyperv_virtual_smb_current_open_file_count` | Represents the current number of open files in the virtual SMB` | gauge | `instance` |
|
||||
| `windows_hyperv_virtual_smb_tree_connect_count` | Represents the number of tree connects in the virtual SMB` | gauge | `instance` |
|
||||
| `windows_hyperv_virtual_smb_requests` | Represents the number of requests per second in the virtual SMB` | counter | `instance` |
|
||||
| `windows_hyperv_virtual_smb_sent_bytes` | Represents the number of bytes sent per second in the virtual SMB` | counter | `instance` |
|
||||
| `windows_hyperv_virtual_smb_received_bytes` | Represents the number of bytes received per second in the virtual SMB` | counter | `instance` |
|
||||
|
||||
|
||||
### Hyper-V Virtual Switch
|
||||
|
||||
| Name | Description | Type | Labels |
|
||||
|---------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------|---------|-----------|
|
||||
| `windows_hyperv_vswitch_broadcast_packets_received_total` | Represents the total number of broadcast packets received per second by the virtual switch | counter | `vswitch` |
|
||||
| `windows_hyperv_vswitch_broadcast_packets_sent_total` | Represents the total number of broadcast packets sent per second by the virtual switch | counter | `vswitch` |
|
||||
| `windows_hyperv_vswitch_bytes_total` | Represents the total number of bytes per second traversing the virtual switch | counter | `vswitch` |
|
||||
| `windows_hyperv_vswitch_bytes_received_total` | Represents the total number of bytes received per second by the virtual switch | counter | `vswitch` |
|
||||
| `windows_hyperv_vswitch_bytes_sent_total` | Represents the total number of bytes sent per second by the virtual switch | counter | `vswitch` |
|
||||
| `windows_hyperv_vswitch_directed_packets_received_total` | Represents the total number of directed packets received per second by the virtual switch | counter | `vswitch` |
|
||||
| `windows_hyperv_vswitch_directed_packets_send_total` | Represents the total number of directed packets sent per second by the virtual switch | counter | `vswitch` |
|
||||
| `windows_hyperv_vswitch_dropped_packets_incoming_total` | Represents the total number of packet dropped per second by the virtual switch in the incoming direction | counter | `vswitch` |
|
||||
| `windows_hyperv_vswitch_dropped_packets_outcoming_total` | Represents the total number of packet dropped per second by the virtual switch in the outgoing direction | counter | `vswitch` |
|
||||
| `windows_hyperv_vswitch_extensions_dropped_packets_incoming_total` | Represents the total number of packet dropped per second by the virtual switch extensions in the incoming direction | counter | `vswitch` |
|
||||
| `windows_hyperv_vswitch_extensions_dropped_packets_outcoming_total` | Represents the total number of packet dropped per second by the virtual switch extensions in the outgoing direction | counter | `vswitch` |
|
||||
| `windows_hyperv_vswitch_learned_mac_addresses_total` | Represents the total number of learned MAC addresses of the virtual switch | counter | `vswitch` |
|
||||
| `windows_hyperv_vswitch_multicast_packets_received_total` | Represents the total number of multicast packets received per second by the virtual switch | counter | `vswitch` |
|
||||
| `windows_hyperv_vswitch_multicast_packets_sent_total` | Represents the total number of multicast packets sent per second by the virtual switch | counter | `vswitch` |
|
||||
| `windows_hyperv_vswitch_number_of_send_channel_moves_total` | Represents the total number of send channel moves per second on this virtual switch | counter | `vswitch` |
|
||||
| `windows_hyperv_vswitch_number_of_vmq_moves_total` | Represents the total number of VMQ moves per second on this virtual switch | counter | `vswitch` |
|
||||
| `windows_hyperv_vswitch_packets_flooded_total` | Represents the total number of packets flooded by the virtual switch | counter | `vswitch` |
|
||||
| `windows_hyperv_vswitch_packets_total` | Represents the total number of packets per second traversing the virtual switch | counter | `vswitch` |
|
||||
| `windows_hyperv_vswitch_packets_received_total` | Represents the total number of packets received per second by the virtual switch | counter | `vswitch` |
|
||||
| `windows_hyperv_vswitch_packets_sent_total` | Represents the total number of packets send per second by the virtual switch | counter | `vswitch` |
|
||||
| `windows_hyperv_vswitch_purged_mac_addresses_total` | Represents the total number of purged MAC addresses of the virtual switch | counter | `vswitch` |
|
||||
|
||||
### Hyper-V Virtual Storage Device
|
||||
|
||||
| Name | Description | Type | Labels |
|
||||
|---------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|---------|----------|
|
||||
| `windows_hyperv_virtual_storage_device_error_count_total` | Represents the total number of errors that have occurred on this virtual device. | counter | `device` |
|
||||
| `windows_hyperv_virtual_storage_device_queue_length` | Represents the average queue length on this virtual device. | gauge | `device` |
|
||||
| `windows_hyperv_virtual_storage_device_bytes_read` | Represents the total number of bytes that have been read on this virtual device. | counter | `device` |
|
||||
| `windows_hyperv_virtual_storage_device_operations_read_total` | Represents the total number of read operations that have occurred on this virtual device. | counter | `device` |
|
||||
| `windows_hyperv_virtual_storage_device_bytes_written` | Represents the total number of bytes that have been written on this virtual device. | counter | `device` |
|
||||
| `windows_hyperv_virtual_storage_device_operations_written_total` | Represents the total number of write operations that have occurred on this virtual device. | counter | `device` |
|
||||
| `windows_hyperv_virtual_storage_device_latency_seconds` | Represents the average IO transfer latency for this virtual device. | gauge | `device` |
|
||||
| `windows_hyperv_virtual_storage_device_throughput` | Represents the average number of 8KB IO transfers completed by this virtual device. | gauge | `device` |
|
||||
| `windows_hyperv_virtual_storage_device_normalized_throughput` | Represents the average number of IO transfers completed by this virtual device. | gauge | `device` |
|
||||
| `windows_hyperv_virtual_storage_device_lower_queue_length` | Represents the average queue length on the underlying storage subsystem for this device. | gauge | `device` |
|
||||
| `windows_hyperv_virtual_storage_device_lower_latency_seconds` | Represents the average IO transfer latency on the underlying storage subsystem for this virtual device. | gauge | `device` |
|
||||
| `windows_hyperv_virtual_storage_device_io_quota_replenishment_rate` | Represents the IO quota replenishment rate for this virtual device. | gauge | `device` |
|
||||
|
||||
### Hyper-V VM Vid Partition
|
||||
|
||||
| Name | Description | Type | Labels |
|
||||
|------------------------------------------------|-------------------------------------------------------------------------|-------|--------|
|
||||
| `windows_hyperv_vid_physical_pages_allocated` | The number of physical pages allocated | gauge | `vm` |
|
||||
| `windows_hyperv_vid_preferred_numa_node_index` | The preferred NUMA node index associated with this partition | gauge | `vm` |
|
||||
| `windows_hyperv_vid_remote_physical_pages` | The number of physical pages not allocated from the preferred NUMA node | gauge | `vm` |
|
||||
|
||||
|
||||
### Hyper-V Virtual Machine Health Summary
|
||||
|
||||
| Name | Description | Type | Labels |
|
||||
|------------------------------------------------------|-------------------------------------------------------|-------|--------|
|
||||
| `windows_hyperv_virtual_machine_health_total_count` | Represents the number of virtual machines with health | gauge | None |
|
||||
|
||||
|
||||
### Example metric
|
||||
_This collector does not yet have explained examples, we would appreciate your help adding them!_
|
||||
@@ -113,19 +265,19 @@ _This collector does not yet have explained examples, we would appreciate your h
|
||||
## Useful queries
|
||||
Percent of physical CPU resources used per VM (on instance "localhost")
|
||||
```
|
||||
(sum (rate(windows_hyperv_vm_cpu_hypervisor_run_time{instance="localhost"}[1m]))) / ignoring(vm) group_left max (windows_cs_logical_processors{instance="localhost"}) / 100000
|
||||
(sum (rate(windows_hyperv_hypervisor_virtual_processor_time_total{state="hypervisor",instance="localhost"}[1m]))) / ignoring(state,vm) group_left max (windows_cpu_logical_processor{instance="localhost"}) / 100000
|
||||
```
|
||||
Percent of physical CPU resources used by all VMs (on all monitored hosts)
|
||||
```
|
||||
(sum by (instance)(rate(windows_hyperv_vm_cpu_total_run_time{}[1m]))) / max by (instance)(windows_cs_logical_processors{}) / 100000
|
||||
(sum by (instance)(rate(windows_hyperv_hypervisor_virtual_processor_total_run_time_total{}[1m]))) / max by (instance)(windows_cpu_logical_processor{}) / 100000
|
||||
```
|
||||
Percent of physical CPU resources by the hosts themselves (on all monitored hosts)
|
||||
```
|
||||
(sum by (instance)(rate(windows_hyperv_host_cpu_total_run_time{}[1m]))) / sum by (instance)(windows_cs_logical_processors{}) / 100000
|
||||
(sum by (instance)(rate(windows_hyperv_hypervisor_root_virtual_processor_total_run_time_total{state="total"}[1m]))) / sum by (instance)(windows_cpu_logical_processor{}) / 100000
|
||||
```
|
||||
Percent of physical CPU resources by the hypervisor (on all monitored hosts)
|
||||
```
|
||||
(sum by (instance)(rate(windows_hyperv_host_lp_total_run_time_percent{}[1m]))) / sum by (instance)(windows_hyperv_hypervisor_logical_processors{}) / 100000
|
||||
(sum by (instance)(rate(windows_hyperv_hypervisor_logical_processor_total_run_time_total{}[1m]))) / sum by (instance)(windows_cpu_logical_processor{}) / 100000
|
||||
```
|
||||
|
||||
## Alerting examples
|
||||
|
||||
@@ -2,13 +2,11 @@
|
||||
|
||||
The logon collector exposes metrics detailing the active user logon sessions.
|
||||
|
||||
|||
|
||||
-|-
|
||||
Metric name prefix | `logon`
|
||||
Classes | [`Win32_LogonSession`](https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-logonsession)
|
||||
Enabled by default? | No
|
||||
|
||||
> :warning: **On some deployments, this collector seems to have some memory/timeout issues**: See [#583](https://github.com/prometheus-community/windows_exporter/issues/583)
|
||||
| | |
|
||||
|---------------------|-----------|
|
||||
| Metric name prefix | `logon` |
|
||||
| Source | Win32 API |
|
||||
| Enabled by default? | No |
|
||||
|
||||
## Flags
|
||||
|
||||
@@ -16,21 +14,65 @@ None
|
||||
|
||||
## Metrics
|
||||
|
||||
Name | Description | Type | Labels
|
||||
-----|-------------|------|-------
|
||||
`windows_logon_logon_type` | Number of active user logon sessions | gauge | status
|
||||
| Name | Description | Type | Labels |
|
||||
|-------------------------------------------|--------------------------------------------|-------|------------------------------------|
|
||||
| `windows_logon_session_logon_timestamp_seconds` | timestamp of the logon session in seconds. | gauge | `domain`, `id`, `type`, `username` |
|
||||
|
||||
### Example metric
|
||||
Query the total number of interactive logon sessions
|
||||
```
|
||||
windows_logon_logon_type{status="interactive"}
|
||||
# HELP windows_logon_session_logon_timestamp_seconds timestamp of the logon session in seconds.
|
||||
# TYPE windows_logon_session_logon_timestamp_seconds gauge
|
||||
windows_logon_session_logon_timestamp_seconds{domain="",id="0x0:0x8c54",type="System",username=""} 1.72876928e+09
|
||||
windows_logon_session_logon_timestamp_seconds{domain="Font Driver Host",id="0x0:0x991a",type="Interactive",username="UMFD-1"} 1.728769282e+09
|
||||
windows_logon_session_logon_timestamp_seconds{domain="Font Driver Host",id="0x0:0x9933",type="Interactive",username="UMFD-0"} 1.728769282e+09
|
||||
windows_logon_session_logon_timestamp_seconds{domain="Font Driver Host",id="0x0:0x994a",type="Interactive",username="UMFD-0"} 1.728769282e+09
|
||||
windows_logon_session_logon_timestamp_seconds{domain="Font Driver Host",id="0x0:0x999d",type="Interactive",username="UMFD-1"} 1.728769282e+09
|
||||
windows_logon_session_logon_timestamp_seconds{domain="Font Driver Host",id="0x0:0xbf25a",type="Interactive",username="UMFD-2"} 1.728769532e+09
|
||||
windows_logon_session_logon_timestamp_seconds{domain="Font Driver Host",id="0x0:0xbf290",type="Interactive",username="UMFD-2"} 1.728769532e+09
|
||||
windows_logon_session_logon_timestamp_seconds{domain="JKROEPKE",id="0x0:0x130241",type="Network",username="vm-jok-dev$"} 1.728769625e+09
|
||||
windows_logon_session_logon_timestamp_seconds{domain="JKROEPKE",id="0x0:0x24f7c9",type="Network",username="vm-jok-dev$"} 1.728770121e+09
|
||||
windows_logon_session_logon_timestamp_seconds{domain="JKROEPKE",id="0x0:0x276846",type="Network",username="vm-jok-dev$"} 1.728770195e+09
|
||||
windows_logon_session_logon_timestamp_seconds{domain="JKROEPKE",id="0x0:0x3e4",type="Service",username="vm-jok-dev$"} 1.728769283e+09
|
||||
windows_logon_session_logon_timestamp_seconds{domain="JKROEPKE",id="0x0:0x3e7",type="System",username="vm-jok-dev$"} 1.728769279e+09
|
||||
windows_logon_session_logon_timestamp_seconds{domain="JKROEPKE",id="0x0:0x71d0f",type="Network",username="vm-jok-dev$"} 1.728769324e+09
|
||||
windows_logon_session_logon_timestamp_seconds{domain="JKROEPKE",id="0x0:0x720a3",type="Network",username="vm-jok-dev$"} 1.728769324e+09
|
||||
windows_logon_session_logon_timestamp_seconds{domain="JKROEPKE",id="0x0:0x725cb",type="Network",username="vm-jok-dev$"} 1.728769324e+09
|
||||
windows_logon_session_logon_timestamp_seconds{domain="JKROEPKE",id="0x0:0x753d8",type="Network",username="vm-jok-dev$"} 1.728769325e+09
|
||||
windows_logon_session_logon_timestamp_seconds{domain="JKROEPKE",id="0x0:0xa3913",type="Network",username="vm-jok-dev$"} 1.728769385e+09
|
||||
windows_logon_session_logon_timestamp_seconds{domain="JKROEPKE",id="0x0:0xbe7f2",type="Network",username="jok"} 1.728769531e+09
|
||||
windows_logon_session_logon_timestamp_seconds{domain="JKROEPKE",id="0x0:0xc76c4",type="RemoteInteractive",username="jok"} 1.728769533e+09
|
||||
windows_logon_session_logon_timestamp_seconds{domain="NT AUTHORITY",id="0x0:0x3e3",type="Service",username="IUSR"} 1.728769295e+09
|
||||
windows_logon_session_logon_timestamp_seconds{domain="NT AUTHORITY",id="0x0:0x3e5",type="Service",username="LOCAL SERVICE"} 1.728769283e+09
|
||||
windows_logon_session_logon_timestamp_seconds{domain="NT Service",id="0x0:0xae4c7",type="Service",username="MSSQLSERVER"} 1.728769425e+09
|
||||
windows_logon_session_logon_timestamp_seconds{domain="NT Service",id="0x0:0xb42f1",type="Service",username="SQLTELEMETRY"} 1.728769431e+09
|
||||
windows_logon_session_logon_timestamp_seconds{domain="Window Manager",id="0x0:0xbfbac",type="Interactive",username="DWM-2"} 1.728769532e+09
|
||||
windows_logon_session_logon_timestamp_seconds{domain="Window Manager",id="0x0:0xbfc72",type="Interactive",username="DWM-2"} 1.728769532e+09
|
||||
windows_logon_session_logon_timestamp_seconds{domain="Window Manager",id="0x0:0xdedd",type="Interactive",username="DWM-1"} 1.728769283e+09
|
||||
windows_logon_session_logon_timestamp_seconds{domain="Window Manager",id="0x0:0xdefd",type="Interactive",username="DWM-1"} 1.728769283e+09
|
||||
```
|
||||
|
||||
### Possible values for `type`
|
||||
|
||||
- System
|
||||
- Interactive
|
||||
- Network
|
||||
- Batch
|
||||
- Service
|
||||
- Proxy
|
||||
- Unlock
|
||||
- NetworkCleartext
|
||||
- NewCredentials
|
||||
- RemoteInteractive
|
||||
- CachedInteractive
|
||||
- CachedRemoteInteractive
|
||||
- CachedUnlock
|
||||
|
||||
## Useful queries
|
||||
Query the total number of local and remote (I.E. Terminal Services) interactive sessions.
|
||||
```
|
||||
windows_logon_logon_type{status=~"interactive|remote_interactive"}
|
||||
count(windows_logon_logon_type{type=~"Interactive|RemoteInteractive"}) by (type)
|
||||
```
|
||||
|
||||
## Alerting examples
|
||||
_This collector does not yet have alerting examples, we would appreciate your help adding them!_
|
||||
_This collector doesn’t yet have alerting examples, we would appreciate your help adding them!_
|
||||
|
||||
@@ -2,26 +2,22 @@
|
||||
|
||||
The msmq collector exposes metrics about the queues on a MSMQ server
|
||||
|
||||
|||
|
||||
-|-
|
||||
Metric name prefix | `msmq`
|
||||
Classes | `Win32_PerfRawData_MSMQ_MSMQQueue`
|
||||
Enabled by default? | No
|
||||
| | |
|
||||
|---------------------|----------------------|
|
||||
| Metric name prefix | `msmq` |
|
||||
| Spource | Performance Counters |
|
||||
| Enabled by default? | No |
|
||||
|
||||
## Flags
|
||||
|
||||
### `--collector.msmq.msmq-where`
|
||||
|
||||
A WMI filter on which queues to include. `%` is a wildcard, and can be used to match on substrings.
|
||||
|
||||
## Metrics
|
||||
|
||||
Name | Description | Type | Labels
|
||||
-----|-------------|------|-------
|
||||
`windows_msmq_bytes_in_journal_queue` | Size of queue journal in bytes | gauge | `name`
|
||||
`windows_msmq_bytes_in_queue` | Size of queue in bytes | gauge | `name`
|
||||
`windows_msmq_messages_in_journal_queue` | Count messages in queue journal | gauge | `name`
|
||||
`windows_msmq_messages_in_queue` | Count messages in queue | gauge | `name`
|
||||
| Name | Description | Type | Labels |
|
||||
|------------------------------------------|---------------------------------|-------|--------|
|
||||
| `windows_msmq_bytes_in_journal_queue` | Size of queue journal in bytes | gauge | `name` |
|
||||
| `windows_msmq_bytes_in_queue` | Size of queue in bytes | gauge | `name` |
|
||||
| `windows_msmq_messages_in_journal_queue` | Count messages in queue journal | gauge | `name` |
|
||||
| `windows_msmq_messages_in_queue` | Count messages in queue | gauge | `name` |
|
||||
|
||||
### Example metric
|
||||
_This collector does not yet have explained examples, we would appreciate your help adding them!_
|
||||
|
||||
@@ -16,246 +16,251 @@ Comma-separated list of MSSQL WMI classes to use. Supported values are `accessme
|
||||
|
||||
### `--collectors.mssql.class-print`
|
||||
|
||||
If true, print available mssql WMI classes and exit. Only displays if the mssql collector is enabled.
|
||||
If true, print available mssql WMI classes and exit. Only displays if the mssql collector is enabled.fman`, `databases`, `dbreplica`, `genstats`, `locks`, `memmgr`, `sqlstats`, `sqlerrors`, `transactions`, and `waitstats`.
|
||||
|
||||
### `--collector.mssql.port`
|
||||
|
||||
Port of MSSQL server used for `windows_mssql_info` metric. Default is `1433`.
|
||||
|
||||
## Metrics
|
||||
|
||||
Name | Description | Type | Labels
|
||||
-----|-------------|------|-------
|
||||
`windows_mssql_collector_duration_seconds` | The time taken for each sub-collector to return | gauge | `collector`, `mssql_instance`
|
||||
`windows_mssql_collector_success` | 1 if sub-collector succeeded, 0 otherwise | gauge | `collector`, `mssql_instance`
|
||||
`windows_mssql_accessmethods_au_batch_cleanups` | The total number of batches that were completed successfully by the background task that cleans up deferred dropped allocation units | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_au_cleanups` | The total number of allocation units that were successfully dropped the background task that cleans up deferred dropped allocation units. Each allocation unit drop requires multiple batches | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_by_reference_lob_creates` | The total count of large object (lob) values that were passed by reference. By-reference lobs are used in certain bulk operations to avoid the cost of passing them by value | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_by_reference_lob_uses` | The total count of by-reference lob values that were used. By-reference lobs are used in certain bulk operations to avoid the cost of passing them by-value | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_lob_read_aheads` | The total count of lob pages on which readahead was issued | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_column_value_pulls` | The total count of column values that were pulled in-row from off-row | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_column_value_pushes` | The total count of column values that were pushed from in-row to off-row | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_deferred_dropped_aus` | The total number of allocation units waiting to be dropped by the background task that cleans up deferred dropped allocation units | gauge | `mssql_instance`
|
||||
`windows_mssql_accessmethods_deferred_dropped_rowsets` | The number of rowsets created as a result of aborted online index build operations that are waiting to be dropped by the background task that cleans up deferred dropped rowsets | gauge | `mssql_instance`
|
||||
`windows_mssql_accessmethods_dropped_rowset_cleanups` | The number of rowsets per second created as a result of aborted online index build operations that were successfully dropped by the background task that cleans up deferred dropped rowsets | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_dropped_rowset_skips` | The number of rowsets per second created as a result of aborted online index build operations that were skipped by the background task that cleans up deferred dropped rowsets created | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_extent_deallocations` | Number of extents deallocated per second in all databases in this instance of SQL Server | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_extent_allocations` | Number of extents allocated per second in all databases in this instance of SQL Server | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_au_batch_cleanup_failures` | The number of batches per second that failed and required retry, by the background task that cleans up deferred dropped allocation units. Failure could be due to lack of memory or disk space, hardware failure and other reasons | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_leaf_page_cookie_failures` | The number of times that a leaf page cookie could not be used during an index search since changes happened on the leaf page. The cookie is used to speed up index search | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_tree_page_cookie_failures` | The number of times that a tree page cookie could not be used during an index search since changes happened on the parent pages of those tree pages. The cookie is used to speed up index search | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_forwarded_records` | Number of records per second fetched through forwarded record pointers | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_free_space_page_fetches` | Number of pages fetched per second by free space scans. These scans search for free space within pages already allocated to an allocation unit, to satisfy requests to insert or modify record fragments | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_free_space_scans` | Number of scans per second that were initiated to search for free space within pages already allocated to an allocation unit to insert or modify record fragment. Each scan may find multiple pages | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_full_scans` | Number of unrestricted full scans per second. These can be either base-table or full-index scans | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_index_searches` | Number of index searches per second. These are used to start a range scan, reposition a range scan, revalidate a scan point, fetch a single index record, and search down the index to locate where to insert a new row | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_insysxact_waits` | Number of times a reader needs to wait for a page because the InSysXact bit is set | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_lob_handle_creates` | Count of temporary lobs created | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_lob_handle_destroys` | Count of temporary lobs destroyed | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_lob_ss_provider_creates` | Count of LOB Storage Service Providers (LobSSP) created. One worktable created per LobSSP | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_lob_ss_provider_destroys` | Count of LobSSP destroyed | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_lob_ss_provider_truncations` | Count of LobSSP truncated | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_mixed_page_allocations` | Number of pages allocated per second from mixed extents. These could be used for storing the IAM pages and the first eight pages that are allocated to an allocation unit | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_page_compression_attempts` | Number of pages evaluated for page-level compression. Includes pages that were not compressed because significant savings could be achieved. Includes all objects in the instance of SQL Server | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_page_deallocations` | Number of pages deallocated per second in all databases in this instance of SQL Server. These include pages from mixed extents and uniform extents | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_page_allocations` | Number of pages allocated per second in all databases in this instance of SQL Server. These include pages allocations from both mixed extents and uniform extents | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_page_compressions` | Number of data pages that are compressed by using PAGE compression. Includes all objects in the instance of SQL Server | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_page_splits` | Number of page splits per second that occur as the result of overflowing index pages | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_probe_scans` | Number of probe scans per second that are used to find at most one single qualified row in an index or base table directly | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_range_scans` | Number of qualified range scans through indexes per second | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_scan_point_revalidations` | Number of times per second that the scan point had to be revalidated to continue the scan | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_ghost_record_skips` | Number of ghosted records per second skipped during scans | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_table_lock_escalations` | Number of times locks on a table were escalated to the TABLE or HoBT granularity | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_leaf_page_cookie_uses` | Number of times a leaf page cookie is used successfully during an index search since no change happened on the leaf page. The cookie is used to speed up index search | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_tree_page_cookie_uses` | Number of times a tree page cookie is used successfully during an index search since no change happened on the parent page of the tree page. The cookie is used to speed up index search | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_workfile_creates` | Number of work files created per second. For example, work files could be used to store temporary results for hash joins and hash aggregates | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_worktables_creates` | Number of work tables created per second. For example, work tables could be used to store temporary results for query spool, lob variables, XML variables, and cursors | counter | `mssql_instance`
|
||||
`windows_mssql_accessmethods_worktables_from_cache_ratio` | Percentage of work tables created where the initial two pages of the work table were not allocated but were immediately available from the work table cache | counter | `mssql_instance`
|
||||
`windows_mssql_availreplica_received_from_replica_bytes` | Number of bytes received from the availability replica per second. Pings and status updates will generate network traffic even on databases with no user updates | counter | `mssql_instance`, `replica`
|
||||
`windows_mssql_availreplica_sent_to_replica_bytes` | Number of bytes sent to the remote availability replica per second. On the primary replica this is the number of bytes sent to the secondary replica. On the secondary replica this is the number of bytes sent to the primary replica | counter | `mssql_instance`, `replica`
|
||||
`windows_mssql_availreplica_sent_to_transport_bytes` | Actual number of bytes sent per second over the network to the remote availability replica. On the primary replica this is the number of bytes sent to the secondary replica. On the secondary replica this is the number of bytes sent to the primary replica | counter | `mssql_instance`, `replica`
|
||||
`windows_mssql_availreplica_initiated_flow_controls` | Time in milliseconds that log stream messages waited for send flow control, in the last second | counter | `mssql_instance`, `replica`
|
||||
`windows_mssql_availreplica_flow_control_wait_seconds` | Number of times flow-control initiated in the last second. Flow Control Time (ms/sec) divided by Flow Control/sec is the average time per wait | counter | `mssql_instance`, `replica`
|
||||
`windows_mssql_availreplica_receives_from_replica` | Number of Always On messages received from thereplica per second | counter | `mssql_instance`, `replica`
|
||||
`windows_mssql_availreplica_resent_messages` | Number of Always On messages resent in the last second | counter | `mssql_instance`, `replica`
|
||||
`windows_mssql_availreplica_sends_to_replica` | Number of Always On messages sent to this availability replica per second | counter | `mssql_instance`, `replica`
|
||||
`windows_mssql_availreplica_sends_to_transport` | Actual number of Always On messages sent per second over the network to the remote availability replica | counter | `mssql_instance`, `replica`
|
||||
`windows_mssql_bufman_background_writer_pages` | Number of pages flushed to enforce the recovery interval settings | counter | `mssql_instance`
|
||||
`windows_mssql_bufman_buffer_cache_hit_ratio` | Indicates the percentage of pages found in the buffer cache without having to read from disk. The ratio is the total number of cache hits divided by the total number of cache lookups over the last few thousand page accesses | gauge | `mssql_instance`
|
||||
`windows_mssql_bufman_checkpoint_pages` | Indicates the number of pages flushed to disk per second by a checkpoint or other operation that require all dirty pages to be flushed | counter | `mssql_instance`
|
||||
`windows_mssql_bufman_database_pages` | Indicates the number of pages in the buffer pool with database content | gauge | `mssql_instance`
|
||||
`windows_mssql_bufman_extension_allocated_pages` | Total number of non-free cache pages in the buffer pool extension file | gauge | `mssql_instance`
|
||||
`windows_mssql_bufman_extension_free_pages` | Total number of free cache pages in the buffer pool extension file | gauge | `mssql_instance`
|
||||
`windows_mssql_bufman_extension_in_use_as_percentage` | _Not yet documented_ | gauge | `mssql_instance`
|
||||
`windows_mssql_bufman_extension_outstanding_io` | Percentage of the buffer pool extension paging file occupied by buffer manager pages | gauge | `mssql_instance`
|
||||
`windows_mssql_bufman_extension_page_evictions` | Number of pages evicted from the buffer pool extension file per second | counter | `mssql_instance`
|
||||
`windows_mssql_bufman_extension_page_reads` | Number of pages read from the buffer pool extension file per second | counter | `mssql_instance`
|
||||
`windows_mssql_bufman_extension_page_unreferenced_seconds` | Average seconds a page will stay in the buffer pool extension without references to it | gauge | `mssql_instance`
|
||||
`windows_mssql_bufman_extension_page_writes` | Number of pages written to the buffer pool extension file per second | counter | `mssql_instance`
|
||||
`windows_mssql_bufman_free_list_stalls` | Indicates the number of requests per second that had to wait for a free page | counter | `mssql_instance`
|
||||
`windows_mssql_bufman_integral_controller_slope` | The slope that integral controller for the buffer pool last used, times -10 billion | gauge | `mssql_instance`
|
||||
`windows_mssql_bufman_lazywrites` | Indicates the number of buffers written per second by the buffer manager's lazy writer | counter | `mssql_instance`
|
||||
`windows_mssql_bufman_page_life_expectancy_seconds` | Indicates the number of seconds a page will stay in the buffer pool without references | gauge | `mssql_instance`
|
||||
`windows_mssql_bufman_page_lookups` | Indicates the number of requests per second to find a page in the buffer pool | counter | `mssql_instance`
|
||||
`windows_mssql_bufman_page_reads` | Indicates the number of physical database page reads that are issued per second | counter | `mssql_instance`
|
||||
`windows_mssql_bufman_page_writes` | Indicates the number of physical database page writes that are issued per second | counter | `mssql_instance`
|
||||
`windows_mssql_bufman_read_ahead_pages` | Indicates the number of pages read per second in anticipation of use | counter | `mssql_instance`
|
||||
`windows_mssql_bufman_read_ahead_issuing_seconds` | Time (microseconds) spent issuing readahead | counter | `mssql_instance`
|
||||
`windows_mssql_bufman_target_pages` | Ideal number of pages in the buffer pool | gauge | `mssql_instance`
|
||||
`windows_mssql_dbreplica_database_flow_control_wait_seconds` | _Not yet documented_ | gauge | `mssql_instance`, `replica`
|
||||
`windows_mssql_dbreplica_database_initiated_flow_controls` | _Not yet documented_ | counter | `mssql_instance`, `replica`
|
||||
`windows_mssql_dbreplica_received_file_bytes` | _Not yet documented_ | counter | `mssql_instance`, `replica`
|
||||
`windows_mssql_dbreplica_group_commits` | _Not yet documented_ | counter | `mssql_instance`, `replica`
|
||||
`windows_mssql_dbreplica_group_commit_stall_seconds` | _Not yet documented_ | counter | `mssql_instance`, `replica`
|
||||
`windows_mssql_dbreplica_log_apply_pending_queue` | _Not yet documented_ | gauge | `mssql_instance`, `replica`
|
||||
`windows_mssql_dbreplica_log_apply_ready_queue` | _Not yet documented_ | gauge | `mssql_instance`, `replica`
|
||||
`windows_mssql_dbreplica_log_compressed_bytes` | _Not yet documented_ | counter | `mssql_instance`, `replica`
|
||||
`windows_mssql_dbreplica_log_decompressed_bytes` | _Not yet documented_ | counter | `mssql_instance`, `replica`
|
||||
`windows_mssql_dbreplica_log_received_bytes` | _Not yet documented_ | counter | `mssql_instance`, `replica`
|
||||
`windows_mssql_dbreplica_log_compression_cachehits` | _Not yet documented_ | counter | `mssql_instance`, `replica`
|
||||
`windows_mssql_dbreplica_log_compression_cachemisses` | _Not yet documented_ | counter | `mssql_instance`, `replica`
|
||||
`windows_mssql_dbreplica_log_compressions` | _Not yet documented_ | counter | `mssql_instance`, `replica`
|
||||
`windows_mssql_dbreplica_log_decompressions` | _Not yet documented_ | counter | `mssql_instance`, `replica`
|
||||
`windows_mssql_dbreplica_log_remaining_for_undo` | The amount of log, in bytes, remaining to complete the undo phase | gauge | `mssql_instance`, `replica`
|
||||
`windows_mssql_dbreplica_log_send_queue` | Amount of log records in the log files of the primary database, in kilobytes, that haven't been sent to the secondary replica | gauge | `mssql_instance`, `replica`
|
||||
`windows_mssql_dbreplica_mirrored_write_transactions` | Number of transactions that were written to the primary database and then waited to commit until the log was sent to the secondary database, in the last second | counter | `mssql_instance`, `replica`
|
||||
`windows_mssql_dbreplica_recovery_queue_records` | Amount of log records in the log files of the secondary replica that have not been redone | gauge | `mssql_instance`, `replica`
|
||||
`windows_mssql_dbreplica_redo_blocks` | Number of times the redo thread was blocked on locks held by readers of the database | counter | `mssql_instance`, `replica`
|
||||
`windows_mssql_dbreplica_redo_remaining_bytes` | The amount of log, in kilobytes, remaining to be redone to finish the reverting phase | gauge | `mssql_instance`, `replica`
|
||||
`windows_mssql_dbreplica_redone_bytes` | Amount of log records redone on the secondary database in the last second | counter | `mssql_instance`, `replica`
|
||||
`windows_mssql_dbreplica_redones` | _Not yet documented_ | counter | `mssql_instance`, `replica`
|
||||
`windows_mssql_dbreplica_total_log_requiring_undo` | Total kilobytes of log that must be undone | gauge | `mssql_instance`, `replica`
|
||||
`windows_mssql_dbreplica_transaction_delay_seconds` | Delay in waiting for unterminated commit acknowledgment for all the current transactions | gauge | `mssql_instance`, `replica`
|
||||
`windows_mssql_databases_active_transactions` | Number of active transactions for the database | gauge | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_backup_restore_operations` | Read/write throughput for backup and restore operations of a database per second | counter | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_bulk_copy_rows` | Number of rows bulk copied per second | counter | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_bulk_copy_bytes` | Amount of data bulk copied (in kilobytes) per second | counter | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_commit_table_entries` | he size (row count) of the in-memory portion of the commit table for the database | gauge | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_data_files_size_bytes` | Cumulative size (in kilobytes) of all the data files in the database including any automatic growth. Monitoring this counter is useful, for example, for determining the correct size of tempdb | gauge | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_dbcc_logical_scan_bytes` | Number of logical read scan bytes per second for database console commands (DBCC) | counter | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_group_commit_stall_seconds` | Group stall time (microseconds) per second | counter | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_log_flushed_bytes` | Total number of log bytes flushed | counter | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_log_cache_hit_ratio` | Percentage of log cache reads satisfied from the log cache | gauge | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_log_cache_reads` | Reads performed per second through the log manager cache | counter | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_log_files_size_bytes` | Cumulative size (in kilobytes) of all the transaction log files in the database | gauge | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_log_files_used_size_bytes` | The cumulative used size of all the log files in the database | gauge | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_log_flushes` | Total wait time (in milliseconds) to flush the log. On an Always On secondary database, this value indicates the wait time for log records to be hardened to disk | counter | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_log_flush_waits` | Number of commits per second waiting for the log flush | counter | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_log_flush_wait_seconds` | Number of commits per second waiting for the log flush | gauge | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_log_flush_write_seconds` | Time in milliseconds for performing writes of log flushes that were completed in the last second | gauge | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_log_growths` | Total number of times the transaction log for the database has been expanded | gauge | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_log_pool_cache_misses` | Number of requests for which the log block was not available in the log pool | counter | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_log_pool_disk_reads` | Number of disk reads that the log pool issued to fetch log blocks | counter | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_log_pool_hash_deletes` | Rate of raw hash entry deletes from the Log Pool | counter | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_log_pool_hash_inserts` | Rate of raw hash entry inserts into the Log Pool | counter | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_log_pool_invalid_hash_entries` | Rate of hash lookups failing due to being invalid | counter | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_log_pool_log_scan_pushes` | Rate of Log block pushes by log scans, which may come from disk or memory | counter | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_log_pool_log_writer_pushes` | Rate of Log block pushes by log writer thread | counter | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_log_pool_empty_free_pool_pushes` | Rate of Log block push fails due to empty free pool | counter | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_log_pool_low_memory_pushes` | Rate of Log block push fails due to being low on memory | counter | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_log_pool_no_free_buffer_pushes` | Rate of Log block push fails due to free buffer unavailable | counter | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_log_pool_req_behind_trunc` | Log pool cache misses due to block requested being behind truncation LSN | counter | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_log_pool_requests_old_vlf` | Log Pool requests that were not in the last VLF of the log | counter | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_log_pool_requests` | The number of log-block requests processed by the log pool | counter | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_log_pool_total_active_log_bytes` | Current total active log stored in the shared cache buffer manager in bytes | gauge | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_log_pool_total_shared_pool_bytes` | Current total memory usage of the shared cache buffer manager in bytes | gauge | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_log_shrinks` | Total number of log shrinks for this database | gauge | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_log_truncations` | The number of times the transaction log has been truncated (in Simple Recovery Model) | gauge | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_log_used_percent` | Percentage of space in the log that is in use | gauge | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_pending_repl_transactions` | Number of transactions in the transaction log of the publication database marked for replication, but not yet delivered to the distribution database | gauge | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_repl_transactions` | Number of transactions per second read out of the transaction log of the publication database and delivered to the distribution database | counter | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_shrink_data_movement_bytes` | Amount of data being moved per second by autoshrink operations, or DBCC SHRINKDATABASE or DBCC SHRINKFILE statements | counter | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_tracked_transactions` | Number of committed transactions recorded in the commit table for the database | counter | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_transactions` | Number of transactions started for the database per second | counter | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_write_transactions` | Number of transactions that wrote to the database and committed, in the last second | counter | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_xtp_controller_dlc_fetch_latency_seconds` | Average latency in microseconds between log blocks entering the Direct Log Consumer and being retrieved by the XTP controller, per second | gauge | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_xtp_controller_dlc_peak_latency_seconds` | The largest recorded latency, in microseconds, of a fetch from the Direct Log Consumer by the XTP controller | gauge | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_xtp_controller_log_processed_bytes` | The amount of log bytes processed by the XTP controller thread, per second | counter | `mssql_instance`, `database`
|
||||
`windows_mssql_databases_xtp_memory_used_bytes` | The amount of memory used by XTP in the database | gauge | `mssql_instance`, `database`
|
||||
`windows_mssql_genstats_active_temp_tables` | Number of temporary tables/table variables in use | gauge | `mssql_instance`
|
||||
`windows_mssql_genstats_connection_resets` | Total number of logins started from the connection pool | counter | `mssql_instance`
|
||||
`windows_mssql_genstats_event_notifications_delayed_drop` | Number of event notifications waiting to be dropped by a system thread | gauge | `mssql_instance`
|
||||
`windows_mssql_genstats_http_authenticated_requests` | Number of authenticated HTTP requests started per second | gauge | `mssql_instance`
|
||||
`windows_mssql_genstats_logical_connections` | Number of logical connections to the system | gauge | `mssql_instance`
|
||||
`windows_mssql_genstats_logins` | Total number of logins started per second. This does not include pooled connections | counter | `mssql_instance`
|
||||
`windows_mssql_genstats_logouts` | Total number of logout operations started per second | counter | `mssql_instance`
|
||||
`windows_mssql_genstats_mars_deadlocks` | Number of MARS deadlocks detected | gauge | `mssql_instance`
|
||||
`windows_mssql_genstats_non_atomic_yields` | Number of non-atomic yields per second | counter | `mssql_instance`
|
||||
`windows_mssql_genstats_blocked_processes` | Number of currently blocked processes | gauge | `mssql_instance`
|
||||
`windows_mssql_genstats_soap_empty_requests` | Number of empty SOAP requests started per second | gauge | `mssql_instance`
|
||||
`windows_mssql_genstats_soap_method_invocations` | Number of SOAP method invocations started per second | gauge | `mssql_instance`
|
||||
`windows_mssql_genstats_soap_session_initiate_requests` | Number of SOAP Session initiate requests started per second | gauge | `mssql_instance`
|
||||
`windows_mssql_genstats_soap_session_terminate_requests` | Number of SOAP Session terminate requests started per second | gauge | `mssql_instance`
|
||||
`windows_mssql_genstats_soapsql_requests` | Number of SOAP SQL requests started per second | gauge | `mssql_instance`
|
||||
`windows_mssql_genstats_soapwsdl_requests` | Number of SOAP Web Service Description Language requests started per second | gauge | `mssql_instance`
|
||||
`windows_mssql_genstats_sql_trace_io_provider_lock_waits` | Number of waits for the File IO Provider lock per second | gauge | `mssql_instance`
|
||||
`windows_mssql_genstats_tempdb_recovery_unit_ids_generated` | Number of duplicate tempdb recovery unit id generated | gauge | `mssql_instance`
|
||||
`windows_mssql_genstats_tempdb_rowset_ids_generated` | Number of duplicate tempdb rowset id generated | gauge | `mssql_instance`
|
||||
`windows_mssql_genstats_temp_tables_creations` | Number of temporary tables/table variables created per second | counter | `mssql_instance`
|
||||
`windows_mssql_genstats_temp_tables_awaiting_destruction` | Number of temporary tables/table variables waiting to be destroyed by the cleanup system thread | gauge | `mssql_instance`
|
||||
`windows_mssql_genstats_trace_event_notification_queue_size` | Number of trace event notification instances waiting in the internal queue to be sent through Service Broker | gauge | `mssql_instance`
|
||||
`windows_mssql_genstats_transactions` | Number of transaction enlistments (local, DTC, bound all combined) | gauge | `mssql_instance`
|
||||
`windows_mssql_genstats_user_connections` | Counts the number of users currently connected to SQL Server | gauge | `mssql_instance`
|
||||
`windows_mssql_locks_average_wait_seconds` | Average amount of wait time (in milliseconds) for each lock request that resulted in a wait | gauge | `mssql_instance`, `resource`
|
||||
`windows_mssql_locks_lock_requests` | Number of new locks and lock conversions per second requested from the lock manager | counter | `mssql_instance`, `resource`
|
||||
`windows_mssql_locks_lock_timeouts` | Number of lock requests per second that timed out, including requests for NOWAIT locks | counter | `mssql_instance`, `resource`
|
||||
`windows_mssql_locks_lock_timeouts_excluding_NOWAIT` | Number of lock requests per second that timed out, but excluding requests for NOWAIT locks | counter | `mssql_instance`, `resource`
|
||||
`windows_mssql_locks_lock_waits` | Total wait time (in milliseconds) for locks in the last second | counter | `mssql_instance`, `resource`
|
||||
`windows_mssql_locks_lock_wait_seconds` | Number of lock requests per second that required the caller to wait | gauge | `mssql_instance`, `resource`
|
||||
`windows_mssql_locks_deadlocks` | Number of lock requests per second that resulted in a deadlock | counter | `mssql_instance`, `resource`
|
||||
`windows_mssql_memmgr_connection_memory_bytes` | Specifies the total amount of dynamic memory the server is using for maintaining connections | gauge | `mssql_instance`
|
||||
`windows_mssql_memmgr_database_cache_memory_bytes` | Specifies the amount of memory the server is currently using for the database pages cache | gauge | `mssql_instance`
|
||||
`windows_mssql_memmgr_external_benefit_of_memory` | An internal estimation of the performance benefit from adding memory to a specific cache | gauge | `mssql_instance`
|
||||
`windows_mssql_memmgr_free_memory_bytes` | Specifies the amount of committed memory currently not used by the server | gauge | `mssql_instance`
|
||||
`windows_mssql_memmgr_granted_workspace_memory_bytes` | Specifies the total amount of memory currently granted to executing processes, such as hash, sort, bulk copy, and index creation operations | gauge | `mssql_instance`
|
||||
`windows_mssql_memmgr_lock_blocks` | Specifies the current number of lock blocks in use on the server (refreshed periodically). A lock block represents an individual locked resource, such as a table, page, or row | gauge | `mssql_instance`
|
||||
`windows_mssql_memmgr_allocated_lock_blocks` | Specifies the current number of allocated lock blocks. At server startup, the number of allocated lock blocks plus the number of allocated lock owner blocks depends on the SQL Server Locks configuration option. If more lock blocks are needed, the value increases | gauge | `mssql_instance`
|
||||
`windows_mssql_memmgr_lock_memory_bytes` | Specifies the total amount of dynamic memory the server is using for locks | gauge | `mssql_instance`
|
||||
`windows_mssql_memmgr_lock_owner_blocks` | Specifies the current number of allocated lock owner blocks. At server startup, the number of allocated lock owner blocks and the number of allocated lock blocks depend on the SQL Server Locks configuration option. If more lock owner blocks are needed, the value increases dynamically | gauge | `mssql_instance`
|
||||
`windows_mssql_memmgr_allocated_lock_owner_blocks` | _Not yet documented_ | gauge | `mssql_instance`
|
||||
`windows_mssql_memmgr_log_pool_memory_bytes` | Total amount of dynamic memory the server is using for Log Pool | gauge | `mssql_instance`
|
||||
`windows_mssql_memmgr_maximum_workspace_memory_bytes` | Indicates the maximum amount of memory available for executing processes, such as hash, sort, bulk copy, and index creation operations | gauge | `mssql_instance`
|
||||
`windows_mssql_memmgr_outstanding_memory_grants` | Specifies the total number of processes that have successfully acquired a workspace memory grant | gauge | `mssql_instance`
|
||||
`windows_mssql_memmgr_pending_memory_grants` | Specifies the total number of processes waiting for a workspace memory grant | gauge | `mssql_instance`
|
||||
`windows_mssql_memmgr_optimizer_memory_bytes` | Specifies the total amount of dynamic memory the server is using for query optimization | gauge | `mssql_instance`
|
||||
`windows_mssql_memmgr_reserved_server_memory_bytes` | ndicates the amount of memory the server has reserved for future usage. This counter shows the current unused amount of memory initially granted that is shown in Granted Workspace Memory | gauge | `mssql_instance`
|
||||
`windows_mssql_memmgr_sql_cache_memory_bytes` | Specifies the total amount of dynamic memory the server is using for the dynamic SQL cache | gauge | `mssql_instance`
|
||||
`windows_mssql_memmgr_stolen_server_memory_bytes` | Specifies the amount of memory the server is using for purposes other than database pages | gauge | `mssql_instance`
|
||||
`windows_mssql_memmgr_target_server_memory_bytes` | Indicates the ideal amount of memory the server can consume | gauge | `mssql_instance`
|
||||
`windows_mssql_memmgr_total_server_memory_bytes` | Specifies the amount of memory the server has committed using the memory manager | gauge | `mssql_instance`
|
||||
`windows_mssql_sqlstats_auto_parameterization_attempts` | Number of failed auto-parameterization attempts per second. This should be small. Note that auto-parameterizations are also known as simple parameterizations in later versions of SQL Server | counter | `mssql_instance`
|
||||
`windows_mssql_sqlstats_batch_requests` | _Not yet documented_ | counter | `mssql_instance`
|
||||
`windows_mssql_sqlstats_failed_auto_parameterization_attempts` | _Not yet documented_ | counter | `mssql_instance`
|
||||
`windows_mssql_sqlstats_forced_parameterizations` | Number of successful forced parameterizations per second | counter | `mssql_instance`
|
||||
`windows_mssql_sqlstats_guided_plan_executions` | Number of plan executions per second in which the query plan has been generated by using a plan guide | counter | `mssql_instance`
|
||||
`windows_mssql_sqlstats_misguided_plan_executions` | Number of plan executions per second in which a plan guide could not be honored during plan generation | counter | `mssql_instance`
|
||||
`windows_mssql_sqlstats_safe_auto_parameterization_attempts` | Number of safe auto-parameterization attempts per second | counter | `mssql_instance`
|
||||
`windows_mssql_sqlstats_sql_attentions` | Number of attentions per second | counter | `mssql_instance`
|
||||
`windows_mssql_sqlstats_sql_compilations` | Number of SQL compilations per second | counter | `mssql_instance`
|
||||
`windows_mssql_sqlstats_sql_recompilations` | Number of statement recompiles per second | counter | `mssql_instance`
|
||||
`windows_mssql_sqlstats_unsafe_auto_parameterization_attempts` | Number of unsafe auto-parameterization attempts per second. | counter | `mssql_instance`
|
||||
`windows_mssql_sql_errors_total` | Information for all errors | counter | `mssql_instance`, `resource`
|
||||
`windows_mssql_transactions_tempdb_free_space_bytes` | The amount of space (in kilobytes) available in tempdb | gauge | `mssql_instance`
|
||||
`windows_mssql_transactions_longest_transaction_running_seconds` | The length of time (in seconds) since the start of the transaction that has been active longer than any other current transaction | gauge | `mssql_instance`
|
||||
`windows_mssql_transactions_nonsnapshot_version_active_total` | The number of currently active transactions that are not using snapshot isolation level and have made data modifications that have generated row versions in the tempdb version store | counter | `mssql_instance`
|
||||
`windows_mssql_transactions_snapshot_active_total` | The number of currently active transactions using the snapshot isolation level | counter | `mssql_instance`
|
||||
`windows_mssql_transactions_active` | The number of currently active transactions of all types | gauge | `mssql_instance`
|
||||
`windows_mssql_transactions_update_conflicts_total` | The percentage of those transactions using the snapshot isolation level that have encountered update conflicts within the last second | counter | `mssql_instance`
|
||||
`windows_mssql_transactions_update_snapshot_active_total` | The number of currently active transactions using the snapshot isolation level and have modified data | counter | `mssql_instance`
|
||||
`windows_mssql_transactions_version_cleanup_rate_bytes` | The rate (in kilobytes per second) at which row versions are removed from the snapshot isolation version store in tempdb | gauge | `mssql_instance`
|
||||
`windows_mssql_transactions_version_generation_rate_bytes` | The rate (in kilobytes per second) at which new row versions are added to the snapshot isolation version store in tempdb | gauge | `mssql_instance`
|
||||
`windows_mssql_transactions_version_store_size_bytes` | he amount of space (in kilobytes) in tempdb being used to store snapshot isolation level row versions | gauge | `mssql_instance`
|
||||
`windows_mssql_transactions_version_store_units` | The number of active allocation units in the snapshot isolation version store in tempdb | counter | `mssql_instance`
|
||||
`windows_mssql_transactions_version_store_creation_units` | The number of allocation units that have been created in the snapshot isolation store since the instance of the Database Engine was started | counter | `mssql_instance`
|
||||
`windows_mssql_transactions_version_store_truncation_units` | The number of allocation units that have been removed from the snapshot isolation store since the instance of the Database Engine was started | counter | `mssql_instance`
|
||||
`windows_mssql_waitstats_lock_waits` | Statistics for processes waiting on a lock | gauge | `mssql_instance`, `item`
|
||||
`windows_mssql_waitstats_memory_grant_queue_waits` | Statistics for processes waiting for memory grant to become available | gauge | `mssql_instance`, `item`
|
||||
`windows_mssql_waitstats_thread_safe_memory_objects_waits` | Statistics for processes waiting on thread-safe memory allocators | gauge | `mssql_instance`, `item`
|
||||
`windows_mssql_waitstats_log_write_waits` | Statistics for processes waiting for log buffer to be written | gauge | `mssql_instance`, `item`
|
||||
`windows_mssql_waitstats_log_buffer_waits` | Statistics for processes waiting for log buffer to be available | gauge | `mssql_instance`, `item`
|
||||
`windows_mssql_waitstats_network_io_waits` | Statistics relevant to wait on network I/O | gauge | `mssql_instance`, `item`
|
||||
`windows_mssql_waitstats_page_io_latch_waits` | Statistics relevant to page I/O latches | gauge | `mssql_instance`, `item`
|
||||
`windows_mssql_waitstats_page_latch_waits` | Statistics relevant to page latches, not including I/O latches | gauge | `mssql_instance`, `item`
|
||||
`windows_mssql_waitstats_nonpage_latch_waits` | Statistics relevant to non-page latches | gauge | `mssql_instance`, `item`
|
||||
`windows_mssql_waitstats_wait_for_the_worker_waits` | Statistics relevant to processes waiting for worker to become available | gauge | `mssql_instance`, `item`
|
||||
`windows_mssql_waitstats_workspace_synchronization_waits` | Statistics relevant to processes synchronizing access to workspace | gauge | `mssql_instance`, `item`
|
||||
`windows_mssql_waitstats_transaction_ownership_waits` | Statistics relevant to processes synchronizing access to transaction | gauge | `mssql_instance`, `item`
|
||||
| Name | Description | Type | Labels |
|
||||
|--------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|-------------------------------|
|
||||
| `windows_mssql_info` | Returns information about the MSSQL server running on port 1433 | gauge | `version` |
|
||||
| `windows_mssql_collector_duration_seconds` | The time taken for each sub-collector to return | gauge | `collector`, `mssql_instance` |
|
||||
| `windows_mssql_collector_success` | 1 if sub-collector succeeded, 0 otherwise | gauge | `collector`, `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_au_batch_cleanups` | The total number of batches that were completed successfully by the background task that cleans up deferred dropped allocation units | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_au_cleanups` | The total number of allocation units that were successfully dropped the background task that cleans up deferred dropped allocation units. Each allocation unit drop requires multiple batches | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_by_reference_lob_creates` | The total count of large object (lob) values that were passed by reference. By-reference lobs are used in certain bulk operations to avoid the cost of passing them by value | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_by_reference_lob_uses` | The total count of by-reference lob values that were used. By-reference lobs are used in certain bulk operations to avoid the cost of passing them by-value | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_lob_read_aheads` | The total count of lob pages on which readahead was issued | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_column_value_pulls` | The total count of column values that were pulled in-row from off-row | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_column_value_pushes` | The total count of column values that were pushed from in-row to off-row | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_deferred_dropped_aus` | The total number of allocation units waiting to be dropped by the background task that cleans up deferred dropped allocation units | gauge | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_deferred_dropped_rowsets` | The number of rowsets created as a result of aborted online index build operations that are waiting to be dropped by the background task that cleans up deferred dropped rowsets | gauge | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_dropped_rowset_cleanups` | The number of rowsets per second created as a result of aborted online index build operations that were successfully dropped by the background task that cleans up deferred dropped rowsets | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_dropped_rowset_skips` | The number of rowsets per second created as a result of aborted online index build operations that were skipped by the background task that cleans up deferred dropped rowsets created | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_extent_deallocations` | Number of extents deallocated per second in all databases in this instance of SQL Server | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_extent_allocations` | Number of extents allocated per second in all databases in this instance of SQL Server | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_au_batch_cleanup_failures` | The number of batches per second that failed and required retry, by the background task that cleans up deferred dropped allocation units. Failure could be due to lack of memory or disk space, hardware failure and other reasons | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_leaf_page_cookie_failures` | The number of times that a leaf page cookie could not be used during an index search since changes happened on the leaf page. The cookie is used to speed up index search | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_tree_page_cookie_failures` | The number of times that a tree page cookie could not be used during an index search since changes happened on the parent pages of those tree pages. The cookie is used to speed up index search | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_forwarded_records` | Number of records per second fetched through forwarded record pointers | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_free_space_page_fetches` | Number of pages fetched per second by free space scans. These scans search for free space within pages already allocated to an allocation unit, to satisfy requests to insert or modify record fragments | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_free_space_scans` | Number of scans per second that were initiated to search for free space within pages already allocated to an allocation unit to insert or modify record fragment. Each scan may find multiple pages | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_full_scans` | Number of unrestricted full scans per second. These can be either base-table or full-index scans | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_index_searches` | Number of index searches per second. These are used to start a range scan, reposition a range scan, revalidate a scan point, fetch a single index record, and search down the index to locate where to insert a new row | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_insysxact_waits` | Number of times a reader needs to wait for a page because the InSysXact bit is set | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_lob_handle_creates` | Count of temporary lobs created | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_lob_handle_destroys` | Count of temporary lobs destroyed | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_lob_ss_provider_creates` | Count of LOB Storage Service Providers (LobSSP) created. One worktable created per LobSSP | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_lob_ss_provider_destroys` | Count of LobSSP destroyed | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_lob_ss_provider_truncations` | Count of LobSSP truncated | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_mixed_page_allocations` | Number of pages allocated per second from mixed extents. These could be used for storing the IAM pages and the first eight pages that are allocated to an allocation unit | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_page_compression_attempts` | Number of pages evaluated for page-level compression. Includes pages that were not compressed because significant savings could be achieved. Includes all objects in the instance of SQL Server | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_page_deallocations` | Number of pages deallocated per second in all databases in this instance of SQL Server. These include pages from mixed extents and uniform extents | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_page_allocations` | Number of pages allocated per second in all databases in this instance of SQL Server. These include pages allocations from both mixed extents and uniform extents | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_page_compressions` | Number of data pages that are compressed by using PAGE compression. Includes all objects in the instance of SQL Server | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_page_splits` | Number of page splits per second that occur as the result of overflowing index pages | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_probe_scans` | Number of probe scans per second that are used to find at most one single qualified row in an index or base table directly | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_range_scans` | Number of qualified range scans through indexes per second | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_scan_point_revalidations` | Number of times per second that the scan point had to be revalidated to continue the scan | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_ghost_record_skips` | Number of ghosted records per second skipped during scans | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_table_lock_escalations` | Number of times locks on a table were escalated to the TABLE or HoBT granularity | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_leaf_page_cookie_uses` | Number of times a leaf page cookie is used successfully during an index search since no change happened on the leaf page. The cookie is used to speed up index search | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_tree_page_cookie_uses` | Number of times a tree page cookie is used successfully during an index search since no change happened on the parent page of the tree page. The cookie is used to speed up index search | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_workfile_creates` | Number of work files created per second. For example, work files could be used to store temporary results for hash joins and hash aggregates | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_worktables_creates` | Number of work tables created per second. For example, work tables could be used to store temporary results for query spool, lob variables, XML variables, and cursors | counter | `mssql_instance` |
|
||||
| `windows_mssql_accessmethods_worktables_from_cache_ratio` | Percentage of work tables created where the initial two pages of the work table were not allocated but were immediately available from the work table cache | counter | `mssql_instance` |
|
||||
| `windows_mssql_availreplica_received_from_replica_bytes` | Number of bytes received from the availability replica per second. Pings and status updates will generate network traffic even on databases with no user updates | counter | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_availreplica_sent_to_replica_bytes` | Number of bytes sent to the remote availability replica per second. On the primary replica this is the number of bytes sent to the secondary replica. On the secondary replica this is the number of bytes sent to the primary replica | counter | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_availreplica_sent_to_transport_bytes` | Actual number of bytes sent per second over the network to the remote availability replica. On the primary replica this is the number of bytes sent to the secondary replica. On the secondary replica this is the number of bytes sent to the primary replica | counter | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_availreplica_initiated_flow_controls` | Time in milliseconds that log stream messages waited for send flow control, in the last second | counter | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_availreplica_flow_control_wait_seconds` | Number of times flow-control initiated in the last second. Flow Control Time (ms/sec) divided by Flow Control/sec is the average time per wait | counter | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_availreplica_receives_from_replica` | Number of Always On messages received from thereplica per second | counter | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_availreplica_resent_messages` | Number of Always On messages resent in the last second | counter | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_availreplica_sends_to_replica` | Number of Always On messages sent to this availability replica per second | counter | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_availreplica_sends_to_transport` | Actual number of Always On messages sent per second over the network to the remote availability replica | counter | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_bufman_background_writer_pages` | Number of pages flushed to enforce the recovery interval settings | counter | `mssql_instance` |
|
||||
| `windows_mssql_bufman_buffer_cache_hit_ratio` | Indicates the percentage of pages found in the buffer cache without having to read from disk. The ratio is the total number of cache hits divided by the total number of cache lookups over the last few thousand page accesses | gauge | `mssql_instance` |
|
||||
| `windows_mssql_bufman_checkpoint_pages` | Indicates the number of pages flushed to disk per second by a checkpoint or other operation that require all dirty pages to be flushed | counter | `mssql_instance` |
|
||||
| `windows_mssql_bufman_database_pages` | Indicates the number of pages in the buffer pool with database content | gauge | `mssql_instance` |
|
||||
| `windows_mssql_bufman_extension_allocated_pages` | Total number of non-free cache pages in the buffer pool extension file | gauge | `mssql_instance` |
|
||||
| `windows_mssql_bufman_extension_free_pages` | Total number of free cache pages in the buffer pool extension file | gauge | `mssql_instance` |
|
||||
| `windows_mssql_bufman_extension_in_use_as_percentage` | _Not yet documented_ | gauge | `mssql_instance` |
|
||||
| `windows_mssql_bufman_extension_outstanding_io` | Percentage of the buffer pool extension paging file occupied by buffer manager pages | gauge | `mssql_instance` |
|
||||
| `windows_mssql_bufman_extension_page_evictions` | Number of pages evicted from the buffer pool extension file per second | counter | `mssql_instance` |
|
||||
| `windows_mssql_bufman_extension_page_reads` | Number of pages read from the buffer pool extension file per second | counter | `mssql_instance` |
|
||||
| `windows_mssql_bufman_extension_page_unreferenced_seconds` | Average seconds a page will stay in the buffer pool extension without references to it | gauge | `mssql_instance` |
|
||||
| `windows_mssql_bufman_extension_page_writes` | Number of pages written to the buffer pool extension file per second | counter | `mssql_instance` |
|
||||
| `windows_mssql_bufman_free_list_stalls` | Indicates the number of requests per second that had to wait for a free page | counter | `mssql_instance` |
|
||||
| `windows_mssql_bufman_integral_controller_slope` | The slope that integral controller for the buffer pool last used, times -10 billion | gauge | `mssql_instance` |
|
||||
| `windows_mssql_bufman_lazywrites` | Indicates the number of buffers written per second by the buffer manager's lazy writer | counter | `mssql_instance` |
|
||||
| `windows_mssql_bufman_page_life_expectancy_seconds` | Indicates the number of seconds a page will stay in the buffer pool without references | gauge | `mssql_instance` |
|
||||
| `windows_mssql_bufman_page_lookups` | Indicates the number of requests per second to find a page in the buffer pool | counter | `mssql_instance` |
|
||||
| `windows_mssql_bufman_page_reads` | Indicates the number of physical database page reads that are issued per second | counter | `mssql_instance` |
|
||||
| `windows_mssql_bufman_page_writes` | Indicates the number of physical database page writes that are issued per second | counter | `mssql_instance` |
|
||||
| `windows_mssql_bufman_read_ahead_pages` | Indicates the number of pages read per second in anticipation of use | counter | `mssql_instance` |
|
||||
| `windows_mssql_bufman_read_ahead_issuing_seconds` | Time (microseconds) spent issuing readahead | counter | `mssql_instance` |
|
||||
| `windows_mssql_bufman_target_pages` | Ideal number of pages in the buffer pool | gauge | `mssql_instance` |
|
||||
| `windows_mssql_dbreplica_database_flow_control_wait_seconds` | _Not yet documented_ | gauge | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_dbreplica_database_initiated_flow_controls` | _Not yet documented_ | counter | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_dbreplica_received_file_bytes` | _Not yet documented_ | counter | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_dbreplica_group_commits` | _Not yet documented_ | counter | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_dbreplica_group_commit_stall_seconds` | _Not yet documented_ | counter | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_dbreplica_log_apply_pending_queue` | _Not yet documented_ | gauge | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_dbreplica_log_apply_ready_queue` | _Not yet documented_ | gauge | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_dbreplica_log_compressed_bytes` | _Not yet documented_ | counter | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_dbreplica_log_decompressed_bytes` | _Not yet documented_ | counter | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_dbreplica_log_received_bytes` | _Not yet documented_ | counter | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_dbreplica_log_compression_cachehits` | _Not yet documented_ | counter | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_dbreplica_log_compression_cachemisses` | _Not yet documented_ | counter | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_dbreplica_log_compressions` | _Not yet documented_ | counter | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_dbreplica_log_decompressions` | _Not yet documented_ | counter | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_dbreplica_log_remaining_for_undo` | The amount of log, in bytes, remaining to complete the undo phase | gauge | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_dbreplica_log_send_queue` | Amount of log records in the log files of the primary database, in kilobytes, that haven't been sent to the secondary replica | gauge | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_dbreplica_mirrored_write_transactions` | Number of transactions that were written to the primary database and then waited to commit until the log was sent to the secondary database, in the last second | counter | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_dbreplica_recovery_queue_records` | Amount of log records in the log files of the secondary replica that have not been redone | gauge | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_dbreplica_redo_blocks` | Number of times the redo thread was blocked on locks held by readers of the database | counter | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_dbreplica_redo_remaining_bytes` | The amount of log, in kilobytes, remaining to be redone to finish the reverting phase | gauge | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_dbreplica_redone_bytes` | Amount of log records redone on the secondary database in the last second | counter | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_dbreplica_redones` | _Not yet documented_ | counter | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_dbreplica_total_log_requiring_undo` | Total kilobytes of log that must be undone | gauge | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_dbreplica_transaction_delay_seconds` | Delay in waiting for unterminated commit acknowledgment for all the current transactions | gauge | `mssql_instance`, `replica` |
|
||||
| `windows_mssql_databases_active_transactions` | Number of active transactions for the database | gauge | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_backup_restore_operations` | Read/write throughput for backup and restore operations of a database per second | counter | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_bulk_copy_rows` | Number of rows bulk copied per second | counter | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_bulk_copy_bytes` | Amount of data bulk copied (in kilobytes) per second | counter | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_commit_table_entries` | he size (row count) of the in-memory portion of the commit table for the database | gauge | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_data_files_size_bytes` | Cumulative size (in kilobytes) of all the data files in the database including any automatic growth. Monitoring this counter is useful, for example, for determining the correct size of tempdb | gauge | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_dbcc_logical_scan_bytes` | Number of logical read scan bytes per second for database console commands (DBCC) | counter | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_group_commit_stall_seconds` | Group stall time (microseconds) per second | counter | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_log_flushed_bytes` | Total number of log bytes flushed | counter | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_log_cache_hit_ratio` | Percentage of log cache reads satisfied from the log cache | gauge | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_log_cache_reads` | Reads performed per second through the log manager cache | counter | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_log_files_size_bytes` | Cumulative size (in kilobytes) of all the transaction log files in the database | gauge | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_log_files_used_size_bytes` | The cumulative used size of all the log files in the database | gauge | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_log_flushes` | Total wait time (in milliseconds) to flush the log. On an Always On secondary database, this value indicates the wait time for log records to be hardened to disk | counter | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_log_flush_waits` | Number of commits per second waiting for the log flush | counter | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_log_flush_wait_seconds` | Number of commits per second waiting for the log flush | gauge | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_log_flush_write_seconds` | Time in milliseconds for performing writes of log flushes that were completed in the last second | gauge | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_log_growths` | Total number of times the transaction log for the database has been expanded | gauge | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_log_pool_cache_misses` | Number of requests for which the log block was not available in the log pool | counter | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_log_pool_disk_reads` | Number of disk reads that the log pool issued to fetch log blocks | counter | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_log_pool_hash_deletes` | Rate of raw hash entry deletes from the Log Pool | counter | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_log_pool_hash_inserts` | Rate of raw hash entry inserts into the Log Pool | counter | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_log_pool_invalid_hash_entries` | Rate of hash lookups failing due to being invalid | counter | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_log_pool_log_scan_pushes` | Rate of Log block pushes by log scans, which may come from disk or memory | counter | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_log_pool_log_writer_pushes` | Rate of Log block pushes by log writer thread | counter | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_log_pool_empty_free_pool_pushes` | Rate of Log block push fails due to empty free pool | counter | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_log_pool_low_memory_pushes` | Rate of Log block push fails due to being low on memory | counter | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_log_pool_no_free_buffer_pushes` | Rate of Log block push fails due to free buffer unavailable | counter | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_log_pool_req_behind_trunc` | Log pool cache misses due to block requested being behind truncation LSN | counter | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_log_pool_requests_old_vlf` | Log Pool requests that were not in the last VLF of the log | counter | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_log_pool_requests` | The number of log-block requests processed by the log pool | counter | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_log_pool_total_active_log_bytes` | Current total active log stored in the shared cache buffer manager in bytes | gauge | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_log_pool_total_shared_pool_bytes` | Current total memory usage of the shared cache buffer manager in bytes | gauge | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_log_shrinks` | Total number of log shrinks for this database | gauge | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_log_truncations` | The number of times the transaction log has been truncated (in Simple Recovery Model) | gauge | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_log_used_percent` | Percentage of space in the log that is in use | gauge | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_pending_repl_transactions` | Number of transactions in the transaction log of the publication database marked for replication, but not yet delivered to the distribution database | gauge | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_repl_transactions` | Number of transactions per second read out of the transaction log of the publication database and delivered to the distribution database | counter | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_shrink_data_movement_bytes` | Amount of data being moved per second by autoshrink operations, or DBCC SHRINKDATABASE or DBCC SHRINKFILE statements | counter | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_tracked_transactions` | Number of committed transactions recorded in the commit table for the database | counter | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_transactions` | Number of transactions started for the database per second | counter | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_write_transactions` | Number of transactions that wrote to the database and committed, in the last second | counter | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_xtp_controller_dlc_fetch_latency_seconds` | Average latency in microseconds between log blocks entering the Direct Log Consumer and being retrieved by the XTP controller, per second | gauge | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_xtp_controller_dlc_peak_latency_seconds` | The largest recorded latency, in microseconds, of a fetch from the Direct Log Consumer by the XTP controller | gauge | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_xtp_controller_log_processed_bytes` | The amount of log bytes processed by the XTP controller thread, per second | counter | `mssql_instance`, `database` |
|
||||
| `windows_mssql_databases_xtp_memory_used_bytes` | The amount of memory used by XTP in the database | gauge | `mssql_instance`, `database` |
|
||||
| `windows_mssql_genstats_active_temp_tables` | Number of temporary tables/table variables in use | gauge | `mssql_instance` |
|
||||
| `windows_mssql_genstats_connection_resets` | Total number of logins started from the connection pool | counter | `mssql_instance` |
|
||||
| `windows_mssql_genstats_event_notifications_delayed_drop` | Number of event notifications waiting to be dropped by a system thread | gauge | `mssql_instance` |
|
||||
| `windows_mssql_genstats_http_authenticated_requests` | Number of authenticated HTTP requests started per second | gauge | `mssql_instance` |
|
||||
| `windows_mssql_genstats_logical_connections` | Number of logical connections to the system | gauge | `mssql_instance` |
|
||||
| `windows_mssql_genstats_logins` | Total number of logins started per second. This does not include pooled connections | counter | `mssql_instance` |
|
||||
| `windows_mssql_genstats_logouts` | Total number of logout operations started per second | counter | `mssql_instance` |
|
||||
| `windows_mssql_genstats_mars_deadlocks` | Number of MARS deadlocks detected | gauge | `mssql_instance` |
|
||||
| `windows_mssql_genstats_non_atomic_yields` | Number of non-atomic yields per second | counter | `mssql_instance` |
|
||||
| `windows_mssql_genstats_blocked_processes` | Number of currently blocked processes | gauge | `mssql_instance` |
|
||||
| `windows_mssql_genstats_soap_empty_requests` | Number of empty SOAP requests started per second | gauge | `mssql_instance` |
|
||||
| `windows_mssql_genstats_soap_method_invocations` | Number of SOAP method invocations started per second | gauge | `mssql_instance` |
|
||||
| `windows_mssql_genstats_soap_session_initiate_requests` | Number of SOAP Session initiate requests started per second | gauge | `mssql_instance` |
|
||||
| `windows_mssql_genstats_soap_session_terminate_requests` | Number of SOAP Session terminate requests started per second | gauge | `mssql_instance` |
|
||||
| `windows_mssql_genstats_soapsql_requests` | Number of SOAP SQL requests started per second | gauge | `mssql_instance` |
|
||||
| `windows_mssql_genstats_soapwsdl_requests` | Number of SOAP Web Service Description Language requests started per second | gauge | `mssql_instance` |
|
||||
| `windows_mssql_genstats_sql_trace_io_provider_lock_waits` | Number of waits for the File IO Provider lock per second | gauge | `mssql_instance` |
|
||||
| `windows_mssql_genstats_tempdb_recovery_unit_ids_generated` | Number of duplicate tempdb recovery unit id generated | gauge | `mssql_instance` |
|
||||
| `windows_mssql_genstats_tempdb_rowset_ids_generated` | Number of duplicate tempdb rowset id generated | gauge | `mssql_instance` |
|
||||
| `windows_mssql_genstats_temp_tables_creations` | Number of temporary tables/table variables created per second | counter | `mssql_instance` |
|
||||
| `windows_mssql_genstats_temp_tables_awaiting_destruction` | Number of temporary tables/table variables waiting to be destroyed by the cleanup system thread | gauge | `mssql_instance` |
|
||||
| `windows_mssql_genstats_trace_event_notification_queue_size` | Number of trace event notification instances waiting in the internal queue to be sent through Service Broker | gauge | `mssql_instance` |
|
||||
| `windows_mssql_genstats_transactions` | Number of transaction enlistments (local, DTC, bound all combined) | gauge | `mssql_instance` |
|
||||
| `windows_mssql_genstats_user_connections` | Counts the number of users currently connected to SQL Server | gauge | `mssql_instance` |
|
||||
| `windows_mssql_locks_average_wait_seconds` | Average amount of wait time (in milliseconds) for each lock request that resulted in a wait | gauge | `mssql_instance`, `resource` |
|
||||
| `windows_mssql_locks_lock_requests` | Number of new locks and lock conversions per second requested from the lock manager | counter | `mssql_instance`, `resource` |
|
||||
| `windows_mssql_locks_lock_timeouts` | Number of lock requests per second that timed out, including requests for NOWAIT locks | counter | `mssql_instance`, `resource` |
|
||||
| `windows_mssql_locks_lock_timeouts_excluding_NOWAIT` | Number of lock requests per second that timed out, but excluding requests for NOWAIT locks | counter | `mssql_instance`, `resource` |
|
||||
| `windows_mssql_locks_lock_waits` | Total wait time (in milliseconds) for locks in the last second | counter | `mssql_instance`, `resource` |
|
||||
| `windows_mssql_locks_lock_wait_seconds` | Number of lock requests per second that required the caller to wait | gauge | `mssql_instance`, `resource` |
|
||||
| `windows_mssql_locks_deadlocks` | Number of lock requests per second that resulted in a deadlock | counter | `mssql_instance`, `resource` |
|
||||
| `windows_mssql_memmgr_connection_memory_bytes` | Specifies the total amount of dynamic memory the server is using for maintaining connections | gauge | `mssql_instance` |
|
||||
| `windows_mssql_memmgr_database_cache_memory_bytes` | Specifies the amount of memory the server is currently using for the database pages cache | gauge | `mssql_instance` |
|
||||
| `windows_mssql_memmgr_external_benefit_of_memory` | An internal estimation of the performance benefit from adding memory to a specific cache | gauge | `mssql_instance` |
|
||||
| `windows_mssql_memmgr_free_memory_bytes` | Specifies the amount of committed memory currently not used by the server | gauge | `mssql_instance` |
|
||||
| `windows_mssql_memmgr_granted_workspace_memory_bytes` | Specifies the total amount of memory currently granted to executing processes, such as hash, sort, bulk copy, and index creation operations | gauge | `mssql_instance` |
|
||||
| `windows_mssql_memmgr_lock_blocks` | Specifies the current number of lock blocks in use on the server (refreshed periodically). A lock block represents an individual locked resource, such as a table, page, or row | gauge | `mssql_instance` |
|
||||
| `windows_mssql_memmgr_allocated_lock_blocks` | Specifies the current number of allocated lock blocks. At server startup, the number of allocated lock blocks plus the number of allocated lock owner blocks depends on the SQL Server Locks configuration option. If more lock blocks are needed, the value increases | gauge | `mssql_instance` |
|
||||
| `windows_mssql_memmgr_lock_memory_bytes` | Specifies the total amount of dynamic memory the server is using for locks | gauge | `mssql_instance` |
|
||||
| `windows_mssql_memmgr_lock_owner_blocks` | Specifies the current number of allocated lock owner blocks. At server startup, the number of allocated lock owner blocks and the number of allocated lock blocks depend on the SQL Server Locks configuration option. If more lock owner blocks are needed, the value increases dynamically | gauge | `mssql_instance` |
|
||||
| `windows_mssql_memmgr_allocated_lock_owner_blocks` | _Not yet documented_ | gauge | `mssql_instance` |
|
||||
| `windows_mssql_memmgr_log_pool_memory_bytes` | Total amount of dynamic memory the server is using for Log Pool | gauge | `mssql_instance` |
|
||||
| `windows_mssql_memmgr_maximum_workspace_memory_bytes` | Indicates the maximum amount of memory available for executing processes, such as hash, sort, bulk copy, and index creation operations | gauge | `mssql_instance` |
|
||||
| `windows_mssql_memmgr_outstanding_memory_grants` | Specifies the total number of processes that have successfully acquired a workspace memory grant | gauge | `mssql_instance` |
|
||||
| `windows_mssql_memmgr_pending_memory_grants` | Specifies the total number of processes waiting for a workspace memory grant | gauge | `mssql_instance` |
|
||||
| `windows_mssql_memmgr_optimizer_memory_bytes` | Specifies the total amount of dynamic memory the server is using for query optimization | gauge | `mssql_instance` |
|
||||
| `windows_mssql_memmgr_reserved_server_memory_bytes` | ndicates the amount of memory the server has reserved for future usage. This counter shows the current unused amount of memory initially granted that is shown in Granted Workspace Memory | gauge | `mssql_instance` |
|
||||
| `windows_mssql_memmgr_sql_cache_memory_bytes` | Specifies the total amount of dynamic memory the server is using for the dynamic SQL cache | gauge | `mssql_instance` |
|
||||
| `windows_mssql_memmgr_stolen_server_memory_bytes` | Specifies the amount of memory the server is using for purposes other than database pages | gauge | `mssql_instance` |
|
||||
| `windows_mssql_memmgr_target_server_memory_bytes` | Indicates the ideal amount of memory the server can consume | gauge | `mssql_instance` |
|
||||
| `windows_mssql_memmgr_total_server_memory_bytes` | Specifies the amount of memory the server has committed using the memory manager | gauge | `mssql_instance` |
|
||||
| `windows_mssql_sqlstats_auto_parameterization_attempts` | Number of failed auto-parameterization attempts per second. This should be small. Note that auto-parameterizations are also known as simple parameterizations in later versions of SQL Server | counter | `mssql_instance` |
|
||||
| `windows_mssql_sqlstats_batch_requests` | _Not yet documented_ | counter | `mssql_instance` |
|
||||
| `windows_mssql_sqlstats_failed_auto_parameterization_attempts` | _Not yet documented_ | counter | `mssql_instance` |
|
||||
| `windows_mssql_sqlstats_forced_parameterizations` | Number of successful forced parameterizations per second | counter | `mssql_instance` |
|
||||
| `windows_mssql_sqlstats_guided_plan_executions` | Number of plan executions per second in which the query plan has been generated by using a plan guide | counter | `mssql_instance` |
|
||||
| `windows_mssql_sqlstats_misguided_plan_executions` | Number of plan executions per second in which a plan guide could not be honored during plan generation | counter | `mssql_instance` |
|
||||
| `windows_mssql_sqlstats_safe_auto_parameterization_attempts` | Number of safe auto-parameterization attempts per second | counter | `mssql_instance` |
|
||||
| `windows_mssql_sqlstats_sql_attentions` | Number of attentions per second | counter | `mssql_instance` |
|
||||
| `windows_mssql_sqlstats_sql_compilations` | Number of SQL compilations per second | counter | `mssql_instance` |
|
||||
| `windows_mssql_sqlstats_sql_recompilations` | Number of statement recompiles per second | counter | `mssql_instance` |
|
||||
| `windows_mssql_sqlstats_unsafe_auto_parameterization_attempts` | Number of unsafe auto-parameterization attempts per second. | counter | `mssql_instance` |
|
||||
| `windows_mssql_sql_errors_total` | Information for all errors | counter | `mssql_instance`, `resource` |
|
||||
| `windows_mssql_transactions_tempdb_free_space_bytes` | The amount of space (in kilobytes) available in tempdb | gauge | `mssql_instance` |
|
||||
| `windows_mssql_transactions_longest_transaction_running_seconds` | The length of time (in seconds) since the start of the transaction that has been active longer than any other current transaction | gauge | `mssql_instance` |
|
||||
| `windows_mssql_transactions_nonsnapshot_version_active_total` | The number of currently active transactions that are not using snapshot isolation level and have made data modifications that have generated row versions in the tempdb version store | counter | `mssql_instance` |
|
||||
| `windows_mssql_transactions_snapshot_active_total` | The number of currently active transactions using the snapshot isolation level | counter | `mssql_instance` |
|
||||
| `windows_mssql_transactions_active` | The number of currently active transactions of all types | gauge | `mssql_instance` |
|
||||
| `windows_mssql_transactions_update_conflicts_total` | The percentage of those transactions using the snapshot isolation level that have encountered update conflicts within the last second | counter | `mssql_instance` |
|
||||
| `windows_mssql_transactions_update_snapshot_active_total` | The number of currently active transactions using the snapshot isolation level and have modified data | counter | `mssql_instance` |
|
||||
| `windows_mssql_transactions_version_cleanup_rate_bytes` | The rate (in kilobytes per second) at which row versions are removed from the snapshot isolation version store in tempdb | gauge | `mssql_instance` |
|
||||
| `windows_mssql_transactions_version_generation_rate_bytes` | The rate (in kilobytes per second) at which new row versions are added to the snapshot isolation version store in tempdb | gauge | `mssql_instance` |
|
||||
| `windows_mssql_transactions_version_store_size_bytes` | he amount of space (in kilobytes) in tempdb being used to store snapshot isolation level row versions | gauge | `mssql_instance` |
|
||||
| `windows_mssql_transactions_version_store_units` | The number of active allocation units in the snapshot isolation version store in tempdb | counter | `mssql_instance` |
|
||||
| `windows_mssql_transactions_version_store_creation_units` | The number of allocation units that have been created in the snapshot isolation store since the instance of the Database Engine was started | counter | `mssql_instance` |
|
||||
| `windows_mssql_transactions_version_store_truncation_units` | The number of allocation units that have been removed from the snapshot isolation store since the instance of the Database Engine was started | counter | `mssql_instance` |
|
||||
| `windows_mssql_waitstats_lock_waits` | Statistics for processes waiting on a lock | gauge | `mssql_instance`, `item` |
|
||||
| `windows_mssql_waitstats_memory_grant_queue_waits` | Statistics for processes waiting for memory grant to become available | gauge | `mssql_instance`, `item` |
|
||||
| `windows_mssql_waitstats_thread_safe_memory_objects_waits` | Statistics for processes waiting on thread-safe memory allocators | gauge | `mssql_instance`, `item` |
|
||||
| `windows_mssql_waitstats_log_write_waits` | Statistics for processes waiting for log buffer to be written | gauge | `mssql_instance`, `item` |
|
||||
| `windows_mssql_waitstats_log_buffer_waits` | Statistics for processes waiting for log buffer to be available | gauge | `mssql_instance`, `item` |
|
||||
| `windows_mssql_waitstats_network_io_waits` | Statistics relevant to wait on network I/O | gauge | `mssql_instance`, `item` |
|
||||
| `windows_mssql_waitstats_page_io_latch_waits` | Statistics relevant to page I/O latches | gauge | `mssql_instance`, `item` |
|
||||
| `windows_mssql_waitstats_page_latch_waits` | Statistics relevant to page latches, not including I/O latches | gauge | `mssql_instance`, `item` |
|
||||
| `windows_mssql_waitstats_nonpage_latch_waits` | Statistics relevant to non-page latches | gauge | `mssql_instance`, `item` |
|
||||
| `windows_mssql_waitstats_wait_for_the_worker_waits` | Statistics relevant to processes waiting for worker to become available | gauge | `mssql_instance`, `item` |
|
||||
| `windows_mssql_waitstats_workspace_synchronization_waits` | Statistics relevant to processes synchronizing access to workspace | gauge | `mssql_instance`, `item` |
|
||||
| `windows_mssql_waitstats_transaction_ownership_waits` | Statistics relevant to processes synchronizing access to transaction | gauge | `mssql_instance`, `item` |
|
||||
|
||||
### Example metric
|
||||
|
||||
@@ -311,4 +316,4 @@ groups:
|
||||
summary: "SQl EXpress Database size exceeded 10GB"
|
||||
description: "The database size has grown larger than 10GB. Instance: {{ $labels.instance }}"
|
||||
|
||||
```
|
||||
```
|
||||
|
||||
@@ -14,13 +14,11 @@ None
|
||||
|
||||
## Metrics
|
||||
|
||||
| Name | Description | Type | Labels |
|
||||
|---------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------|------------------------------------------------------------------------|
|
||||
| `windows_os_info` | Contains full product name & version in labels. Note that the `major_version` for Windows 11 is "10"; a build number greater than 22000 represents Windows 11. | gauge | `product`, `version`, `major_version`, `minor_version`, `build_number` |
|
||||
| `windows_os_paging_limit_bytes` | Total number of bytes that can be stored in the operating system paging files. 0 (zero) indicates that there are no paging files | gauge | None |
|
||||
| `windows_os_paging_free_bytes` | Number of bytes that can be mapped into the operating system paging files without causing any other pages to be swapped out | gauge | None |
|
||||
| Name | Description | Type | Labels |
|
||||
|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|-------|------------------------------------------------------------------------|
|
||||
| `windows_os_hostname` | Labelled system hostname information as provided by ComputerSystem.DNSHostName and ComputerSystem.Domain | gauge | `domain`, `fqdn`, `hostname` |
|
||||
| `windows_os_info` | Contains full product name & version in labels. Note that the `major_version` for Windows 11 is "10"; a build number greater than 22000 represents Windows 11. | gauge | `product`, `version`, `major_version`, `minor_version`, `build_number` |
|
||||
|
||||
|
||||
### Example metric
|
||||
|
||||
```
|
||||
@@ -36,4 +34,4 @@ windows_os_info{build_number="19045",major_version="10",minor_version="0",produc
|
||||
_This collector does not yet have useful queries, we would appreciate your help adding them!_
|
||||
|
||||
## Alerting examples
|
||||
_This collector does not yet have alerting examples, we would appreciate your help adding them!_
|
||||
_This collector does not yet have alerting examples, we would appreciate your help adding them!_
|
||||
|
||||
38
docs/collector.pagefile.md
Normal file
38
docs/collector.pagefile.md
Normal file
@@ -0,0 +1,38 @@
|
||||
# pagefile collector
|
||||
|
||||
The pagefile collector exposes metrics about the pagefile usage
|
||||
|
||||
|||
|
||||
-|-
|
||||
Metric name prefix | `pagefile`
|
||||
Classes | [`Win32_OperatingSystem`](https://msdn.microsoft.com/en-us/library/aa394239)
|
||||
Enabled by default? | Yes
|
||||
|
||||
## Flags
|
||||
|
||||
None
|
||||
|
||||
## Metrics
|
||||
|
||||
| Name | Description | Type | Labels |
|
||||
|--------------------------------|-----------------------------------------------------------------------------------------------------------------------------|-------|--------|
|
||||
| `windows_pagefile_free_bytes` | Number of bytes that can be mapped into the operating system paging files without causing any other pages to be swapped out | gauge | `file` |
|
||||
| `windows_pagefile_limit_bytes` | Number of bytes that can be stored in the operating system paging files. 0 (zero) indicates that there are no paging files | gauge | `file` |
|
||||
|
||||
|
||||
### Example metric
|
||||
|
||||
```
|
||||
# HELP windows_pagefile_free_bytes OperatingSystem.FreeSpaceInPagingFiles
|
||||
# TYPE windows_pagefile_free_bytes gauge
|
||||
windows_pagefile_free_bytes{file="C:\\pagefile.sys"} 6.025797632e+09
|
||||
# HELP windows_pagefile_limit_bytes OperatingSystem.SizeStoredInPagingFiles
|
||||
# TYPE windows_pagefile_limit_bytes gauge
|
||||
windows_pagefile_limit_bytes{file="C:\\pagefile.sys"} 6.442450944e+09
|
||||
```
|
||||
|
||||
## Useful queries
|
||||
_This collector does not yet have useful queries, we would appreciate your help adding them!_
|
||||
|
||||
## Alerting examples
|
||||
_This collector does not yet have alerting examples, we would appreciate your help adding them!_
|
||||
@@ -35,7 +35,7 @@ metrics.
|
||||
|
||||
Enables IIS process name queries. IIS process names are combined with their app pool name to form the `process` label.
|
||||
|
||||
Disabled by default, and can be enabled with `--collector.process.iis=true`.
|
||||
Disabled by default, and can be enabled with `--collector.process.iis`. NOTE: Just plain parameter without `true`.
|
||||
|
||||
|
||||
### Example
|
||||
@@ -44,7 +44,7 @@ Note that multiple processes with the same name will be disambiguated by
|
||||
Windows by adding a number suffix, such as `firefox#2`. Your [regexp](https://en.wikipedia.org/wiki/Regular_expression) must take
|
||||
these suffixes into consideration.
|
||||
|
||||
:warning: The regexp is case-sensitive, so `--collector.process.include="FIREFOX.*"` will **NOT** match a process named `firefox` .
|
||||
:warning: The regexp is case-sensitive, so `--collector.process.include="FIREFOX.*"` will **NOT** match a process named `firefox` .
|
||||
|
||||
To specify multiple names, use the pipe `|` character:
|
||||
```
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
# tcp collector
|
||||
|
||||
The tcp collector exposes metrics about the TCP/IPv4 network stack.
|
||||
The tcp collector exposes metrics about the TCP network stack.
|
||||
|
||||
|||
|
||||
-|-
|
||||
Metric name prefix | `tcp`
|
||||
Data source | Perflib
|
||||
Classes | [`Win32_PerfRawData_Tcpip_TCPv4`](https://msdn.microsoft.com/en-us/library/aa394341(v=vs.85).aspx), Win32_PerfRawData_Tcpip_TCPv6
|
||||
Enabled by default? | No
|
||||
|
||||
## Flags
|
||||
@@ -15,17 +14,18 @@ None
|
||||
|
||||
## Metrics
|
||||
|
||||
Name | Description | Type | Labels
|
||||
-----|-------------|------|-------
|
||||
`windows_tcp_connection_failures_total` | Number of times TCP connections have made a direct transition to the CLOSED state from the SYN-SENT state or the SYN-RCVD state, plus the number of times TCP connections have made a direct transition from the SYN-RCVD state to the LISTEN state | counter | af
|
||||
`windows_tcp_connections_active_total` | Number of times TCP connections have made a direct transition from the CLOSED state to the SYN-SENT state.| counter | af
|
||||
`windows_tcp_connections_established` | Number of TCP connections for which the current state is either ESTABLISHED or CLOSE-WAIT. | gauge | af
|
||||
`windows_tcp_connections_passive_total` | Number of times TCP connections have made a direct transition from the LISTEN state to the SYN-RCVD state. | counter | af
|
||||
`windows_tcp_connections_reset_total` | Connections Reset is the number of times TCP connections have made a direct transition to the CLOSED state from either the ESTABLISHED state or the CLOSE-WAIT state. | counter | af
|
||||
`windows_tcp_segments_total` | Total segments sent or received using the TCP protocol | counter | af
|
||||
`windows_tcp_segments_received_total` | Total segments received, including those received in error. This count includes segments received on currently established connections | counter | af
|
||||
`windows_tcp_segments_retransmitted_total` | Total segments retransmitted. That is, segments transmitted that contain one or more previously transmitted bytes | counter | af
|
||||
`windows_tcp_segments_sent_total` | Total segments sent, including those on current connections, but excluding those containing *only* retransmitted bytes | counter | af
|
||||
| Name | Description | Type | Labels |
|
||||
|--------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|--------|
|
||||
| `windows_tcp_connection_failures_total` | Number of times TCP connections have made a direct transition to the CLOSED state from the SYN-SENT state or the SYN-RCVD state, plus the number of times TCP connections have made a direct transition from the SYN-RCVD state to the LISTEN state | counter | af |
|
||||
| `windows_tcp_connections_active_total` | Number of times TCP connections have made a direct transition from the CLOSED state to the SYN-SENT state. | counter | af |
|
||||
| `windows_tcp_connections_established` | Number of TCP connections for which the current state is either ESTABLISHED or CLOSE-WAIT. | gauge | af |
|
||||
| `windows_tcp_connections_passive_total` | Number of times TCP connections have made a direct transition from the LISTEN state to the SYN-RCVD state. | counter | af |
|
||||
| `windows_tcp_connections_reset_total` | Connections Reset is the number of times TCP connections have made a direct transition to the CLOSED state from either the ESTABLISHED state or the CLOSE-WAIT state. | counter | af |
|
||||
| `windows_tcp_segments_total` | Total segments sent or received using the TCP protocol | counter | af |
|
||||
| `windows_tcp_segments_received_total` | Total segments received, including those received in error. This count includes segments received on currently established connections | counter | af |
|
||||
| `windows_tcp_segments_retransmitted_total` | Total segments retransmitted. That is, segments transmitted that contain one or more previously transmitted bytes | counter | af |
|
||||
| `windows_tcp_segments_sent_total` | Total segments sent, including those on current connections, but excluding those containing *only* retransmitted bytes | counter | af |
|
||||
| `windows_tcp_connections_state_count` | Number of TCP connections by state among: CLOSED, LISTENING, SYN_SENT, SYN_RECEIVED, ESTABLISHED, FIN_WAIT1, FIN_WAIT2, CLOSE_WAIT, CLOSING, LAST_ACK, TIME_WAIT, DELETE_TCB | gauge | af |
|
||||
|
||||
### Example metric
|
||||
_This collector does not yet have explained examples, we would appreciate your help adding them!_
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
# teradici_pcoip collector
|
||||
|
||||
The teradici_pcoip collector exposes metrics relating to Teradici PCoIP sessions
|
||||
|
||||
|||
|
||||
-|-
|
||||
Metric name prefix | `teradici_pcoip`
|
||||
Classes | `Win32_PerfRawData_TeradiciPerf_PCoIPSessionAudioStatistics`, `Win32_PerfRawData_TeradiciPerf_PCoIPSessionGeneralStatistics`,`Win32_PerfRawData_TeradiciPerf_PCoIPSessionImagingStatistics`,`Win32_PerfRawData_TeradiciPerf_PCoIPSessionNetworkStatistics`,`Win32_PerfRawData_TeradiciPerf_PCoIPSessionUsbStatistics`
|
||||
Enabled by default? | No
|
||||
|
||||
## Flags
|
||||
|
||||
None
|
||||
|
||||
## Metrics
|
||||
|
||||
Name | Description | Type | Labels
|
||||
-----|-------------|------|-------
|
||||
`windows_teradici_pcoip_audio_bytes_received_total` | _Not yet documented_ | counter | None
|
||||
`windows_teradici_pcoip_audio_bytes_sent_total` | _Not yet documented_ | counter | None
|
||||
`windows_teradici_pcoip_audio_rx_bw_kbit_persec` | _Not yet documented_ | gauge | None
|
||||
`windows_teradici_pcoip_audio_tx_bw_kbit_persec` | _Not yet documented_ | gauge | None
|
||||
`windows_teradici_pcoip_audio_tx_bw_limit_kbit_persec` | _Not yet documented_ | gauge | None
|
||||
`windows_teradici_pcoip_bytes_received_total` | _Not yet documented_ | counter | None
|
||||
`windows_teradici_pcoip_bytes_sent_total` | _Not yet documented_ | counter | None
|
||||
`windows_teradici_pcoip_packets_received_total` | _Not yet documented_ | counter | None
|
||||
`windows_teradici_pcoip_packets_sent_total` | _Not yet documented_ | counter | None
|
||||
`windows_teradici_pcoip_rx_packets_lost_total` | _Not yet documented_ | counter | None
|
||||
`windows_teradici_pcoip_session_duration_seconds_total` | _Not yet documented_ | counter | None
|
||||
`windows_teradici_pcoip_tx_packets_lost_total` | _Not yet documented_ | counter | None
|
||||
`windows_teradici_pcoip_imaging_active_min_quality` | _Not yet documented_ | gauge | None
|
||||
`windows_teradici_pcoip_imaging_apex2800_offload` | _Not yet documented_ | gauge | None
|
||||
`windows_teradici_pcoip_imaging_bytes_received_total` | _Not yet documented_ | counter | None
|
||||
`windows_teradici_pcoip_imaging_bytes_sent_total` | _Not yet documented_ | counter | None
|
||||
`windows_teradici_pcoip_imaging_decoder_capability_kbit_persec` | _Not yet documented_ | gauge | None
|
||||
`windows_teradici_pcoip_imaging_encoded_frames_persec` | _Not yet documented_ | gauge | None
|
||||
`windows_teradici_pcoip_imaging_megapixel_persec` | _Not yet documented_ | gauge | None
|
||||
`windows_teradici_pcoip_imaging_negative_acks_total` | _Not yet documented_ | counter | None
|
||||
`windows_teradici_pcoip_imaging_rx_bw_kbit_persec` | _Not yet documented_ | gauge | None
|
||||
`windows_teradici_pcoip_imaging_svga_devtap_frames_persec` | _Not yet documented_ | gauge | None
|
||||
`windows_teradici_pcoip_imaging_tx_bw_kbit_persec` | _Not yet documented_ | gauge | None
|
||||
`windows_teradici_pcoip_round_trip_latency_ms` | _Not yet documented_ | gauge | None
|
||||
`windows_teradici_pcoip_rx_bw_kbit_persec` | _Not yet documented_ | gauge | None
|
||||
`windows_teradici_pcoip_rx_bw_peak_kbit_persec` | _Not yet documented_ | gauge | None
|
||||
`windows_teradici_pcoip_rx_packet_loss_percent` | _Not yet documented_ | gauge | None
|
||||
`windows_teradici_pcoip_rx_packet_loss_percent_base` | _Not yet documented_ | gauge | None
|
||||
`windows_teradici_pcoip_tx_bw_active_limit_kbit_persec` | _Not yet documented_ | gauge | None
|
||||
`windows_teradici_pcoip_tx_bw_kbit_persec` | _Not yet documented_ | gauge | None
|
||||
`windows_teradici_pcoip_tx_bw_limit_kbit_persec` | _Not yet documented_ | gauge | None
|
||||
`windows_teradici_pcoip_tx_packet_loss_percent` | _Not yet documented_ | gauge | None
|
||||
`windows_teradici_pcoip_tx_packet_loss_percent_base` | _Not yet documented_ | gauge | None
|
||||
`windows_teradici_pcoip_usb_bytes_received_total` | _Not yet documented_ | counter | None
|
||||
`windows_teradici_pcoip_usb_bytes_sent_total` | _Not yet documented_ | counter | None
|
||||
`windows_teradici_pcoip_usb_rx_bw_kbit_persec` | _Not yet documented_ | gauge | None
|
||||
`windows_teradici_pcoip_usb_tx_bw_kbit_persec` | _Not yet documented_ | gauge | None
|
||||
|
||||
### 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!_
|
||||
@@ -6,7 +6,7 @@ The textfile collector exposes metrics from files written by other processes.
|
||||
-|-
|
||||
Metric name prefix | `textfile`
|
||||
Classes | None
|
||||
Enabled by default? | Yes
|
||||
Enabled by default? | No
|
||||
|
||||
## Flags
|
||||
|
||||
|
||||
@@ -5,15 +5,19 @@ If the Windows Time Service is stopped after collection has started, collector m
|
||||
|
||||
Please note the Time Service perflib counters are only available on [Windows Server 2016 or newer](https://docs.microsoft.com/en-us/windows-server/networking/windows-time-service/windows-server-2016-improvements).
|
||||
|
||||
| | |
|
||||
|---------------------|---------|
|
||||
| Metric name prefix | `time` |
|
||||
| Data source | Perflib |
|
||||
| Enabled by default? | No |
|
||||
| | |
|
||||
|---------------------|--------|
|
||||
| Metric name prefix | `time` |
|
||||
| Data source | PDH |
|
||||
| Enabled by default? | No |
|
||||
|
||||
## Flags
|
||||
|
||||
None
|
||||
### `--collectors.time.enabled`
|
||||
Comma-separated list of collectors to use, for example: `--collectors.time.enabled=ntp,system_time`.
|
||||
Matching is case-sensitive.
|
||||
|
||||
|
||||
|
||||
## Metrics
|
||||
|
||||
|
||||
31
docs/collector.udp.md
Normal file
31
docs/collector.udp.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# udp collector
|
||||
|
||||
The udp collector exposes metrics about the UDP network stack.
|
||||
|
||||
|||
|
||||
-|-
|
||||
Metric name prefix | `udp`
|
||||
Data source | Perflib
|
||||
Enabled by default? | No
|
||||
|
||||
## Flags
|
||||
|
||||
None
|
||||
|
||||
## Metrics
|
||||
|
||||
| Name | Description | Type | Labels |
|
||||
|-----------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|---------|--------|
|
||||
| `windows_udp_datagram_datagram_no_port_total` | Number of received UDP datagrams for which there was no application at the destination port | counter | af |
|
||||
| `windows_udp_datagram_received_errors_total` | Number of received UDP datagrams that could not be delivered for reasons other than the lack of an application at the destination port | counter | af |
|
||||
| `windows_udp_datagram_received_total` | Number of UDP datagrams segments received | counter | af |
|
||||
| `windows_udp_datagram_sent_total` | Number of UDP datagrams segments sent | counter | af |
|
||||
|
||||
### 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!_
|
||||
48
docs/collector.update.md
Normal file
48
docs/collector.update.md
Normal file
@@ -0,0 +1,48 @@
|
||||
# update collector
|
||||
|
||||
The update collector exposes the Windows Update service metrics. Note that the Windows Update service (`wuauserv`) must be running, else metric collection will fail.
|
||||
|
||||
The Windows Update service is responsible for managing the installation of updates for the operating system and other Microsoft software. The service can be configured to automatically download and install updates, or to notify the user when updates are available.
|
||||
|
||||
|
||||
| | |
|
||||
|---------------------|------------------------|
|
||||
| Metric name prefix | `update` |
|
||||
| Data source | Windows Update service |
|
||||
| Enabled by default? | No |
|
||||
|
||||
## Flags
|
||||
|
||||
### `--collector.updates.online`
|
||||
Whether to search for updates online. If set to `false`, the collector will only list updates that are already found by the Windows Update service.
|
||||
Set to `true` to search for updates online, which will take longer to complete.
|
||||
|
||||
### `--collector.updates.scrape-interval`
|
||||
Define the interval of scraping Windows Update information
|
||||
|
||||
## Metrics
|
||||
|
||||
| Name | Description | Type | Labels |
|
||||
|--------------------------------|-----------------------------------------------|-------|-------------------------------|
|
||||
| `windows_updates_pending_info` | Expose information single pending update item | gauge | `category`,`severity`,`title` |
|
||||
| `windows_updates_scrape_query_duration_seconds` | Duration of the last scrape query to the Windows Update API | gauge | |
|
||||
| `windows_updates_scrape_timestamp_seconds` | Timestamp of the last scrape | gauge | |
|
||||
|
||||
### Example metrics
|
||||
```
|
||||
# HELP windows_updates_pending Pending Windows Updates
|
||||
# TYPE windows_updates_pending gauge
|
||||
windows_updates_pending{category="Drivers",severity="",title="Intel Corporation - Bluetooth - 23.60.5.10"} 1
|
||||
# HELP windows_updates_scrape_query_duration_seconds Duration of the last scrape query to the Windows Update API
|
||||
# TYPE windows_updates_scrape_query_duration_seconds gauge
|
||||
windows_updates_scrape_query_duration_seconds 2.8161838
|
||||
# HELP windows_updates_scrape_timestamp_seconds Timestamp of the last scrape
|
||||
# TYPE windows_updates_scrape_timestamp_seconds gauge
|
||||
windows_updates_scrape_timestamp_seconds 1.727539734e+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!_
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
The vmware collector exposes metrics about a VMware guest VM
|
||||
|
||||
|||
|
||||
-|-
|
||||
Metric name prefix | `vmware`
|
||||
Classes | `Win32_PerfRawData_vmGuestLib_VMem`, `Win32_PerfRawData_vmGuestLib_VCPU`
|
||||
Enabled by default? | No
|
||||
| | |
|
||||
|---------------------|----------------------|
|
||||
| Metric name prefix | `vmware` |
|
||||
| Source | Performance counters |
|
||||
| Enabled by default? | No |
|
||||
|
||||
## Flags
|
||||
|
||||
@@ -14,27 +14,27 @@ None
|
||||
|
||||
## Metrics
|
||||
|
||||
Name | Description | Type | Labels
|
||||
-----|-------------|------|-------
|
||||
`windows_vmware_mem_active_bytes` | _Not yet documented_ | gauge | None
|
||||
`windows_vmware_mem_ballooned_bytes` | _Not yet documented_ | gauge | None
|
||||
`windows_vmware_mem_limit_bytes` | _Not yet documented_ | gauge | None
|
||||
`windows_vmware_mem_mapped_bytes` | _Not yet documented_ | gauge | None
|
||||
`windows_vmware_mem_overhead_bytes` | _Not yet documented_ | gauge | None
|
||||
`windows_vmware_mem_reservation_bytes` | _Not yet documented_ | gauge | None
|
||||
`windows_vmware_mem_shared_bytes` | _Not yet documented_ | gauge | None
|
||||
`windows_vmware_mem_shared_saved_bytes` | _Not yet documented_ | gauge | None
|
||||
`windows_vmware_mem_shares` | _Not yet documented_ | gauge | None
|
||||
`windows_vmware_mem_swapped_bytes` | _Not yet documented_ | gauge | None
|
||||
`windows_vmware_mem_target_size_bytes` | _Not yet documented_ | gauge | None
|
||||
`windows_vmware_mem_used_bytes` | _Not yet documented_ | gauge | None
|
||||
`windows_vmware_cpu_limit_mhz` | _Not yet documented_ | gauge | None
|
||||
`windows_vmware_cpu_reservation_mhz` | _Not yet documented_ | gauge | None
|
||||
`windows_vmware_cpu_shares` | _Not yet documented_ | gauge | None
|
||||
`windows_vmware_cpu_stolen_seconds_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_cpu_time_seconds_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_effective_vm_speed_mhz` | _Not yet documented_ | gauge | None
|
||||
`windows_vmware_host_processor_speed_mhz` | _Not yet documented_ | gauge | None
|
||||
| Name | Description | Type | Labels |
|
||||
|---------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|--------|
|
||||
| `windows_vmware_mem_active_bytes` | The estimated amount of memory the virtual machine is actively using. | gauge | None |
|
||||
| `windows_vmware_mem_ballooned_bytes` | The amount of memory that has been reclaimed from this virtual machine via the VMware Memory Balloon mechanism. | gauge | None |
|
||||
| `windows_vmware_mem_limit_bytes` | The maximum amount of memory that is allowed to the virtual machine. Assigning a Memory Limit ensures that this virtual machine never consumes more than a certain amount of the allowed memory. By limiting the amount of memory consumed, a portion of this shared resource is allowed to other virtual machines. | gauge | None |
|
||||
| `windows_vmware_mem_mapped_bytes` | The mapped memory size of this virtual machine. This is the current total amount of guest memory that is backed by physical memory. Note that this number may include pages of memory shared between multiple virtual machines and thus may be an overestimate of the amount of physical host memory consumed by this virtual machine. | gauge | None |
|
||||
| `windows_vmware_mem_overhead_bytes` | The amount of overhead memory associated with this virtual machine consumed on the host system. | gauge | None |
|
||||
| `windows_vmware_mem_reservation_bytes` | The minimum amount of memory that is guaranteed to the virtual machine. Assigning a Memory Reservation ensures that even as other virtual machines on the same host consume memory, there is still a certain minimum amount for this virtual machine. | gauge | None |
|
||||
| `windows_vmware_mem_shared_bytes` | The amount of physical memory associated with this virtual machine that is copy-on-write (COW) shared on the host. | gauge | None |
|
||||
| `windows_vmware_mem_shared_saved_bytes` | The estimated amount of physical memory on the host saved from copy-on-write (COW) shared guest physical memory. | gauge | None |
|
||||
| `windows_vmware_mem_shares` | The number of memory shares allocated to the virtual machine. | gauge | None |
|
||||
| `windows_vmware_mem_swapped_bytes` | The amount of memory associated with this virtual machine that has been swapped by ESX. | gauge | None |
|
||||
| `windows_vmware_mem_target_size_bytes` | Memory Target Size | gauge | None |
|
||||
| `windows_vmware_mem_used_bytes` | The estimated amount of physical host memory currently consumed for this virtual machine’s physical memory. | gauge | None |
|
||||
| `windows_vmware_cpu_limit_mhz` | The maximum processing power in MHz allowed to the virtual machine. Assigning a CPU Limit ensures that this virtual machine never consumes more than a certain amount of the available processor power. By limiting the amount of processing power consumed, a portion of the processing power becomes available to other virtual machines. | gauge | None |
|
||||
| `windows_vmware_cpu_reservation_mhz` | The minimum processing power in MHz available to the virtual machine. Assigning a CPU Reservation ensures that even as other virtual machines on the same host consume shared processing power, there is still a certain minimum amount for this virtual machine. | gauge | None |
|
||||
| `windows_vmware_cpu_shares` | The number of CPU shares allocated to the virtual machine. | gauge | None |
|
||||
| `windows_vmware_cpu_stolen_seconds_total` | The time that the VM was runnable but not scheduled to run | counter | None |
|
||||
| `windows_vmware_cpu_time_seconds_total` | Current load of the VM’s virtual processor | counter | None |
|
||||
| `windows_vmware_cpu_effective_vm_speed_mhz` | The effective speed of the VM’s virtual CPU | gauge | None |
|
||||
| `windows_vmware_host_processor_speed_mhz` | Host Processor speed | gauge | None |
|
||||
|
||||
### Example metric
|
||||
_This collector does not yet have explained examples, we would appreciate your help adding them!_
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
# vmware_blast collector
|
||||
|
||||
The vmware_blast collector exposes metrics relating to VMware Blast sessions
|
||||
|
||||
|||
|
||||
-|-
|
||||
Metric name prefix | `vmware_blast`
|
||||
Classes | `Win32_PerfRawData_Counters_VMwareBlastAudioCounters`,`Win32_PerfRawData_Counters_VMwareBlastCDRCounters`,`Win32_PerfRawData_Counters_VMwareBlastClipboardCounters`,`Win32_PerfRawData_Counters_VMwareBlastHTML5MMRCounters`,`Win32_PerfRawData_Counters_VMwareBlastImagingCounters`,`Win32_PerfRawData_Counters_VMwareBlastRTAVCounters`,`Win32_PerfRawData_Counters_VMwareBlastSerialPortandScannerCounters`,`Win32_PerfRawData_Counters_VMwareBlastSessionCounters`,`Win32_PerfRawData_Counters_VMwareBlastSkypeforBusinessControlCounters`,`Win32_PerfRawData_Counters_VMwareBlastThinPrintCounters`,`Win32_PerfRawData_Counters_VMwareBlastUSBCounters`,`Win32_PerfRawData_Counters_VMwareBlastWindowsMediaMMRCounters`
|
||||
Enabled by default? | No
|
||||
|
||||
## Flags
|
||||
|
||||
None
|
||||
|
||||
## Metrics
|
||||
|
||||
Some of these metrics may not be collected, depending on the installation options chosen when installing the Horizon agent
|
||||
|
||||
Name | Description | Type | Labels
|
||||
-----|-------------|------|-------
|
||||
`windows_vmware_blast_audio_received_bytes_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_audio_received_packets_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_audio_transmitted_bytes_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_audio_transmitted_packets_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_cdr_received_bytes_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_cdr_received_packets_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_cdr_transmitted_bytes_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_cdr_transmitted_packets_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_clipboard_received_bytes_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_clipboard_received_packets_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_clipboard_transmitted_bytes_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_clipboard_transmitted_packets_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_html5_mmr_received_bytes_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_html5_mmr_received_packets_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_html5_mmr_transmitted_bytes_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_html5_mmr_transmitted_packets_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_imaging_dirty_frames_per_second` | _Not yet documented_ | gauge | None
|
||||
`windows_vmware_blast_imaging_fbc_rate` | _Not yet documented_ | gauge | None
|
||||
`windows_vmware_blast_imaging_frames_per_second` | _Not yet documented_ | gauge | None
|
||||
`windows_vmware_blast_imaging_poll_rate` | _Not yet documented_ | gauge | None
|
||||
`windows_vmware_blast_imaging_received_bytes_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_imaging_received_packets_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_imaging_dirty_frames_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_imaging_fbc_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_imaging_frames_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_imaging_poll_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_imaging_transmitted_bytes_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_imaging_transmitted_packets_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_rtav_received_bytes_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_rtav_received_packets_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_rtav_transmitted_bytes_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_rtav_transmitted_packets_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_serial_port_and_scanner_received_bytes_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_serial_port_and_scanner_received_packets_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_serial_port_and_scanner_transmitted_bytes_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_serial_port_and_scanner_transmitted_packets_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_session_automatic_reconnect_count_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_session_cumlative_received_bytes_over_tcp_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_session_cumlative_received_bytes_over_udp_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_session_cumlative_transmitted_bytes_over_tcp_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_session_cumlative_transmitted_bytes_over_udp_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_session_estimated_bandwidth_uplink` | _Not yet documented_ | gauge | None
|
||||
`windows_vmware_blast_session_instantaneous_received_bytes_over_tcp_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_session_instantaneous_received_bytes_over_udp_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_session_instantaneous_transmitted_bytes_over_tcp_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_session_instantaneous_transmitted_bytes_over_udp_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_session_jitter_uplink` | _Not yet documented_ | gauge | None
|
||||
`windows_vmware_blast_session_packet_loss_uplink` | _Not yet documented_ | gauge | None
|
||||
`windows_vmware_blast_session_received_bytes_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_session_received_packets_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_session_rtt` | _Not yet documented_ | gauge | None
|
||||
`windows_vmware_blast_session_transmitted_bytes_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_session_transmitted_packets_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_skype_for_business_control_received_bytes_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_skype_for_business_control_received_packets_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_skype_for_business_control_transmitted_bytes_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_skype_for_business_control_transmitted_packets_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_thinprint_received_bytes_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_thinprint_received_packets_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_thinprint_transmitted_bytes_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_thinprint_transmitted_packets_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_usb_received_bytes_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_usb_received_packets_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_usb_transmitted_bytes_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_usb_transmitted_packets_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_windows_media_mmr_received_bytes_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_windows_media_mmr_received_packets_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_windows_media_mmr_transmitted_bytes_total` | _Not yet documented_ | counter | None
|
||||
`windows_vmware_blast_windows_media_mmr_transmitted_packets_total` | _Not yet documented_ | counter | None
|
||||
|
||||
### 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!_
|
||||
38
go.mod
38
go.mod
@@ -3,34 +3,36 @@ module github.com/prometheus-community/windows_exporter
|
||||
go 1.23
|
||||
|
||||
require (
|
||||
github.com/Microsoft/hcsshim v0.12.7
|
||||
github.com/Microsoft/go-winio v0.6.2
|
||||
github.com/Microsoft/hcsshim v0.12.9
|
||||
github.com/alecthomas/kingpin/v2 v2.4.0
|
||||
github.com/bmatcuk/doublestar/v4 v4.6.1
|
||||
github.com/bmatcuk/doublestar/v4 v4.7.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/prometheus/client_golang v1.20.4
|
||||
github.com/prometheus/client_golang v1.20.5
|
||||
github.com/prometheus/client_model v0.6.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
|
||||
golang.org/x/sys v0.25.0
|
||||
github.com/prometheus/common v0.60.1
|
||||
github.com/prometheus/exporter-toolkit v0.13.1
|
||||
github.com/stretchr/testify v1.10.0
|
||||
golang.org/x/sys v0.27.0
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/Microsoft/go-winio v0.6.2 // indirect
|
||||
github.com/alecthomas/units v0.0.0-20240626203959-61d1e3462e30 // indirect
|
||||
github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/containerd/cgroups/v3 v3.0.3 // indirect
|
||||
github.com/containerd/errdefs v0.1.0 // indirect
|
||||
github.com/containerd/errdefs v0.3.0 // indirect
|
||||
github.com/containerd/errdefs/pkg v0.3.0 // indirect
|
||||
github.com/containerd/typeurl/v2 v2.2.0 // indirect
|
||||
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // 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.10 // indirect
|
||||
github.com/klauspost/compress v1.17.11 // 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
|
||||
@@ -41,13 +43,13 @@ require (
|
||||
github.com/sirupsen/logrus v1.9.3 // indirect
|
||||
github.com/xhit/go-str2duration/v2 v2.1.0 // indirect
|
||||
go.opencensus.io v0.24.0 // indirect
|
||||
golang.org/x/crypto v0.27.0 // indirect
|
||||
golang.org/x/net v0.29.0 // indirect
|
||||
golang.org/x/crypto v0.28.0 // indirect
|
||||
golang.org/x/net v0.30.0 // indirect
|
||||
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-20240924160255-9d4c2d233b61 // indirect
|
||||
google.golang.org/grpc v1.67.0 // indirect
|
||||
google.golang.org/protobuf v1.34.2 // indirect
|
||||
golang.org/x/text v0.19.0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 // indirect
|
||||
google.golang.org/grpc v1.67.1 // indirect
|
||||
google.golang.org/protobuf v1.35.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
)
|
||||
|
||||
91
go.sum
91
go.sum
@@ -2,16 +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.7 h1:MP6R1spmjxTE4EU4J3YsrTxn8CjvN9qwjTKJXldFaRg=
|
||||
github.com/Microsoft/hcsshim v0.12.7/go.mod h1:HPbAuJ9BvQYYZbB4yEQcyGIsTP5L4yHKeO9XO149AEM=
|
||||
github.com/Microsoft/hcsshim v0.12.9 h1:2zJy5KA+l0loz1HzEGqyNnjd3fyZA31ZBCGKacp6lLg=
|
||||
github.com/Microsoft/hcsshim v0.12.9/go.mod h1:fJ0gkFAna6ukt0bLdKB8djt4XIJhF/vEPuoIWYVvZ8Y=
|
||||
github.com/alecthomas/kingpin/v2 v2.4.0 h1:f48lwail6p8zpO1bC4TxtqACaGqHYA22qkHjHpqDjYY=
|
||||
github.com/alecthomas/kingpin/v2 v2.4.0/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/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b h1:mimo19zliBX/vSQ6PWWSL9lK8qwHozUj03+zLoEB8O0=
|
||||
github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b/go.mod h1:fvzegU4vN3H1qMT+8wDmzjAcDONcgo2/SZ/TyfdUOFs=
|
||||
github.com/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/bmatcuk/doublestar/v4 v4.7.1 h1:fdDeAqgT47acgwd9bd9HxJRDmc9UAmPpc+2m0CXv75Q=
|
||||
github.com/bmatcuk/doublestar/v4 v4.7.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=
|
||||
@@ -19,8 +19,12 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk
|
||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||
github.com/containerd/cgroups/v3 v3.0.3 h1:S5ByHZ/h9PMe5IOQoN7E+nMc2UcLEM/V48DGDJ9kip0=
|
||||
github.com/containerd/cgroups/v3 v3.0.3/go.mod h1:8HBe7V3aWGLFPd/k03swSIsGjZhHI2WzJmticMgVuz0=
|
||||
github.com/containerd/errdefs v0.1.0 h1:m0wCRBiu1WJT/Fr+iOoQHMQS/eP5myQ8lCv4Dz5ZURM=
|
||||
github.com/containerd/errdefs v0.1.0/go.mod h1:YgWiiHtLmSeBrvpw+UfPijzbLaB77mEG1WwJTDETIV0=
|
||||
github.com/containerd/errdefs v0.3.0 h1:FSZgGOeK4yuT/+DnF07/Olde/q4KBoMsaamhXxIMDp4=
|
||||
github.com/containerd/errdefs v0.3.0/go.mod h1:+YBYIdtsnF4Iw6nWZhJcqGSg/dwvV7tyJ/kCkyJ2k+M=
|
||||
github.com/containerd/errdefs/pkg v0.3.0 h1:9IKJ06FvyNlexW690DXuQNx2KA2cUJXx151Xdx3ZPPE=
|
||||
github.com/containerd/errdefs/pkg v0.3.0/go.mod h1:NJw6s9HwNuRhnjJhM7pylWwMyAkmCQvQ4GpJHEqRLVk=
|
||||
github.com/containerd/typeurl/v2 v2.2.0 h1:6NBDbQzr7I5LHgp34xAXYF5DOTQDn05X58lsPEmzLso=
|
||||
github.com/containerd/typeurl/v2 v2.2.0/go.mod h1:8XOOxnyatxSWuG8OfsZXVnAF4iZfedjS/8UHSPJnX4g=
|
||||
github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs=
|
||||
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
@@ -32,10 +36,11 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
||||
github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
|
||||
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
|
||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
|
||||
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
|
||||
@@ -63,8 +68,10 @@ 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/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.10 h1:oXAz+Vh0PMUvJczoi+flxpnBEPxoER1IaAnU/NMPtT0=
|
||||
github.com/klauspost/compress v1.17.10/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
|
||||
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
|
||||
github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
@@ -83,15 +90,15 @@ 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.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI=
|
||||
github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
|
||||
github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y=
|
||||
github.com/prometheus/client_golang v1.20.5/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/common v0.60.1 h1:FUas6GcOw66yB/73KC+BOZoFJmbo/1pojoILArPAaSc=
|
||||
github.com/prometheus/common v0.60.1/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw=
|
||||
github.com/prometheus/exporter-toolkit v0.13.1 h1:Evsh0gWQo2bdOHlnz9+0Nm7/OFfIwhE2Ws4A2jIlR04=
|
||||
github.com/prometheus/exporter-toolkit v0.13.1/go.mod h1:ujdv2YIOxtdFxxqtloLpbqmxd5J0Le6IITUvIRSWjj0=
|
||||
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
|
||||
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
|
||||
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
|
||||
@@ -107,71 +114,85 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8Ydu2Bstc=
|
||||
github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU=
|
||||
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
|
||||
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0=
|
||||
go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A=
|
||||
golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70=
|
||||
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw=
|
||||
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo=
|
||||
golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0=
|
||||
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
|
||||
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs=
|
||||
golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
|
||||
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
|
||||
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
|
||||
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224=
|
||||
golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
|
||||
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
|
||||
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-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/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 h1:X58yt85/IXCx0Y3ZwN6sEIKZzQtDEYaBWrDvErdXrRE=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI=
|
||||
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.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw=
|
||||
google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA=
|
||||
google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E=
|
||||
google.golang.org/grpc v1.67.1/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=
|
||||
@@ -181,8 +202,8 @@ google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2
|
||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
|
||||
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
|
||||
google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=
|
||||
google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:netfx="http://wixtoolset.org/schemas/v4/wxs/netfx"
|
||||
xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
|
||||
<!--
|
||||
~ Copyright 2024 The Prometheus Authors
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<Wix xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"
|
||||
xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
||||
<Fragment>
|
||||
<DirectoryRef Id="APPLICATIONFOLDER">
|
||||
<Component Transitive="yes">
|
||||
@@ -13,7 +28,7 @@
|
||||
Start="auto"
|
||||
Type="ownProcess"
|
||||
Vital="yes"
|
||||
Arguments="--log.file eventlog [ConfigFileFlag] [CollectorsFlag] [ListenFlag] [MetricsPathFlag] [TextfileDirsFlag] [ExtraFlags]">
|
||||
Arguments="[ConfigFileFlag] [CollectorsFlag] [ListenFlag] [MetricsPathFlag] [TextfileDirsFlag] [ExtraFlags]">
|
||||
<util:ServiceConfig
|
||||
ResetPeriodInDays="1"
|
||||
FirstFailureActionType="restart"
|
||||
|
||||
@@ -9,9 +9,24 @@
|
||||
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
|
||||
<?endif?>
|
||||
|
||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
|
||||
xmlns:fw="http://wixtoolset.org/schemas/v4/wxs/firewall"
|
||||
xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
|
||||
<!--
|
||||
~ Copyright 2024 The Prometheus Authors
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<Wix xmlns:fw="http://wixtoolset.org/schemas/v4/wxs/firewall"
|
||||
xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui"
|
||||
xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
||||
<Package UpgradeCode="66a6eb5b-1fc2-4b14-a362-5ceec6413308" Name="$(var.ProductName)" Version="$(var.Version)"
|
||||
Manufacturer="prometheus-community" Language="1033" Scope="perMachine">
|
||||
<SummaryInformation Manufacturer="prometheus-community" Description="$(var.ProductName) $(var.Version) installer" />
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
27
internal/collector/ad/ad_test.go
Normal file
27
internal/collector/ad/ad_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package ad_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/collector/ad"
|
||||
"github.com/prometheus-community/windows_exporter/internal/utils/testutils"
|
||||
)
|
||||
|
||||
func BenchmarkCollector(b *testing.B) {
|
||||
testutils.FuncBenchmarkCollector(b, ad.Name, ad.NewWithFlags)
|
||||
}
|
||||
222
internal/collector/ad/const.go
Normal file
222
internal/collector/ad/const.go
Normal file
@@ -0,0 +1,222 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package ad
|
||||
|
||||
const (
|
||||
abANRPerSec = "AB ANR/sec"
|
||||
abBrowsesPerSec = "AB Browses/sec"
|
||||
abClientSessions = "AB Client Sessions"
|
||||
abMatchesPerSec = "AB Matches/sec"
|
||||
abPropertyReadsPerSec = "AB Property Reads/sec"
|
||||
abProxyLookupsPerSec = "AB Proxy Lookups/sec"
|
||||
abSearchesPerSec = "AB Searches/sec"
|
||||
approximateHighestDNT = "Approximate highest DNT"
|
||||
atqEstimatedQueueDelay = "ATQ Estimated Queue Delay"
|
||||
atqOutstandingQueuedRequests = "ATQ Outstanding Queued Requests"
|
||||
_ = "ATQ Queue Latency"
|
||||
atqRequestLatency = "ATQ Request Latency"
|
||||
atqThreadsLDAP = "ATQ Threads LDAP"
|
||||
atqThreadsOther = "ATQ Threads Other"
|
||||
atqThreadsTotal = "ATQ Threads Total"
|
||||
baseSearchesPerSec = "Base searches/sec"
|
||||
databaseAddsPerSec = "Database adds/sec"
|
||||
databaseDeletesPerSec = "Database deletes/sec"
|
||||
databaseModifiesPerSec = "Database modifys/sec"
|
||||
databaseRecyclesPerSec = "Database recycles/sec"
|
||||
digestBindsPerSec = "Digest Binds/sec"
|
||||
_ = "DirSync session throttling rate"
|
||||
_ = "DirSync sessions in progress"
|
||||
draHighestUSNCommittedHighPart = "DRA Highest USN Committed (High part)"
|
||||
draHighestUSNCommittedLowPart = "DRA Highest USN Committed (Low part)"
|
||||
draHighestUSNIssuedHighPart = "DRA Highest USN Issued (High part)"
|
||||
draHighestUSNIssuedLowPart = "DRA Highest USN Issued (Low part)"
|
||||
draInboundBytesCompressedBetweenSitesAfterCompressionSinceBoot = "DRA Inbound Bytes Compressed (Between Sites, After Compression) Since Boot"
|
||||
draInboundBytesCompressedBetweenSitesAfterCompressionPerSec = "DRA Inbound Bytes Compressed (Between Sites, After Compression)/sec"
|
||||
draInboundBytesCompressedBetweenSitesBeforeCompressionSinceBoot = "DRA Inbound Bytes Compressed (Between Sites, Before Compression) Since Boot"
|
||||
draInboundBytesCompressedBetweenSitesBeforeCompressionPerSec = "DRA Inbound Bytes Compressed (Between Sites, Before Compression)/sec"
|
||||
draInboundBytesNotCompressedWithinSiteSinceBoot = "DRA Inbound Bytes Not Compressed (Within Site) Since Boot"
|
||||
draInboundBytesNotCompressedWithinSitePerSec = "DRA Inbound Bytes Not Compressed (Within Site)/sec"
|
||||
draInboundBytesTotalSinceBoot = "DRA Inbound Bytes Total Since Boot"
|
||||
draInboundBytesTotalPerSec = "DRA Inbound Bytes Total/sec"
|
||||
draInboundFullSyncObjectsRemaining = "DRA Inbound Full Sync Objects Remaining"
|
||||
draInboundLinkValueUpdatesRemainingInPacket = "DRA Inbound Link Value Updates Remaining in Packet"
|
||||
_ = "DRA Inbound Link Values/sec"
|
||||
draInboundObjectUpdatesRemainingInPacket = "DRA Inbound Object Updates Remaining in Packet"
|
||||
draInboundObjectsAppliedPerSec = "DRA Inbound Objects Applied/sec"
|
||||
draInboundObjectsFilteredPerSec = "DRA Inbound Objects Filtered/sec"
|
||||
draInboundObjectsPerSec = "DRA Inbound Objects/sec"
|
||||
draInboundPropertiesAppliedPerSec = "DRA Inbound Properties Applied/sec"
|
||||
draInboundPropertiesFilteredPerSec = "DRA Inbound Properties Filtered/sec"
|
||||
draInboundPropertiesTotalPerSec = "DRA Inbound Properties Total/sec"
|
||||
_ = "DRA Inbound Sync Link Deletion/sec"
|
||||
draInboundTotalUpdatesRemainingInPacket = "DRA Inbound Total Updates Remaining in Packet"
|
||||
draInboundValuesDNsOnlyPerSec = "DRA Inbound Values (DNs only)/sec"
|
||||
draInboundValuesTotalPerSec = "DRA Inbound Values Total/sec"
|
||||
_ = "DRA number of NC replication calls since boot"
|
||||
_ = "DRA number of successful NC replication calls since boot"
|
||||
draOutboundBytesCompressedBetweenSitesAfterCompressionSinceBoot = "DRA Outbound Bytes Compressed (Between Sites, After Compression) Since Boot"
|
||||
draOutboundBytesCompressedBetweenSitesAfterCompressionPerSec = "DRA Outbound Bytes Compressed (Between Sites, After Compression)/sec"
|
||||
draOutboundBytesCompressedBetweenSitesBeforeCompressionSinceBoot = "DRA Outbound Bytes Compressed (Between Sites, Before Compression) Since Boot"
|
||||
draOutboundBytesCompressedBetweenSitesBeforeCompressionPerSec = "DRA Outbound Bytes Compressed (Between Sites, Before Compression)/sec"
|
||||
draOutboundBytesNotCompressedWithinSiteSinceBoot = "DRA Outbound Bytes Not Compressed (Within Site) Since Boot"
|
||||
draOutboundBytesNotCompressedWithinSitePerSec = "DRA Outbound Bytes Not Compressed (Within Site)/sec"
|
||||
draOutboundBytesTotalSinceBoot = "DRA Outbound Bytes Total Since Boot"
|
||||
draOutboundBytesTotalPerSec = "DRA Outbound Bytes Total/sec"
|
||||
draOutboundObjectsFilteredPerSec = "DRA Outbound Objects Filtered/sec"
|
||||
draOutboundObjectsPerSec = "DRA Outbound Objects/sec"
|
||||
draOutboundPropertiesPerSec = "DRA Outbound Properties/sec"
|
||||
draOutboundValuesDNsOnlyPerSec = "DRA Outbound Values (DNs only)/sec"
|
||||
draOutboundValuesTotalPerSec = "DRA Outbound Values Total/sec"
|
||||
draPendingReplicationOperations = "DRA Pending Replication Operations"
|
||||
draPendingReplicationSynchronizations = "DRA Pending Replication Synchronizations"
|
||||
draSyncFailuresOnSchemaMismatch = "DRA Sync Failures on Schema Mismatch"
|
||||
draSyncRequestsMade = "DRA Sync Requests Made"
|
||||
draSyncRequestsSuccessful = "DRA Sync Requests Successful"
|
||||
draThreadsGettingNCChanges = "DRA Threads Getting NC Changes"
|
||||
draThreadsGettingNCChangesHoldingSemaphore = "DRA Threads Getting NC Changes Holding Semaphore"
|
||||
_ = "DRA total number of Busy failures since boot"
|
||||
_ = "DRA total number of MissingParent failures since boot"
|
||||
_ = "DRA total number of NotEnoughAttrs/MissingObject failures since boot"
|
||||
_ = "DRA total number of Preempted failures since boot"
|
||||
_ = "DRA total time of applying replication package since boot"
|
||||
_ = "DRA total time of NC replication calls since boot"
|
||||
_ = "DRA total time of successful NC replication calls since boot"
|
||||
_ = "DRA total time of successfully applying replication package since boot"
|
||||
_ = "DRA total time on waiting async replication packages since boot"
|
||||
_ = "DRA total time on waiting sync replication packages since boot"
|
||||
dsPercentReadsFromDRA = "DS % Reads from DRA"
|
||||
dsPercentReadsFromKCC = "DS % Reads from KCC"
|
||||
dsPercentReadsFromLSA = "DS % Reads from LSA"
|
||||
dsPercentReadsFromNSPI = "DS % Reads from NSPI"
|
||||
dsPercentReadsFromNTDSAPI = "DS % Reads from NTDSAPI"
|
||||
dsPercentReadsFromSAM = "DS % Reads from SAM"
|
||||
dsPercentReadsOther = "DS % Reads Other"
|
||||
dsPercentSearchesFromDRA = "DS % Searches from DRA"
|
||||
dsPercentSearchesFromKCC = "DS % Searches from KCC"
|
||||
dsPercentSearchesFromLDAP = "DS % Searches from LDAP"
|
||||
dsPercentSearchesFromLSA = "DS % Searches from LSA"
|
||||
dsPercentSearchesFromNSPI = "DS % Searches from NSPI"
|
||||
dsPercentSearchesFromNTDSAPI = "DS % Searches from NTDSAPI"
|
||||
dsPercentSearchesFromSAM = "DS % Searches from SAM"
|
||||
dsPercentSearchesOther = "DS % Searches Other"
|
||||
dsPercentWritesFromDRA = "DS % Writes from DRA"
|
||||
dsPercentWritesFromKCC = "DS % Writes from KCC"
|
||||
dsPercentWritesFromLDAP = "DS % Writes from LDAP"
|
||||
dsPercentWritesFromLSA = "DS % Writes from LSA"
|
||||
dsPercentWritesFromNSPI = "DS % Writes from NSPI"
|
||||
dsPercentWritesFromNTDSAPI = "DS % Writes from NTDSAPI"
|
||||
dsPercentWritesFromSAM = "DS % Writes from SAM"
|
||||
dsPercentWritesOther = "DS % Writes Other"
|
||||
dsClientBindsPerSec = "DS Client Binds/sec"
|
||||
dsClientNameTranslationsPerSec = "DS Client Name Translations/sec"
|
||||
dsDirectoryReadsPerSec = "DS Directory Reads/sec"
|
||||
dsDirectorySearchesPerSec = "DS Directory Searches/sec"
|
||||
dsDirectoryWritesPerSec = "DS Directory Writes/sec"
|
||||
dsMonitorListSize = "DS Monitor List Size"
|
||||
dsNameCacheHitRate = "DS Name Cache hit rate"
|
||||
dsNotifyQueueSize = "DS Notify Queue Size"
|
||||
dsSearchSubOperationsPerSec = "DS Search sub-operations/sec"
|
||||
dsSecurityDescriptorPropagationsEvents = "DS Security Descriptor Propagations Events"
|
||||
dsSecurityDescriptorPropagatorAverageExclusionTime = "DS Security Descriptor Propagator Average Exclusion Time"
|
||||
dsSecurityDescriptorPropagatorRuntimeQueue = "DS Security Descriptor Propagator Runtime Queue"
|
||||
dsSecurityDescriptorSubOperationsPerSec = "DS Security Descriptor sub-operations/sec"
|
||||
dsServerBindsPerSec = "DS Server Binds/sec"
|
||||
dsServerNameTranslationsPerSec = "DS Server Name Translations/sec"
|
||||
dsThreadsInUse = "DS Threads in Use"
|
||||
_ = "Error eventlogs since boot"
|
||||
_ = "Error events since boot"
|
||||
externalBindsPerSec = "External Binds/sec"
|
||||
fastBindsPerSec = "Fast Binds/sec"
|
||||
_ = "Fatal events since boot"
|
||||
_ = "Info eventlogs since boot"
|
||||
ldapActiveThreads = "LDAP Active Threads"
|
||||
_ = "LDAP Add Operations"
|
||||
_ = "LDAP Add Operations/sec"
|
||||
_ = "LDAP batch slots available"
|
||||
ldapBindTime = "LDAP Bind Time"
|
||||
_ = "LDAP busy retries"
|
||||
_ = "LDAP busy retries/sec"
|
||||
ldapClientSessions = "LDAP Client Sessions"
|
||||
ldapClosedConnectionsPerSec = "LDAP Closed Connections/sec"
|
||||
_ = "LDAP Delete Operations"
|
||||
_ = "LDAP Delete Operations/sec"
|
||||
_ = "LDAP Modify DN Operations"
|
||||
_ = "LDAP Modify DN Operations/sec"
|
||||
_ = "LDAP Modify Operations"
|
||||
_ = "LDAP Modify Operations/sec"
|
||||
ldapNewConnectionsPerSec = "LDAP New Connections/sec"
|
||||
ldapNewSSLConnectionsPerSec = "LDAP New SSL Connections/sec"
|
||||
_ = "LDAP Outbound Bytes"
|
||||
_ = "LDAP Outbound Bytes/sec"
|
||||
_ = "LDAP Page Search Cache entries count"
|
||||
_ = "LDAP Page Search Cache size"
|
||||
ldapSearchesPerSec = "LDAP Searches/sec"
|
||||
ldapSuccessfulBindsPerSec = "LDAP Successful Binds/sec"
|
||||
_ = "LDAP Threads Sleeping on BUSY"
|
||||
ldapUDPOperationsPerSec = "LDAP UDP operations/sec"
|
||||
ldapWritesPerSec = "LDAP Writes/sec"
|
||||
linkValuesCleanedPerSec = "Link Values Cleaned/sec"
|
||||
_ = "Links added"
|
||||
_ = "Links added/sec"
|
||||
_ = "Links visited"
|
||||
_ = "Links visited/sec"
|
||||
_ = "Logical link deletes"
|
||||
_ = "Logical link deletes/sec"
|
||||
negotiatedBindsPerSec = "Negotiated Binds/sec"
|
||||
ntlmBindsPerSec = "NTLM Binds/sec"
|
||||
_ = "Objects returned"
|
||||
_ = "Objects returned/sec"
|
||||
_ = "Objects visited"
|
||||
_ = "Objects visited/sec"
|
||||
oneLevelSearchesPerSec = "Onelevel searches/sec"
|
||||
_ = "PDC failed password update notifications"
|
||||
_ = "PDC password update notifications/sec"
|
||||
_ = "PDC successful password update notifications"
|
||||
phantomsCleanedPerSec = "Phantoms Cleaned/sec"
|
||||
phantomsVisitedPerSec = "Phantoms Visited/sec"
|
||||
_ = "Physical link deletes"
|
||||
_ = "Physical link deletes/sec"
|
||||
_ = "Replicate Single Object operations"
|
||||
_ = "Replicate Single Object operations/sec"
|
||||
_ = "RID Pool invalidations since boot"
|
||||
_ = "RID Pool request failures since boot"
|
||||
_ = "RID Pool request successes since boot"
|
||||
samAccountGroupEvaluationLatency = "SAM Account Group Evaluation Latency"
|
||||
samDisplayInformationQueriesPerSec = "SAM Display Information Queries/sec"
|
||||
samDomainLocalGroupMembershipEvaluationsPerSec = "SAM Domain Local Group Membership Evaluations/sec"
|
||||
samEnumerationsPerSec = "SAM Enumerations/sec"
|
||||
samGCEvaluationsPerSec = "SAM GC Evaluations/sec"
|
||||
samGlobalGroupMembershipEvaluationsPerSec = "SAM Global Group Membership Evaluations/sec"
|
||||
samMachineCreationAttemptsPerSec = "SAM Machine Creation Attempts/sec"
|
||||
samMembershipChangesPerSec = "SAM Membership Changes/sec"
|
||||
samNonTransitiveMembershipEvaluationsPerSec = "SAM Non-Transitive Membership Evaluations/sec"
|
||||
samPasswordChangesPerSec = "SAM Password Changes/sec"
|
||||
samResourceGroupEvaluationLatency = "SAM Resource Group Evaluation Latency"
|
||||
samSuccessfulComputerCreationsPerSecIncludesAllRequests = "SAM Successful Computer Creations/sec: Includes all requests"
|
||||
samSuccessfulUserCreationsPerSec = "SAM Successful User Creations/sec"
|
||||
samTransitiveMembershipEvaluationsPerSec = "SAM Transitive Membership Evaluations/sec"
|
||||
samUniversalGroupMembershipEvaluationsPerSec = "SAM Universal Group Membership Evaluations/sec"
|
||||
samUserCreationAttemptsPerSec = "SAM User Creation Attempts/sec"
|
||||
simpleBindsPerSec = "Simple Binds/sec"
|
||||
subtreeSearchesPerSec = "Subtree searches/sec"
|
||||
tombstonesGarbageCollectedPerSec = "Tombstones Garbage Collected/sec"
|
||||
tombstonesVisitedPerSec = "Tombstones Visited/sec"
|
||||
transitiveOperationsMillisecondsRun = "Transitive operations milliseconds run"
|
||||
transitiveOperationsPerSec = "Transitive operations/sec"
|
||||
transitiveSubOperationsPerSec = "Transitive suboperations/sec"
|
||||
_ = "Warning eventlogs since boot"
|
||||
_ = "Warning events since boot"
|
||||
)
|
||||
@@ -1,29 +1,44 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package adcs
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"strings"
|
||||
|
||||
"github.com/alecthomas/kingpin/v2"
|
||||
"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-community/windows_exporter/internal/mi"
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus-community/windows_exporter/internal/utils"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/yusufpapurcu/wmi"
|
||||
)
|
||||
|
||||
const Name = "adcs"
|
||||
|
||||
type Config struct{}
|
||||
|
||||
//nolint:gochecknoglobals
|
||||
var ConfigDefaults = Config{}
|
||||
|
||||
type Collector struct {
|
||||
config Config
|
||||
|
||||
perfDataCollector *perfdata.Collector
|
||||
|
||||
challengeResponseProcessingTime *prometheus.Desc
|
||||
challengeResponsesPerSecond *prometheus.Desc
|
||||
failedRequestsPerSecond *prometheus.Desc
|
||||
@@ -59,15 +74,34 @@ func (c *Collector) GetName() string {
|
||||
return Name
|
||||
}
|
||||
|
||||
func (c *Collector) GetPerfCounter(_ *slog.Logger) ([]string, error) {
|
||||
return []string{"Certification Authority"}, nil
|
||||
}
|
||||
func (c *Collector) Close() error {
|
||||
c.perfDataCollector.Close()
|
||||
|
||||
func (c *Collector) Close(_ *slog.Logger) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
|
||||
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
|
||||
var err error
|
||||
|
||||
c.perfDataCollector, err = perfdata.NewCollector("Certification Authority", perfdata.InstancesAll, []string{
|
||||
requestsPerSecond,
|
||||
requestProcessingTime,
|
||||
retrievalsPerSecond,
|
||||
retrievalProcessingTime,
|
||||
failedRequestsPerSecond,
|
||||
issuedRequestsPerSecond,
|
||||
pendingRequestsPerSecond,
|
||||
requestCryptographicSigningTime,
|
||||
requestPolicyModuleProcessingTime,
|
||||
challengeResponsesPerSecond,
|
||||
challengeResponseProcessingTime,
|
||||
signedCertificateTimestampListsPerSecond,
|
||||
signedCertificateTimestampListProcessingTime,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create Certification Authority collector: %w", err)
|
||||
}
|
||||
|
||||
c.requestsPerSecond = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "requests_total"),
|
||||
"Total certificate requests processed",
|
||||
@@ -150,134 +184,94 @@ func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) Collect(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
|
||||
logger = logger.With(slog.String("collector", Name))
|
||||
if err := c.collectADCSCounters(ctx, logger, ch); err != nil {
|
||||
logger.Error("failed collecting ADCS metrics",
|
||||
slog.Any("err", err),
|
||||
)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type perflibADCS struct {
|
||||
Name string
|
||||
RequestsPerSecond float64 `perflib:"Requests/sec"`
|
||||
RequestProcessingTime float64 `perflib:"Request processing time (ms)"`
|
||||
RetrievalsPerSecond float64 `perflib:"Retrievals/sec"`
|
||||
RetrievalProcessingTime float64 `perflib:"Retrieval processing time (ms)"`
|
||||
FailedRequestsPerSecond float64 `perflib:"Failed Requests/sec"`
|
||||
IssuedRequestsPerSecond float64 `perflib:"Issued Requests/sec"`
|
||||
PendingRequestsPerSecond float64 `perflib:"Pending Requests/sec"`
|
||||
RequestCryptographicSigningTime float64 `perflib:"Request cryptographic signing time (ms)"`
|
||||
RequestPolicyModuleProcessingTime float64 `perflib:"Request policy module processing time (ms)"`
|
||||
ChallengeResponsesPerSecond float64 `perflib:"Challenge Responses/sec"`
|
||||
ChallengeResponseProcessingTime float64 `perflib:"Challenge Response processing time (ms)"`
|
||||
SignedCertificateTimestampListsPerSecond float64 `perflib:"Signed Certificate Timestamp Lists/sec"`
|
||||
SignedCertificateTimestampListProcessingTime float64 `perflib:"Signed Certificate Timestamp List processing time (ms)"`
|
||||
}
|
||||
|
||||
func (c *Collector) collectADCSCounters(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
|
||||
dst := make([]perflibADCS, 0)
|
||||
|
||||
if _, ok := ctx.PerfObjects["Certification Authority"]; !ok {
|
||||
return errors.New("perflib did not contain an entry for Certification Authority")
|
||||
}
|
||||
|
||||
err := perflib.UnmarshalObject(ctx.PerfObjects["Certification Authority"], &dst, logger)
|
||||
func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
|
||||
perfData, err := c.perfDataCollector.Collect()
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("failed to collect Certification Authority (ADCS) metrics: %w", err)
|
||||
}
|
||||
|
||||
if len(dst) == 0 {
|
||||
return errors.New("perflib query for Certification Authority (ADCS) returned empty result set")
|
||||
if len(perfData) == 0 {
|
||||
return fmt.Errorf("failed to collect Certification Authority (ADCS) metrics: %w", types.ErrNoData)
|
||||
}
|
||||
|
||||
for _, d := range dst {
|
||||
n := strings.ToLower(d.Name)
|
||||
if n == "" {
|
||||
continue
|
||||
}
|
||||
for name, data := range perfData {
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.requestsPerSecond,
|
||||
prometheus.CounterValue,
|
||||
d.RequestsPerSecond,
|
||||
d.Name,
|
||||
data[requestsPerSecond].FirstValue,
|
||||
name,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.requestProcessingTime,
|
||||
prometheus.GaugeValue,
|
||||
utils.MilliSecToSec(d.RequestProcessingTime),
|
||||
d.Name,
|
||||
utils.MilliSecToSec(data[requestProcessingTime].FirstValue),
|
||||
name,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.retrievalsPerSecond,
|
||||
prometheus.CounterValue,
|
||||
d.RetrievalsPerSecond,
|
||||
d.Name,
|
||||
data[retrievalsPerSecond].FirstValue,
|
||||
name,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.retrievalProcessingTime,
|
||||
prometheus.GaugeValue,
|
||||
utils.MilliSecToSec(d.RetrievalProcessingTime),
|
||||
d.Name,
|
||||
utils.MilliSecToSec(data[retrievalProcessingTime].FirstValue),
|
||||
name,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.failedRequestsPerSecond,
|
||||
prometheus.CounterValue,
|
||||
d.FailedRequestsPerSecond,
|
||||
d.Name,
|
||||
data[failedRequestsPerSecond].FirstValue,
|
||||
name,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.issuedRequestsPerSecond,
|
||||
prometheus.CounterValue,
|
||||
d.IssuedRequestsPerSecond,
|
||||
d.Name,
|
||||
data[issuedRequestsPerSecond].FirstValue,
|
||||
name,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.pendingRequestsPerSecond,
|
||||
prometheus.CounterValue,
|
||||
d.PendingRequestsPerSecond,
|
||||
d.Name,
|
||||
data[pendingRequestsPerSecond].FirstValue,
|
||||
name,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.requestCryptographicSigningTime,
|
||||
prometheus.GaugeValue,
|
||||
utils.MilliSecToSec(d.RequestCryptographicSigningTime),
|
||||
d.Name,
|
||||
utils.MilliSecToSec(data[requestCryptographicSigningTime].FirstValue),
|
||||
name,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.requestPolicyModuleProcessingTime,
|
||||
prometheus.GaugeValue,
|
||||
utils.MilliSecToSec(d.RequestPolicyModuleProcessingTime),
|
||||
d.Name,
|
||||
utils.MilliSecToSec(data[requestPolicyModuleProcessingTime].FirstValue),
|
||||
name,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.challengeResponsesPerSecond,
|
||||
prometheus.CounterValue,
|
||||
d.ChallengeResponsesPerSecond,
|
||||
d.Name,
|
||||
data[challengeResponsesPerSecond].FirstValue,
|
||||
name,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.challengeResponseProcessingTime,
|
||||
prometheus.GaugeValue,
|
||||
utils.MilliSecToSec(d.ChallengeResponseProcessingTime),
|
||||
d.Name,
|
||||
utils.MilliSecToSec(data[challengeResponseProcessingTime].FirstValue),
|
||||
name,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.signedCertificateTimestampListsPerSecond,
|
||||
prometheus.CounterValue,
|
||||
d.SignedCertificateTimestampListsPerSecond,
|
||||
d.Name,
|
||||
data[signedCertificateTimestampListsPerSecond].FirstValue,
|
||||
name,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.signedCertificateTimestampListProcessingTime,
|
||||
prometheus.GaugeValue,
|
||||
utils.MilliSecToSec(d.SignedCertificateTimestampListProcessingTime),
|
||||
d.Name,
|
||||
utils.MilliSecToSec(data[signedCertificateTimestampListProcessingTime].FirstValue),
|
||||
name,
|
||||
)
|
||||
}
|
||||
|
||||
27
internal/collector/adcs/adcs_test.go
Normal file
27
internal/collector/adcs/adcs_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package adcs_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/collector/adcs"
|
||||
"github.com/prometheus-community/windows_exporter/internal/utils/testutils"
|
||||
)
|
||||
|
||||
func BenchmarkCollector(b *testing.B) {
|
||||
testutils.FuncBenchmarkCollector(b, adcs.Name, adcs.NewWithFlags)
|
||||
}
|
||||
32
internal/collector/adcs/const.go
Normal file
32
internal/collector/adcs/const.go
Normal file
@@ -0,0 +1,32 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package adcs
|
||||
|
||||
const (
|
||||
challengeResponseProcessingTime = "Challenge Response processing time (ms)"
|
||||
challengeResponsesPerSecond = "Challenge Responses/sec"
|
||||
failedRequestsPerSecond = "Failed Requests/sec"
|
||||
issuedRequestsPerSecond = "Issued Requests/sec"
|
||||
pendingRequestsPerSecond = "Pending Requests/sec"
|
||||
requestCryptographicSigningTime = "Request cryptographic signing time (ms)"
|
||||
requestPolicyModuleProcessingTime = "Request policy module processing time (ms)"
|
||||
requestProcessingTime = "Request processing time (ms)"
|
||||
requestsPerSecond = "Requests/sec"
|
||||
retrievalProcessingTime = "Retrieval processing time (ms)"
|
||||
retrievalsPerSecond = "Retrievals/sec"
|
||||
signedCertificateTimestampListProcessingTime = "Signed Certificate Timestamp List processing time (ms)"
|
||||
signedCertificateTimestampListsPerSecond = "Signed Certificate Timestamp Lists/sec"
|
||||
)
|
||||
@@ -1,27 +1,46 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package adfs
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"maps"
|
||||
"math"
|
||||
"slices"
|
||||
|
||||
"github.com/alecthomas/kingpin/v2"
|
||||
"github.com/prometheus-community/windows_exporter/pkg/perflib"
|
||||
"github.com/prometheus-community/windows_exporter/pkg/types"
|
||||
"github.com/prometheus-community/windows_exporter/internal/mi"
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/yusufpapurcu/wmi"
|
||||
)
|
||||
|
||||
const Name = "adfs"
|
||||
|
||||
type Config struct{}
|
||||
|
||||
//nolint:gochecknoglobals
|
||||
var ConfigDefaults = Config{}
|
||||
|
||||
type Collector struct {
|
||||
config Config
|
||||
|
||||
perfDataCollector *perfdata.Collector
|
||||
|
||||
adLoginConnectionFailures *prometheus.Desc
|
||||
artifactDBFailures *prometheus.Desc
|
||||
avgArtifactDBQueryTime *prometheus.Desc
|
||||
@@ -63,8 +82,8 @@ type Collector struct {
|
||||
upAuthenticationFailures *prometheus.Desc
|
||||
upAuthentications *prometheus.Desc
|
||||
windowsIntegratedAuthentications *prometheus.Desc
|
||||
wsfedTokenRequests *prometheus.Desc
|
||||
wstrustTokenRequests *prometheus.Desc
|
||||
wsFedTokenRequests *prometheus.Desc
|
||||
wsTrustTokenRequests *prometheus.Desc
|
||||
}
|
||||
|
||||
func New(config *Config) *Collector {
|
||||
@@ -87,15 +106,64 @@ func (c *Collector) GetName() string {
|
||||
return Name
|
||||
}
|
||||
|
||||
func (c *Collector) GetPerfCounter(_ *slog.Logger) ([]string, error) {
|
||||
return []string{"AD FS"}, nil
|
||||
}
|
||||
func (c *Collector) Close() error {
|
||||
c.perfDataCollector.Close()
|
||||
|
||||
func (c *Collector) Close(_ *slog.Logger) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
|
||||
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
|
||||
var err error
|
||||
|
||||
c.perfDataCollector, err = perfdata.NewCollector("AD FS", nil, []string{
|
||||
adLoginConnectionFailures,
|
||||
certificateAuthentications,
|
||||
deviceAuthentications,
|
||||
extranetAccountLockouts,
|
||||
federatedAuthentications,
|
||||
passportAuthentications,
|
||||
passiveRequests,
|
||||
passwordChangeFailed,
|
||||
passwordChangeSucceeded,
|
||||
tokenRequests,
|
||||
windowsIntegratedAuthentications,
|
||||
oAuthAuthZRequests,
|
||||
oAuthClientAuthentications,
|
||||
oAuthClientAuthenticationFailures,
|
||||
oAuthClientCredentialRequestFailures,
|
||||
oAuthClientCredentialRequests,
|
||||
oAuthClientPrivateKeyJWTAuthenticationFailures,
|
||||
oAuthClientPrivateKeyJWTAuthentications,
|
||||
oAuthClientBasicAuthenticationFailures,
|
||||
oAuthClientBasicAuthentications,
|
||||
oAuthClientSecretPostAuthenticationFailures,
|
||||
oAuthClientSecretPostAuthentications,
|
||||
oAuthClientWindowsAuthenticationFailures,
|
||||
oAuthClientWindowsAuthentications,
|
||||
oAuthLogonCertRequestFailures,
|
||||
oAuthLogonCertTokenRequests,
|
||||
oAuthPasswordGrantRequestFailures,
|
||||
oAuthPasswordGrantRequests,
|
||||
oAuthTokenRequests,
|
||||
samlPTokenRequests,
|
||||
ssoAuthenticationFailures,
|
||||
ssoAuthentications,
|
||||
wsFedTokenRequests,
|
||||
wsTrustTokenRequests,
|
||||
usernamePasswordAuthenticationFailures,
|
||||
usernamePasswordAuthentications,
|
||||
externalAuthentications,
|
||||
externalAuthNFailures,
|
||||
artifactDBFailures,
|
||||
avgArtifactDBQueryTime,
|
||||
configDBFailures,
|
||||
avgConfigDBQueryTime,
|
||||
federationMetadataRequests,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create AD FS collector: %w", err)
|
||||
}
|
||||
|
||||
c.adLoginConnectionFailures = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "ad_login_connection_failures_total"),
|
||||
"Total number of connection failures to an Active Directory domain controller",
|
||||
@@ -288,13 +356,13 @@ func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.wsfedTokenRequests = prometheus.NewDesc(
|
||||
c.wsFedTokenRequests = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "wsfed_token_requests_success_total"),
|
||||
"Total number of successful RP tokens issued over WS-Fed protocol",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.wstrustTokenRequests = prometheus.NewDesc(
|
||||
c.wsTrustTokenRequests = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "wstrust_token_requests_success_total"),
|
||||
"Total number of successful RP tokens issued over WS-Trust protocol",
|
||||
nil,
|
||||
@@ -358,318 +426,280 @@ func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
type perflibADFS struct {
|
||||
AdLoginConnectionFailures float64 `perflib:"AD Login Connection Failures"`
|
||||
CertificateAuthentications float64 `perflib:"Certificate Authentications"`
|
||||
DeviceAuthentications float64 `perflib:"Device Authentications"`
|
||||
ExtranetAccountLockouts float64 `perflib:"Extranet Account Lockouts"`
|
||||
FederatedAuthentications float64 `perflib:"Federated Authentications"`
|
||||
PassportAuthentications float64 `perflib:"Microsoft Passport Authentications"`
|
||||
PassiveRequests float64 `perflib:"Passive Requests"`
|
||||
PasswordChangeFailed float64 `perflib:"Password Change Failed Requests"`
|
||||
PasswordChangeSucceeded float64 `perflib:"Password Change Successful Requests"`
|
||||
TokenRequests float64 `perflib:"Token Requests"`
|
||||
WindowsIntegratedAuthentications float64 `perflib:"Windows Integrated Authentications"`
|
||||
OAuthAuthZRequests float64 `perflib:"OAuth AuthZ Requests"`
|
||||
OAuthClientAuthentications float64 `perflib:"OAuth Client Authentications"`
|
||||
OAuthClientAuthenticationFailures float64 `perflib:"OAuth Client Authentications Failures"`
|
||||
OAuthClientCredentialRequestFailures float64 `perflib:"OAuth Client Credentials Request Failures"`
|
||||
OAuthClientCredentialRequests float64 `perflib:"OAuth Client Credentials Requests"`
|
||||
OAuthClientPrivKeyJWTAuthnFailures float64 `perflib:"OAuth Client Private Key Jwt Authentication Failures"`
|
||||
OAuthClientPrivKeyJWTAuthentications float64 `perflib:"OAuth Client Private Key Jwt Authentications"`
|
||||
OAuthClientBasicAuthnFailures float64 `perflib:"OAuth Client Secret Basic Authentication Failures"`
|
||||
OAuthClientBasicAuthentications float64 `perflib:"OAuth Client Secret Basic Authentication Requests"`
|
||||
OAuthClientSecretPostAuthnFailures float64 `perflib:"OAuth Client Secret Post Authentication Failures"`
|
||||
OAuthClientSecretPostAuthentications float64 `perflib:"OAuth Client Secret Post Authentications"`
|
||||
OAuthClientWindowsAuthnFailures float64 `perflib:"OAuth Client Windows Integrated Authentication Failures"`
|
||||
OAuthClientWindowsAuthentications float64 `perflib:"OAuth Client Windows Integrated Authentications"`
|
||||
OAuthLogonCertRequestFailures float64 `perflib:"OAuth Logon Certificate Request Failures"`
|
||||
OAuthLogonCertTokenRequests float64 `perflib:"OAuth Logon Certificate Token Requests"`
|
||||
OAuthPasswordGrantRequestFailures float64 `perflib:"OAuth Password Grant Request Failures"`
|
||||
OAuthPasswordGrantRequests float64 `perflib:"OAuth Password Grant Requests"`
|
||||
OAuthTokenRequests float64 `perflib:"OAuth Token Requests"`
|
||||
SAMLPTokenRequests float64 `perflib:"SAML-P Token Requests"`
|
||||
SSOAuthenticationFailures float64 `perflib:"SSO Authentication Failures"`
|
||||
SSOAuthentications float64 `perflib:"SSO Authentications"`
|
||||
WSFedTokenRequests float64 `perflib:"WS-Fed Token Requests"`
|
||||
WSTrustTokenRequests float64 `perflib:"WS-Trust Token Requests"`
|
||||
UsernamePasswordAuthnFailures float64 `perflib:"U/P Authentication Failures"`
|
||||
UsernamePasswordAuthentications float64 `perflib:"U/P Authentications"`
|
||||
ExternalAuthentications float64 `perflib:"External Authentications"`
|
||||
ExternalAuthNFailures float64 `perflib:"External Authentication Failures"`
|
||||
ArtifactDBFailures float64 `perflib:"Artifact Database Connection Failures"`
|
||||
AvgArtifactDBQueryTime float64 `perflib:"Average Artifact Database Query Time"`
|
||||
ConfigDBFailures float64 `perflib:"Configuration Database Connection Failures"`
|
||||
AvgConfigDBQueryTime float64 `perflib:"Average Config Database Query Time"`
|
||||
FederationMetadataRequests float64 `perflib:"Federation Metadata Requests"`
|
||||
}
|
||||
|
||||
func (c *Collector) Collect(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
|
||||
logger = logger.With(slog.String("collector", Name))
|
||||
|
||||
var adfsData []perflibADFS
|
||||
|
||||
err := perflib.UnmarshalObject(ctx.PerfObjects["AD FS"], &adfsData, logger)
|
||||
func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
|
||||
data, err := c.perfDataCollector.Collect()
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("failed to collect ADFS metrics: %w", err)
|
||||
}
|
||||
|
||||
instanceKey := slices.Collect(maps.Keys(data))
|
||||
|
||||
if len(instanceKey) == 0 {
|
||||
return fmt.Errorf("failed to collect ADFS metrics: %w", types.ErrNoData)
|
||||
}
|
||||
|
||||
adfsData, ok := data[instanceKey[0]]
|
||||
|
||||
if !ok {
|
||||
return fmt.Errorf("failed to collect ADFS metrics: %w", types.ErrNoData)
|
||||
}
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.adLoginConnectionFailures,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].AdLoginConnectionFailures,
|
||||
adfsData[adLoginConnectionFailures].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.certificateAuthentications,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].CertificateAuthentications,
|
||||
adfsData[certificateAuthentications].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.deviceAuthentications,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].DeviceAuthentications,
|
||||
adfsData[deviceAuthentications].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.extranetAccountLockouts,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].ExtranetAccountLockouts,
|
||||
adfsData[extranetAccountLockouts].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.federatedAuthentications,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].FederatedAuthentications,
|
||||
adfsData[federatedAuthentications].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.passportAuthentications,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].PassportAuthentications,
|
||||
adfsData[passportAuthentications].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.passiveRequests,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].PassiveRequests,
|
||||
adfsData[passiveRequests].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.passwordChangeFailed,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].PasswordChangeFailed,
|
||||
adfsData[passwordChangeFailed].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.passwordChangeSucceeded,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].PasswordChangeSucceeded,
|
||||
adfsData[passwordChangeSucceeded].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.tokenRequests,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].TokenRequests,
|
||||
adfsData[tokenRequests].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.windowsIntegratedAuthentications,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].WindowsIntegratedAuthentications,
|
||||
adfsData[windowsIntegratedAuthentications].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.oAuthAuthZRequests,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].OAuthAuthZRequests,
|
||||
adfsData[oAuthAuthZRequests].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.oAuthClientAuthentications,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].OAuthClientAuthentications,
|
||||
adfsData[oAuthClientAuthentications].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.oAuthClientAuthenticationsFailures,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].OAuthClientAuthenticationFailures,
|
||||
adfsData[oAuthClientAuthenticationFailures].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.oAuthClientCredentialsRequestFailures,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].OAuthClientCredentialRequestFailures,
|
||||
adfsData[oAuthClientCredentialRequestFailures].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.oAuthClientCredentialsRequests,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].OAuthClientCredentialRequests,
|
||||
adfsData[oAuthClientCredentialRequests].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.oAuthClientPrivateKeyJwtAuthenticationFailures,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].OAuthClientPrivKeyJWTAuthnFailures,
|
||||
adfsData[oAuthClientPrivateKeyJWTAuthenticationFailures].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.oAuthClientPrivateKeyJwtAuthentications,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].OAuthClientPrivKeyJWTAuthentications,
|
||||
adfsData[oAuthClientPrivateKeyJWTAuthentications].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.oAuthClientSecretBasicAuthenticationFailures,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].OAuthClientBasicAuthnFailures,
|
||||
adfsData[oAuthClientBasicAuthenticationFailures].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.oAuthClientSecretBasicAuthentications,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].OAuthClientBasicAuthentications,
|
||||
adfsData[oAuthClientBasicAuthentications].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.oAuthClientSecretPostAuthenticationFailures,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].OAuthClientSecretPostAuthnFailures,
|
||||
adfsData[oAuthClientSecretPostAuthenticationFailures].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.oAuthClientSecretPostAuthentications,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].OAuthClientSecretPostAuthentications,
|
||||
adfsData[oAuthClientSecretPostAuthentications].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.oAuthClientWindowsIntegratedAuthenticationFailures,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].OAuthClientWindowsAuthnFailures,
|
||||
adfsData[oAuthClientWindowsAuthenticationFailures].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.oAuthClientWindowsIntegratedAuthentications,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].OAuthClientWindowsAuthentications,
|
||||
adfsData[oAuthClientWindowsAuthentications].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.oAuthLogonCertificateRequestFailures,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].OAuthLogonCertRequestFailures,
|
||||
adfsData[oAuthLogonCertRequestFailures].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.oAuthLogonCertificateTokenRequests,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].OAuthLogonCertTokenRequests,
|
||||
adfsData[oAuthLogonCertTokenRequests].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.oAuthPasswordGrantRequestFailures,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].OAuthPasswordGrantRequestFailures,
|
||||
adfsData[oAuthPasswordGrantRequestFailures].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.oAuthPasswordGrantRequests,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].OAuthPasswordGrantRequests,
|
||||
adfsData[oAuthPasswordGrantRequests].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.oAuthTokenRequests,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].OAuthTokenRequests,
|
||||
adfsData[oAuthTokenRequests].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.samlPTokenRequests,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].SAMLPTokenRequests,
|
||||
adfsData[samlPTokenRequests].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ssoAuthenticationFailures,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].SSOAuthenticationFailures,
|
||||
adfsData[ssoAuthenticationFailures].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ssoAuthentications,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].SSOAuthentications,
|
||||
adfsData[ssoAuthentications].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.wsfedTokenRequests,
|
||||
c.wsFedTokenRequests,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].WSFedTokenRequests,
|
||||
adfsData[wsFedTokenRequests].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.wstrustTokenRequests,
|
||||
c.wsTrustTokenRequests,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].WSTrustTokenRequests,
|
||||
adfsData[wsTrustTokenRequests].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.upAuthenticationFailures,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].UsernamePasswordAuthnFailures,
|
||||
adfsData[usernamePasswordAuthenticationFailures].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.upAuthentications,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].UsernamePasswordAuthentications,
|
||||
adfsData[usernamePasswordAuthentications].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.externalAuthenticationFailures,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].ExternalAuthNFailures,
|
||||
adfsData[externalAuthNFailures].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.externalAuthentications,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].ExternalAuthentications,
|
||||
adfsData[externalAuthentications].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.artifactDBFailures,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].ArtifactDBFailures,
|
||||
adfsData[artifactDBFailures].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.avgArtifactDBQueryTime,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].AvgArtifactDBQueryTime*math.Pow(10, -8),
|
||||
adfsData[avgArtifactDBQueryTime].FirstValue*math.Pow(10, -8),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.configDBFailures,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].ConfigDBFailures,
|
||||
adfsData[configDBFailures].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.avgConfigDBQueryTime,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].AvgConfigDBQueryTime*math.Pow(10, -8),
|
||||
adfsData[avgConfigDBQueryTime].FirstValue*math.Pow(10, -8),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.federationMetadataRequests,
|
||||
prometheus.CounterValue,
|
||||
adfsData[0].FederationMetadataRequests,
|
||||
adfsData[federationMetadataRequests].FirstValue,
|
||||
)
|
||||
|
||||
return nil
|
||||
27
internal/collector/adfs/adfs_test.go
Normal file
27
internal/collector/adfs/adfs_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package adfs_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/collector/adfs"
|
||||
"github.com/prometheus-community/windows_exporter/internal/utils/testutils"
|
||||
)
|
||||
|
||||
func BenchmarkCollector(b *testing.B) {
|
||||
testutils.FuncBenchmarkCollector(b, adfs.Name, adfs.NewWithFlags)
|
||||
}
|
||||
62
internal/collector/adfs/const.go
Normal file
62
internal/collector/adfs/const.go
Normal file
@@ -0,0 +1,62 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package adfs
|
||||
|
||||
const (
|
||||
adLoginConnectionFailures = "AD Login Connection Failures"
|
||||
artifactDBFailures = "Artifact Database Connection Failures"
|
||||
avgArtifactDBQueryTime = "Average Artifact Database Query Time"
|
||||
avgConfigDBQueryTime = "Average Config Database Query Time"
|
||||
certificateAuthentications = "Certificate Authentications"
|
||||
configDBFailures = "Configuration Database Connection Failures"
|
||||
deviceAuthentications = "Device Authentications"
|
||||
externalAuthentications = "External Authentications"
|
||||
externalAuthNFailures = "External Authentication Failures"
|
||||
extranetAccountLockouts = "Extranet Account Lockouts"
|
||||
federatedAuthentications = "Federated Authentications"
|
||||
federationMetadataRequests = "Federation Metadata Requests"
|
||||
oAuthAuthZRequests = "OAuth AuthZ Requests"
|
||||
oAuthClientAuthenticationFailures = "OAuth Client Authentications Failures"
|
||||
oAuthClientAuthentications = "OAuth Client Authentications"
|
||||
oAuthClientBasicAuthenticationFailures = "OAuth Client Secret Basic Authentication Failures"
|
||||
oAuthClientBasicAuthentications = "OAuth Client Secret Basic Authentications"
|
||||
oAuthClientCredentialRequestFailures = "OAuth Client Credentials Request Failures"
|
||||
oAuthClientCredentialRequests = "OAuth Client Credentials Requests"
|
||||
oAuthClientPrivateKeyJWTAuthenticationFailures = "OAuth Client Private Key Jwt Authentication Failures"
|
||||
oAuthClientPrivateKeyJWTAuthentications = "OAuth Client Private Key Jwt Authentications"
|
||||
oAuthClientSecretPostAuthenticationFailures = "OAuth Client Secret Post Authentication Failures"
|
||||
oAuthClientSecretPostAuthentications = "OAuth Client Secret Post Authentications"
|
||||
oAuthClientWindowsAuthenticationFailures = "OAuth Client Windows Integrated Authentication Failures"
|
||||
oAuthClientWindowsAuthentications = "OAuth Client Windows Integrated Authentications"
|
||||
oAuthLogonCertRequestFailures = "OAuth Logon Certificate Request Failures"
|
||||
oAuthLogonCertTokenRequests = "OAuth Logon Certificate Token Requests"
|
||||
oAuthPasswordGrantRequestFailures = "OAuth Password Grant Request Failures"
|
||||
oAuthPasswordGrantRequests = "OAuth Password Grant Requests"
|
||||
oAuthTokenRequests = "OAuth Token Requests"
|
||||
passiveRequests = "Passive Requests"
|
||||
passportAuthentications = "Microsoft Passport Authentications"
|
||||
passwordChangeFailed = "Password Change Failed Requests"
|
||||
passwordChangeSucceeded = "Password Change Successful Requests"
|
||||
samlPTokenRequests = "SAML-P Token Requests"
|
||||
ssoAuthenticationFailures = "SSO Authentication Failures"
|
||||
ssoAuthentications = "SSO Authentications"
|
||||
tokenRequests = "Token Requests"
|
||||
usernamePasswordAuthenticationFailures = "U/P Authentication Failures"
|
||||
usernamePasswordAuthentications = "U/P Authentications"
|
||||
windowsIntegratedAuthentications = "Windows Integrated Authentications"
|
||||
wsFedTokenRequests = "WS-Fed Token Requests"
|
||||
wsTrustTokenRequests = "WS-Trust Token Requests"
|
||||
)
|
||||
@@ -1,28 +1,44 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package cache
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
|
||||
"github.com/alecthomas/kingpin/v2"
|
||||
"github.com/prometheus-community/windows_exporter/pkg/perflib"
|
||||
"github.com/prometheus-community/windows_exporter/pkg/types"
|
||||
"github.com/prometheus-community/windows_exporter/internal/mi"
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/yusufpapurcu/wmi"
|
||||
)
|
||||
|
||||
const Name = "cache"
|
||||
|
||||
type Config struct{}
|
||||
|
||||
//nolint:gochecknoglobals
|
||||
var ConfigDefaults = Config{}
|
||||
|
||||
// A Collector is a Prometheus Collector for Perflib Cache metrics.
|
||||
type Collector struct {
|
||||
config Config
|
||||
|
||||
perfDataCollector *perfdata.Collector
|
||||
|
||||
asyncCopyReadsTotal *prometheus.Desc
|
||||
asyncDataMapsTotal *prometheus.Desc
|
||||
asyncFastReadsTotal *prometheus.Desc
|
||||
@@ -74,15 +90,50 @@ func (c *Collector) GetName() string {
|
||||
return Name
|
||||
}
|
||||
|
||||
func (c *Collector) GetPerfCounter(_ *slog.Logger) ([]string, error) {
|
||||
return []string{"Cache"}, nil
|
||||
}
|
||||
func (c *Collector) Close() error {
|
||||
c.perfDataCollector.Close()
|
||||
|
||||
func (c *Collector) Close(_ *slog.Logger) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
|
||||
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
|
||||
var err error
|
||||
|
||||
c.perfDataCollector, err = perfdata.NewCollector("Cache", perfdata.InstancesAll, []string{
|
||||
asyncCopyReadsTotal,
|
||||
asyncDataMapsTotal,
|
||||
asyncFastReadsTotal,
|
||||
asyncMDLReadsTotal,
|
||||
asyncPinReadsTotal,
|
||||
copyReadHitsTotal,
|
||||
copyReadsTotal,
|
||||
dataFlushesTotal,
|
||||
dataFlushPagesTotal,
|
||||
dataMapHitsPercent,
|
||||
dataMapPinsTotal,
|
||||
dataMapsTotal,
|
||||
dirtyPages,
|
||||
dirtyPageThreshold,
|
||||
fastReadNotPossiblesTotal,
|
||||
fastReadResourceMissesTotal,
|
||||
fastReadsTotal,
|
||||
lazyWriteFlushesTotal,
|
||||
lazyWritePagesTotal,
|
||||
mdlReadHitsTotal,
|
||||
mdlReadsTotal,
|
||||
pinReadHitsTotal,
|
||||
pinReadsTotal,
|
||||
readAheadsTotal,
|
||||
syncCopyReadsTotal,
|
||||
syncDataMapsTotal,
|
||||
syncFastReadsTotal,
|
||||
syncMDLReadsTotal,
|
||||
syncPinReadsTotal,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create Cache collector: %w", err)
|
||||
}
|
||||
|
||||
c.asyncCopyReadsTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "async_copy_reads_total"),
|
||||
"(AsyncCopyReadsTotal)",
|
||||
@@ -262,238 +313,190 @@ func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
|
||||
}
|
||||
|
||||
// Collect implements the Collector interface.
|
||||
func (c *Collector) Collect(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
|
||||
logger = logger.With(slog.String("collector", Name))
|
||||
if err := c.collect(ctx, logger, ch); err != nil {
|
||||
logger.Error("failed collecting cache metrics",
|
||||
slog.Any("err", err),
|
||||
)
|
||||
|
||||
return err
|
||||
func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
|
||||
data, err := c.perfDataCollector.Collect()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect Cache metrics: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
cacheData, ok := data[perfdata.InstanceEmpty]
|
||||
|
||||
// Perflib "Cache":
|
||||
// - https://docs.microsoft.com/en-us/previous-versions/aa394267(v=vs.85)
|
||||
type perflibCache struct {
|
||||
AsyncCopyReadsTotal float64 `perflib:"Async Copy Reads/sec"`
|
||||
AsyncDataMapsTotal float64 `perflib:"Async Data Maps/sec"`
|
||||
AsyncFastReadsTotal float64 `perflib:"Async Fast Reads/sec"`
|
||||
AsyncMDLReadsTotal float64 `perflib:"Async MDL Reads/sec"`
|
||||
AsyncPinReadsTotal float64 `perflib:"Async Pin Reads/sec"`
|
||||
CopyReadHitsTotal float64 `perflib:"Copy Read Hits %"`
|
||||
CopyReadsTotal float64 `perflib:"Copy Reads/sec"`
|
||||
DataFlushesTotal float64 `perflib:"Data Flushes/sec"`
|
||||
DataFlushPagesTotal float64 `perflib:"Data Flush Pages/sec"`
|
||||
DataMapHitsPercent float64 `perflib:"Data Map Hits %"`
|
||||
DataMapPinsTotal float64 `perflib:"Data Map Pins/sec"`
|
||||
DataMapsTotal float64 `perflib:"Data Maps/sec"`
|
||||
DirtyPages float64 `perflib:"Dirty Pages"`
|
||||
DirtyPageThreshold float64 `perflib:"Dirty Page Threshold"`
|
||||
FastReadNotPossiblesTotal float64 `perflib:"Fast Read Not Possibles/sec"`
|
||||
FastReadResourceMissesTotal float64 `perflib:"Fast Read Resource Misses/sec"`
|
||||
FastReadsTotal float64 `perflib:"Fast Reads/sec"`
|
||||
LazyWriteFlushesTotal float64 `perflib:"Lazy Write Flushes/sec"`
|
||||
LazyWritePagesTotal float64 `perflib:"Lazy Write Pages/sec"`
|
||||
MDLReadHitsTotal float64 `perflib:"MDL Read Hits %"`
|
||||
MDLReadsTotal float64 `perflib:"MDL Reads/sec"`
|
||||
PinReadHitsTotal float64 `perflib:"Pin Read Hits %"`
|
||||
PinReadsTotal float64 `perflib:"Pin Reads/sec"`
|
||||
ReadAheadsTotal float64 `perflib:"Read Aheads/sec"`
|
||||
SyncCopyReadsTotal float64 `perflib:"Sync Copy Reads/sec"`
|
||||
SyncDataMapsTotal float64 `perflib:"Sync Data Maps/sec"`
|
||||
SyncFastReadsTotal float64 `perflib:"Sync Fast Reads/sec"`
|
||||
SyncMDLReadsTotal float64 `perflib:"Sync MDL Reads/sec"`
|
||||
SyncPinReadsTotal float64 `perflib:"Sync Pin Reads/sec"`
|
||||
}
|
||||
|
||||
func (c *Collector) collect(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
|
||||
logger = logger.With(slog.String("collector", Name))
|
||||
|
||||
var dst []perflibCache // Single-instance class, array is required but will have single entry.
|
||||
|
||||
if err := perflib.UnmarshalObject(ctx.PerfObjects["Cache"], &dst, logger); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(dst) != 1 {
|
||||
return errors.New("expected single instance of Cache")
|
||||
if !ok {
|
||||
return fmt.Errorf("failed to collect Cache metrics: %w", types.ErrNoData)
|
||||
}
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.asyncCopyReadsTotal,
|
||||
prometheus.CounterValue,
|
||||
dst[0].AsyncCopyReadsTotal,
|
||||
cacheData[asyncCopyReadsTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.asyncDataMapsTotal,
|
||||
prometheus.CounterValue,
|
||||
dst[0].AsyncDataMapsTotal,
|
||||
cacheData[asyncDataMapsTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.asyncFastReadsTotal,
|
||||
prometheus.CounterValue,
|
||||
dst[0].AsyncFastReadsTotal,
|
||||
cacheData[asyncFastReadsTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.asyncMDLReadsTotal,
|
||||
prometheus.CounterValue,
|
||||
dst[0].AsyncMDLReadsTotal,
|
||||
cacheData[asyncMDLReadsTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.asyncPinReadsTotal,
|
||||
prometheus.CounterValue,
|
||||
dst[0].AsyncPinReadsTotal,
|
||||
cacheData[asyncPinReadsTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.copyReadHitsTotal,
|
||||
prometheus.GaugeValue,
|
||||
dst[0].CopyReadHitsTotal,
|
||||
cacheData[copyReadHitsTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.copyReadsTotal,
|
||||
prometheus.CounterValue,
|
||||
dst[0].CopyReadsTotal,
|
||||
cacheData[copyReadsTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataFlushesTotal,
|
||||
prometheus.CounterValue,
|
||||
dst[0].DataFlushesTotal,
|
||||
cacheData[dataFlushesTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataFlushPagesTotal,
|
||||
prometheus.CounterValue,
|
||||
dst[0].DataFlushPagesTotal,
|
||||
cacheData[dataFlushPagesTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataMapHitsPercent,
|
||||
prometheus.GaugeValue,
|
||||
dst[0].DataMapHitsPercent,
|
||||
cacheData[dataMapHitsPercent].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataMapPinsTotal,
|
||||
prometheus.CounterValue,
|
||||
dst[0].DataMapPinsTotal,
|
||||
cacheData[dataMapPinsTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataMapsTotal,
|
||||
prometheus.CounterValue,
|
||||
dst[0].DataMapsTotal,
|
||||
cacheData[dataMapsTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dirtyPages,
|
||||
prometheus.GaugeValue,
|
||||
dst[0].DirtyPages,
|
||||
cacheData[dirtyPages].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dirtyPageThreshold,
|
||||
prometheus.GaugeValue,
|
||||
dst[0].DirtyPageThreshold,
|
||||
cacheData[dirtyPageThreshold].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.fastReadNotPossiblesTotal,
|
||||
prometheus.CounterValue,
|
||||
dst[0].FastReadNotPossiblesTotal,
|
||||
cacheData[fastReadNotPossiblesTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.fastReadResourceMissesTotal,
|
||||
prometheus.CounterValue,
|
||||
dst[0].FastReadResourceMissesTotal,
|
||||
cacheData[fastReadResourceMissesTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.fastReadsTotal,
|
||||
prometheus.CounterValue,
|
||||
dst[0].FastReadsTotal,
|
||||
cacheData[fastReadsTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.lazyWriteFlushesTotal,
|
||||
prometheus.CounterValue,
|
||||
dst[0].LazyWriteFlushesTotal,
|
||||
cacheData[lazyWriteFlushesTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.lazyWritePagesTotal,
|
||||
prometheus.CounterValue,
|
||||
dst[0].LazyWritePagesTotal,
|
||||
cacheData[lazyWritePagesTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.mdlReadHitsTotal,
|
||||
prometheus.CounterValue,
|
||||
dst[0].MDLReadHitsTotal,
|
||||
cacheData[mdlReadHitsTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.mdlReadsTotal,
|
||||
prometheus.CounterValue,
|
||||
dst[0].MDLReadsTotal,
|
||||
cacheData[mdlReadsTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.pinReadHitsTotal,
|
||||
prometheus.CounterValue,
|
||||
dst[0].PinReadHitsTotal,
|
||||
cacheData[pinReadHitsTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.pinReadsTotal,
|
||||
prometheus.CounterValue,
|
||||
dst[0].PinReadsTotal,
|
||||
cacheData[pinReadsTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.readAheadsTotal,
|
||||
prometheus.CounterValue,
|
||||
dst[0].ReadAheadsTotal,
|
||||
cacheData[readAheadsTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.syncCopyReadsTotal,
|
||||
prometheus.CounterValue,
|
||||
dst[0].SyncCopyReadsTotal,
|
||||
cacheData[syncCopyReadsTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.syncDataMapsTotal,
|
||||
prometheus.CounterValue,
|
||||
dst[0].SyncDataMapsTotal,
|
||||
cacheData[syncDataMapsTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.syncFastReadsTotal,
|
||||
prometheus.CounterValue,
|
||||
dst[0].SyncFastReadsTotal,
|
||||
cacheData[syncFastReadsTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.syncMDLReadsTotal,
|
||||
prometheus.CounterValue,
|
||||
dst[0].SyncMDLReadsTotal,
|
||||
cacheData[syncMDLReadsTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.syncPinReadsTotal,
|
||||
prometheus.CounterValue,
|
||||
dst[0].SyncPinReadsTotal,
|
||||
cacheData[syncPinReadsTotal].FirstValue,
|
||||
)
|
||||
|
||||
return nil
|
||||
27
internal/collector/cache/cache_test.go
vendored
Normal file
27
internal/collector/cache/cache_test.go
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package cache_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/collector/cache"
|
||||
"github.com/prometheus-community/windows_exporter/internal/utils/testutils"
|
||||
)
|
||||
|
||||
func BenchmarkCollector(b *testing.B) {
|
||||
testutils.FuncBenchmarkCollector(b, cache.Name, cache.NewWithFlags)
|
||||
}
|
||||
50
internal/collector/cache/const.go
vendored
Normal file
50
internal/collector/cache/const.go
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package cache
|
||||
|
||||
// Perflib "Cache":
|
||||
// - https://docs.microsoft.com/en-us/previous-versions/aa394267(v=vs.85)
|
||||
const (
|
||||
asyncCopyReadsTotal = "Async Copy Reads/sec"
|
||||
asyncDataMapsTotal = "Async Data Maps/sec"
|
||||
asyncFastReadsTotal = "Async Fast Reads/sec"
|
||||
asyncMDLReadsTotal = "Async MDL Reads/sec"
|
||||
asyncPinReadsTotal = "Async Pin Reads/sec"
|
||||
copyReadHitsTotal = "Copy Read Hits %"
|
||||
copyReadsTotal = "Copy Reads/sec"
|
||||
dataFlushesTotal = "Data Flushes/sec"
|
||||
dataFlushPagesTotal = "Data Flush Pages/sec"
|
||||
dataMapHitsPercent = "Data Map Hits %"
|
||||
dataMapPinsTotal = "Data Map Pins/sec"
|
||||
dataMapsTotal = "Data Maps/sec"
|
||||
dirtyPages = "Dirty Pages"
|
||||
dirtyPageThreshold = "Dirty Page Threshold"
|
||||
fastReadNotPossiblesTotal = "Fast Read Not Possibles/sec"
|
||||
fastReadResourceMissesTotal = "Fast Read Resource Misses/sec"
|
||||
fastReadsTotal = "Fast Reads/sec"
|
||||
lazyWriteFlushesTotal = "Lazy Write Flushes/sec"
|
||||
lazyWritePagesTotal = "Lazy Write Pages/sec"
|
||||
mdlReadHitsTotal = "MDL Read Hits %"
|
||||
mdlReadsTotal = "MDL Reads/sec"
|
||||
pinReadHitsTotal = "Pin Read Hits %"
|
||||
pinReadsTotal = "Pin Reads/sec"
|
||||
readAheadsTotal = "Read Aheads/sec"
|
||||
syncCopyReadsTotal = "Sync Copy Reads/sec"
|
||||
syncDataMapsTotal = "Sync Data Maps/sec"
|
||||
syncFastReadsTotal = "Sync Fast Reads/sec"
|
||||
syncMDLReadsTotal = "Sync MDL Reads/sec"
|
||||
syncPinReadsTotal = "Sync Pin Reads/sec"
|
||||
)
|
||||
@@ -1,3 +1,16 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package container
|
||||
@@ -10,22 +23,25 @@ import (
|
||||
|
||||
"github.com/Microsoft/hcsshim"
|
||||
"github.com/alecthomas/kingpin/v2"
|
||||
"github.com/prometheus-community/windows_exporter/pkg/perflib"
|
||||
"github.com/prometheus-community/windows_exporter/pkg/types"
|
||||
"github.com/prometheus-community/windows_exporter/internal/mi"
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/yusufpapurcu/wmi"
|
||||
)
|
||||
|
||||
const Name = "container"
|
||||
|
||||
type Config struct{}
|
||||
|
||||
//nolint:gochecknoglobals
|
||||
var ConfigDefaults = Config{}
|
||||
|
||||
// A Collector is a Prometheus Collector for containers metrics.
|
||||
type Collector struct {
|
||||
config Config
|
||||
|
||||
logger *slog.Logger
|
||||
|
||||
// Presence
|
||||
containerAvailable *prometheus.Desc
|
||||
|
||||
@@ -78,15 +94,13 @@ 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 {
|
||||
func (c *Collector) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
|
||||
func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
|
||||
c.logger = logger.With(slog.String("collector", Name))
|
||||
|
||||
c.containerAvailable = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "available"),
|
||||
"Available",
|
||||
@@ -201,28 +215,11 @@ func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
|
||||
|
||||
// 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(logger, ch); err != nil {
|
||||
logger.Error("failed collecting collector metrics",
|
||||
slog.Any("err", err),
|
||||
)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) collect(logger *slog.Logger, ch chan<- prometheus.Metric) error {
|
||||
func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
|
||||
// Types Container is passed to get the containers compute systems only
|
||||
containers, err := hcsshim.GetContainers(hcsshim.ComputeSystemQuery{Types: []string{"Container"}})
|
||||
if err != nil {
|
||||
logger.Error("Err in Getting containers",
|
||||
slog.Any("err", err),
|
||||
)
|
||||
|
||||
return err
|
||||
return fmt.Errorf("error in fetching containers: %w", err)
|
||||
}
|
||||
|
||||
count := len(containers)
|
||||
@@ -243,14 +240,14 @@ func (c *Collector) collect(logger *slog.Logger, ch chan<- prometheus.Metric) er
|
||||
for _, containerDetails := range containers {
|
||||
containerIdWithPrefix := getContainerIdWithPrefix(containerDetails)
|
||||
|
||||
if err = c.collectContainer(logger, ch, containerDetails, containerIdWithPrefix); err != nil {
|
||||
if err = c.collectContainer(ch, containerDetails, containerIdWithPrefix); err != nil {
|
||||
if hcsshim.IsNotExist(err) {
|
||||
logger.Debug("err in fetching container statistics",
|
||||
c.logger.Debug("err in fetching container statistics",
|
||||
slog.String("container_id", containerDetails.ID),
|
||||
slog.Any("err", err),
|
||||
)
|
||||
} else {
|
||||
logger.Error("err in fetching container statistics",
|
||||
c.logger.Error("err in fetching container statistics",
|
||||
slog.String("container_id", containerDetails.ID),
|
||||
slog.Any("err", err),
|
||||
)
|
||||
@@ -264,7 +261,7 @@ func (c *Collector) collect(logger *slog.Logger, ch chan<- prometheus.Metric) er
|
||||
containerPrefixes[containerDetails.ID] = containerIdWithPrefix
|
||||
}
|
||||
|
||||
if err = c.collectNetworkMetrics(logger, ch, containerPrefixes); err != nil {
|
||||
if err = c.collectNetworkMetrics(ch, containerPrefixes); err != nil {
|
||||
return fmt.Errorf("error in fetching container network statistics: %w", err)
|
||||
}
|
||||
|
||||
@@ -275,7 +272,7 @@ func (c *Collector) collect(logger *slog.Logger, ch chan<- prometheus.Metric) er
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) collectContainer(logger *slog.Logger, ch chan<- prometheus.Metric, containerDetails hcsshim.ContainerProperties, containerIdWithPrefix string) error {
|
||||
func (c *Collector) collectContainer(ch chan<- prometheus.Metric, containerDetails hcsshim.ContainerProperties, containerIdWithPrefix string) error {
|
||||
container, err := hcsshim.OpenContainer(containerDetails.ID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error in opening container: %w", err)
|
||||
@@ -287,7 +284,7 @@ func (c *Collector) collectContainer(logger *slog.Logger, ch chan<- prometheus.M
|
||||
}
|
||||
|
||||
if err := container.Close(); err != nil {
|
||||
logger.Error("error in closing container",
|
||||
c.logger.Error("error in closing container",
|
||||
slog.Any("err", err),
|
||||
)
|
||||
}
|
||||
@@ -325,19 +322,19 @@ func (c *Collector) collectContainer(logger *slog.Logger, ch chan<- prometheus.M
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.runtimeTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(containerStats.Processor.TotalRuntime100ns)*perflib.TicksToSecondScaleFactor,
|
||||
float64(containerStats.Processor.TotalRuntime100ns)*perfdata.TicksToSecondScaleFactor,
|
||||
containerIdWithPrefix,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.runtimeUser,
|
||||
prometheus.CounterValue,
|
||||
float64(containerStats.Processor.RuntimeUser100ns)*perflib.TicksToSecondScaleFactor,
|
||||
float64(containerStats.Processor.RuntimeUser100ns)*perfdata.TicksToSecondScaleFactor,
|
||||
containerIdWithPrefix,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.runtimeKernel,
|
||||
prometheus.CounterValue,
|
||||
float64(containerStats.Processor.RuntimeKernel100ns)*perflib.TicksToSecondScaleFactor,
|
||||
float64(containerStats.Processor.RuntimeKernel100ns)*perfdata.TicksToSecondScaleFactor,
|
||||
containerIdWithPrefix,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
@@ -372,24 +369,20 @@ func (c *Collector) collectContainer(logger *slog.Logger, ch chan<- prometheus.M
|
||||
// With HNSv2, the network stats must be collected from hcsshim.HNSListEndpointRequest.
|
||||
// Network statistics from the container.Statistics() are providing data only, if HNSv1 is used.
|
||||
// Ref: https://github.com/prometheus-community/windows_exporter/pull/1218
|
||||
func (c *Collector) collectNetworkMetrics(logger *slog.Logger, ch chan<- prometheus.Metric, containerPrefixes map[string]string) error {
|
||||
func (c *Collector) collectNetworkMetrics(ch chan<- prometheus.Metric, containerPrefixes map[string]string) error {
|
||||
hnsEndpoints, err := hcsshim.HNSListEndpointRequest()
|
||||
if err != nil {
|
||||
logger.Warn("Failed to collect network stats for containers")
|
||||
|
||||
return err
|
||||
return fmt.Errorf("error in fetching HNS endpoints: %w", err)
|
||||
}
|
||||
|
||||
if len(hnsEndpoints) == 0 {
|
||||
logger.Info("No network stats for containers to collect")
|
||||
|
||||
return nil
|
||||
return errors.New("no network stats for containers to collect")
|
||||
}
|
||||
|
||||
for _, endpoint := range hnsEndpoints {
|
||||
endpointStats, err := hcsshim.GetHNSEndpointStats(endpoint.Id)
|
||||
if err != nil {
|
||||
logger.Warn("Failed to collect network stats for interface "+endpoint.Id,
|
||||
c.logger.Warn("Failed to collect network stats for interface "+endpoint.Id,
|
||||
slog.Any("err", err),
|
||||
)
|
||||
|
||||
@@ -400,7 +393,7 @@ func (c *Collector) collectNetworkMetrics(logger *slog.Logger, ch chan<- prometh
|
||||
containerIdWithPrefix, ok := containerPrefixes[containerId]
|
||||
|
||||
if !ok {
|
||||
logger.Debug("Failed to collect network stats for container " + containerId)
|
||||
c.logger.Debug("Failed to collect network stats for container " + containerId)
|
||||
|
||||
continue
|
||||
}
|
||||
27
internal/collector/container/container_test.go
Normal file
27
internal/collector/container/container_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package container_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/collector/container"
|
||||
"github.com/prometheus-community/windows_exporter/internal/utils/testutils"
|
||||
)
|
||||
|
||||
func BenchmarkCollector(b *testing.B) {
|
||||
testutils.FuncBenchmarkCollector(b, container.Name, container.NewWithFlags)
|
||||
}
|
||||
43
internal/collector/cpu/const.go
Normal file
43
internal/collector/cpu/const.go
Normal file
@@ -0,0 +1,43 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package 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"
|
||||
dpcQueuedPerSecond = "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"
|
||||
)
|
||||
378
internal/collector/cpu/cpu.go
Normal file
378
internal/collector/cpu/cpu.go
Normal file
@@ -0,0 +1,378 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package cpu
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"sync"
|
||||
|
||||
"github.com/alecthomas/kingpin/v2"
|
||||
"github.com/prometheus-community/windows_exporter/internal/mi"
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus-community/windows_exporter/internal/utils"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
const Name = "cpu"
|
||||
|
||||
type Config struct{}
|
||||
|
||||
//nolint:gochecknoglobals
|
||||
var ConfigDefaults = Config{}
|
||||
|
||||
type Collector struct {
|
||||
config Config
|
||||
|
||||
perfDataCollector *perfdata.Collector
|
||||
|
||||
mu sync.Mutex
|
||||
|
||||
processorRTCValues map[string]utils.Counter
|
||||
processorMPerfValues map[string]utils.Counter
|
||||
|
||||
logicalProcessors *prometheus.Desc
|
||||
cStateSecondsTotal *prometheus.Desc
|
||||
timeTotal *prometheus.Desc
|
||||
interruptsTotal *prometheus.Desc
|
||||
dpcsTotal *prometheus.Desc
|
||||
clockInterruptsTotal *prometheus.Desc
|
||||
idleBreakEventsTotal *prometheus.Desc
|
||||
parkingStatus *prometheus.Desc
|
||||
processorFrequencyMHz *prometheus.Desc
|
||||
processorPerformance *prometheus.Desc
|
||||
processorMPerf *prometheus.Desc
|
||||
processorRTC *prometheus.Desc
|
||||
processorUtility *prometheus.Desc
|
||||
processorPrivilegedUtility *prometheus.Desc
|
||||
}
|
||||
|
||||
func New(config *Config) *Collector {
|
||||
if config == nil {
|
||||
config = &ConfigDefaults
|
||||
}
|
||||
|
||||
c := &Collector{
|
||||
config: *config,
|
||||
}
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
func NewWithFlags(_ *kingpin.Application) *Collector {
|
||||
return &Collector{}
|
||||
}
|
||||
|
||||
func (c *Collector) GetName() string {
|
||||
return Name
|
||||
}
|
||||
|
||||
func (c *Collector) Close() error {
|
||||
c.perfDataCollector.Close()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
|
||||
var err error
|
||||
|
||||
c.mu = sync.Mutex{}
|
||||
|
||||
c.perfDataCollector, err = perfdata.NewCollector("Processor Information", perfdata.InstancesAll, []string{
|
||||
c1TimeSeconds,
|
||||
c2TimeSeconds,
|
||||
c3TimeSeconds,
|
||||
c1TransitionsTotal,
|
||||
c2TransitionsTotal,
|
||||
c3TransitionsTotal,
|
||||
clockInterruptsTotal,
|
||||
dpcQueuedPerSecond,
|
||||
dpcTimeSeconds,
|
||||
idleBreakEventsTotal,
|
||||
idleTimeSeconds,
|
||||
interruptsTotal,
|
||||
interruptTimeSeconds,
|
||||
parkingStatus,
|
||||
performanceLimitPercent,
|
||||
priorityTimeSeconds,
|
||||
privilegedTimeSeconds,
|
||||
privilegedUtilitySeconds,
|
||||
processorFrequencyMHz,
|
||||
processorPerformance,
|
||||
processorTimeSeconds,
|
||||
processorUtilityRate,
|
||||
userTimeSeconds,
|
||||
})
|
||||
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",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.cStateSecondsTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "cstate_seconds_total"),
|
||||
"Time spent in low-power idle state",
|
||||
[]string{"core", "state"},
|
||||
nil,
|
||||
)
|
||||
c.timeTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "time_total"),
|
||||
"Time that processor spent in different modes (dpc, idle, interrupt, privileged, user)",
|
||||
[]string{"core", "mode"},
|
||||
nil,
|
||||
)
|
||||
c.interruptsTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "interrupts_total"),
|
||||
"Total number of received and serviced hardware interrupts",
|
||||
[]string{"core"},
|
||||
nil,
|
||||
)
|
||||
c.dpcsTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dpcs_total"),
|
||||
"Total number of received and serviced deferred procedure calls (DPCs)",
|
||||
[]string{"core"},
|
||||
nil,
|
||||
)
|
||||
c.clockInterruptsTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "clock_interrupts_total"),
|
||||
"Total number of received and serviced clock tick interrupts",
|
||||
[]string{"core"},
|
||||
nil,
|
||||
)
|
||||
c.idleBreakEventsTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "idle_break_events_total"),
|
||||
"Total number of time processor was woken from idle",
|
||||
[]string{"core"},
|
||||
nil,
|
||||
)
|
||||
c.parkingStatus = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "parking_status"),
|
||||
"Parking Status represents whether a processor is parked or not",
|
||||
[]string{"core"},
|
||||
nil,
|
||||
)
|
||||
c.processorFrequencyMHz = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "core_frequency_mhz"),
|
||||
"Core frequency in megahertz",
|
||||
[]string{"core"},
|
||||
nil,
|
||||
)
|
||||
c.processorPerformance = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "processor_performance_total"),
|
||||
"Processor Performance is the average performance of the processor while it is executing instructions, as a percentage of the nominal performance of the processor. On some processors, Processor Performance may exceed 100%",
|
||||
[]string{"core"},
|
||||
nil,
|
||||
)
|
||||
c.processorMPerf = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "processor_mperf_total"),
|
||||
"Processor MPerf is the number of TSC ticks incremented while executing instructions",
|
||||
[]string{"core"},
|
||||
nil,
|
||||
)
|
||||
c.processorRTC = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "processor_rtc_total"),
|
||||
"Processor RTC represents the number of RTC ticks made since the system booted. It should consistently be 64e6, and can be used to properly derive Processor Utility Rate",
|
||||
[]string{"core"},
|
||||
nil,
|
||||
)
|
||||
c.processorUtility = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "processor_utility_total"),
|
||||
"Processor Utility represents is the amount of time the core spends executing instructions",
|
||||
[]string{"core"},
|
||||
nil,
|
||||
)
|
||||
c.processorPrivilegedUtility = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "processor_privileged_utility_total"),
|
||||
"Processor Privileged Utility represents is the amount of time the core has spent executing instructions inside the kernel",
|
||||
[]string{"core"},
|
||||
nil,
|
||||
)
|
||||
|
||||
c.processorRTCValues = map[string]utils.Counter{}
|
||||
c.processorMPerfValues = map[string]utils.Counter{}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
|
||||
c.mu.Lock() // Lock is needed to prevent concurrent map access to c.processorRTCValues
|
||||
defer c.mu.Unlock()
|
||||
|
||||
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++
|
||||
|
||||
var (
|
||||
counterProcessorRTCValues utils.Counter
|
||||
counterProcessorMPerfValues utils.Counter
|
||||
ok bool
|
||||
)
|
||||
|
||||
if counterProcessorRTCValues, ok = c.processorRTCValues[core]; ok {
|
||||
counterProcessorRTCValues.AddValue(uint32(coreData[processorUtilityRate].SecondValue))
|
||||
} else {
|
||||
counterProcessorRTCValues = utils.NewCounter(uint32(coreData[privilegedUtilitySeconds].SecondValue))
|
||||
}
|
||||
|
||||
c.processorRTCValues[core] = counterProcessorRTCValues
|
||||
|
||||
if counterProcessorMPerfValues, ok = c.processorMPerfValues[core]; ok {
|
||||
counterProcessorMPerfValues.AddValue(uint32(coreData[processorPerformance].SecondValue))
|
||||
} else {
|
||||
counterProcessorMPerfValues = utils.NewCounter(uint32(coreData[processorPerformance].SecondValue))
|
||||
}
|
||||
|
||||
c.processorMPerfValues[core] = counterProcessorMPerfValues
|
||||
|
||||
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[dpcQueuedPerSecond].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,
|
||||
counterProcessorMPerfValues.Value(),
|
||||
core,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.processorRTC,
|
||||
prometheus.CounterValue,
|
||||
counterProcessorRTCValues.Value(),
|
||||
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
|
||||
}
|
||||
31
internal/collector/cpu/cpu_test.go
Normal file
31
internal/collector/cpu/cpu_test.go
Normal file
@@ -0,0 +1,31 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package cpu_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/collector/cpu"
|
||||
"github.com/prometheus-community/windows_exporter/internal/utils/testutils"
|
||||
)
|
||||
|
||||
func BenchmarkCollector(b *testing.B) {
|
||||
testutils.FuncBenchmarkCollector(b, cpu.Name, cpu.NewWithFlags)
|
||||
}
|
||||
|
||||
func TestCollector(t *testing.T) {
|
||||
testutils.TestCollector(t, cpu.New, nil)
|
||||
}
|
||||
@@ -1,32 +1,45 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package cpu_info
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/alecthomas/kingpin/v2"
|
||||
"github.com/prometheus-community/windows_exporter/pkg/types"
|
||||
"github.com/prometheus-community/windows_exporter/internal/mi"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/yusufpapurcu/wmi"
|
||||
)
|
||||
|
||||
const (
|
||||
Name = "cpu_info"
|
||||
)
|
||||
const Name = "cpu_info"
|
||||
|
||||
type Config struct{}
|
||||
|
||||
//nolint:gochecknoglobals
|
||||
var ConfigDefaults = Config{}
|
||||
|
||||
// A Collector is a Prometheus Collector for a few WMI metrics in Win32_Processor.
|
||||
type Collector struct {
|
||||
config Config
|
||||
|
||||
wmiClient *wmi.Client
|
||||
config Config
|
||||
miSession *mi.Session
|
||||
miQuery mi.Query
|
||||
|
||||
cpuInfo *prometheus.Desc
|
||||
cpuCoreCount *prometheus.Desc
|
||||
@@ -57,20 +70,23 @@ 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 {
|
||||
func (c *Collector) Close() 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")
|
||||
func (c *Collector) Build(_ *slog.Logger, miSession *mi.Session) error {
|
||||
if miSession == nil {
|
||||
return errors.New("miSession is nil")
|
||||
}
|
||||
|
||||
c.wmiClient = wmiClient
|
||||
miQuery, err := mi.NewQuery("SELECT Architecture, DeviceId, Description, Family, L2CacheSize, L3CacheSize, Name, ThreadCount, NumberOfCores, NumberOfEnabledCore, NumberOfLogicalProcessors FROM Win32_Processor")
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create WMI query: %w", err)
|
||||
}
|
||||
|
||||
c.miQuery = miQuery
|
||||
c.miSession = miSession
|
||||
|
||||
c.cpuInfo = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, "", Name),
|
||||
"Labelled CPU information as provided by Win32_Processor",
|
||||
@@ -132,49 +148,36 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
|
||||
nil,
|
||||
)
|
||||
|
||||
var dst []miProcessor
|
||||
if err := c.miSession.Query(&dst, mi.NamespaceRootCIMv2, c.miQuery); err != nil {
|
||||
return fmt.Errorf("WMI query failed: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type win32Processor struct {
|
||||
Architecture uint32
|
||||
DeviceID string
|
||||
Description string
|
||||
Family uint16
|
||||
L2CacheSize uint32
|
||||
L3CacheSize uint32
|
||||
Name string
|
||||
ThreadCount uint32
|
||||
NumberOfCores uint32
|
||||
NumberOfEnabledCore uint32
|
||||
NumberOfLogicalProcessors uint32
|
||||
type miProcessor struct {
|
||||
Architecture uint32 `mi:"Architecture"`
|
||||
DeviceID string `mi:"DeviceID"`
|
||||
Description string `mi:"Description"`
|
||||
Family uint16 `mi:"Family"`
|
||||
L2CacheSize uint32 `mi:"L2CacheSize"`
|
||||
L3CacheSize uint32 `mi:"L3CacheSize"`
|
||||
Name string `mi:"Name"`
|
||||
ThreadCount uint32 `mi:"ThreadCount"`
|
||||
NumberOfCores uint32 `mi:"NumberOfCores"`
|
||||
NumberOfEnabledCore uint32 `mi:"NumberOfEnabledCore"`
|
||||
NumberOfLogicalProcessors uint32 `mi:"NumberOfLogicalProcessors"`
|
||||
|
||||
Total int
|
||||
}
|
||||
|
||||
// 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 cpu_info metrics",
|
||||
slog.Any("err", err),
|
||||
)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) collect(ch chan<- prometheus.Metric) error {
|
||||
var dst []win32Processor
|
||||
// We use a static query here because the provided methods in wmi.go all issue a SELECT *;
|
||||
// This results in the time-consuming LoadPercentage field being read which seems to measure each CPU
|
||||
// serially over a 1 second interval, so the scrape time is at least 1s * num_sockets
|
||||
if err := c.wmiClient.Query("SELECT Architecture, DeviceId, Description, Family, L2CacheSize, L3CacheSize, Name, ThreadCount, NumberOfCores, NumberOfEnabledCore, NumberOfLogicalProcessors FROM Win32_Processor", &dst); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(dst) == 0 {
|
||||
return errors.New("WMI query returned empty result set")
|
||||
func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
|
||||
var dst []miProcessor
|
||||
if err := c.miSession.Query(&dst, mi.NamespaceRootCIMv2, c.miQuery); err != nil {
|
||||
return fmt.Errorf("WMI query failed: %w", err)
|
||||
}
|
||||
|
||||
// Some CPUs end up exposing trailing spaces for certain strings, so clean them up
|
||||
31
internal/collector/cpu_info/cpu_info_test.go
Normal file
31
internal/collector/cpu_info/cpu_info_test.go
Normal file
@@ -0,0 +1,31 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package cpu_info_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/collector/cpu_info"
|
||||
"github.com/prometheus-community/windows_exporter/internal/utils/testutils"
|
||||
)
|
||||
|
||||
func BenchmarkCollector(b *testing.B) {
|
||||
testutils.FuncBenchmarkCollector(b, cpu_info.Name, cpu_info.NewWithFlags)
|
||||
}
|
||||
|
||||
func TestCollector(t *testing.T) {
|
||||
testutils.TestCollector(t, cpu_info.New, nil)
|
||||
}
|
||||
@@ -1,3 +1,16 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package cs
|
||||
@@ -6,16 +19,17 @@ import (
|
||||
"log/slog"
|
||||
|
||||
"github.com/alecthomas/kingpin/v2"
|
||||
"github.com/prometheus-community/windows_exporter/pkg/headers/sysinfoapi"
|
||||
"github.com/prometheus-community/windows_exporter/pkg/types"
|
||||
"github.com/prometheus-community/windows_exporter/internal/headers/sysinfoapi"
|
||||
"github.com/prometheus-community/windows_exporter/internal/mi"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/yusufpapurcu/wmi"
|
||||
)
|
||||
|
||||
const Name = "cs"
|
||||
|
||||
type Config struct{}
|
||||
|
||||
//nolint:gochecknoglobals
|
||||
var ConfigDefaults = Config{}
|
||||
|
||||
// A Collector is a Prometheus Collector for WMI metrics.
|
||||
@@ -23,10 +37,10 @@ type Collector struct {
|
||||
config Config
|
||||
|
||||
// physicalMemoryBytes
|
||||
// Deprecated: Use windows_cpu_logical_processor instead
|
||||
// Deprecated: Use windows_physical_memory_total_bytes instead
|
||||
physicalMemoryBytes *prometheus.Desc
|
||||
// logicalProcessors
|
||||
// Deprecated: Use windows_physical_memory_total_bytes instead
|
||||
// Deprecated: Use windows_cpu_logical_processor instead
|
||||
logicalProcessors *prometheus.Desc
|
||||
// hostname
|
||||
// Deprecated: Use windows_os_hostname instead
|
||||
@@ -53,15 +67,11 @@ 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 {
|
||||
func (c *Collector) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
|
||||
func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
|
||||
logger.Warn("The cs collector is deprecated and will be removed in a future release. " +
|
||||
"Logical processors has been moved to cpu_info collector. " +
|
||||
"Physical memory has been moved to memory collector. " +
|
||||
@@ -95,21 +105,7 @@ func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
|
||||
|
||||
// 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 cs metrics",
|
||||
slog.Any("err", err),
|
||||
)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) collect(ch chan<- prometheus.Metric) error {
|
||||
func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
|
||||
// Get systeminfo for number of processors
|
||||
systemInfo := sysinfoapi.GetSystemInfo()
|
||||
|
||||
27
internal/collector/cs/cs_test.go
Normal file
27
internal/collector/cs/cs_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package cs_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/collector/cs"
|
||||
"github.com/prometheus-community/windows_exporter/internal/utils/testutils"
|
||||
)
|
||||
|
||||
func BenchmarkCollector(b *testing.B) {
|
||||
testutils.FuncBenchmarkCollector(b, cs.Name, cs.NewWithFlags)
|
||||
}
|
||||
57
internal/collector/dfsr/const.go
Normal file
57
internal/collector/dfsr/const.go
Normal file
@@ -0,0 +1,57 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package dfsr
|
||||
|
||||
const (
|
||||
// Connection Perflib: "DFS Replication Service Connections".
|
||||
bytesReceivedTotal = "Total Bytes Received"
|
||||
|
||||
// Folder Perflib: "DFS Replicated Folder".
|
||||
bandwidthSavingsUsingDFSReplicationTotal = "Bandwidth Savings Using DFS Replication"
|
||||
compressedSizeOfFilesReceivedTotal = "Compressed Size of Files Received"
|
||||
conflictBytesCleanedUpTotal = "Conflict Bytes Cleaned Up"
|
||||
conflictBytesGeneratedTotal = "Conflict Bytes Generated"
|
||||
conflictFilesCleanedUpTotal = "Conflict Files Cleaned Up"
|
||||
conflictFilesGeneratedTotal = "Conflict Files Generated"
|
||||
conflictFolderCleanupsCompletedTotal = "Conflict folder Cleanups Completed"
|
||||
conflictSpaceInUse = "Conflict Space In Use"
|
||||
deletedSpaceInUse = "Deleted Space In Use"
|
||||
deletedBytesCleanedUpTotal = "Deleted Bytes Cleaned Up"
|
||||
deletedBytesGeneratedTotal = "Deleted Bytes Generated"
|
||||
deletedFilesCleanedUpTotal = "Deleted Files Cleaned Up"
|
||||
deletedFilesGeneratedTotal = "Deleted Files Generated"
|
||||
fileInstallsRetriedTotal = "File Installs Retried"
|
||||
fileInstallsSucceededTotal = "File Installs Succeeded"
|
||||
filesReceivedTotal = "Total Files Received"
|
||||
rdcBytesReceivedTotal = "RDC Bytes Received"
|
||||
rdcCompressedSizeOfFilesReceivedTotal = "RDC Compressed Size of Files Received"
|
||||
rdcNumberOfFilesReceivedTotal = "RDC Number of Files Received"
|
||||
rdcSizeOfFilesReceivedTotal = "RDC Size of Files Received"
|
||||
sizeOfFilesReceivedTotal = "Size of Files Received"
|
||||
stagingSpaceInUse = "Staging Space In Use"
|
||||
stagingBytesCleanedUpTotal = "Staging Bytes Cleaned Up"
|
||||
stagingBytesGeneratedTotal = "Staging Bytes Generated"
|
||||
stagingFilesCleanedUpTotal = "Staging Files Cleaned Up"
|
||||
stagingFilesGeneratedTotal = "Staging Files Generated"
|
||||
updatesDroppedTotal = "Updates Dropped"
|
||||
|
||||
// Volume Perflib: "DFS Replication Service Volumes".
|
||||
databaseCommitsTotal = "Database Commits"
|
||||
databaseLookupsTotal = "Database Lookups"
|
||||
usnJournalRecordsReadTotal = "USN Journal Records Read"
|
||||
usnJournalRecordsAcceptedTotal = "USN Journal Records Accepted"
|
||||
usnJournalUnreadPercentage = "USN Journal Unread Percentage"
|
||||
)
|
||||
@@ -1,17 +1,32 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package dfsr
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"github.com/alecthomas/kingpin/v2"
|
||||
"github.com/prometheus-community/windows_exporter/pkg/perflib"
|
||||
"github.com/prometheus-community/windows_exporter/pkg/types"
|
||||
"github.com/prometheus-community/windows_exporter/internal/mi"
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/yusufpapurcu/wmi"
|
||||
)
|
||||
|
||||
const Name = "dfsr"
|
||||
@@ -20,6 +35,7 @@ type Config struct {
|
||||
CollectorsEnabled []string `yaml:"collectors_enabled"`
|
||||
}
|
||||
|
||||
//nolint:gochecknoglobals
|
||||
var ConfigDefaults = Config{
|
||||
CollectorsEnabled: []string{"connection", "folder", "volume"},
|
||||
}
|
||||
@@ -28,6 +44,10 @@ var ConfigDefaults = Config{
|
||||
type Collector struct {
|
||||
config Config
|
||||
|
||||
perfDataCollectorConnection *perfdata.Collector
|
||||
perfDataCollectorFolder *perfdata.Collector
|
||||
perfDataCollectorVolume *perfdata.Collector
|
||||
|
||||
// connection source
|
||||
connectionBandwidthSavingsUsingDFSReplicationTotal *prometheus.Desc
|
||||
connectionBytesReceivedTotal *prometheus.Desc
|
||||
@@ -36,17 +56,17 @@ type Collector struct {
|
||||
connectionRDCBytesReceivedTotal *prometheus.Desc
|
||||
connectionRDCCompressedSizeOfFilesReceivedTotal *prometheus.Desc
|
||||
connectionRDCSizeOfFilesReceivedTotal *prometheus.Desc
|
||||
connectionRDCNumberofFilesReceivedTotal *prometheus.Desc
|
||||
connectionRDCNumberOfFilesReceivedTotal *prometheus.Desc
|
||||
connectionSizeOfFilesReceivedTotal *prometheus.Desc
|
||||
|
||||
// folder source
|
||||
folderBandwidthSavingsUsingDFSReplicationTotal *prometheus.Desc
|
||||
folderCompressedSizeOfFilesReceivedTotal *prometheus.Desc
|
||||
folderConflictBytesCleanedupTotal *prometheus.Desc
|
||||
folderConflictBytesCleanedUpTotal *prometheus.Desc
|
||||
folderConflictBytesGeneratedTotal *prometheus.Desc
|
||||
folderConflictFilesCleanedUpTotal *prometheus.Desc
|
||||
folderConflictFilesGeneratedTotal *prometheus.Desc
|
||||
folderConflictfolderCleanupsCompletedTotal *prometheus.Desc
|
||||
folderConflictFolderCleanupsCompletedTotal *prometheus.Desc
|
||||
folderConflictSpaceInUse *prometheus.Desc
|
||||
folderDeletedSpaceInUse *prometheus.Desc
|
||||
folderDeletedBytesCleanedUpTotal *prometheus.Desc
|
||||
@@ -58,7 +78,7 @@ type Collector struct {
|
||||
folderFilesReceivedTotal *prometheus.Desc
|
||||
folderRDCBytesReceivedTotal *prometheus.Desc
|
||||
folderRDCCompressedSizeOfFilesReceivedTotal *prometheus.Desc
|
||||
folderRDCNumberofFilesReceivedTotal *prometheus.Desc
|
||||
folderRDCNumberOfFilesReceivedTotal *prometheus.Desc
|
||||
folderRDCSizeOfFilesReceivedTotal *prometheus.Desc
|
||||
folderSizeOfFilesReceivedTotal *prometheus.Desc
|
||||
folderStagingSpaceInUse *prometheus.Desc
|
||||
@@ -74,29 +94,6 @@ type Collector struct {
|
||||
volumeUSNJournalUnreadPercentage *prometheus.Desc
|
||||
volumeUSNJournalRecordsAcceptedTotal *prometheus.Desc
|
||||
volumeUSNJournalRecordsReadTotal *prometheus.Desc
|
||||
|
||||
// Map of child Collector functions used during collection
|
||||
dfsrChildCollectors []dfsrCollectorFunc
|
||||
}
|
||||
|
||||
type dfsrCollectorFunc func(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error
|
||||
|
||||
// Map Perflib sources to DFSR Collector names
|
||||
// e.g, volume -> DFS Replication Service Volumes.
|
||||
func dfsrGetPerfObjectName(collector string) string {
|
||||
prefix := "DFS "
|
||||
suffix := ""
|
||||
|
||||
switch collector {
|
||||
case "connection":
|
||||
suffix = "Replication Connections"
|
||||
case "folder":
|
||||
suffix = "Replicated Folders"
|
||||
case "volume":
|
||||
suffix = "Replication Service Volumes"
|
||||
}
|
||||
|
||||
return prefix + suffix
|
||||
}
|
||||
|
||||
func New(config *Config) *Collector {
|
||||
@@ -119,10 +116,11 @@ func NewWithFlags(app *kingpin.Application) *Collector {
|
||||
c := &Collector{
|
||||
config: ConfigDefaults,
|
||||
}
|
||||
c.config.CollectorsEnabled = make([]string, 0)
|
||||
|
||||
var collectorsEnabled string
|
||||
|
||||
app.Flag("collectors.dfsr.sources-enabled", "Comma-separated list of DFSR Perflib sources to use.").
|
||||
app.Flag("collector.dfsr.sources-enabled", "Comma-separated list of DFSR Perflib sources to use.").
|
||||
Default(strings.Join(ConfigDefaults.CollectorsEnabled, ",")).StringVar(&collectorsEnabled)
|
||||
|
||||
app.Action(func(*kingpin.ParseContext) error {
|
||||
@@ -138,27 +136,93 @@ func (c *Collector) GetName() string {
|
||||
return Name
|
||||
}
|
||||
|
||||
func (c *Collector) GetPerfCounter(_ *slog.Logger) ([]string, error) {
|
||||
// Perflib sources are dynamic, depending on the enabled child collectors
|
||||
expandedChildCollectors := slices.Compact(c.config.CollectorsEnabled)
|
||||
perflibDependencies := make([]string, 0, len(expandedChildCollectors))
|
||||
|
||||
for _, source := range expandedChildCollectors {
|
||||
perflibDependencies = append(perflibDependencies, dfsrGetPerfObjectName(source))
|
||||
func (c *Collector) Close() error {
|
||||
if slices.Contains(c.config.CollectorsEnabled, "connection") {
|
||||
c.perfDataCollectorConnection.Close()
|
||||
}
|
||||
|
||||
return perflibDependencies, nil
|
||||
}
|
||||
if slices.Contains(c.config.CollectorsEnabled, "folder") {
|
||||
c.perfDataCollectorFolder.Close()
|
||||
}
|
||||
|
||||
if slices.Contains(c.config.CollectorsEnabled, "volume") {
|
||||
c.perfDataCollectorVolume.Close()
|
||||
}
|
||||
|
||||
func (c *Collector) Close(_ *slog.Logger) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
|
||||
func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
|
||||
logger = logger.With(slog.String("collector", Name))
|
||||
|
||||
logger.Info("dfsr collector is in an experimental state! Metrics for this collector have not been tested.")
|
||||
|
||||
var err error
|
||||
|
||||
if slices.Contains(c.config.CollectorsEnabled, "connection") {
|
||||
c.perfDataCollectorConnection, err = perfdata.NewCollector("DFS Replication Connections", perfdata.InstancesAll, []string{
|
||||
bandwidthSavingsUsingDFSReplicationTotal,
|
||||
bytesReceivedTotal,
|
||||
compressedSizeOfFilesReceivedTotal,
|
||||
filesReceivedTotal,
|
||||
rdcBytesReceivedTotal,
|
||||
rdcCompressedSizeOfFilesReceivedTotal,
|
||||
rdcNumberOfFilesReceivedTotal,
|
||||
rdcSizeOfFilesReceivedTotal,
|
||||
sizeOfFilesReceivedTotal,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create DFS Replication Connections collector: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
if slices.Contains(c.config.CollectorsEnabled, "folder") {
|
||||
c.perfDataCollectorFolder, err = perfdata.NewCollector("DFS Replicated Folders", perfdata.InstancesAll, []string{
|
||||
bandwidthSavingsUsingDFSReplicationTotal,
|
||||
compressedSizeOfFilesReceivedTotal,
|
||||
conflictBytesCleanedUpTotal,
|
||||
conflictBytesGeneratedTotal,
|
||||
conflictFilesCleanedUpTotal,
|
||||
conflictFilesGeneratedTotal,
|
||||
conflictFolderCleanupsCompletedTotal,
|
||||
conflictSpaceInUse,
|
||||
deletedSpaceInUse,
|
||||
deletedBytesCleanedUpTotal,
|
||||
deletedBytesGeneratedTotal,
|
||||
deletedFilesCleanedUpTotal,
|
||||
deletedFilesGeneratedTotal,
|
||||
fileInstallsRetriedTotal,
|
||||
fileInstallsSucceededTotal,
|
||||
filesReceivedTotal,
|
||||
rdcBytesReceivedTotal,
|
||||
rdcCompressedSizeOfFilesReceivedTotal,
|
||||
rdcNumberOfFilesReceivedTotal,
|
||||
rdcSizeOfFilesReceivedTotal,
|
||||
sizeOfFilesReceivedTotal,
|
||||
stagingSpaceInUse,
|
||||
stagingBytesCleanedUpTotal,
|
||||
stagingBytesGeneratedTotal,
|
||||
stagingFilesCleanedUpTotal,
|
||||
stagingFilesGeneratedTotal,
|
||||
updatesDroppedTotal,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create DFS Replicated Folders collector: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
if slices.Contains(c.config.CollectorsEnabled, "volume") {
|
||||
c.perfDataCollectorVolume, err = perfdata.NewCollector("DFS Replication Service Volumes", perfdata.InstancesAll, []string{
|
||||
databaseCommitsTotal,
|
||||
databaseLookupsTotal,
|
||||
usnJournalRecordsReadTotal,
|
||||
usnJournalRecordsAcceptedTotal,
|
||||
usnJournalUnreadPercentage,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create DFS Replication Service Volumes collector: %w", err)
|
||||
}
|
||||
}
|
||||
// connection
|
||||
c.connectionBandwidthSavingsUsingDFSReplicationTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "connection_bandwidth_savings_using_dfs_replication_bytes_total"),
|
||||
@@ -202,7 +266,7 @@ func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
|
||||
nil,
|
||||
)
|
||||
|
||||
c.connectionRDCNumberofFilesReceivedTotal = prometheus.NewDesc(
|
||||
c.connectionRDCNumberOfFilesReceivedTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "connection_rdc_received_files_total"),
|
||||
"Total number of files received using remote differential compression",
|
||||
[]string{"name"},
|
||||
@@ -238,7 +302,7 @@ func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
|
||||
nil,
|
||||
)
|
||||
|
||||
c.folderConflictBytesCleanedupTotal = prometheus.NewDesc(
|
||||
c.folderConflictBytesCleanedUpTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "folder_conflict_cleaned_up_bytes_total"),
|
||||
"Total size of conflict loser files and folders deleted from the Conflict and Deleted folder, in bytes",
|
||||
[]string{"name"},
|
||||
@@ -266,7 +330,7 @@ func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
|
||||
nil,
|
||||
)
|
||||
|
||||
c.folderConflictfolderCleanupsCompletedTotal = prometheus.NewDesc(
|
||||
c.folderConflictFolderCleanupsCompletedTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "folder_conflict_folder_cleanups_total"),
|
||||
"Number of deletions of conflict loser files and folders in the Conflict and Deleted",
|
||||
[]string{"name"},
|
||||
@@ -350,7 +414,7 @@ func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
|
||||
nil,
|
||||
)
|
||||
|
||||
c.folderRDCNumberofFilesReceivedTotal = prometheus.NewDesc(
|
||||
c.folderRDCNumberOfFilesReceivedTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "folder_rdc_received_files_total"),
|
||||
"Total number of files received with Remote Differential Compression",
|
||||
[]string{"name"},
|
||||
@@ -449,428 +513,355 @@ func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
|
||||
nil,
|
||||
)
|
||||
|
||||
// Perflib sources are dynamic, depending on the enabled child collectors
|
||||
expandedChildCollectors := slices.Compact(c.config.CollectorsEnabled)
|
||||
c.dfsrChildCollectors = c.getDFSRChildCollectors(expandedChildCollectors)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Maps enabled child collectors names to their relevant collection function,
|
||||
// for use in Collector.Collect().
|
||||
func (c *Collector) getDFSRChildCollectors(enabledCollectors []string) []dfsrCollectorFunc {
|
||||
var dfsrCollectors []dfsrCollectorFunc
|
||||
|
||||
for _, collector := range enabledCollectors {
|
||||
switch collector {
|
||||
case "connection":
|
||||
dfsrCollectors = append(dfsrCollectors, c.collectConnection)
|
||||
case "folder":
|
||||
dfsrCollectors = append(dfsrCollectors, c.collectFolder)
|
||||
case "volume":
|
||||
dfsrCollectors = append(dfsrCollectors, c.collectVolume)
|
||||
}
|
||||
}
|
||||
|
||||
return dfsrCollectors
|
||||
}
|
||||
|
||||
// Collect implements the Collector interface.
|
||||
// Sends metric values for each metric to the provided prometheus Metric channel.
|
||||
func (c *Collector) Collect(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
|
||||
logger = logger.With(slog.String("collector", Name))
|
||||
for _, fn := range c.dfsrChildCollectors {
|
||||
err := fn(ctx, logger, ch)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
|
||||
errs := make([]error, 0, 3)
|
||||
|
||||
if slices.Contains(c.config.CollectorsEnabled, "connection") {
|
||||
errs = append(errs, c.collectPDHConnection(ch))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// PerflibDFSRConnection Perflib: "DFS Replication Service Connections".
|
||||
type PerflibDFSRConnection struct {
|
||||
Name string
|
||||
|
||||
BandwidthSavingsUsingDFSReplicationTotal float64 `perflib:"Bandwidth Savings Using DFS Replication"`
|
||||
BytesReceivedTotal float64 `perflib:"Total Bytes Received"`
|
||||
CompressedSizeOfFilesReceivedTotal float64 `perflib:"Compressed Size of Files Received"`
|
||||
FilesReceivedTotal float64 `perflib:"Total Files Received"`
|
||||
RDCBytesReceivedTotal float64 `perflib:"RDC Bytes Received"`
|
||||
RDCCompressedSizeOfFilesReceivedTotal float64 `perflib:"RDC Compressed Size of Files Received"`
|
||||
RDCNumberofFilesReceivedTotal float64 `perflib:"RDC Number of Files Received"`
|
||||
RDCSizeOfFilesReceivedTotal float64 `perflib:"RDC Size of Files Received"`
|
||||
SizeOfFilesReceivedTotal float64 `perflib:"Size of Files Received"`
|
||||
}
|
||||
|
||||
func (c *Collector) collectConnection(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
|
||||
logger = logger.With(slog.String("collector", Name))
|
||||
|
||||
var dst []PerflibDFSRConnection
|
||||
|
||||
if err := perflib.UnmarshalObject(ctx.PerfObjects["DFS Replication Connections"], &dst, logger); err != nil {
|
||||
return err
|
||||
if slices.Contains(c.config.CollectorsEnabled, "folder") {
|
||||
errs = append(errs, c.collectPDHFolder(ch))
|
||||
}
|
||||
|
||||
for _, connection := range dst {
|
||||
if slices.Contains(c.config.CollectorsEnabled, "volume") {
|
||||
errs = append(errs, c.collectPDHVolume(ch))
|
||||
}
|
||||
|
||||
return errors.Join(errs...)
|
||||
}
|
||||
|
||||
func (c *Collector) collectPDHConnection(ch chan<- prometheus.Metric) error {
|
||||
perfData, err := c.perfDataCollectorConnection.Collect()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect DFS Replication Connections metrics: %w", err)
|
||||
}
|
||||
|
||||
if len(perfData) == 0 {
|
||||
return fmt.Errorf("failed to collect DFS Replication Connections metrics: %w", types.ErrNoData)
|
||||
}
|
||||
|
||||
for name, connection := range perfData {
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.connectionBandwidthSavingsUsingDFSReplicationTotal,
|
||||
prometheus.CounterValue,
|
||||
connection.BandwidthSavingsUsingDFSReplicationTotal,
|
||||
connection.Name,
|
||||
connection[bandwidthSavingsUsingDFSReplicationTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.connectionBytesReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
connection.BytesReceivedTotal,
|
||||
connection.Name,
|
||||
connection[bytesReceivedTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.connectionCompressedSizeOfFilesReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
connection.CompressedSizeOfFilesReceivedTotal,
|
||||
connection.Name,
|
||||
connection[compressedSizeOfFilesReceivedTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.connectionFilesReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
connection.FilesReceivedTotal,
|
||||
connection.Name,
|
||||
connection[filesReceivedTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.connectionRDCBytesReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
connection.RDCBytesReceivedTotal,
|
||||
connection.Name,
|
||||
connection[rdcBytesReceivedTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.connectionRDCCompressedSizeOfFilesReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
connection.RDCCompressedSizeOfFilesReceivedTotal,
|
||||
connection.Name,
|
||||
connection[rdcCompressedSizeOfFilesReceivedTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.connectionRDCSizeOfFilesReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
connection.RDCSizeOfFilesReceivedTotal,
|
||||
connection.Name,
|
||||
connection[rdcSizeOfFilesReceivedTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.connectionRDCNumberofFilesReceivedTotal,
|
||||
c.connectionRDCNumberOfFilesReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
connection.RDCNumberofFilesReceivedTotal,
|
||||
connection.Name,
|
||||
connection[rdcNumberOfFilesReceivedTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.connectionSizeOfFilesReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
connection.SizeOfFilesReceivedTotal,
|
||||
connection.Name,
|
||||
connection[sizeOfFilesReceivedTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// perflibDFSRFolder Perflib: "DFS Replicated Folder".
|
||||
type perflibDFSRFolder struct {
|
||||
Name string
|
||||
|
||||
BandwidthSavingsUsingDFSReplicationTotal float64 `perflib:"Bandwidth Savings Using DFS Replication"`
|
||||
CompressedSizeOfFilesReceivedTotal float64 `perflib:"Compressed Size of Files Received"`
|
||||
ConflictBytesCleanedupTotal float64 `perflib:"Conflict Bytes Cleaned Up"`
|
||||
ConflictBytesGeneratedTotal float64 `perflib:"Conflict Bytes Generated"`
|
||||
ConflictFilesCleanedUpTotal float64 `perflib:"Conflict Files Cleaned Up"`
|
||||
ConflictFilesGeneratedTotal float64 `perflib:"Conflict Files Generated"`
|
||||
ConflictFolderCleanupsCompletedTotal float64 `perflib:"Conflict folder Cleanups Completed"`
|
||||
ConflictSpaceInUse float64 `perflib:"Conflict Space In Use"`
|
||||
DeletedSpaceInUse float64 `perflib:"Deleted Space In Use"`
|
||||
DeletedBytesCleanedUpTotal float64 `perflib:"Deleted Bytes Cleaned Up"`
|
||||
DeletedBytesGeneratedTotal float64 `perflib:"Deleted Bytes Generated"`
|
||||
DeletedFilesCleanedUpTotal float64 `perflib:"Deleted Files Cleaned Up"`
|
||||
DeletedFilesGeneratedTotal float64 `perflib:"Deleted Files Generated"`
|
||||
FileInstallsRetriedTotal float64 `perflib:"File Installs Retried"`
|
||||
FileInstallsSucceededTotal float64 `perflib:"File Installs Succeeded"`
|
||||
FilesReceivedTotal float64 `perflib:"Total Files Received"`
|
||||
RDCBytesReceivedTotal float64 `perflib:"RDC Bytes Received"`
|
||||
RDCCompressedSizeOfFilesReceivedTotal float64 `perflib:"RDC Compressed Size of Files Received"`
|
||||
RDCNumberofFilesReceivedTotal float64 `perflib:"RDC Number of Files Received"`
|
||||
RDCSizeOfFilesReceivedTotal float64 `perflib:"RDC Size of Files Received"`
|
||||
SizeOfFilesReceivedTotal float64 `perflib:"Size of Files Received"`
|
||||
StagingSpaceInUse float64 `perflib:"Staging Space In Use"`
|
||||
StagingBytesCleanedUpTotal float64 `perflib:"Staging Bytes Cleaned Up"`
|
||||
StagingBytesGeneratedTotal float64 `perflib:"Staging Bytes Generated"`
|
||||
StagingFilesCleanedUpTotal float64 `perflib:"Staging Files Cleaned Up"`
|
||||
StagingFilesGeneratedTotal float64 `perflib:"Staging Files Generated"`
|
||||
UpdatesDroppedTotal float64 `perflib:"Updates Dropped"`
|
||||
}
|
||||
|
||||
func (c *Collector) collectFolder(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
|
||||
logger = logger.With(slog.String("collector", Name))
|
||||
|
||||
var dst []perflibDFSRFolder
|
||||
|
||||
if err := perflib.UnmarshalObject(ctx.PerfObjects["DFS Replicated Folders"], &dst, logger); err != nil {
|
||||
return err
|
||||
func (c *Collector) collectPDHFolder(ch chan<- prometheus.Metric) error {
|
||||
perfData, err := c.perfDataCollectorFolder.Collect()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect DFS Replicated Folders metrics: %w", err)
|
||||
}
|
||||
|
||||
for _, folder := range dst {
|
||||
if len(perfData) == 0 {
|
||||
return fmt.Errorf("failed to collect DFS Replicated Folders metrics: %w", types.ErrNoData)
|
||||
}
|
||||
|
||||
for name, folder := range perfData {
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderBandwidthSavingsUsingDFSReplicationTotal,
|
||||
prometheus.CounterValue,
|
||||
folder.BandwidthSavingsUsingDFSReplicationTotal,
|
||||
folder.Name,
|
||||
folder[bandwidthSavingsUsingDFSReplicationTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderCompressedSizeOfFilesReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder.CompressedSizeOfFilesReceivedTotal,
|
||||
folder.Name,
|
||||
folder[compressedSizeOfFilesReceivedTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderConflictBytesCleanedupTotal,
|
||||
c.folderConflictBytesCleanedUpTotal,
|
||||
prometheus.CounterValue,
|
||||
folder.ConflictBytesCleanedupTotal,
|
||||
folder.Name,
|
||||
folder[conflictBytesCleanedUpTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderConflictBytesGeneratedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder.ConflictBytesGeneratedTotal,
|
||||
folder.Name,
|
||||
folder[conflictBytesGeneratedTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderConflictFilesCleanedUpTotal,
|
||||
prometheus.CounterValue,
|
||||
folder.ConflictFilesCleanedUpTotal,
|
||||
folder.Name,
|
||||
folder[conflictFilesCleanedUpTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderConflictFilesGeneratedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder.ConflictFilesGeneratedTotal,
|
||||
folder.Name,
|
||||
folder[conflictFilesGeneratedTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderConflictfolderCleanupsCompletedTotal,
|
||||
c.folderConflictFolderCleanupsCompletedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder.ConflictFolderCleanupsCompletedTotal,
|
||||
folder.Name,
|
||||
folder[conflictFolderCleanupsCompletedTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderConflictSpaceInUse,
|
||||
prometheus.GaugeValue,
|
||||
folder.ConflictSpaceInUse,
|
||||
folder.Name,
|
||||
folder[conflictSpaceInUse].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderDeletedSpaceInUse,
|
||||
prometheus.GaugeValue,
|
||||
folder.DeletedSpaceInUse,
|
||||
folder.Name,
|
||||
folder[deletedSpaceInUse].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderDeletedBytesCleanedUpTotal,
|
||||
prometheus.CounterValue,
|
||||
folder.DeletedBytesCleanedUpTotal,
|
||||
folder.Name,
|
||||
folder[deletedBytesCleanedUpTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderDeletedBytesGeneratedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder.DeletedBytesGeneratedTotal,
|
||||
folder.Name,
|
||||
folder[deletedBytesGeneratedTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderDeletedFilesCleanedUpTotal,
|
||||
prometheus.CounterValue,
|
||||
folder.DeletedFilesCleanedUpTotal,
|
||||
folder.Name,
|
||||
folder[deletedFilesCleanedUpTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderDeletedFilesGeneratedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder.DeletedFilesGeneratedTotal,
|
||||
folder.Name,
|
||||
folder[deletedFilesGeneratedTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderFileInstallsRetriedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder.FileInstallsRetriedTotal,
|
||||
folder.Name,
|
||||
folder[fileInstallsRetriedTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderFileInstallsSucceededTotal,
|
||||
prometheus.CounterValue,
|
||||
folder.FileInstallsSucceededTotal,
|
||||
folder.Name,
|
||||
folder[fileInstallsSucceededTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderFilesReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder.FilesReceivedTotal,
|
||||
folder.Name,
|
||||
folder[filesReceivedTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderRDCBytesReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder.RDCBytesReceivedTotal,
|
||||
folder.Name,
|
||||
folder[rdcBytesReceivedTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderRDCCompressedSizeOfFilesReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder.RDCCompressedSizeOfFilesReceivedTotal,
|
||||
folder.Name,
|
||||
folder[rdcCompressedSizeOfFilesReceivedTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderRDCNumberofFilesReceivedTotal,
|
||||
c.folderRDCNumberOfFilesReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder.RDCNumberofFilesReceivedTotal,
|
||||
folder.Name,
|
||||
folder[rdcNumberOfFilesReceivedTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderRDCSizeOfFilesReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder.RDCSizeOfFilesReceivedTotal,
|
||||
folder.Name,
|
||||
folder[rdcSizeOfFilesReceivedTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderSizeOfFilesReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder.SizeOfFilesReceivedTotal,
|
||||
folder.Name,
|
||||
folder[sizeOfFilesReceivedTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderStagingSpaceInUse,
|
||||
prometheus.GaugeValue,
|
||||
folder.StagingSpaceInUse,
|
||||
folder.Name,
|
||||
folder[stagingSpaceInUse].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderStagingBytesCleanedUpTotal,
|
||||
prometheus.CounterValue,
|
||||
folder.StagingBytesCleanedUpTotal,
|
||||
folder.Name,
|
||||
folder[stagingBytesCleanedUpTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderStagingBytesGeneratedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder.StagingBytesGeneratedTotal,
|
||||
folder.Name,
|
||||
folder[stagingBytesGeneratedTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderStagingFilesCleanedUpTotal,
|
||||
prometheus.CounterValue,
|
||||
folder.StagingFilesCleanedUpTotal,
|
||||
folder.Name,
|
||||
folder[stagingFilesCleanedUpTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderStagingFilesGeneratedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder.StagingFilesGeneratedTotal,
|
||||
folder.Name,
|
||||
folder[stagingFilesGeneratedTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.folderUpdatesDroppedTotal,
|
||||
prometheus.CounterValue,
|
||||
folder.UpdatesDroppedTotal,
|
||||
folder.Name,
|
||||
folder[updatesDroppedTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// perflibDFSRVolume Perflib: "DFS Replication Service Volumes".
|
||||
type perflibDFSRVolume struct {
|
||||
Name string
|
||||
|
||||
DatabaseCommitsTotal float64 `perflib:"Database Commits"`
|
||||
DatabaseLookupsTotal float64 `perflib:"Database Lookups"`
|
||||
USNJournalRecordsReadTotal float64 `perflib:"USN Journal Records Read"`
|
||||
USNJournalRecordsAcceptedTotal float64 `perflib:"USN Journal Records Accepted"`
|
||||
USNJournalUnreadPercentage float64 `perflib:"USN Journal Records Unread Percentage"`
|
||||
}
|
||||
|
||||
func (c *Collector) collectVolume(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
|
||||
logger = logger.With(slog.String("collector", Name))
|
||||
|
||||
var dst []perflibDFSRVolume
|
||||
|
||||
if err := perflib.UnmarshalObject(ctx.PerfObjects["DFS Replication Service Volumes"], &dst, logger); err != nil {
|
||||
return err
|
||||
func (c *Collector) collectPDHVolume(ch chan<- prometheus.Metric) error {
|
||||
perfData, err := c.perfDataCollectorVolume.Collect()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect DFS Replication Volumes metrics: %w", err)
|
||||
}
|
||||
|
||||
for _, volume := range dst {
|
||||
if len(perfData) == 0 {
|
||||
return fmt.Errorf("failed to collect DFS Replication Volumes metrics: %w", types.ErrNoData)
|
||||
}
|
||||
|
||||
for name, volume := range perfData {
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.volumeDatabaseLookupsTotal,
|
||||
prometheus.CounterValue,
|
||||
volume.DatabaseLookupsTotal,
|
||||
volume.Name,
|
||||
volume[databaseLookupsTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.volumeDatabaseCommitsTotal,
|
||||
prometheus.CounterValue,
|
||||
volume.DatabaseCommitsTotal,
|
||||
volume.Name,
|
||||
volume[databaseCommitsTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.volumeUSNJournalRecordsAcceptedTotal,
|
||||
prometheus.CounterValue,
|
||||
volume.USNJournalRecordsAcceptedTotal,
|
||||
volume.Name,
|
||||
volume[usnJournalRecordsAcceptedTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.volumeUSNJournalRecordsReadTotal,
|
||||
prometheus.CounterValue,
|
||||
volume.USNJournalRecordsReadTotal,
|
||||
volume.Name,
|
||||
volume[usnJournalRecordsReadTotal].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.volumeUSNJournalUnreadPercentage,
|
||||
prometheus.GaugeValue,
|
||||
volume.USNJournalUnreadPercentage,
|
||||
volume.Name,
|
||||
volume[usnJournalUnreadPercentage].FirstValue,
|
||||
name,
|
||||
)
|
||||
}
|
||||
|
||||
27
internal/collector/dfsr/dfsr_test.go
Normal file
27
internal/collector/dfsr/dfsr_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package dfsr_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/collector/dfsr"
|
||||
"github.com/prometheus-community/windows_exporter/internal/utils/testutils"
|
||||
)
|
||||
|
||||
func BenchmarkCollector(b *testing.B) {
|
||||
testutils.FuncBenchmarkCollector(b, dfsr.Name, dfsr.NewWithFlags)
|
||||
}
|
||||
44
internal/collector/dhcp/const.go
Normal file
44
internal/collector/dhcp/const.go
Normal file
@@ -0,0 +1,44 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package dhcp
|
||||
|
||||
const (
|
||||
acksTotal = "Acks/sec"
|
||||
activeQueueLength = "Active Queue Length"
|
||||
conflictCheckQueueLength = "Conflict Check Queue Length"
|
||||
declinesTotal = "Declines/sec"
|
||||
deniedDueToMatch = "Denied due to match."
|
||||
deniedDueToNonMatch = "Denied due to match."
|
||||
discoversTotal = "Discovers/sec"
|
||||
duplicatesDroppedTotal = "Duplicates Dropped/sec"
|
||||
failoverBndAckReceivedTotal = "Failover: BndAck received/sec."
|
||||
failoverBndAckSentTotal = "Failover: BndAck sent/sec."
|
||||
failoverBndUpdDropped = "Failover: BndUpd Dropped."
|
||||
failoverBndUpdPendingOutboundQueue = "Failover: BndUpd pending in outbound queue."
|
||||
failoverBndUpdReceivedTotal = "Failover: BndUpd received/sec."
|
||||
failoverBndUpdSentTotal = "Failover: BndUpd sent/sec."
|
||||
failoverTransitionsCommunicationInterruptedState = "Failover: Transitions to COMMUNICATION-INTERRUPTED state."
|
||||
failoverTransitionsPartnerDownState = "Failover: Transitions to PARTNER-DOWN state."
|
||||
failoverTransitionsRecoverState = "Failover: Transitions to RECOVER state."
|
||||
informsTotal = "Informs/sec"
|
||||
nacksTotal = "Nacks/sec"
|
||||
offerQueueLength = "Offer Queue Length"
|
||||
offersTotal = "Offers/sec"
|
||||
packetsExpiredTotal = "Packets Expired/sec"
|
||||
packetsReceivedTotal = "Packets Received/sec"
|
||||
releasesTotal = "Releases/sec"
|
||||
requestsTotal = "Requests/sec"
|
||||
)
|
||||
@@ -1,27 +1,44 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package dhcp
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log/slog"
|
||||
|
||||
"github.com/alecthomas/kingpin/v2"
|
||||
"github.com/prometheus-community/windows_exporter/pkg/perflib"
|
||||
"github.com/prometheus-community/windows_exporter/pkg/types"
|
||||
"github.com/prometheus-community/windows_exporter/internal/mi"
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/yusufpapurcu/wmi"
|
||||
)
|
||||
|
||||
const Name = "dhcp"
|
||||
|
||||
type Config struct{}
|
||||
|
||||
//nolint:gochecknoglobals
|
||||
var ConfigDefaults = Config{}
|
||||
|
||||
// A Collector is a Prometheus Collector perflib DHCP metrics.
|
||||
type Collector struct {
|
||||
config Config
|
||||
|
||||
perfDataCollector *perfdata.Collector
|
||||
|
||||
acksTotal *prometheus.Desc
|
||||
activeQueueLength *prometheus.Desc
|
||||
conflictCheckQueueLength *prometheus.Desc
|
||||
@@ -30,12 +47,12 @@ type Collector struct {
|
||||
deniedDueToNonMatch *prometheus.Desc
|
||||
discoversTotal *prometheus.Desc
|
||||
duplicatesDroppedTotal *prometheus.Desc
|
||||
failoverBndackReceivedTotal *prometheus.Desc
|
||||
failoverBndackSentTotal *prometheus.Desc
|
||||
failoverBndupdDropped *prometheus.Desc
|
||||
failoverBndupdPendingOutboundQueue *prometheus.Desc
|
||||
failoverBndupdReceivedTotal *prometheus.Desc
|
||||
failoverBndupdSentTotal *prometheus.Desc
|
||||
failoverBndAckReceivedTotal *prometheus.Desc
|
||||
failoverBndAckSentTotal *prometheus.Desc
|
||||
failoverBndUpdDropped *prometheus.Desc
|
||||
failoverBndUpdPendingOutboundQueue *prometheus.Desc
|
||||
failoverBndUpdReceivedTotal *prometheus.Desc
|
||||
failoverBndUpdSentTotal *prometheus.Desc
|
||||
failoverTransitionsCommunicationInterruptedState *prometheus.Desc
|
||||
failoverTransitionsPartnerDownState *prometheus.Desc
|
||||
failoverTransitionsRecoverState *prometheus.Desc
|
||||
@@ -69,15 +86,46 @@ func (c *Collector) GetName() string {
|
||||
return Name
|
||||
}
|
||||
|
||||
func (c *Collector) GetPerfCounter(_ *slog.Logger) ([]string, error) {
|
||||
return []string{"DHCP Server"}, nil
|
||||
}
|
||||
func (c *Collector) Close() error {
|
||||
c.perfDataCollector.Close()
|
||||
|
||||
func (c *Collector) Close(_ *slog.Logger) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
|
||||
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
|
||||
var err error
|
||||
|
||||
c.perfDataCollector, err = perfdata.NewCollector("DHCP Server", nil, []string{
|
||||
acksTotal,
|
||||
activeQueueLength,
|
||||
conflictCheckQueueLength,
|
||||
declinesTotal,
|
||||
deniedDueToMatch,
|
||||
deniedDueToNonMatch,
|
||||
discoversTotal,
|
||||
duplicatesDroppedTotal,
|
||||
failoverBndAckReceivedTotal,
|
||||
failoverBndAckSentTotal,
|
||||
failoverBndUpdDropped,
|
||||
failoverBndUpdPendingOutboundQueue,
|
||||
failoverBndUpdReceivedTotal,
|
||||
failoverBndUpdSentTotal,
|
||||
failoverTransitionsCommunicationInterruptedState,
|
||||
failoverTransitionsPartnerDownState,
|
||||
failoverTransitionsRecoverState,
|
||||
informsTotal,
|
||||
nacksTotal,
|
||||
offerQueueLength,
|
||||
offersTotal,
|
||||
packetsExpiredTotal,
|
||||
packetsReceivedTotal,
|
||||
releasesTotal,
|
||||
requestsTotal,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create DHCP Server collector: %w", err)
|
||||
}
|
||||
|
||||
c.packetsReceivedTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "packets_received_total"),
|
||||
"Total number of packets received by the DHCP server (PacketsReceivedTotal)",
|
||||
@@ -174,31 +222,31 @@ func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.failoverBndupdSentTotal = prometheus.NewDesc(
|
||||
c.failoverBndUpdSentTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "failover_bndupd_sent_total"),
|
||||
"Number of DHCP fail over Binding Update messages sent (FailoverBndupdSentTotal)",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.failoverBndupdReceivedTotal = prometheus.NewDesc(
|
||||
c.failoverBndUpdReceivedTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "failover_bndupd_received_total"),
|
||||
"Number of DHCP fail over Binding Update messages received (FailoverBndupdReceivedTotal)",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.failoverBndackSentTotal = prometheus.NewDesc(
|
||||
c.failoverBndAckSentTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "failover_bndack_sent_total"),
|
||||
"Number of DHCP fail over Binding Ack messages sent (FailoverBndackSentTotal)",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.failoverBndackReceivedTotal = prometheus.NewDesc(
|
||||
c.failoverBndAckReceivedTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "failover_bndack_received_total"),
|
||||
"Number of DHCP fail over Binding Ack messages received (FailoverBndackReceivedTotal)",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.failoverBndupdPendingOutboundQueue = prometheus.NewDesc(
|
||||
c.failoverBndUpdPendingOutboundQueue = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "failover_bndupd_pending_in_outbound_queue"),
|
||||
"Number of pending outbound DHCP fail over Binding Update messages (FailoverBndupdPendingOutboundQueue)",
|
||||
nil,
|
||||
@@ -222,7 +270,7 @@ func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.failoverBndupdDropped = prometheus.NewDesc(
|
||||
c.failoverBndUpdDropped = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "failover_bndupd_dropped_total"),
|
||||
"Total number of DHCP fail over Binding Updates dropped (FailoverBndupdDropped)",
|
||||
nil,
|
||||
@@ -232,194 +280,165 @@ func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// represents perflib metrics from the DHCP Server class.
|
||||
// While the name of a number of perflib metrics would indicate a rate is being returned (E.G. Packets Received/sec),
|
||||
// perflib instead returns a counter, hence the "Total" suffix in some of the variable names.
|
||||
type dhcpPerf struct {
|
||||
PacketsReceivedTotal float64 `perflib:"Packets Received/sec"`
|
||||
DuplicatesDroppedTotal float64 `perflib:"Duplicates Dropped/sec"`
|
||||
PacketsExpiredTotal float64 `perflib:"Packets Expired/sec"`
|
||||
ActiveQueueLength float64 `perflib:"Active Queue Length"`
|
||||
ConflictCheckQueueLength float64 `perflib:"Conflict Check Queue Length"`
|
||||
DiscoversTotal float64 `perflib:"Discovers/sec"`
|
||||
OffersTotal float64 `perflib:"Offers/sec"`
|
||||
RequestsTotal float64 `perflib:"Requests/sec"`
|
||||
InformsTotal float64 `perflib:"Informs/sec"`
|
||||
AcksTotal float64 `perflib:"Acks/sec"`
|
||||
NacksTotal float64 `perflib:"Nacks/sec"`
|
||||
DeclinesTotal float64 `perflib:"Declines/sec"`
|
||||
ReleasesTotal float64 `perflib:"Releases/sec"`
|
||||
DeniedDueToMatch float64 `perflib:"Denied due to match."`
|
||||
DeniedDueToNonMatch float64 `perflib:"Denied due to match."`
|
||||
OfferQueueLength float64 `perflib:"Offer Queue Length"`
|
||||
FailoverBndupdSentTotal float64 `perflib:"Failover: BndUpd sent/sec."`
|
||||
FailoverBndupdReceivedTotal float64 `perflib:"Failover: BndUpd received/sec."`
|
||||
FailoverBndackSentTotal float64 `perflib:"Failover: BndAck sent/sec."`
|
||||
FailoverBndackReceivedTotal float64 `perflib:"Failover: BndAck received/sec."`
|
||||
FailoverBndupdPendingOutboundQueue float64 `perflib:"Failover: BndUpd pending in outbound queue."`
|
||||
FailoverTransitionsCommunicationinterruptedState float64 `perflib:"Failover: Transitions to COMMUNICATION-INTERRUPTED state."`
|
||||
FailoverTransitionsPartnerdownState float64 `perflib:"Failover: Transitions to PARTNER-DOWN state."`
|
||||
FailoverTransitionsRecoverState float64 `perflib:"Failover: Transitions to RECOVER state."`
|
||||
FailoverBndupdDropped float64 `perflib:"Failover: BndUpd Dropped."`
|
||||
}
|
||||
func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
|
||||
perfData, err := c.perfDataCollector.Collect()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect DHCP Server metrics: %w", err)
|
||||
}
|
||||
|
||||
func (c *Collector) Collect(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
|
||||
logger = logger.With(slog.String("collector", Name))
|
||||
|
||||
var dhcpPerfs []dhcpPerf
|
||||
|
||||
if err := perflib.UnmarshalObject(ctx.PerfObjects["DHCP Server"], &dhcpPerfs, logger); err != nil {
|
||||
return err
|
||||
data, ok := perfData[perfdata.InstanceEmpty]
|
||||
if !ok {
|
||||
return fmt.Errorf("failed to collect DHCP Server metrics: %w", types.ErrNoData)
|
||||
}
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.packetsReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
dhcpPerfs[0].PacketsReceivedTotal,
|
||||
data[packetsReceivedTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.duplicatesDroppedTotal,
|
||||
prometheus.CounterValue,
|
||||
dhcpPerfs[0].DuplicatesDroppedTotal,
|
||||
data[duplicatesDroppedTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.packetsExpiredTotal,
|
||||
prometheus.CounterValue,
|
||||
dhcpPerfs[0].PacketsExpiredTotal,
|
||||
data[packetsExpiredTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.activeQueueLength,
|
||||
prometheus.GaugeValue,
|
||||
dhcpPerfs[0].ActiveQueueLength,
|
||||
data[activeQueueLength].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.conflictCheckQueueLength,
|
||||
prometheus.GaugeValue,
|
||||
dhcpPerfs[0].ConflictCheckQueueLength,
|
||||
data[conflictCheckQueueLength].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.discoversTotal,
|
||||
prometheus.CounterValue,
|
||||
dhcpPerfs[0].DiscoversTotal,
|
||||
data[discoversTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.offersTotal,
|
||||
prometheus.CounterValue,
|
||||
dhcpPerfs[0].OffersTotal,
|
||||
data[offersTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.requestsTotal,
|
||||
prometheus.CounterValue,
|
||||
dhcpPerfs[0].RequestsTotal,
|
||||
data[requestsTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.informsTotal,
|
||||
prometheus.CounterValue,
|
||||
dhcpPerfs[0].InformsTotal,
|
||||
data[informsTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.acksTotal,
|
||||
prometheus.CounterValue,
|
||||
dhcpPerfs[0].AcksTotal,
|
||||
data[acksTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.nACKsTotal,
|
||||
prometheus.CounterValue,
|
||||
dhcpPerfs[0].NacksTotal,
|
||||
data[nacksTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.declinesTotal,
|
||||
prometheus.CounterValue,
|
||||
dhcpPerfs[0].DeclinesTotal,
|
||||
data[declinesTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.releasesTotal,
|
||||
prometheus.CounterValue,
|
||||
dhcpPerfs[0].ReleasesTotal,
|
||||
data[releasesTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.offerQueueLength,
|
||||
prometheus.GaugeValue,
|
||||
dhcpPerfs[0].OfferQueueLength,
|
||||
data[offerQueueLength].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.deniedDueToMatch,
|
||||
prometheus.CounterValue,
|
||||
dhcpPerfs[0].DeniedDueToMatch,
|
||||
data[deniedDueToMatch].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.deniedDueToNonMatch,
|
||||
prometheus.CounterValue,
|
||||
dhcpPerfs[0].DeniedDueToNonMatch,
|
||||
data[deniedDueToNonMatch].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.failoverBndupdSentTotal,
|
||||
c.failoverBndUpdSentTotal,
|
||||
prometheus.CounterValue,
|
||||
dhcpPerfs[0].FailoverBndupdSentTotal,
|
||||
data[failoverBndUpdSentTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.failoverBndupdReceivedTotal,
|
||||
c.failoverBndUpdReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
dhcpPerfs[0].FailoverBndupdReceivedTotal,
|
||||
data[failoverBndUpdReceivedTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.failoverBndackSentTotal,
|
||||
c.failoverBndAckSentTotal,
|
||||
prometheus.CounterValue,
|
||||
dhcpPerfs[0].FailoverBndackSentTotal,
|
||||
data[failoverBndAckSentTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.failoverBndackReceivedTotal,
|
||||
c.failoverBndAckReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
dhcpPerfs[0].FailoverBndackReceivedTotal,
|
||||
data[failoverBndAckReceivedTotal].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.failoverBndupdPendingOutboundQueue,
|
||||
c.failoverBndUpdPendingOutboundQueue,
|
||||
prometheus.GaugeValue,
|
||||
dhcpPerfs[0].FailoverBndupdPendingOutboundQueue,
|
||||
data[failoverBndUpdPendingOutboundQueue].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.failoverTransitionsCommunicationInterruptedState,
|
||||
prometheus.CounterValue,
|
||||
dhcpPerfs[0].FailoverTransitionsCommunicationinterruptedState,
|
||||
data[failoverTransitionsCommunicationInterruptedState].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.failoverTransitionsPartnerDownState,
|
||||
prometheus.CounterValue,
|
||||
dhcpPerfs[0].FailoverTransitionsPartnerdownState,
|
||||
data[failoverTransitionsPartnerDownState].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.failoverTransitionsRecoverState,
|
||||
prometheus.CounterValue,
|
||||
dhcpPerfs[0].FailoverTransitionsRecoverState,
|
||||
data[failoverTransitionsRecoverState].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.failoverBndupdDropped,
|
||||
c.failoverBndUpdDropped,
|
||||
prometheus.CounterValue,
|
||||
dhcpPerfs[0].FailoverBndupdDropped,
|
||||
data[failoverBndUpdDropped].FirstValue,
|
||||
)
|
||||
|
||||
return nil
|
||||
27
internal/collector/dhcp/dhcp_test.go
Normal file
27
internal/collector/dhcp/dhcp_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package dhcp_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/collector/dhcp"
|
||||
"github.com/prometheus-community/windows_exporter/internal/utils/testutils"
|
||||
)
|
||||
|
||||
func BenchmarkCollector(b *testing.B) {
|
||||
testutils.FuncBenchmarkCollector(b, dhcp.Name, dhcp.NewWithFlags)
|
||||
}
|
||||
@@ -1,31 +1,44 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package diskdrive
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"strings"
|
||||
|
||||
"github.com/alecthomas/kingpin/v2"
|
||||
"github.com/prometheus-community/windows_exporter/pkg/types"
|
||||
"github.com/prometheus-community/windows_exporter/internal/mi"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/yusufpapurcu/wmi"
|
||||
)
|
||||
|
||||
const (
|
||||
Name = "diskdrive"
|
||||
win32DiskQuery = "SELECT DeviceID, Model, Caption, Name, Partitions, Size, Status, Availability FROM WIN32_DiskDrive"
|
||||
)
|
||||
const Name = "diskdrive"
|
||||
|
||||
type Config struct{}
|
||||
|
||||
//nolint:gochecknoglobals
|
||||
var ConfigDefaults = Config{}
|
||||
|
||||
// A Collector is a Prometheus Collector for a few WMI metrics in Win32_DiskDrive.
|
||||
type Collector struct {
|
||||
config Config
|
||||
wmiClient *wmi.Client
|
||||
miSession *mi.Session
|
||||
miQuery mi.Query
|
||||
|
||||
availability *prometheus.Desc
|
||||
diskInfo *prometheus.Desc
|
||||
@@ -54,20 +67,23 @@ 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 {
|
||||
func (c *Collector) Close() 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")
|
||||
func (c *Collector) Build(_ *slog.Logger, miSession *mi.Session) error {
|
||||
if miSession == nil {
|
||||
return errors.New("miSession is nil")
|
||||
}
|
||||
|
||||
c.wmiClient = wmiClient
|
||||
miQuery, err := mi.NewQuery("SELECT DeviceID, Model, Caption, Name, Partitions, Size, Status, Availability FROM WIN32_DiskDrive")
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create WMI query: %w", err)
|
||||
}
|
||||
|
||||
c.miQuery = miQuery
|
||||
c.miSession = miSession
|
||||
|
||||
c.diskInfo = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "info"),
|
||||
"General drive information",
|
||||
@@ -104,20 +120,26 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
|
||||
nil,
|
||||
)
|
||||
|
||||
var dst []diskDrive
|
||||
if err := c.miSession.Query(&dst, mi.NamespaceRootCIMv2, c.miQuery); err != nil {
|
||||
return fmt.Errorf("WMI query failed: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type win32_DiskDrive struct {
|
||||
DeviceID string
|
||||
Model string
|
||||
Size uint64
|
||||
Name string
|
||||
Caption string
|
||||
Partitions uint32
|
||||
Status string
|
||||
Availability uint16
|
||||
type diskDrive struct {
|
||||
DeviceID string `mi:"DeviceID"`
|
||||
Model string `mi:"Model"`
|
||||
Size uint64 `mi:"Size"`
|
||||
Name string `mi:"Name"`
|
||||
Caption string `mi:"Caption"`
|
||||
Partitions uint32 `mi:"Partitions"`
|
||||
Status string `mi:"Status"`
|
||||
Availability uint16 `mi:"Availability"`
|
||||
}
|
||||
|
||||
//nolint:gochecknoglobals
|
||||
var (
|
||||
allDiskStatus = []string{
|
||||
"OK",
|
||||
@@ -160,24 +182,10 @@ var (
|
||||
)
|
||||
|
||||
// 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 disk_drive_info metrics",
|
||||
slog.Any("err", err),
|
||||
)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) collect(ch chan<- prometheus.Metric) error {
|
||||
var dst []win32_DiskDrive
|
||||
|
||||
if err := c.wmiClient.Query(win32DiskQuery, &dst); err != nil {
|
||||
return err
|
||||
func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
|
||||
var dst []diskDrive
|
||||
if err := c.miSession.Query(&dst, mi.NamespaceRootCIMv2, c.miQuery); err != nil {
|
||||
return fmt.Errorf("WMI query failed: %w", err)
|
||||
}
|
||||
|
||||
if len(dst) == 0 {
|
||||
@@ -185,14 +193,16 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
|
||||
}
|
||||
|
||||
for _, disk := range dst {
|
||||
distName := strings.Trim(disk.Name, `\.`)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.diskInfo,
|
||||
prometheus.GaugeValue,
|
||||
1.0,
|
||||
strings.Trim(disk.DeviceID, "\\.\\"), //nolint:staticcheck
|
||||
strings.Trim(disk.DeviceID, `\.`),
|
||||
strings.TrimRight(disk.Model, " "),
|
||||
strings.TrimRight(disk.Caption, " "),
|
||||
strings.TrimRight(disk.Name, "\\.\\"), //nolint:staticcheck
|
||||
distName,
|
||||
)
|
||||
|
||||
for _, status := range allDiskStatus {
|
||||
@@ -205,7 +215,7 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
|
||||
c.status,
|
||||
prometheus.GaugeValue,
|
||||
isCurrentState,
|
||||
strings.Trim(disk.Name, "\\.\\"), //nolint:staticcheck
|
||||
distName,
|
||||
status,
|
||||
)
|
||||
}
|
||||
@@ -214,14 +224,14 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
|
||||
c.size,
|
||||
prometheus.GaugeValue,
|
||||
float64(disk.Size),
|
||||
strings.Trim(disk.Name, "\\.\\"), //nolint:staticcheck
|
||||
distName,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.partitions,
|
||||
prometheus.GaugeValue,
|
||||
float64(disk.Partitions),
|
||||
strings.Trim(disk.Name, "\\.\\"), //nolint:staticcheck
|
||||
distName,
|
||||
)
|
||||
|
||||
for availNum, val := range availMap {
|
||||
@@ -233,7 +243,7 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
|
||||
c.availability,
|
||||
prometheus.GaugeValue,
|
||||
isCurrentState,
|
||||
strings.Trim(disk.Name, "\\.\\"), //nolint:staticcheck
|
||||
distName,
|
||||
val,
|
||||
)
|
||||
}
|
||||
27
internal/collector/diskdrive/diskdrive_test.go
Normal file
27
internal/collector/diskdrive/diskdrive_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package diskdrive_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/collector/diskdrive"
|
||||
"github.com/prometheus-community/windows_exporter/internal/utils/testutils"
|
||||
)
|
||||
|
||||
func BenchmarkCollector(b *testing.B) {
|
||||
testutils.FuncBenchmarkCollector(b, diskdrive.Name, diskdrive.NewWithFlags)
|
||||
}
|
||||
107
internal/collector/dns/const.go
Normal file
107
internal/collector/dns/const.go
Normal file
@@ -0,0 +1,107 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package dns
|
||||
|
||||
const (
|
||||
_ = "% User Time"
|
||||
_ = "176"
|
||||
_ = "Async Fast Reads/sec"
|
||||
axfrRequestReceived = "AXFR Request Received"
|
||||
axfrRequestSent = "AXFR Request Sent"
|
||||
axfrResponseReceived = "AXFR Response Received"
|
||||
axfrSuccessReceived = "AXFR Success Received"
|
||||
axfrSuccessSent = "AXFR Success Sent"
|
||||
cachingMemory = "Caching Memory"
|
||||
_ = "Data Flush Pages/sec"
|
||||
_ = "Data Flushes/sec"
|
||||
databaseNodeMemory = "Database Node Memory"
|
||||
dynamicUpdateNoOperation = "Dynamic Update NoOperation"
|
||||
_ = "Dynamic Update NoOperation/sec"
|
||||
dynamicUpdateQueued = "Dynamic Update Queued"
|
||||
_ = "Dynamic Update Received"
|
||||
_ = "Dynamic Update Received/sec"
|
||||
dynamicUpdateRejected = "Dynamic Update Rejected"
|
||||
dynamicUpdateTimeOuts = "Dynamic Update TimeOuts"
|
||||
dynamicUpdateWrittenToDatabase = "Dynamic Update Written to Database"
|
||||
_ = "Dynamic Update Written to Database/sec"
|
||||
_ = "Enumerations Server/sec"
|
||||
_ = "Fast Read Not Possibles/sec"
|
||||
_ = "Fast Read Resource Misses/sec"
|
||||
ixfrRequestReceived = "IXFR Request Received"
|
||||
ixfrRequestSent = "IXFR Request Sent"
|
||||
ixfrResponseReceived = "IXFR Response Received"
|
||||
_ = "IXFR Success Received"
|
||||
ixfrSuccessSent = "IXFR Success Sent"
|
||||
ixfrTCPSuccessReceived = "IXFR TCP Success Received"
|
||||
ixfrUDPSuccessReceived = "IXFR UDP Success Received"
|
||||
_ = "Lazy Write Flushes/sec"
|
||||
_ = "Lazy Write Pages/sec"
|
||||
_ = "Level 2 TLB Fills/sec"
|
||||
nbStatMemory = "Nbstat Memory"
|
||||
notifyReceived = "Notify Received"
|
||||
notifySent = "Notify Sent"
|
||||
_ = "Query Dropped Bad Socket"
|
||||
_ = "Query Dropped Bad Socket/sec"
|
||||
_ = "Query Dropped By Policy"
|
||||
_ = "Query Dropped By Policy/sec"
|
||||
_ = "Query Dropped By Response Rate Limiting"
|
||||
_ = "Query Dropped By Response Rate Limiting/sec"
|
||||
_ = "Query Dropped Send"
|
||||
_ = "Query Dropped Send/sec"
|
||||
_ = "Query Dropped Total"
|
||||
_ = "Query Dropped Total/sec"
|
||||
recordFlowMemory = "Record Flow Memory"
|
||||
recursiveQueries = "Recursive Queries"
|
||||
_ = "Recursive Queries/sec"
|
||||
recursiveQueryFailure = "Recursive Query Failure"
|
||||
_ = "Recursive Query Failure/sec"
|
||||
_ = "Recursive Send TimeOuts"
|
||||
recursiveSendTimeOuts = "Recursive TimeOut/sec"
|
||||
_ = "Responses Suppressed"
|
||||
_ = "Responses Suppressed/sec"
|
||||
secureUpdateFailure = "Secure Update Failure"
|
||||
secureUpdateReceived = "Secure Update Received"
|
||||
_ = "Secure Update Received/sec"
|
||||
tcpMessageMemory = "TCP Message Memory"
|
||||
tcpQueryReceived = "TCP Query Received"
|
||||
_ = "TCP Query Received/sec"
|
||||
tcpResponseSent = "TCP Response Sent"
|
||||
_ = "TCP Response Sent/sec"
|
||||
_ = "Total Query Received"
|
||||
_ = "Total Query Received/sec"
|
||||
_ = "Total Remote Inflight Queries"
|
||||
_ = "Total Response Sent"
|
||||
_ = "Total Response Sent/sec"
|
||||
udpMessageMemory = "UDP Message Memory"
|
||||
udpQueryReceived = "UDP Query Received"
|
||||
_ = "UDP Query Received/sec"
|
||||
udpResponseSent = "UDP Response Sent"
|
||||
_ = "UDP Response Sent/sec"
|
||||
unmatchedResponsesReceived = "Unmatched Responses Received"
|
||||
_ = "Virtual Bytes"
|
||||
winsLookupReceived = "WINS Lookup Received"
|
||||
_ = "WINS Lookup Received/sec"
|
||||
winsResponseSent = "WINS Response Sent"
|
||||
_ = "WINS Response Sent/sec"
|
||||
winsReverseLookupReceived = "WINS Reverse Lookup Received"
|
||||
_ = "WINS Reverse Lookup Received/sec"
|
||||
winsReverseResponseSent = "WINS Reverse Response Sent"
|
||||
_ = "WINS Reverse Response Sent/sec"
|
||||
zoneTransferFailure = "Zone Transfer Failure"
|
||||
zoneTransferSOARequestSent = "Zone Transfer Request Received"
|
||||
_ = "Zone Transfer SOA Request Sent"
|
||||
_ = "Zone Transfer Success"
|
||||
)
|
||||
@@ -1,27 +1,43 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package dns
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
|
||||
"github.com/alecthomas/kingpin/v2"
|
||||
"github.com/prometheus-community/windows_exporter/pkg/types"
|
||||
"github.com/prometheus-community/windows_exporter/internal/mi"
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/yusufpapurcu/wmi"
|
||||
)
|
||||
|
||||
const Name = "dns"
|
||||
|
||||
type Config struct{}
|
||||
|
||||
//nolint:gochecknoglobals
|
||||
var ConfigDefaults = Config{}
|
||||
|
||||
// A Collector is a Prometheus Collector for WMI Win32_PerfRawData_DNS_DNS metrics.
|
||||
type Collector struct {
|
||||
config Config
|
||||
wmiClient *wmi.Client
|
||||
config Config
|
||||
|
||||
perfDataCollector *perfdata.Collector
|
||||
|
||||
dynamicUpdatesFailures *prometheus.Desc
|
||||
dynamicUpdatesQueued *prometheus.Desc
|
||||
@@ -67,20 +83,60 @@ func (c *Collector) GetName() string {
|
||||
return Name
|
||||
}
|
||||
|
||||
func (c *Collector) GetPerfCounter(_ *slog.Logger) ([]string, error) {
|
||||
return []string{}, nil
|
||||
}
|
||||
func (c *Collector) Close() error {
|
||||
c.perfDataCollector.Close()
|
||||
|
||||
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")
|
||||
}
|
||||
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
|
||||
var err error
|
||||
|
||||
c.wmiClient = wmiClient
|
||||
c.perfDataCollector, err = perfdata.NewCollector("DNS", perfdata.InstancesAll, []string{
|
||||
axfrRequestReceived,
|
||||
axfrRequestSent,
|
||||
axfrResponseReceived,
|
||||
axfrSuccessReceived,
|
||||
axfrSuccessSent,
|
||||
cachingMemory,
|
||||
databaseNodeMemory,
|
||||
dynamicUpdateNoOperation,
|
||||
dynamicUpdateQueued,
|
||||
dynamicUpdateRejected,
|
||||
dynamicUpdateTimeOuts,
|
||||
dynamicUpdateWrittenToDatabase,
|
||||
ixfrRequestReceived,
|
||||
ixfrRequestSent,
|
||||
ixfrResponseReceived,
|
||||
ixfrSuccessSent,
|
||||
ixfrTCPSuccessReceived,
|
||||
ixfrUDPSuccessReceived,
|
||||
nbStatMemory,
|
||||
notifyReceived,
|
||||
notifySent,
|
||||
recordFlowMemory,
|
||||
recursiveQueries,
|
||||
recursiveQueryFailure,
|
||||
recursiveSendTimeOuts,
|
||||
secureUpdateFailure,
|
||||
secureUpdateReceived,
|
||||
tcpMessageMemory,
|
||||
tcpQueryReceived,
|
||||
tcpResponseSent,
|
||||
udpMessageMemory,
|
||||
udpQueryReceived,
|
||||
udpResponseSent,
|
||||
unmatchedResponsesReceived,
|
||||
winsLookupReceived,
|
||||
winsResponseSent,
|
||||
winsReverseLookupReceived,
|
||||
winsReverseResponseSent,
|
||||
zoneTransferFailure,
|
||||
zoneTransferSOARequestSent,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create DNS collector: %w", err)
|
||||
}
|
||||
|
||||
c.zoneTransferRequestsReceived = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "zone_transfer_requests_received_total"),
|
||||
@@ -220,138 +276,80 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
|
||||
|
||||
// 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 dns metrics",
|
||||
slog.Any("err", err),
|
||||
)
|
||||
|
||||
return err
|
||||
func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
|
||||
perfData, err := c.perfDataCollector.Collect()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect DNS metrics: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Win32_PerfRawData_DNS_DNS docs:
|
||||
// - https://msdn.microsoft.com/en-us/library/ms803992.aspx?f=255&MSPPError=-2147217396
|
||||
// - https://technet.microsoft.com/en-us/library/cc977686.aspx
|
||||
type Win32_PerfRawData_DNS_DNS struct {
|
||||
AXFRRequestReceived uint32
|
||||
AXFRRequestSent uint32
|
||||
AXFRResponseReceived uint32
|
||||
AXFRSuccessReceived uint32
|
||||
AXFRSuccessSent uint32
|
||||
CachingMemory uint32
|
||||
DatabaseNodeMemory uint32
|
||||
DynamicUpdateNoOperation uint32
|
||||
DynamicUpdateQueued uint32
|
||||
DynamicUpdateRejected uint32
|
||||
DynamicUpdateTimeOuts uint32
|
||||
DynamicUpdateWrittentoDatabase uint32
|
||||
IXFRRequestReceived uint32
|
||||
IXFRRequestSent uint32
|
||||
IXFRResponseReceived uint32
|
||||
IXFRSuccessSent uint32
|
||||
IXFRTCPSuccessReceived uint32
|
||||
IXFRUDPSuccessReceived uint32
|
||||
NbstatMemory uint32
|
||||
NotifyReceived uint32
|
||||
NotifySent uint32
|
||||
RecordFlowMemory uint32
|
||||
RecursiveQueries uint32
|
||||
RecursiveQueryFailure uint32
|
||||
RecursiveSendTimeOuts uint32
|
||||
SecureUpdateFailure uint32
|
||||
SecureUpdateReceived uint32
|
||||
TCPMessageMemory uint32
|
||||
TCPQueryReceived uint32
|
||||
TCPResponseSent uint32
|
||||
UDPMessageMemory uint32
|
||||
UDPQueryReceived uint32
|
||||
UDPResponseSent uint32
|
||||
UnmatchedResponsesReceived uint32
|
||||
WINSLookupReceived uint32
|
||||
WINSResponseSent uint32
|
||||
WINSReverseLookupReceived uint32
|
||||
WINSReverseResponseSent uint32
|
||||
ZoneTransferFailure uint32
|
||||
ZoneTransferSOARequestSent uint32
|
||||
}
|
||||
|
||||
func (c *Collector) collect(ch chan<- prometheus.Metric) error {
|
||||
var dst []Win32_PerfRawData_DNS_DNS
|
||||
if err := c.wmiClient.Query("SELECT * FROM Win32_PerfRawData_DNS_DNS", &dst); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(dst) == 0 {
|
||||
return errors.New("WMI query returned empty result set")
|
||||
data, ok := perfData[perfdata.InstanceEmpty]
|
||||
if !ok {
|
||||
return fmt.Errorf("failed to collect DNS metrics: %w", types.ErrNoData)
|
||||
}
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.zoneTransferRequestsReceived,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].AXFRRequestReceived),
|
||||
data[axfrRequestReceived].FirstValue,
|
||||
"full",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.zoneTransferRequestsReceived,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].IXFRRequestReceived),
|
||||
data[ixfrRequestReceived].FirstValue,
|
||||
"incremental",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.zoneTransferRequestsSent,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].AXFRRequestSent),
|
||||
data[axfrRequestSent].FirstValue,
|
||||
"full",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.zoneTransferRequestsSent,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].IXFRRequestSent),
|
||||
data[ixfrRequestSent].FirstValue,
|
||||
"incremental",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.zoneTransferRequestsSent,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].ZoneTransferSOARequestSent),
|
||||
data[zoneTransferSOARequestSent].FirstValue,
|
||||
"soa",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.zoneTransferResponsesReceived,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].AXFRResponseReceived),
|
||||
data[axfrResponseReceived].FirstValue,
|
||||
"full",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.zoneTransferResponsesReceived,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].IXFRResponseReceived),
|
||||
data[ixfrResponseReceived].FirstValue,
|
||||
"incremental",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.zoneTransferSuccessReceived,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].AXFRSuccessReceived),
|
||||
data[axfrSuccessReceived].FirstValue,
|
||||
"full",
|
||||
"tcp",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.zoneTransferSuccessReceived,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].IXFRTCPSuccessReceived),
|
||||
data[ixfrTCPSuccessReceived].FirstValue,
|
||||
"incremental",
|
||||
"tcp",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.zoneTransferSuccessReceived,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].IXFRTCPSuccessReceived),
|
||||
data[ixfrTCPSuccessReceived].FirstValue,
|
||||
"incremental",
|
||||
"udp",
|
||||
)
|
||||
@@ -359,183 +357,183 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.zoneTransferSuccessSent,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].AXFRSuccessSent),
|
||||
data[axfrSuccessSent].FirstValue,
|
||||
"full",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.zoneTransferSuccessSent,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].IXFRSuccessSent),
|
||||
data[ixfrSuccessSent].FirstValue,
|
||||
"incremental",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.zoneTransferFailures,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].ZoneTransferFailure),
|
||||
data[zoneTransferFailure].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.memoryUsedBytes,
|
||||
prometheus.GaugeValue,
|
||||
float64(dst[0].CachingMemory),
|
||||
data[cachingMemory].FirstValue,
|
||||
"caching",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.memoryUsedBytes,
|
||||
prometheus.GaugeValue,
|
||||
float64(dst[0].DatabaseNodeMemory),
|
||||
data[databaseNodeMemory].FirstValue,
|
||||
"database_node",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.memoryUsedBytes,
|
||||
prometheus.GaugeValue,
|
||||
float64(dst[0].NbstatMemory),
|
||||
data[nbStatMemory].FirstValue,
|
||||
"nbstat",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.memoryUsedBytes,
|
||||
prometheus.GaugeValue,
|
||||
float64(dst[0].RecordFlowMemory),
|
||||
data[recordFlowMemory].FirstValue,
|
||||
"record_flow",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.memoryUsedBytes,
|
||||
prometheus.GaugeValue,
|
||||
float64(dst[0].TCPMessageMemory),
|
||||
data[tcpMessageMemory].FirstValue,
|
||||
"tcp_message",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.memoryUsedBytes,
|
||||
prometheus.GaugeValue,
|
||||
float64(dst[0].UDPMessageMemory),
|
||||
data[udpMessageMemory].FirstValue,
|
||||
"udp_message",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dynamicUpdatesReceived,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].DynamicUpdateNoOperation),
|
||||
data[dynamicUpdateNoOperation].FirstValue,
|
||||
"noop",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dynamicUpdatesReceived,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].DynamicUpdateWrittentoDatabase),
|
||||
data[dynamicUpdateWrittenToDatabase].FirstValue,
|
||||
"written",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dynamicUpdatesQueued,
|
||||
prometheus.GaugeValue,
|
||||
float64(dst[0].DynamicUpdateQueued),
|
||||
data[dynamicUpdateQueued].FirstValue,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dynamicUpdatesFailures,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].DynamicUpdateRejected),
|
||||
data[dynamicUpdateRejected].FirstValue,
|
||||
"rejected",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dynamicUpdatesFailures,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].DynamicUpdateTimeOuts),
|
||||
data[dynamicUpdateTimeOuts].FirstValue,
|
||||
"timeout",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.notifyReceived,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].NotifyReceived),
|
||||
data[notifyReceived].FirstValue,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.notifySent,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].NotifySent),
|
||||
data[notifySent].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.recursiveQueries,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].RecursiveQueries),
|
||||
data[recursiveQueries].FirstValue,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.recursiveQueryFailures,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].RecursiveQueryFailure),
|
||||
data[recursiveQueryFailure].FirstValue,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.recursiveQuerySendTimeouts,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].RecursiveSendTimeOuts),
|
||||
data[recursiveSendTimeOuts].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.queries,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].TCPQueryReceived),
|
||||
data[tcpQueryReceived].FirstValue,
|
||||
"tcp",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.queries,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].UDPQueryReceived),
|
||||
data[udpQueryReceived].FirstValue,
|
||||
"udp",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.responses,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].TCPResponseSent),
|
||||
data[tcpResponseSent].FirstValue,
|
||||
"tcp",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.responses,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].UDPResponseSent),
|
||||
data[udpResponseSent].FirstValue,
|
||||
"udp",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.unmatchedResponsesReceived,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].UnmatchedResponsesReceived),
|
||||
data[unmatchedResponsesReceived].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.winsQueries,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].WINSLookupReceived),
|
||||
data[winsLookupReceived].FirstValue,
|
||||
"forward",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.winsQueries,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].WINSReverseLookupReceived),
|
||||
data[winsReverseLookupReceived].FirstValue,
|
||||
"reverse",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.winsResponses,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].WINSResponseSent),
|
||||
data[winsResponseSent].FirstValue,
|
||||
"forward",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.winsResponses,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].WINSReverseResponseSent),
|
||||
data[winsReverseResponseSent].FirstValue,
|
||||
"reverse",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.secureUpdateFailures,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].SecureUpdateFailure),
|
||||
data[secureUpdateFailure].FirstValue,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.secureUpdateReceived,
|
||||
prometheus.CounterValue,
|
||||
float64(dst[0].SecureUpdateReceived),
|
||||
data[secureUpdateReceived].FirstValue,
|
||||
)
|
||||
|
||||
return nil
|
||||
27
internal/collector/dns/dns_test.go
Normal file
27
internal/collector/dns/dns_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package dns_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/collector/dns"
|
||||
"github.com/prometheus-community/windows_exporter/internal/utils/testutils"
|
||||
)
|
||||
|
||||
func BenchmarkCollector(b *testing.B) {
|
||||
testutils.FuncBenchmarkCollector(b, dns.Name, dns.NewWithFlags)
|
||||
}
|
||||
272
internal/collector/exchange/exchange.go
Normal file
272
internal/collector/exchange/exchange.go
Normal file
@@ -0,0 +1,272 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package exchange
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/alecthomas/kingpin/v2"
|
||||
"github.com/prometheus-community/windows_exporter/internal/mi"
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
const Name = "exchange"
|
||||
|
||||
const (
|
||||
adAccessProcesses = "ADAccessProcesses"
|
||||
transportQueues = "TransportQueues"
|
||||
httpProxy = "HttpProxy"
|
||||
activeSync = "ActiveSync"
|
||||
availabilityService = "AvailabilityService"
|
||||
outlookWebAccess = "OutlookWebAccess"
|
||||
autoDiscover = "Autodiscover"
|
||||
workloadManagement = "WorkloadManagement"
|
||||
rpcClientAccess = "RpcClientAccess"
|
||||
mapiHttpEmsmdb = "MapiHttpEmsmdb"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
CollectorsEnabled []string `yaml:"collectors_enabled"`
|
||||
}
|
||||
|
||||
//nolint:gochecknoglobals
|
||||
var ConfigDefaults = Config{
|
||||
CollectorsEnabled: []string{
|
||||
adAccessProcesses,
|
||||
transportQueues,
|
||||
httpProxy,
|
||||
activeSync,
|
||||
availabilityService,
|
||||
outlookWebAccess,
|
||||
autoDiscover,
|
||||
workloadManagement,
|
||||
rpcClientAccess,
|
||||
mapiHttpEmsmdb,
|
||||
},
|
||||
}
|
||||
|
||||
type Collector struct {
|
||||
config Config
|
||||
|
||||
perfDataCollectorADAccessProcesses *perfdata.Collector
|
||||
perfDataCollectorTransportQueues *perfdata.Collector
|
||||
perfDataCollectorHttpProxy *perfdata.Collector
|
||||
perfDataCollectorActiveSync *perfdata.Collector
|
||||
perfDataCollectorAvailabilityService *perfdata.Collector
|
||||
perfDataCollectorOWA *perfdata.Collector
|
||||
perfDataCollectorAutoDiscover *perfdata.Collector
|
||||
perfDataCollectorWorkloadManagementWorkloads *perfdata.Collector
|
||||
perfDataCollectorRpcClientAccess *perfdata.Collector
|
||||
perfDataCollectorMapiHttpEmsmdb *perfdata.Collector
|
||||
|
||||
activeMailboxDeliveryQueueLength *prometheus.Desc
|
||||
activeSyncRequestsPerSec *prometheus.Desc
|
||||
activeTasks *prometheus.Desc
|
||||
activeUserCount *prometheus.Desc
|
||||
activeUserCountMapiHttpEmsMDB *prometheus.Desc
|
||||
autoDiscoverRequestsPerSec *prometheus.Desc
|
||||
availabilityRequestsSec *prometheus.Desc
|
||||
averageAuthenticationLatency *prometheus.Desc
|
||||
averageCASProcessingLatency *prometheus.Desc
|
||||
completedTasks *prometheus.Desc
|
||||
connectionCount *prometheus.Desc
|
||||
currentUniqueUsers *prometheus.Desc
|
||||
externalActiveRemoteDeliveryQueueLength *prometheus.Desc
|
||||
externalLargestDeliveryQueueLength *prometheus.Desc
|
||||
internalActiveRemoteDeliveryQueueLength *prometheus.Desc
|
||||
internalLargestDeliveryQueueLength *prometheus.Desc
|
||||
isActive *prometheus.Desc
|
||||
ldapReadTime *prometheus.Desc
|
||||
ldapSearchTime *prometheus.Desc
|
||||
ldapTimeoutErrorsPerSec *prometheus.Desc
|
||||
ldapWriteTime *prometheus.Desc
|
||||
longRunningLDAPOperationsPerMin *prometheus.Desc
|
||||
mailboxServerLocatorAverageLatency *prometheus.Desc
|
||||
mailboxServerProxyFailureRate *prometheus.Desc
|
||||
outstandingProxyRequests *prometheus.Desc
|
||||
owaRequestsPerSec *prometheus.Desc
|
||||
pingCommandsPending *prometheus.Desc
|
||||
poisonQueueLength *prometheus.Desc
|
||||
proxyRequestsPerSec *prometheus.Desc
|
||||
queuedTasks *prometheus.Desc
|
||||
retryMailboxDeliveryQueueLength *prometheus.Desc
|
||||
rpcAveragedLatency *prometheus.Desc
|
||||
rpcOperationsPerSec *prometheus.Desc
|
||||
rpcRequests *prometheus.Desc
|
||||
syncCommandsPerSec *prometheus.Desc
|
||||
unreachableQueueLength *prometheus.Desc
|
||||
userCount *prometheus.Desc
|
||||
yieldedTasks *prometheus.Desc
|
||||
messagesQueuedForDeliveryTotal *prometheus.Desc
|
||||
messagesSubmittedTotal *prometheus.Desc
|
||||
messagesDelayedTotal *prometheus.Desc
|
||||
messagesCompletedDeliveryTotal *prometheus.Desc
|
||||
shadowQueueLength *prometheus.Desc
|
||||
submissionQueueLength *prometheus.Desc
|
||||
delayQueueLength *prometheus.Desc
|
||||
itemsCompletedDeliveryTotal *prometheus.Desc
|
||||
itemsQueuedForDeliveryExpiredTotal *prometheus.Desc
|
||||
itemsQueuedForDeliveryTotal *prometheus.Desc
|
||||
itemsResubmittedTotal *prometheus.Desc
|
||||
}
|
||||
|
||||
func New(config *Config) *Collector {
|
||||
if config == nil {
|
||||
config = &ConfigDefaults
|
||||
}
|
||||
|
||||
if config.CollectorsEnabled == nil {
|
||||
config.CollectorsEnabled = ConfigDefaults.CollectorsEnabled
|
||||
}
|
||||
|
||||
c := &Collector{
|
||||
config: *config,
|
||||
}
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
func NewWithFlags(app *kingpin.Application) *Collector {
|
||||
c := &Collector{
|
||||
config: ConfigDefaults,
|
||||
}
|
||||
c.config.CollectorsEnabled = make([]string, 0)
|
||||
|
||||
var listAllCollectors bool
|
||||
|
||||
var collectorsEnabled string
|
||||
|
||||
app.Flag(
|
||||
"collector.exchange.list",
|
||||
"List the collectors along with their perflib object name/ids",
|
||||
).BoolVar(&listAllCollectors)
|
||||
|
||||
app.Flag(
|
||||
"collector.exchange.enabled",
|
||||
"Comma-separated list of collectors to use. Defaults to all, if not specified.",
|
||||
).Default(strings.Join(ConfigDefaults.CollectorsEnabled, ",")).StringVar(&collectorsEnabled)
|
||||
|
||||
app.PreAction(func(*kingpin.ParseContext) error {
|
||||
if listAllCollectors {
|
||||
collectorDesc := map[string]string{
|
||||
adAccessProcesses: "[19108] MSExchange ADAccess Processes",
|
||||
transportQueues: "[20524] MSExchangeTransport Queues",
|
||||
httpProxy: "[36934] MSExchange HttpProxy",
|
||||
activeSync: "[25138] MSExchange ActiveSync",
|
||||
availabilityService: "[24914] MSExchange Availability Service",
|
||||
outlookWebAccess: "[24618] MSExchange OWA",
|
||||
autoDiscover: "[29240] MSExchange Autodiscover",
|
||||
workloadManagement: "[19430] MSExchange WorkloadManagement Workloads",
|
||||
rpcClientAccess: "[29336] MSExchange RpcClientAccess",
|
||||
mapiHttpEmsmdb: "[26463] MSExchange MapiHttp Emsmdb",
|
||||
}
|
||||
|
||||
sb := strings.Builder{}
|
||||
sb.WriteString(fmt.Sprintf("%-32s %-32s\n", "Collector Name", "[PerfID] Perflib Object"))
|
||||
|
||||
for _, cname := range ConfigDefaults.CollectorsEnabled {
|
||||
sb.WriteString(fmt.Sprintf("%-32s %-32s\n", cname, collectorDesc[cname]))
|
||||
}
|
||||
|
||||
app.UsageTemplate(sb.String()).Usage(nil)
|
||||
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
app.Action(func(*kingpin.ParseContext) error {
|
||||
c.config.CollectorsEnabled = strings.Split(collectorsEnabled, ",")
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
func (c *Collector) GetName() string {
|
||||
return Name
|
||||
}
|
||||
|
||||
func (c *Collector) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
|
||||
collectorFuncs := map[string]func() error{
|
||||
adAccessProcesses: c.buildADAccessProcesses,
|
||||
transportQueues: c.buildTransportQueues,
|
||||
httpProxy: c.buildHTTPProxy,
|
||||
activeSync: c.buildActiveSync,
|
||||
availabilityService: c.buildAvailabilityService,
|
||||
outlookWebAccess: c.buildOWA,
|
||||
autoDiscover: c.buildAutoDiscover,
|
||||
workloadManagement: c.buildWorkloadManagementWorkloads,
|
||||
rpcClientAccess: c.buildRPC,
|
||||
mapiHttpEmsmdb: c.buildMapiHttpEmsmdb,
|
||||
}
|
||||
|
||||
for _, collectorName := range c.config.CollectorsEnabled {
|
||||
if err := collectorFuncs[collectorName](); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Collect collects exchange metrics and sends them to prometheus.
|
||||
func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
|
||||
collectorFuncs := map[string]func(ch chan<- prometheus.Metric) error{
|
||||
adAccessProcesses: c.collectADAccessProcesses,
|
||||
transportQueues: c.collectTransportQueues,
|
||||
httpProxy: c.collectHTTPProxy,
|
||||
activeSync: c.collectActiveSync,
|
||||
availabilityService: c.collectAvailabilityService,
|
||||
outlookWebAccess: c.collectOWA,
|
||||
autoDiscover: c.collectAutoDiscover,
|
||||
workloadManagement: c.collectWorkloadManagementWorkloads,
|
||||
rpcClientAccess: c.collectRPC,
|
||||
mapiHttpEmsmdb: c.collectMapiHttpEmsmdb,
|
||||
}
|
||||
|
||||
errs := make([]error, len(c.config.CollectorsEnabled))
|
||||
|
||||
for i, collectorName := range c.config.CollectorsEnabled {
|
||||
errs[i] = collectorFuncs[collectorName](ch)
|
||||
}
|
||||
|
||||
return errors.Join(errs...)
|
||||
}
|
||||
|
||||
// toLabelName converts strings to lowercase and replaces all whitespaces and dots with underscores.
|
||||
func (c *Collector) toLabelName(name string) string {
|
||||
s := strings.ReplaceAll(strings.Join(strings.Fields(strings.ToLower(name)), "_"), ".", "_")
|
||||
s = strings.ReplaceAll(s, "__", "_")
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
// msToSec converts from ms to seconds.
|
||||
func (c *Collector) msToSec(t float64) float64 {
|
||||
return t / 1000
|
||||
}
|
||||
97
internal/collector/exchange/exchange_active_sync.go
Normal file
97
internal/collector/exchange/exchange_active_sync.go
Normal file
@@ -0,0 +1,97 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package exchange
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
const (
|
||||
requestsPerSec = "Requests/sec"
|
||||
pingCommandsPending = "Ping Commands Pending"
|
||||
syncCommandsPerSec = "Sync Commands/sec"
|
||||
)
|
||||
|
||||
func (c *Collector) buildActiveSync() error {
|
||||
counters := []string{
|
||||
requestsPerSec,
|
||||
pingCommandsPending,
|
||||
syncCommandsPerSec,
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
c.perfDataCollectorActiveSync, err = perfdata.NewCollector("MSExchange ActiveSync", perfdata.InstancesAll, counters)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create MSExchange ActiveSync collector: %w", err)
|
||||
}
|
||||
|
||||
c.pingCommandsPending = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "activesync_ping_cmds_pending"),
|
||||
"Number of ping commands currently pending in the queue",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.syncCommandsPerSec = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "activesync_sync_cmds_total"),
|
||||
"Number of sync commands processed per second. Clients use this command to synchronize items within a folder",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.activeSyncRequestsPerSec = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "activesync_requests_total"),
|
||||
"Num HTTP requests received from the client via ASP.NET per sec. Shows Current user load",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) collectActiveSync(ch chan<- prometheus.Metric) error {
|
||||
perfData, err := c.perfDataCollectorActiveSync.Collect()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect MSExchange ActiveSync metrics: %w", err)
|
||||
}
|
||||
|
||||
if len(perfData) == 0 {
|
||||
return fmt.Errorf("failed to collect MSExchange ActiveSync metrics: %w", types.ErrNoData)
|
||||
}
|
||||
|
||||
for _, data := range perfData {
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.activeSyncRequestsPerSec,
|
||||
prometheus.CounterValue,
|
||||
data[requestsPerSec].FirstValue,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.pingCommandsPending,
|
||||
prometheus.GaugeValue,
|
||||
data[pingCommandsPending].FirstValue,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.syncCommandsPerSec,
|
||||
prometheus.CounterValue,
|
||||
data[syncCommandsPerSec].FirstValue,
|
||||
)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
139
internal/collector/exchange/exchange_ad_access_processes.go
Normal file
139
internal/collector/exchange/exchange_ad_access_processes.go
Normal file
@@ -0,0 +1,139 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package exchange
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
const (
|
||||
ldapReadTime = "LDAP Read Time"
|
||||
ldapSearchTime = "LDAP Search Time"
|
||||
ldapWriteTime = "LDAP Write Time"
|
||||
ldapTimeoutErrorsPerSec = "LDAP Timeout Errors/sec"
|
||||
longRunningLDAPOperationsPerMin = "Long Running LDAP Operations/min"
|
||||
)
|
||||
|
||||
func (c *Collector) buildADAccessProcesses() error {
|
||||
counters := []string{
|
||||
ldapReadTime,
|
||||
ldapSearchTime,
|
||||
ldapWriteTime,
|
||||
ldapTimeoutErrorsPerSec,
|
||||
longRunningLDAPOperationsPerMin,
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
c.perfDataCollectorADAccessProcesses, err = perfdata.NewCollector("MSExchange ADAccess Processes", perfdata.InstancesAll, counters)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create MSExchange ADAccess Processes collector: %w", err)
|
||||
}
|
||||
|
||||
c.ldapReadTime = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "ldap_read_time_sec"),
|
||||
"Time (sec) to send an LDAP read request and receive a response",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.ldapSearchTime = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "ldap_search_time_sec"),
|
||||
"Time (sec) to send an LDAP search request and receive a response",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.ldapWriteTime = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "ldap_write_time_sec"),
|
||||
"Time (sec) to send an LDAP Add/Modify/Delete request and receive a response",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.ldapTimeoutErrorsPerSec = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "ldap_timeout_errors_total"),
|
||||
"Total number of LDAP timeout errors",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.longRunningLDAPOperationsPerMin = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "ldap_long_running_ops_per_sec"),
|
||||
"Long Running LDAP operations per second",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) collectADAccessProcesses(ch chan<- prometheus.Metric) error {
|
||||
perfData, err := c.perfDataCollectorADAccessProcesses.Collect()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect MSExchange ADAccess Processes metrics: %w", err)
|
||||
}
|
||||
|
||||
if len(perfData) == 0 {
|
||||
return fmt.Errorf("failed to collect MSExchange ADAccess Processes metrics: %w", types.ErrNoData)
|
||||
}
|
||||
|
||||
labelUseCount := make(map[string]int)
|
||||
|
||||
for name, data := range perfData {
|
||||
labelName := c.toLabelName(name)
|
||||
|
||||
// Since we're not including the PID suffix from the instance names in the label names, we get an occasional duplicate.
|
||||
// This seems to affect about 4 instances only of this object.
|
||||
labelUseCount[labelName]++
|
||||
if labelUseCount[labelName] > 1 {
|
||||
labelName = fmt.Sprintf("%s_%d", labelName, labelUseCount[labelName])
|
||||
}
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ldapReadTime,
|
||||
prometheus.CounterValue,
|
||||
c.msToSec(data[ldapReadTime].FirstValue),
|
||||
labelName,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ldapSearchTime,
|
||||
prometheus.CounterValue,
|
||||
c.msToSec(data[ldapSearchTime].FirstValue),
|
||||
labelName,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ldapWriteTime,
|
||||
prometheus.CounterValue,
|
||||
c.msToSec(data[ldapWriteTime].FirstValue),
|
||||
labelName,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ldapTimeoutErrorsPerSec,
|
||||
prometheus.CounterValue,
|
||||
data[ldapTimeoutErrorsPerSec].FirstValue,
|
||||
labelName,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.longRunningLDAPOperationsPerMin,
|
||||
prometheus.CounterValue,
|
||||
data[longRunningLDAPOperationsPerMin].FirstValue*60,
|
||||
labelName,
|
||||
)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
67
internal/collector/exchange/exchange_autodiscover.go
Normal file
67
internal/collector/exchange/exchange_autodiscover.go
Normal file
@@ -0,0 +1,67 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package exchange
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
func (c *Collector) buildAutoDiscover() error {
|
||||
counters := []string{
|
||||
requestsPerSec,
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
c.perfDataCollectorAutoDiscover, err = perfdata.NewCollector("MSExchange Autodiscover", perfdata.InstancesAll, counters)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create MSExchange Autodiscover collector: %w", err)
|
||||
}
|
||||
|
||||
c.autoDiscoverRequestsPerSec = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "autodiscover_requests_total"),
|
||||
"Number of autodiscover service requests processed each second",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) collectAutoDiscover(ch chan<- prometheus.Metric) error {
|
||||
perfData, err := c.perfDataCollectorAutoDiscover.Collect()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect MSExchange Autodiscover metrics: %w", err)
|
||||
}
|
||||
|
||||
if len(perfData) == 0 {
|
||||
return fmt.Errorf("failed to collect MSExchange Autodiscover metrics: %w", types.ErrNoData)
|
||||
}
|
||||
|
||||
for _, data := range perfData {
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.autoDiscoverRequestsPerSec,
|
||||
prometheus.CounterValue,
|
||||
data[requestsPerSec].FirstValue,
|
||||
)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
67
internal/collector/exchange/exchange_availability_service.go
Normal file
67
internal/collector/exchange/exchange_availability_service.go
Normal file
@@ -0,0 +1,67 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package exchange
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
func (c *Collector) buildAvailabilityService() error {
|
||||
counters := []string{
|
||||
requestsPerSec,
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
c.perfDataCollectorAvailabilityService, err = perfdata.NewCollector("MSExchange Availability Service", perfdata.InstancesAll, counters)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create MSExchange Availability Service collector: %w", err)
|
||||
}
|
||||
|
||||
c.availabilityRequestsSec = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "avail_service_requests_per_sec"),
|
||||
"Number of requests serviced per second",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) collectAvailabilityService(ch chan<- prometheus.Metric) error {
|
||||
perfData, err := c.perfDataCollectorAvailabilityService.Collect()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect MSExchange Availability Service metrics: %w", err)
|
||||
}
|
||||
|
||||
if len(perfData) == 0 {
|
||||
return fmt.Errorf("failed to collect MSExchange Availability Service metrics: %w", types.ErrNoData)
|
||||
}
|
||||
|
||||
for _, data := range perfData {
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.availabilityRequestsSec,
|
||||
prometheus.CounterValue,
|
||||
data[requestsPerSec].FirstValue,
|
||||
)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
143
internal/collector/exchange/exchange_http_proxy.go
Normal file
143
internal/collector/exchange/exchange_http_proxy.go
Normal file
@@ -0,0 +1,143 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package exchange
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
const (
|
||||
mailboxServerLocatorAverageLatency = "MailboxServerLocator Average Latency (Moving Average)"
|
||||
averageAuthenticationLatency = "Average Authentication Latency"
|
||||
averageCASProcessingLatency = "Average ClientAccess Server Processing Latency"
|
||||
mailboxServerProxyFailureRate = "Mailbox Server Proxy Failure Rate"
|
||||
outstandingProxyRequests = "Outstanding Proxy Requests"
|
||||
proxyRequestsPerSec = "Proxy Requests/Sec"
|
||||
)
|
||||
|
||||
func (c *Collector) buildHTTPProxy() error {
|
||||
counters := []string{
|
||||
mailboxServerLocatorAverageLatency,
|
||||
averageAuthenticationLatency,
|
||||
averageCASProcessingLatency,
|
||||
mailboxServerProxyFailureRate,
|
||||
outstandingProxyRequests,
|
||||
proxyRequestsPerSec,
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
c.perfDataCollectorHttpProxy, err = perfdata.NewCollector("MSExchange HttpProxy", perfdata.InstancesAll, counters)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create MSExchange HttpProxy collector: %w", err)
|
||||
}
|
||||
|
||||
c.mailboxServerLocatorAverageLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "http_proxy_mailbox_server_locator_avg_latency_sec"),
|
||||
"Average latency (sec) of MailboxServerLocator web service calls",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.averageAuthenticationLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "http_proxy_avg_auth_latency"),
|
||||
"Average time spent authenticating CAS requests over the last 200 samples",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.outstandingProxyRequests = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "http_proxy_outstanding_proxy_requests"),
|
||||
"Number of concurrent outstanding proxy requests",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.proxyRequestsPerSec = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "http_proxy_requests_total"),
|
||||
"Number of proxy requests processed each second",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.averageCASProcessingLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "http_proxy_avg_cas_processing_latency_sec"),
|
||||
"Average latency (sec) of CAS processing time over the last 200 reqs",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.mailboxServerProxyFailureRate = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "http_proxy_mailbox_proxy_failure_rate"),
|
||||
"% of failures between this CAS and MBX servers over the last 200 samples",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) collectHTTPProxy(ch chan<- prometheus.Metric) error {
|
||||
perfData, err := c.perfDataCollectorHttpProxy.Collect()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect MSExchange HttpProxy Service metrics: %w", err)
|
||||
}
|
||||
|
||||
if len(perfData) == 0 {
|
||||
return fmt.Errorf("failed to collect MSExchange HttpProxy Service metrics: %w", types.ErrNoData)
|
||||
}
|
||||
|
||||
for name, data := range perfData {
|
||||
labelName := c.toLabelName(name)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.mailboxServerLocatorAverageLatency,
|
||||
prometheus.GaugeValue,
|
||||
c.msToSec(data[mailboxServerLocatorAverageLatency].FirstValue),
|
||||
labelName,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.averageAuthenticationLatency,
|
||||
prometheus.GaugeValue,
|
||||
data[averageAuthenticationLatency].FirstValue,
|
||||
labelName,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.averageCASProcessingLatency,
|
||||
prometheus.GaugeValue,
|
||||
c.msToSec(data[averageCASProcessingLatency].FirstValue),
|
||||
labelName,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.mailboxServerProxyFailureRate,
|
||||
prometheus.GaugeValue,
|
||||
data[mailboxServerProxyFailureRate].FirstValue,
|
||||
labelName,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.outstandingProxyRequests,
|
||||
prometheus.GaugeValue,
|
||||
data[outstandingProxyRequests].FirstValue,
|
||||
labelName,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.proxyRequestsPerSec,
|
||||
prometheus.CounterValue,
|
||||
data[proxyRequestsPerSec].FirstValue,
|
||||
labelName,
|
||||
)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
71
internal/collector/exchange/exchange_mapi_http_emsmdb.go
Normal file
71
internal/collector/exchange/exchange_mapi_http_emsmdb.go
Normal file
@@ -0,0 +1,71 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package exchange
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
const (
|
||||
activeUserCount = "Active User Count"
|
||||
)
|
||||
|
||||
func (c *Collector) buildMapiHttpEmsmdb() error {
|
||||
counters := []string{
|
||||
activeUserCount,
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
c.perfDataCollectorMapiHttpEmsmdb, err = perfdata.NewCollector("MSExchange MapiHttp Emsmdb", perfdata.InstancesAll, counters)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create MSExchange MapiHttp Emsmdb: %w", err)
|
||||
}
|
||||
|
||||
c.activeUserCountMapiHttpEmsMDB = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "mapihttp_emsmdb_active_user_count"),
|
||||
"Number of unique outlook users that have shown some kind of activity in the last 2 minutes",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) collectMapiHttpEmsmdb(ch chan<- prometheus.Metric) error {
|
||||
perfData, err := c.perfDataCollectorMapiHttpEmsmdb.Collect()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect MSExchange MapiHttp Emsmdb metrics: %w", err)
|
||||
}
|
||||
|
||||
if len(perfData) == 0 {
|
||||
return fmt.Errorf("failed to collect MSExchange MapiHttp Emsmdb metrics: %w", types.ErrNoData)
|
||||
}
|
||||
|
||||
for _, data := range perfData {
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.activeUserCountMapiHttpEmsMDB,
|
||||
prometheus.GaugeValue,
|
||||
data[activeUserCount].FirstValue,
|
||||
)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
84
internal/collector/exchange/exchange_outlook_web_access.go
Normal file
84
internal/collector/exchange/exchange_outlook_web_access.go
Normal file
@@ -0,0 +1,84 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package exchange
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
const (
|
||||
currentUniqueUsers = "Current Unique Users"
|
||||
// requestsPerSec = "Requests/sec"
|
||||
)
|
||||
|
||||
func (c *Collector) buildOWA() error {
|
||||
counters := []string{
|
||||
currentUniqueUsers,
|
||||
requestsPerSec,
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
c.perfDataCollectorOWA, err = perfdata.NewCollector("MSExchange OWA", perfdata.InstancesAll, counters)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create MSExchange OWA collector: %w", err)
|
||||
}
|
||||
|
||||
c.currentUniqueUsers = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "owa_current_unique_users"),
|
||||
"Number of unique users currently logged on to Outlook Web App",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.owaRequestsPerSec = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "owa_requests_total"),
|
||||
"Number of requests handled by Outlook Web App per second",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) collectOWA(ch chan<- prometheus.Metric) error {
|
||||
perfData, err := c.perfDataCollectorOWA.Collect()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect MSExchange OWA metrics: %w", err)
|
||||
}
|
||||
|
||||
if len(perfData) == 0 {
|
||||
return fmt.Errorf("failed to collect MSExchange OWA metrics: %w", types.ErrNoData)
|
||||
}
|
||||
|
||||
for _, data := range perfData {
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.currentUniqueUsers,
|
||||
prometheus.GaugeValue,
|
||||
data[currentUniqueUsers].FirstValue,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.owaRequestsPerSec,
|
||||
prometheus.CounterValue,
|
||||
data[requestsPerSec].FirstValue,
|
||||
)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
136
internal/collector/exchange/exchange_rpc_client_access.go
Normal file
136
internal/collector/exchange/exchange_rpc_client_access.go
Normal file
@@ -0,0 +1,136 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package exchange
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
const (
|
||||
rpcAveragedLatency = "RPC Averaged Latency"
|
||||
rpcRequests = "RPC Requests"
|
||||
// activeUserCount = "Active User Count"
|
||||
connectionCount = "Connection Count"
|
||||
rpcOperationsPerSec = "RPC Operations/sec"
|
||||
userCount = "User Count"
|
||||
)
|
||||
|
||||
func (c *Collector) buildRPC() error {
|
||||
counters := []string{
|
||||
rpcAveragedLatency,
|
||||
rpcRequests,
|
||||
activeUserCount,
|
||||
connectionCount,
|
||||
rpcOperationsPerSec,
|
||||
userCount,
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
c.perfDataCollectorRpcClientAccess, err = perfdata.NewCollector("MSExchange RpcClientAccess", perfdata.InstancesAll, counters)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create MSExchange RpcClientAccess collector: %w", err)
|
||||
}
|
||||
|
||||
c.rpcAveragedLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "rpc_avg_latency_sec"),
|
||||
"The latency (sec) averaged for the past 1024 packets",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.rpcRequests = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "rpc_requests"),
|
||||
"Number of client requests currently being processed by the RPC Client Access service",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.activeUserCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "rpc_active_user_count"),
|
||||
"Number of unique users that have shown some kind of activity in the last 2 minutes",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.connectionCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "rpc_connection_count"),
|
||||
"Total number of client connections maintained",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.rpcOperationsPerSec = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "rpc_operations_total"),
|
||||
"The rate at which RPC operations occur",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.userCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "rpc_user_count"),
|
||||
"Number of users",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) collectRPC(ch chan<- prometheus.Metric) error {
|
||||
perfData, err := c.perfDataCollectorRpcClientAccess.Collect()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect MSExchange RpcClientAccess: %w", err)
|
||||
}
|
||||
|
||||
if len(perfData) == 0 {
|
||||
return fmt.Errorf("failed to collect MSExchange RpcClientAccess metrics: %w", types.ErrNoData)
|
||||
}
|
||||
|
||||
for _, data := range perfData {
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.rpcAveragedLatency,
|
||||
prometheus.GaugeValue,
|
||||
c.msToSec(data[rpcAveragedLatency].FirstValue),
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.rpcRequests,
|
||||
prometheus.GaugeValue,
|
||||
data[rpcRequests].FirstValue,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.activeUserCount,
|
||||
prometheus.GaugeValue,
|
||||
data[activeUserCount].FirstValue,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.connectionCount,
|
||||
prometheus.GaugeValue,
|
||||
data[connectionCount].FirstValue,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.rpcOperationsPerSec,
|
||||
prometheus.CounterValue,
|
||||
data[rpcOperationsPerSec].FirstValue,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.userCount,
|
||||
prometheus.GaugeValue,
|
||||
data[userCount].FirstValue,
|
||||
)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
27
internal/collector/exchange/exchange_test.go
Normal file
27
internal/collector/exchange/exchange_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package exchange_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/collector/exchange"
|
||||
"github.com/prometheus-community/windows_exporter/internal/utils/testutils"
|
||||
)
|
||||
|
||||
func BenchmarkCollector(b *testing.B) {
|
||||
testutils.FuncBenchmarkCollector(b, exchange.Name, exchange.NewWithFlags)
|
||||
}
|
||||
326
internal/collector/exchange/exchange_transport_queues.go
Normal file
326
internal/collector/exchange/exchange_transport_queues.go
Normal file
@@ -0,0 +1,326 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package exchange
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
const (
|
||||
externalActiveRemoteDeliveryQueueLength = "External Active Remote Delivery Queue Length"
|
||||
internalActiveRemoteDeliveryQueueLength = "Internal Active Remote Delivery Queue Length"
|
||||
activeMailboxDeliveryQueueLength = "Active Mailbox Delivery Queue Length"
|
||||
retryMailboxDeliveryQueueLength = "Retry Mailbox Delivery Queue Length"
|
||||
unreachableQueueLength = "Unreachable Queue Length"
|
||||
externalLargestDeliveryQueueLength = "External Largest Delivery Queue Length"
|
||||
internalLargestDeliveryQueueLength = "Internal Largest Delivery Queue Length"
|
||||
poisonQueueLength = "Poison Queue Length"
|
||||
messagesQueuedForDeliveryTotal = "Messages Queued For Delivery Total"
|
||||
messagesSubmittedTotal = "Messages Submitted Total"
|
||||
messagesDelayedTotal = "Messages Delayed Total"
|
||||
messagesCompletedDeliveryTotal = "Messages Completed Delivery Total"
|
||||
shadowQueueLength = "Shadow Queue Length"
|
||||
submissionQueueLength = "Submission Queue Length"
|
||||
delayQueueLength = "Delay Queue Length"
|
||||
itemsCompletedDeliveryTotal = "Items Completed Delivery Total"
|
||||
itemsQueuedForDeliveryExpiredTotal = "Items Queued For Delivery Expired Total"
|
||||
itemsQueuedForDeliveryTotal = "Items Queued For Delivery Total"
|
||||
itemsResubmittedTotal = "Items Resubmitted Total"
|
||||
)
|
||||
|
||||
func (c *Collector) buildTransportQueues() error {
|
||||
counters := []string{
|
||||
externalActiveRemoteDeliveryQueueLength,
|
||||
internalActiveRemoteDeliveryQueueLength,
|
||||
activeMailboxDeliveryQueueLength,
|
||||
retryMailboxDeliveryQueueLength,
|
||||
unreachableQueueLength,
|
||||
externalLargestDeliveryQueueLength,
|
||||
internalLargestDeliveryQueueLength,
|
||||
poisonQueueLength,
|
||||
messagesQueuedForDeliveryTotal,
|
||||
messagesSubmittedTotal,
|
||||
messagesDelayedTotal,
|
||||
messagesCompletedDeliveryTotal,
|
||||
shadowQueueLength,
|
||||
submissionQueueLength,
|
||||
delayQueueLength,
|
||||
itemsCompletedDeliveryTotal,
|
||||
itemsQueuedForDeliveryExpiredTotal,
|
||||
itemsQueuedForDeliveryTotal,
|
||||
itemsResubmittedTotal,
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
c.perfDataCollectorTransportQueues, err = perfdata.NewCollector("MSExchangeTransport Queues", perfdata.InstancesAll, counters)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create MSExchangeTransport Queues collector: %w", err)
|
||||
}
|
||||
|
||||
c.externalActiveRemoteDeliveryQueueLength = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "transport_queues_external_active_remote_delivery"),
|
||||
"External Active Remote Delivery Queue length",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.internalActiveRemoteDeliveryQueueLength = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "transport_queues_internal_active_remote_delivery"),
|
||||
"Internal Active Remote Delivery Queue length",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.activeMailboxDeliveryQueueLength = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "transport_queues_active_mailbox_delivery"),
|
||||
"Active Mailbox Delivery Queue length",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.retryMailboxDeliveryQueueLength = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "transport_queues_retry_mailbox_delivery"),
|
||||
"Retry Mailbox Delivery Queue length",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.unreachableQueueLength = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "transport_queues_unreachable"),
|
||||
"Unreachable Queue length",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.externalLargestDeliveryQueueLength = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "transport_queues_external_largest_delivery"),
|
||||
"External Largest Delivery Queue length",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.internalLargestDeliveryQueueLength = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "transport_queues_internal_largest_delivery"),
|
||||
"Internal Largest Delivery Queue length",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.poisonQueueLength = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "transport_queues_poison"),
|
||||
"Poison Queue length",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.messagesQueuedForDeliveryTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "transport_queues_messages_queued_for_delivery_total"),
|
||||
"Messages Queued For Delivery Total",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.messagesSubmittedTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "transport_queues_messages_submitted_total"),
|
||||
"Messages Submitted Total",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.messagesDelayedTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "transport_queues_messages_delayed_total"),
|
||||
"Messages Delayed Total",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.messagesCompletedDeliveryTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "transport_queues_messages_completed_delivery_total"),
|
||||
"Messages Completed Delivery Total",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.shadowQueueLength = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "transport_queues_shadow_queue_length"),
|
||||
"Shadow Queue Length",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.submissionQueueLength = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "transport_queues_submission_queue_length"),
|
||||
"Submission Queue Length",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.delayQueueLength = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "transport_queues_delay_queue_length"),
|
||||
"Delay Queue Length",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.itemsCompletedDeliveryTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "transport_queues_items_completed_delivery_total"),
|
||||
"Items Completed Delivery Total",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.itemsQueuedForDeliveryExpiredTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "transport_queues_items_queued_for_delivery_expired_total"),
|
||||
"Items Queued For Delivery Expired Total",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.itemsQueuedForDeliveryTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "transport_queues_items_queued_for_delivery_total"),
|
||||
"Items Queued For Delivery Total",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.itemsResubmittedTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "transport_queues_items_resubmitted_total"),
|
||||
"Items Resubmitted Total",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) collectTransportQueues(ch chan<- prometheus.Metric) error {
|
||||
perfData, err := c.perfDataCollectorTransportQueues.Collect()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect MSExchangeTransport Queues: %w", err)
|
||||
}
|
||||
|
||||
if len(perfData) == 0 {
|
||||
return fmt.Errorf("failed to collect MSExchangeTransport Queues metrics: %w", types.ErrNoData)
|
||||
}
|
||||
|
||||
for name, data := range perfData {
|
||||
labelName := c.toLabelName(name)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.externalActiveRemoteDeliveryQueueLength,
|
||||
prometheus.GaugeValue,
|
||||
data[externalActiveRemoteDeliveryQueueLength].FirstValue,
|
||||
labelName,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.internalActiveRemoteDeliveryQueueLength,
|
||||
prometheus.GaugeValue,
|
||||
data[internalActiveRemoteDeliveryQueueLength].FirstValue,
|
||||
labelName,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.activeMailboxDeliveryQueueLength,
|
||||
prometheus.GaugeValue,
|
||||
data[activeMailboxDeliveryQueueLength].FirstValue,
|
||||
labelName,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.retryMailboxDeliveryQueueLength,
|
||||
prometheus.GaugeValue,
|
||||
data[retryMailboxDeliveryQueueLength].FirstValue,
|
||||
labelName,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.unreachableQueueLength,
|
||||
prometheus.GaugeValue,
|
||||
data[unreachableQueueLength].FirstValue,
|
||||
labelName,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.externalLargestDeliveryQueueLength,
|
||||
prometheus.GaugeValue,
|
||||
data[externalLargestDeliveryQueueLength].FirstValue,
|
||||
labelName,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.internalLargestDeliveryQueueLength,
|
||||
prometheus.GaugeValue,
|
||||
data[internalLargestDeliveryQueueLength].FirstValue,
|
||||
labelName,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.poisonQueueLength,
|
||||
prometheus.GaugeValue,
|
||||
data[poisonQueueLength].FirstValue,
|
||||
labelName,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.messagesQueuedForDeliveryTotal,
|
||||
prometheus.CounterValue,
|
||||
data[messagesQueuedForDeliveryTotal].FirstValue,
|
||||
labelName,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.messagesSubmittedTotal,
|
||||
prometheus.CounterValue,
|
||||
data[messagesSubmittedTotal].FirstValue,
|
||||
labelName,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.messagesDelayedTotal,
|
||||
prometheus.CounterValue,
|
||||
data[messagesDelayedTotal].FirstValue,
|
||||
labelName,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.messagesCompletedDeliveryTotal,
|
||||
prometheus.CounterValue,
|
||||
data[messagesCompletedDeliveryTotal].FirstValue,
|
||||
labelName,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.shadowQueueLength,
|
||||
prometheus.GaugeValue,
|
||||
data[shadowQueueLength].FirstValue,
|
||||
labelName,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.submissionQueueLength,
|
||||
prometheus.GaugeValue,
|
||||
data[submissionQueueLength].FirstValue,
|
||||
labelName,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.delayQueueLength,
|
||||
prometheus.GaugeValue,
|
||||
data[delayQueueLength].FirstValue,
|
||||
labelName,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.itemsCompletedDeliveryTotal,
|
||||
prometheus.CounterValue,
|
||||
data[itemsCompletedDeliveryTotal].FirstValue,
|
||||
labelName,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.itemsQueuedForDeliveryExpiredTotal,
|
||||
prometheus.CounterValue,
|
||||
data[itemsQueuedForDeliveryExpiredTotal].FirstValue,
|
||||
labelName,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.itemsQueuedForDeliveryTotal,
|
||||
prometheus.CounterValue,
|
||||
data[itemsQueuedForDeliveryTotal].FirstValue,
|
||||
labelName,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.itemsResubmittedTotal,
|
||||
prometheus.CounterValue,
|
||||
data[itemsResubmittedTotal].FirstValue,
|
||||
labelName,
|
||||
)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
130
internal/collector/exchange/exchange_workload_management.go
Normal file
130
internal/collector/exchange/exchange_workload_management.go
Normal file
@@ -0,0 +1,130 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package exchange
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
const (
|
||||
activeTasks = "ActiveTasks"
|
||||
completedTasks = "CompletedTasks"
|
||||
queuedTasks = "QueuedTasks"
|
||||
yieldedTasks = "YieldedTasks"
|
||||
isActive = "Active"
|
||||
)
|
||||
|
||||
func (c *Collector) buildWorkloadManagementWorkloads() error {
|
||||
counters := []string{
|
||||
activeTasks,
|
||||
completedTasks,
|
||||
queuedTasks,
|
||||
yieldedTasks,
|
||||
isActive,
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
c.perfDataCollectorWorkloadManagementWorkloads, err = perfdata.NewCollector("MSExchange WorkloadManagement Workloads", perfdata.InstancesAll, counters)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create MSExchange WorkloadManagement Workloads collector: %w", err)
|
||||
}
|
||||
|
||||
c.activeTasks = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "workload_active_tasks"),
|
||||
"Number of active tasks currently running in the background for workload management",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.completedTasks = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "workload_completed_tasks"),
|
||||
"Number of workload management tasks that have been completed",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.queuedTasks = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "workload_queued_tasks"),
|
||||
"Number of workload management tasks that are currently queued up waiting to be processed",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.yieldedTasks = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "workload_yielded_tasks"),
|
||||
"The total number of tasks that have been yielded by a workload",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
c.isActive = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "workload_is_active"),
|
||||
"Active indicates whether the workload is in an active (1) or paused (0) state",
|
||||
[]string{"name"},
|
||||
nil,
|
||||
)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) collectWorkloadManagementWorkloads(ch chan<- prometheus.Metric) error {
|
||||
perfData, err := c.perfDataCollectorWorkloadManagementWorkloads.Collect()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect MSExchange WorkloadManagement Workloads: %w", err)
|
||||
}
|
||||
|
||||
if len(perfData) == 0 {
|
||||
return fmt.Errorf("failed to collect MSExchange WorkloadManagement Workloads metrics: %w", types.ErrNoData)
|
||||
}
|
||||
|
||||
for name, data := range perfData {
|
||||
labelName := c.toLabelName(name)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.activeTasks,
|
||||
prometheus.GaugeValue,
|
||||
data[activeTasks].FirstValue,
|
||||
labelName,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.completedTasks,
|
||||
prometheus.CounterValue,
|
||||
data[completedTasks].FirstValue,
|
||||
labelName,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.queuedTasks,
|
||||
prometheus.CounterValue,
|
||||
data[queuedTasks].FirstValue,
|
||||
labelName,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.yieldedTasks,
|
||||
prometheus.CounterValue,
|
||||
data[yieldedTasks].FirstValue,
|
||||
labelName,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.isActive,
|
||||
prometheus.GaugeValue,
|
||||
data[isActive].FirstValue,
|
||||
labelName,
|
||||
)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,3 +1,16 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package filetime
|
||||
@@ -12,25 +25,27 @@ import (
|
||||
|
||||
"github.com/alecthomas/kingpin/v2"
|
||||
"github.com/bmatcuk/doublestar/v4"
|
||||
"github.com/prometheus-community/windows_exporter/pkg/types"
|
||||
"github.com/prometheus-community/windows_exporter/internal/mi"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/yusufpapurcu/wmi"
|
||||
)
|
||||
|
||||
const Name = "filetime"
|
||||
|
||||
type Config struct {
|
||||
filePatterns []string
|
||||
FilePatterns []string
|
||||
}
|
||||
|
||||
//nolint:gochecknoglobals
|
||||
var ConfigDefaults = Config{
|
||||
filePatterns: []string{},
|
||||
FilePatterns: []string{},
|
||||
}
|
||||
|
||||
// A Collector is a Prometheus Collector for collecting file times.
|
||||
type Collector struct {
|
||||
config Config
|
||||
|
||||
logger *slog.Logger
|
||||
fileMTime *prometheus.Desc
|
||||
}
|
||||
|
||||
@@ -39,8 +54,8 @@ func New(config *Config) *Collector {
|
||||
config = &ConfigDefaults
|
||||
}
|
||||
|
||||
if config.filePatterns == nil {
|
||||
config.filePatterns = ConfigDefaults.filePatterns
|
||||
if config.FilePatterns == nil {
|
||||
config.FilePatterns = ConfigDefaults.FilePatterns
|
||||
}
|
||||
|
||||
c := &Collector{
|
||||
@@ -54,18 +69,18 @@ func NewWithFlags(app *kingpin.Application) *Collector {
|
||||
c := &Collector{
|
||||
config: ConfigDefaults,
|
||||
}
|
||||
c.config.filePatterns = make([]string, 0)
|
||||
c.config.FilePatterns = make([]string, 0)
|
||||
|
||||
var filePatterns string
|
||||
|
||||
app.Flag(
|
||||
"collectors.filetime.file-patterns",
|
||||
"collector.filetime.file-patterns",
|
||||
"Comma-separated list of file patterns. Each pattern is a glob pattern that can contain `*`, `?`, and `**` (recursive). See https://github.com/bmatcuk/doublestar#patterns",
|
||||
).Default(strings.Join(ConfigDefaults.filePatterns, ",")).StringVar(&filePatterns)
|
||||
).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), ",")
|
||||
c.config.FilePatterns = strings.Split(filepath.ToSlash(filePatterns), ",")
|
||||
|
||||
return nil
|
||||
})
|
||||
@@ -77,18 +92,14 @@ 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 {
|
||||
func (c *Collector) Close() 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),
|
||||
)
|
||||
func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
|
||||
c.logger = logger.With(slog.String("collector", Name))
|
||||
|
||||
c.logger.Info("filetime collector is in an experimental state! It may subject to change.")
|
||||
|
||||
c.fileMTime = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "mtime_timestamp_seconds"),
|
||||
@@ -97,7 +108,7 @@ func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
|
||||
nil,
|
||||
)
|
||||
|
||||
for _, filePattern := range c.config.filePatterns {
|
||||
for _, filePattern := range c.config.FilePatterns {
|
||||
basePath, pattern := doublestar.SplitPattern(filePattern)
|
||||
|
||||
_, err := doublestar.Glob(os.DirFS(basePath), pattern, doublestar.WithFilesOnly())
|
||||
@@ -111,24 +122,17 @@ func (c *Collector) Build(logger *slog.Logger, _ *wmi.Client) error {
|
||||
|
||||
// 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 {
|
||||
func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
|
||||
wg := sync.WaitGroup{}
|
||||
|
||||
for _, filePattern := range c.config.filePatterns {
|
||||
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",
|
||||
if err := c.collectGlobFilePath(ch, filePattern); err != nil {
|
||||
c.logger.Error("failed collecting metrics for filepath",
|
||||
slog.String("filepath", filePattern),
|
||||
slog.Any("err", err),
|
||||
)
|
||||
@@ -141,7 +145,7 @@ func (c *Collector) collectGlob(logger *slog.Logger, ch chan<- prometheus.Metric
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) collectGlobFilePath(logger *slog.Logger, ch chan<- prometheus.Metric, filePattern string) error {
|
||||
func (c *Collector) collectGlobFilePath(ch chan<- prometheus.Metric, filePattern string) error {
|
||||
basePath, pattern := doublestar.SplitPattern(filePattern)
|
||||
basePathFS := os.DirFS(basePath)
|
||||
|
||||
@@ -155,7 +159,7 @@ func (c *Collector) collectGlobFilePath(logger *slog.Logger, ch chan<- prometheu
|
||||
|
||||
fileInfo, err := os.Stat(filePath)
|
||||
if err != nil {
|
||||
logger.Warn("failed to state file",
|
||||
c.logger.Warn("failed to state file",
|
||||
slog.String("file", filePath),
|
||||
slog.Any("err", err),
|
||||
)
|
||||
33
internal/collector/filetime/filetime_test.go
Normal file
33
internal/collector/filetime/filetime_test.go
Normal file
@@ -0,0 +1,33 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package filetime_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/collector/filetime"
|
||||
"github.com/prometheus-community/windows_exporter/internal/utils/testutils"
|
||||
)
|
||||
|
||||
func BenchmarkCollector(b *testing.B) {
|
||||
testutils.FuncBenchmarkCollector(b, filetime.Name, filetime.NewWithFlags)
|
||||
}
|
||||
|
||||
func TestCollector(t *testing.T) {
|
||||
testutils.TestCollector(t, filetime.New, &filetime.Config{
|
||||
FilePatterns: []string{"*.*"},
|
||||
})
|
||||
}
|
||||
@@ -1,27 +1,43 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package fsrmquota
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
|
||||
"github.com/alecthomas/kingpin/v2"
|
||||
"github.com/prometheus-community/windows_exporter/pkg/types"
|
||||
"github.com/prometheus-community/windows_exporter/pkg/utils"
|
||||
"github.com/prometheus-community/windows_exporter/internal/mi"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus-community/windows_exporter/internal/utils"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/yusufpapurcu/wmi"
|
||||
)
|
||||
|
||||
const Name = "fsrmquota"
|
||||
|
||||
type Config struct{}
|
||||
|
||||
//nolint:gochecknoglobals
|
||||
var ConfigDefaults = Config{}
|
||||
|
||||
type Collector struct {
|
||||
config Config
|
||||
wmiClient *wmi.Client
|
||||
miSession *mi.Session
|
||||
miQuery mi.Query
|
||||
|
||||
quotasCount *prometheus.Desc
|
||||
peakUsage *prometheus.Desc
|
||||
@@ -55,20 +71,22 @@ 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 {
|
||||
func (c *Collector) Close() 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")
|
||||
func (c *Collector) Build(_ *slog.Logger, miSession *mi.Session) error {
|
||||
if miSession == nil {
|
||||
return errors.New("miSession is nil")
|
||||
}
|
||||
|
||||
c.wmiClient = wmiClient
|
||||
miQuery, err := mi.NewQuery("SELECT * FROM MSFT_FSRMQuota")
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create WMI query: %w", err)
|
||||
}
|
||||
|
||||
c.miQuery = miQuery
|
||||
c.miSession = miSession
|
||||
|
||||
c.quotasCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "count"),
|
||||
@@ -125,19 +143,9 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
|
||||
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 fsrmquota metrics",
|
||||
slog.Any("err", err),
|
||||
)
|
||||
|
||||
return err
|
||||
var dst []msftFSRMQuota
|
||||
if err := c.miSession.Query(&dst, mi.NamespaceRootWindowsFSRM, c.miQuery); err != nil {
|
||||
return fmt.Errorf("WMI query failed: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -145,30 +153,28 @@ func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan
|
||||
|
||||
// MSFT_FSRMQuota docs:
|
||||
// https://docs.microsoft.com/en-us/previous-versions/windows/desktop/fsrm/msft-fsrmquota
|
||||
type MSFT_FSRMQuota struct {
|
||||
Name string
|
||||
|
||||
Path string
|
||||
PeakUsage uint64
|
||||
Size uint64
|
||||
Usage uint64
|
||||
Description string
|
||||
Template string
|
||||
// Threshold string
|
||||
Disabled bool
|
||||
MatchesTemplate bool
|
||||
SoftLimit bool
|
||||
type msftFSRMQuota struct {
|
||||
Path string `mi:"Path"`
|
||||
PeakUsage uint64 `mi:"PeakUsage"`
|
||||
Size uint64 `mi:"Size"`
|
||||
Usage uint64 `mi:"Usage"`
|
||||
Description string `mi:"Description"`
|
||||
Template string `mi:"Template"`
|
||||
Disabled bool `mi:"Disabled"`
|
||||
MatchesTemplate bool `mi:"MatchesTemplate"`
|
||||
SoftLimit bool `mi:"SoftLimit"`
|
||||
}
|
||||
|
||||
func (c *Collector) collect(ch chan<- prometheus.Metric) error {
|
||||
var dst []MSFT_FSRMQuota
|
||||
// Collect sends the metric values for each metric
|
||||
// to the provided prometheus Metric channel.
|
||||
func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
|
||||
var dst []msftFSRMQuota
|
||||
if err := c.miSession.Query(&dst, mi.NamespaceRootWindowsFSRM, c.miQuery); err != nil {
|
||||
return fmt.Errorf("WMI query failed: %w", err)
|
||||
}
|
||||
|
||||
var count int
|
||||
|
||||
if err := c.wmiClient.Query("SELECT * FROM MSFT_FSRMQuota", &dst, nil, "root/microsoft/windows/fsrm"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, quota := range dst {
|
||||
count++
|
||||
path := quota.Path
|
||||
27
internal/collector/fsrmquota/fsrmquota_test.go
Normal file
27
internal/collector/fsrmquota/fsrmquota_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package fsrmquota_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/collector/fsrmquota"
|
||||
"github.com/prometheus-community/windows_exporter/internal/utils/testutils"
|
||||
)
|
||||
|
||||
func BenchmarkCollector(b *testing.B) {
|
||||
testutils.FuncBenchmarkCollector(b, fsrmquota.Name, fsrmquota.NewWithFlags)
|
||||
}
|
||||
304
internal/collector/hyperv/hyperv.go
Normal file
304
internal/collector/hyperv/hyperv.go
Normal file
@@ -0,0 +1,304 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package hyperv
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/alecthomas/kingpin/v2"
|
||||
"github.com/prometheus-community/windows_exporter/internal/mi"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
const (
|
||||
Name = "hyperv"
|
||||
|
||||
subCollectorDataStore = "datastore"
|
||||
subCollectorDynamicMemoryBalancer = "dynamic_memory_balancer"
|
||||
subCollectorDynamicMemoryVM = "dynamic_memory_vm"
|
||||
subCollectorHypervisorLogicalProcessor = "hypervisor_logical_processor"
|
||||
subCollectorHypervisorRootPartition = "hypervisor_root_partition"
|
||||
subCollectorHypervisorRootVirtualProcessor = "hypervisor_root_virtual_processor"
|
||||
subCollectorHypervisorVirtualProcessor = "hypervisor_virtual_processor"
|
||||
subCollectorLegacyNetworkAdapter = "legacy_network_adapter"
|
||||
subCollectorVirtualMachineHealthSummary = "virtual_machine_health_summary"
|
||||
subCollectorVirtualMachineVidPartition = "virtual_machine_vid_partition"
|
||||
subCollectorVirtualNetworkAdapter = "virtual_network_adapter"
|
||||
subCollectorVirtualNetworkAdapterDropReasons = "virtual_network_adapter_drop_reasons"
|
||||
subCollectorVirtualSMB = "virtual_smb"
|
||||
subCollectorVirtualStorageDevice = "virtual_storage_device"
|
||||
subCollectorVirtualSwitch = "virtual_switch"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
CollectorsEnabled []string `yaml:"collectors_enabled"`
|
||||
}
|
||||
|
||||
//nolint:gochecknoglobals
|
||||
var ConfigDefaults = Config{
|
||||
CollectorsEnabled: []string{
|
||||
subCollectorDataStore,
|
||||
subCollectorDynamicMemoryBalancer,
|
||||
subCollectorDynamicMemoryVM,
|
||||
subCollectorHypervisorLogicalProcessor,
|
||||
subCollectorHypervisorRootPartition,
|
||||
subCollectorHypervisorRootVirtualProcessor,
|
||||
subCollectorHypervisorVirtualProcessor,
|
||||
subCollectorLegacyNetworkAdapter,
|
||||
subCollectorVirtualMachineHealthSummary,
|
||||
subCollectorVirtualMachineVidPartition,
|
||||
subCollectorVirtualNetworkAdapter,
|
||||
subCollectorVirtualNetworkAdapterDropReasons,
|
||||
subCollectorVirtualSMB,
|
||||
subCollectorVirtualStorageDevice,
|
||||
subCollectorVirtualSwitch,
|
||||
},
|
||||
}
|
||||
|
||||
// Collector is a Prometheus Collector for hyper-v.
|
||||
type Collector struct {
|
||||
config Config
|
||||
|
||||
collectorFns []func(ch chan<- prometheus.Metric) error
|
||||
closeFns []func()
|
||||
|
||||
collectorDataStore
|
||||
collectorDynamicMemoryBalancer
|
||||
collectorDynamicMemoryVM
|
||||
collectorHypervisorLogicalProcessor
|
||||
collectorHypervisorRootPartition
|
||||
collectorHypervisorRootVirtualProcessor
|
||||
collectorHypervisorVirtualProcessor
|
||||
collectorLegacyNetworkAdapter
|
||||
collectorVirtualMachineHealthSummary
|
||||
collectorVirtualMachineVidPartition
|
||||
collectorVirtualNetworkAdapter
|
||||
collectorVirtualNetworkAdapterDropReasons
|
||||
collectorVirtualSMB
|
||||
collectorVirtualStorageDevice
|
||||
collectorVirtualSwitch
|
||||
}
|
||||
|
||||
func New(config *Config) *Collector {
|
||||
if config == nil {
|
||||
config = &ConfigDefaults
|
||||
}
|
||||
|
||||
if config.CollectorsEnabled == nil {
|
||||
config.CollectorsEnabled = ConfigDefaults.CollectorsEnabled
|
||||
}
|
||||
|
||||
c := &Collector{
|
||||
config: *config,
|
||||
}
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
func NewWithFlags(app *kingpin.Application) *Collector {
|
||||
c := &Collector{
|
||||
config: ConfigDefaults,
|
||||
}
|
||||
c.config.CollectorsEnabled = make([]string, 0)
|
||||
|
||||
var collectorsEnabled string
|
||||
|
||||
app.Flag(
|
||||
"collector.hyperv.enabled",
|
||||
"Comma-separated list of collectors to use.",
|
||||
).Default(strings.Join(ConfigDefaults.CollectorsEnabled, ",")).StringVar(&collectorsEnabled)
|
||||
|
||||
app.Action(func(*kingpin.ParseContext) error {
|
||||
c.config.CollectorsEnabled = strings.Split(collectorsEnabled, ",")
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
func (c *Collector) GetName() string {
|
||||
return Name
|
||||
}
|
||||
|
||||
func (c *Collector) Close() error {
|
||||
for _, fn := range c.closeFns {
|
||||
fn()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
|
||||
c.collectorFns = make([]func(ch chan<- prometheus.Metric) error, 0, len(c.config.CollectorsEnabled))
|
||||
c.closeFns = make([]func(), 0, len(c.config.CollectorsEnabled))
|
||||
|
||||
if len(c.config.CollectorsEnabled) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
version := windows.RtlGetVersion()
|
||||
|
||||
subCollectors := map[string]struct {
|
||||
build func() error
|
||||
collect func(ch chan<- prometheus.Metric) error
|
||||
close func()
|
||||
minBuildNumber uint32
|
||||
}{
|
||||
subCollectorDataStore: {
|
||||
build: c.buildDataStore,
|
||||
collect: c.collectDataStore,
|
||||
close: c.perfDataCollectorDataStore.Close,
|
||||
minBuildNumber: types.BuildNumberWindowsServer2022,
|
||||
},
|
||||
subCollectorDynamicMemoryBalancer: {
|
||||
build: c.buildDynamicMemoryBalancer,
|
||||
collect: c.collectDynamicMemoryBalancer,
|
||||
close: c.perfDataCollectorDynamicMemoryBalancer.Close,
|
||||
},
|
||||
subCollectorDynamicMemoryVM: {
|
||||
build: c.buildDynamicMemoryVM,
|
||||
collect: c.collectDynamicMemoryVM,
|
||||
close: c.perfDataCollectorDynamicMemoryVM.Close,
|
||||
},
|
||||
subCollectorHypervisorLogicalProcessor: {
|
||||
build: c.buildHypervisorLogicalProcessor,
|
||||
collect: c.collectHypervisorLogicalProcessor,
|
||||
close: c.perfDataCollectorHypervisorLogicalProcessor.Close,
|
||||
},
|
||||
subCollectorHypervisorRootPartition: {
|
||||
build: c.buildHypervisorRootPartition,
|
||||
collect: c.collectHypervisorRootPartition,
|
||||
close: c.perfDataCollectorHypervisorRootPartition.Close,
|
||||
},
|
||||
subCollectorHypervisorRootVirtualProcessor: {
|
||||
build: c.buildHypervisorRootVirtualProcessor,
|
||||
collect: c.collectHypervisorRootVirtualProcessor,
|
||||
close: c.perfDataCollectorHypervisorRootVirtualProcessor.Close,
|
||||
},
|
||||
subCollectorHypervisorVirtualProcessor: {
|
||||
build: c.buildHypervisorVirtualProcessor,
|
||||
collect: c.collectHypervisorVirtualProcessor,
|
||||
close: c.perfDataCollectorHypervisorVirtualProcessor.Close,
|
||||
},
|
||||
subCollectorLegacyNetworkAdapter: {
|
||||
build: c.buildLegacyNetworkAdapter,
|
||||
collect: c.collectLegacyNetworkAdapter,
|
||||
close: c.perfDataCollectorLegacyNetworkAdapter.Close,
|
||||
},
|
||||
subCollectorVirtualMachineHealthSummary: {
|
||||
build: c.buildVirtualMachineHealthSummary,
|
||||
collect: c.collectVirtualMachineHealthSummary,
|
||||
close: c.perfDataCollectorVirtualMachineHealthSummary.Close,
|
||||
},
|
||||
subCollectorVirtualMachineVidPartition: {
|
||||
build: c.buildVirtualMachineVidPartition,
|
||||
collect: c.collectVirtualMachineVidPartition,
|
||||
close: c.perfDataCollectorVirtualMachineVidPartition.Close,
|
||||
},
|
||||
subCollectorVirtualNetworkAdapter: {
|
||||
build: c.buildVirtualNetworkAdapter,
|
||||
collect: c.collectVirtualNetworkAdapter,
|
||||
close: c.perfDataCollectorVirtualNetworkAdapter.Close,
|
||||
},
|
||||
subCollectorVirtualNetworkAdapterDropReasons: {
|
||||
build: c.buildVirtualNetworkAdapterDropReasons,
|
||||
collect: c.collectVirtualNetworkAdapterDropReasons,
|
||||
close: c.perfDataCollectorVirtualNetworkAdapterDropReasons.Close,
|
||||
},
|
||||
subCollectorVirtualSMB: {
|
||||
build: c.buildVirtualSMB,
|
||||
collect: c.collectVirtualSMB,
|
||||
close: c.perfDataCollectorVirtualSMB.Close,
|
||||
},
|
||||
subCollectorVirtualStorageDevice: {
|
||||
build: c.buildVirtualStorageDevice,
|
||||
collect: c.collectVirtualStorageDevice,
|
||||
close: c.perfDataCollectorVirtualStorageDevice.Close,
|
||||
},
|
||||
subCollectorVirtualSwitch: {
|
||||
build: c.buildVirtualSwitch,
|
||||
collect: c.collectVirtualSwitch,
|
||||
close: c.perfDataCollectorVirtualSwitch.Close,
|
||||
},
|
||||
}
|
||||
|
||||
// Result must order, to prevent test failures.
|
||||
sort.Strings(c.config.CollectorsEnabled)
|
||||
|
||||
errs := make([]error, 0, len(c.config.CollectorsEnabled))
|
||||
|
||||
for _, name := range c.config.CollectorsEnabled {
|
||||
if _, ok := subCollectors[name]; !ok {
|
||||
return fmt.Errorf("unknown collector: %s", name)
|
||||
}
|
||||
|
||||
if version.BuildNumber < subCollectors[name].minBuildNumber {
|
||||
errs = append(errs, fmt.Errorf("collector %s requires Windows Server 2022 or newer", name))
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
if err := subCollectors[name].build(); err != nil {
|
||||
errs = append(errs, fmt.Errorf("failed to build %s collector: %w", name, err))
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
c.collectorFns = append(c.collectorFns, subCollectors[name].collect)
|
||||
c.closeFns = append(c.closeFns, subCollectors[name].close)
|
||||
}
|
||||
|
||||
return errors.Join(errs...)
|
||||
}
|
||||
|
||||
// Collect sends the metric values for each metric
|
||||
// to the provided prometheus Metric channel.
|
||||
func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
|
||||
errCh := make(chan error, len(c.collectorFns))
|
||||
errs := make([]error, 0, len(c.collectorFns))
|
||||
|
||||
wg := sync.WaitGroup{}
|
||||
|
||||
for _, fn := range c.collectorFns {
|
||||
wg.Add(1)
|
||||
|
||||
go func(fn func(ch chan<- prometheus.Metric) error) {
|
||||
defer wg.Done()
|
||||
|
||||
if err := fn(ch); err != nil {
|
||||
errCh <- err
|
||||
}
|
||||
}(fn)
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
|
||||
close(errCh)
|
||||
|
||||
for err := range errCh {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
|
||||
return errors.Join(errs...)
|
||||
}
|
||||
794
internal/collector/hyperv/hyperv_datastore.go
Normal file
794
internal/collector/hyperv/hyperv_datastore.go
Normal file
@@ -0,0 +1,794 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package hyperv
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
// collectorDataStore Hyper-V DataStore metrics
|
||||
type collectorDataStore struct {
|
||||
perfDataCollectorDataStore *perfdata.Collector
|
||||
|
||||
dataStoreFragmentationRatio *prometheus.Desc // \Hyper-V DataStore(*)\Fragmentation ratio
|
||||
dataStoreSectorSize *prometheus.Desc // \Hyper-V DataStore(*)\Sector size
|
||||
dataStoreDataAlignment *prometheus.Desc // \Hyper-V DataStore(*)\Data alignment
|
||||
dataStoreCurrentReplayLogSize *prometheus.Desc // \Hyper-V DataStore(*)\Current replay logSize
|
||||
dataStoreAvailableEntries *prometheus.Desc // \Hyper-V DataStore(*)\Number of available entries inside object tables
|
||||
dataStoreEmptyEntries *prometheus.Desc // \Hyper-V DataStore(*)\Number of empty entries inside object tables
|
||||
dataStoreFreeBytes *prometheus.Desc // \Hyper-V DataStore(*)\Number of free bytes inside key tables
|
||||
dataStoreDataEnd *prometheus.Desc // \Hyper-V DataStore(*)\Data end
|
||||
dataStoreFileObjects *prometheus.Desc // \Hyper-V DataStore(*)\Number of file objects
|
||||
dataStoreObjectTables *prometheus.Desc // \Hyper-V DataStore(*)\Number of object tables
|
||||
dataStoreKeyTables *prometheus.Desc // \Hyper-V DataStore(*)\Number of key tables
|
||||
dataStoreFileDataSize *prometheus.Desc // \Hyper-V DataStore(*)\File data size in bytes
|
||||
dataStoreTableDataSize *prometheus.Desc // \Hyper-V DataStore(*)\Table data size in bytes
|
||||
dataStoreNamesSize *prometheus.Desc // \Hyper-V DataStore(*)\Names size in bytes
|
||||
dataStoreNumberOfKeys *prometheus.Desc // \Hyper-V DataStore(*)\Number of keys
|
||||
dataStoreReconnectLatencyMicro *prometheus.Desc // \Hyper-V DataStore(*)\Reconnect latency microseconds
|
||||
dataStoreDisconnectCount *prometheus.Desc // \Hyper-V DataStore(*)\Disconnect count
|
||||
dataStoreWriteToFileByteLatency *prometheus.Desc // \Hyper-V DataStore(*)\Write to file byte latency microseconds
|
||||
dataStoreWriteToFileByteCount *prometheus.Desc // \Hyper-V DataStore(*)\Write to file byte count
|
||||
dataStoreWriteToFileCount *prometheus.Desc // \Hyper-V DataStore(*)\Write to file count
|
||||
dataStoreReadFromFileByteLatency *prometheus.Desc // \Hyper-V DataStore(*)\Read from file byte latency microseconds
|
||||
dataStoreReadFromFileByteCount *prometheus.Desc // \Hyper-V DataStore(*)\Read from file byte count
|
||||
dataStoreReadFromFileCount *prometheus.Desc // \Hyper-V DataStore(*)\Read from file count
|
||||
dataStoreWriteToStorageByteLatency *prometheus.Desc // \Hyper-V DataStore(*)\Write to storage byte latency microseconds
|
||||
dataStoreWriteToStorageByteCount *prometheus.Desc // \Hyper-V DataStore(*)\Write to storage byte count
|
||||
dataStoreWriteToStorageCount *prometheus.Desc // \Hyper-V DataStore(*)\Write to storage count
|
||||
dataStoreReadFromStorageByteLatency *prometheus.Desc // \Hyper-V DataStore(*)\Read from storage byte latency microseconds
|
||||
dataStoreReadFromStorageByteCount *prometheus.Desc // \Hyper-V DataStore(*)\Read from storage byte count
|
||||
dataStoreReadFromStorageCount *prometheus.Desc // \Hyper-V DataStore(*)\Read from storage count
|
||||
dataStoreCommitByteLatency *prometheus.Desc // \Hyper-V DataStore(*)\Commit byte latency microseconds
|
||||
dataStoreCommitByteCount *prometheus.Desc // \Hyper-V DataStore(*)\Commit byte count
|
||||
dataStoreCommitCount *prometheus.Desc // \Hyper-V DataStore(*)\Commit count
|
||||
dataStoreCacheUpdateOperationLatency *prometheus.Desc // \Hyper-V DataStore(*)\Cache update operation latency microseconds
|
||||
dataStoreCacheUpdateOperationCount *prometheus.Desc // \Hyper-V DataStore(*)\Cache update operation count
|
||||
dataStoreCommitOperationLatency *prometheus.Desc // \Hyper-V DataStore(*)\Commit operation latency microseconds
|
||||
dataStoreCommitOperationCount *prometheus.Desc // \Hyper-V DataStore(*)\Commit operation count
|
||||
dataStoreCompactOperationLatency *prometheus.Desc // \Hyper-V DataStore(*)\Compact operation latency microseconds
|
||||
dataStoreCompactOperationCount *prometheus.Desc // \Hyper-V DataStore(*)\Compact operation count
|
||||
dataStoreLoadFileOperationLatency *prometheus.Desc // \Hyper-V DataStore(*)\Load file operation latency microseconds
|
||||
dataStoreLoadFileOperationCount *prometheus.Desc // \Hyper-V DataStore(*)\Load file operation count
|
||||
dataStoreRemoveOperationLatency *prometheus.Desc // \Hyper-V DataStore(*)\Remove operation latency microseconds
|
||||
dataStoreRemoveOperationCount *prometheus.Desc // \Hyper-V DataStore(*)\Remove operation count
|
||||
dataStoreQuerySizeOperationLatency *prometheus.Desc // \Hyper-V DataStore(*)\Query size operation latency microseconds
|
||||
dataStoreQuerySizeOperationCount *prometheus.Desc // \Hyper-V DataStore(*)\Query size operation count
|
||||
dataStoreSetOperationLatencyMicro *prometheus.Desc // \Hyper-V DataStore(*)\Set operation latency microseconds
|
||||
dataStoreSetOperationCount *prometheus.Desc // \Hyper-V DataStore(*)\Set operation count
|
||||
}
|
||||
|
||||
const (
|
||||
// Hyper-V DataStore metrics
|
||||
dataStoreFragmentationRatio = "Fragmentation ratio"
|
||||
dataStoreSectorSize = "Sector size"
|
||||
dataStoreDataAlignment = "Data alignment"
|
||||
dataStoreCurrentReplayLogSize = "Current replay logSize"
|
||||
dataStoreAvailableEntries = "Number of available entries inside object tables"
|
||||
dataStoreEmptyEntries = "Number of empty entries inside object tables"
|
||||
dataStoreFreeBytes = "Number of free bytes inside key tables"
|
||||
dataStoreDataEnd = "Data end"
|
||||
dataStoreFileObjects = "Number of file objects"
|
||||
dataStoreObjectTables = "Number of object tables"
|
||||
dataStoreKeyTables = "Number of key tables"
|
||||
dataStoreFileDataSize = "File data size in bytes"
|
||||
dataStoreTableDataSize = "Table data size in bytes"
|
||||
dataStoreNamesSize = "Names size in bytes"
|
||||
dataStoreNumberOfKeys = "Number of keys"
|
||||
dataStoreReconnectLatencyMicro = "Reconnect latency microseconds"
|
||||
dataStoreDisconnectCount = "Disconnect count"
|
||||
dataStoreWriteToFileByteLatency = "Write to file byte latency microseconds"
|
||||
dataStoreWriteToFileByteCount = "Write to file byte count"
|
||||
dataStoreWriteToFileCount = "Write to file count"
|
||||
dataStoreReadFromFileByteLatency = "Read from file byte latency microseconds"
|
||||
dataStoreReadFromFileByteCount = "Read from file byte count"
|
||||
dataStoreReadFromFileCount = "Read from file count"
|
||||
dataStoreWriteToStorageByteLatency = "Write to storage byte latency microseconds"
|
||||
dataStoreWriteToStorageByteCount = "Write to storage byte count"
|
||||
dataStoreWriteToStorageCount = "Write to storage count"
|
||||
dataStoreReadFromStorageByteLatency = "Read from storage byte latency microseconds"
|
||||
dataStoreReadFromStorageByteCount = "Read from storage byte count"
|
||||
dataStoreReadFromStorageCount = "Read from storage count"
|
||||
dataStoreCommitByteLatency = "Commit byte latency microseconds"
|
||||
dataStoreCommitByteCount = "Commit byte count"
|
||||
dataStoreCommitCount = "Commit count"
|
||||
dataStoreCacheUpdateOperationLatency = "Cache update operation latency microseconds"
|
||||
dataStoreCacheUpdateOperationCount = "Cache update operation count"
|
||||
dataStoreCommitOperationLatency = "Commit operation latency microseconds"
|
||||
dataStoreCommitOperationCount = "Commit operation count"
|
||||
dataStoreCompactOperationLatency = "Compact operation latency microseconds"
|
||||
dataStoreCompactOperationCount = "Compact operation count"
|
||||
dataStoreLoadFileOperationLatency = "Load file operation latency microseconds"
|
||||
dataStoreLoadFileOperationCount = "Load file operation count"
|
||||
dataStoreRemoveOperationLatency = "Remove operation latency microseconds"
|
||||
dataStoreRemoveOperationCount = "Remove operation count"
|
||||
dataStoreQuerySizeOperationLatency = "Query size operation latency microseconds"
|
||||
dataStoreQuerySizeOperationCount = "Query size operation count"
|
||||
dataStoreSetOperationLatencyMicro = "Set operation latency microseconds"
|
||||
dataStoreSetOperationCount = "Set operation count"
|
||||
)
|
||||
|
||||
func (c *Collector) buildDataStore() error {
|
||||
var err error
|
||||
|
||||
c.perfDataCollectorDataStore, err = perfdata.NewCollector("Hyper-V DataStore", perfdata.InstancesAll, []string{
|
||||
dataStoreFragmentationRatio,
|
||||
dataStoreSectorSize,
|
||||
dataStoreDataAlignment,
|
||||
dataStoreCurrentReplayLogSize,
|
||||
dataStoreAvailableEntries,
|
||||
dataStoreEmptyEntries,
|
||||
dataStoreFreeBytes,
|
||||
dataStoreDataEnd,
|
||||
dataStoreFileObjects,
|
||||
dataStoreObjectTables,
|
||||
dataStoreKeyTables,
|
||||
dataStoreFileDataSize,
|
||||
dataStoreTableDataSize,
|
||||
dataStoreNamesSize,
|
||||
dataStoreNumberOfKeys,
|
||||
dataStoreReconnectLatencyMicro,
|
||||
dataStoreDisconnectCount,
|
||||
dataStoreWriteToFileByteLatency,
|
||||
dataStoreWriteToFileByteCount,
|
||||
dataStoreWriteToFileCount,
|
||||
dataStoreReadFromFileByteLatency,
|
||||
dataStoreReadFromFileByteCount,
|
||||
dataStoreReadFromFileCount,
|
||||
dataStoreWriteToStorageByteLatency,
|
||||
dataStoreWriteToStorageByteCount,
|
||||
dataStoreWriteToStorageCount,
|
||||
dataStoreReadFromStorageByteLatency,
|
||||
dataStoreReadFromStorageByteCount,
|
||||
dataStoreReadFromStorageCount,
|
||||
dataStoreCommitByteLatency,
|
||||
dataStoreCommitByteCount,
|
||||
dataStoreCommitCount,
|
||||
dataStoreCacheUpdateOperationLatency,
|
||||
dataStoreCacheUpdateOperationCount,
|
||||
dataStoreCommitOperationLatency,
|
||||
dataStoreCommitOperationCount,
|
||||
dataStoreCompactOperationLatency,
|
||||
dataStoreCompactOperationCount,
|
||||
dataStoreLoadFileOperationLatency,
|
||||
dataStoreLoadFileOperationCount,
|
||||
dataStoreRemoveOperationLatency,
|
||||
dataStoreRemoveOperationCount,
|
||||
dataStoreQuerySizeOperationLatency,
|
||||
dataStoreQuerySizeOperationCount,
|
||||
dataStoreSetOperationLatencyMicro,
|
||||
dataStoreSetOperationCount,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create Hyper-V DataStore collector: %w", err)
|
||||
}
|
||||
|
||||
c.dataStoreFragmentationRatio = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_fragmentation_ratio"),
|
||||
"Represents the fragmentation ratio of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreSectorSize = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_sector_size_bytes"),
|
||||
"Represents the sector size of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreDataAlignment = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_data_alignment_bytes"),
|
||||
"Represents the data alignment of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreCurrentReplayLogSize = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_current_replay_log_size_bytes"),
|
||||
"Represents the current replay log size of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreAvailableEntries = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_available_entries"),
|
||||
"Represents the number of available entries inside object tables.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreEmptyEntries = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_empty_entries"),
|
||||
"Represents the number of empty entries inside object tables.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreFreeBytes = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_free_bytes"),
|
||||
"Represents the number of free bytes inside key tables.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreDataEnd = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_data_end_bytes"),
|
||||
"Represents the data end of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreFileObjects = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_file_objects"),
|
||||
"Represents the number of file objects in the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreObjectTables = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_object_tables"),
|
||||
"Represents the number of object tables in the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreKeyTables = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_key_tables"),
|
||||
"Represents the number of key tables in the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreFileDataSize = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_file_data_size_bytes"),
|
||||
"Represents the file data size in bytes of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreTableDataSize = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_table_data_size_bytes"),
|
||||
"Represents the table data size in bytes of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreNamesSize = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_names_size_bytes"),
|
||||
"Represents the names size in bytes of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreNumberOfKeys = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_number_of_keys"),
|
||||
"Represents the number of keys in the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreReconnectLatencyMicro = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_reconnect_latency_microseconds"),
|
||||
"Represents the reconnect latency in microseconds of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreDisconnectCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_disconnect_count"),
|
||||
"Represents the disconnect count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreWriteToFileByteLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_write_to_file_byte_latency_microseconds"),
|
||||
"Represents the write to file byte latency in microseconds of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreWriteToFileByteCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_write_to_file_byte_count"),
|
||||
"Represents the write to file byte count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreWriteToFileCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_write_to_file_count"),
|
||||
"Represents the write to file count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreReadFromFileByteLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_read_from_file_byte_latency_microseconds"),
|
||||
"Represents the read from file byte latency in microseconds of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreReadFromFileByteCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_read_from_file_byte_count"),
|
||||
"Represents the read from file byte count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreReadFromFileCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_read_from_file_count"),
|
||||
"Represents the read from file count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreWriteToStorageByteLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_write_to_storage_byte_latency_microseconds"),
|
||||
"Represents the write to storage byte latency in microseconds of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreWriteToStorageByteCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_write_to_storage_byte_count"),
|
||||
"Represents the write to storage byte count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreWriteToStorageCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_write_to_storage_count"),
|
||||
"Represents the write to storage count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreReadFromStorageByteLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_read_from_storage_byte_latency_microseconds"),
|
||||
"Represents the read from storage byte latency in microseconds of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreReadFromStorageByteCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_read_from_storage_byte_count"),
|
||||
"Represents the read from storage byte count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreReadFromStorageCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_read_from_storage_count"),
|
||||
"Represents the read from storage count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreCommitByteLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_commit_byte_latency_microseconds"),
|
||||
"Represents the commit byte latency in microseconds of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreCommitByteCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_commit_byte_count"),
|
||||
"Represents the commit byte count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreCommitCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_commit_count"),
|
||||
"Represents the commit count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreCacheUpdateOperationLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_cache_update_operation_latency_microseconds"),
|
||||
"Represents the cache update operation latency in microseconds of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreCacheUpdateOperationCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_cache_update_operation_count"),
|
||||
"Represents the cache update operation count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreCommitOperationLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_commit_operation_latency_microseconds"),
|
||||
"Represents the commit operation latency in microseconds of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreCommitOperationCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_commit_operation_count"),
|
||||
"Represents the commit operation count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreCompactOperationLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_compact_operation_latency_microseconds"),
|
||||
"Represents the compact operation latency in microseconds of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreCompactOperationCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_compact_operation_count"),
|
||||
"Represents the compact operation count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreLoadFileOperationLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_load_file_operation_latency_microseconds"),
|
||||
"Represents the load file operation latency in microseconds of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreLoadFileOperationCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_load_file_operation_count"),
|
||||
"Represents the load file operation count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreRemoveOperationLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_remove_operation_latency_microseconds"),
|
||||
"Represents the remove operation latency in microseconds of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreRemoveOperationCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_remove_operation_count"),
|
||||
"Represents the remove operation count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreQuerySizeOperationLatency = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_query_size_operation_latency_microseconds"),
|
||||
"Represents the query size operation latency in microseconds of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreQuerySizeOperationCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_query_size_operation_count"),
|
||||
"Represents the query size operation count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreSetOperationLatencyMicro = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_set_operation_latency_microseconds"),
|
||||
"Represents the set operation latency in microseconds of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
c.dataStoreSetOperationCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "datastore_set_operation_count"),
|
||||
"Represents the set operation count of the DataStore.",
|
||||
[]string{"datastore"},
|
||||
nil,
|
||||
)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) collectDataStore(ch chan<- prometheus.Metric) error {
|
||||
data, err := c.perfDataCollectorDataStore.Collect()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect Hyper-V DataStore metrics: %w", err)
|
||||
}
|
||||
|
||||
for name, page := range data {
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreFragmentationRatio,
|
||||
prometheus.GaugeValue,
|
||||
page[dataStoreFragmentationRatio].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreSectorSize,
|
||||
prometheus.GaugeValue,
|
||||
page[dataStoreSectorSize].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreDataAlignment,
|
||||
prometheus.GaugeValue,
|
||||
page[dataStoreDataAlignment].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreCurrentReplayLogSize,
|
||||
prometheus.GaugeValue,
|
||||
page[dataStoreCurrentReplayLogSize].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreAvailableEntries,
|
||||
prometheus.GaugeValue,
|
||||
page[dataStoreAvailableEntries].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreEmptyEntries,
|
||||
prometheus.GaugeValue,
|
||||
page[dataStoreEmptyEntries].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreFreeBytes,
|
||||
prometheus.GaugeValue,
|
||||
page[dataStoreFreeBytes].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreDataEnd,
|
||||
prometheus.GaugeValue,
|
||||
page[dataStoreDataEnd].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreFileObjects,
|
||||
prometheus.GaugeValue,
|
||||
page[dataStoreFileObjects].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreObjectTables,
|
||||
prometheus.GaugeValue,
|
||||
page[dataStoreObjectTables].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreKeyTables,
|
||||
prometheus.GaugeValue,
|
||||
page[dataStoreKeyTables].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreFileDataSize,
|
||||
prometheus.GaugeValue,
|
||||
page[dataStoreFileDataSize].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreTableDataSize,
|
||||
prometheus.GaugeValue,
|
||||
page[dataStoreTableDataSize].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreNamesSize,
|
||||
prometheus.GaugeValue,
|
||||
page[dataStoreNamesSize].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreNumberOfKeys,
|
||||
prometheus.GaugeValue,
|
||||
page[dataStoreNumberOfKeys].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreReconnectLatencyMicro,
|
||||
prometheus.GaugeValue,
|
||||
page[dataStoreReconnectLatencyMicro].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreDisconnectCount,
|
||||
prometheus.CounterValue,
|
||||
page[dataStoreDisconnectCount].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreWriteToFileByteLatency,
|
||||
prometheus.GaugeValue,
|
||||
page[dataStoreWriteToFileByteLatency].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreWriteToFileByteCount,
|
||||
prometheus.CounterValue,
|
||||
page[dataStoreWriteToFileByteCount].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreWriteToFileCount,
|
||||
prometheus.CounterValue,
|
||||
page[dataStoreWriteToFileCount].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreReadFromFileByteLatency,
|
||||
prometheus.GaugeValue,
|
||||
page[dataStoreReadFromFileByteLatency].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreReadFromFileByteCount,
|
||||
prometheus.CounterValue,
|
||||
page[dataStoreReadFromFileByteCount].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreReadFromFileCount,
|
||||
prometheus.CounterValue,
|
||||
page[dataStoreReadFromFileCount].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreWriteToStorageByteLatency,
|
||||
prometheus.GaugeValue,
|
||||
page[dataStoreWriteToStorageByteLatency].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreWriteToStorageByteCount,
|
||||
prometheus.CounterValue,
|
||||
page[dataStoreWriteToStorageByteCount].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreWriteToStorageCount,
|
||||
prometheus.CounterValue,
|
||||
page[dataStoreWriteToStorageCount].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreReadFromStorageByteLatency,
|
||||
prometheus.GaugeValue,
|
||||
page[dataStoreReadFromStorageByteLatency].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreReadFromStorageByteCount,
|
||||
prometheus.CounterValue,
|
||||
page[dataStoreReadFromStorageByteCount].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreReadFromStorageCount,
|
||||
prometheus.CounterValue,
|
||||
page[dataStoreReadFromStorageCount].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreCommitByteLatency,
|
||||
prometheus.GaugeValue,
|
||||
page[dataStoreCommitByteLatency].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreCommitByteCount,
|
||||
prometheus.CounterValue,
|
||||
page[dataStoreCommitByteCount].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreCommitCount,
|
||||
prometheus.CounterValue,
|
||||
page[dataStoreCommitCount].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreCacheUpdateOperationLatency,
|
||||
prometheus.GaugeValue,
|
||||
page[dataStoreCacheUpdateOperationLatency].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreCacheUpdateOperationCount,
|
||||
prometheus.CounterValue,
|
||||
page[dataStoreCacheUpdateOperationCount].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreCommitOperationLatency,
|
||||
prometheus.GaugeValue,
|
||||
page[dataStoreCommitOperationLatency].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreCommitOperationCount,
|
||||
prometheus.CounterValue,
|
||||
page[dataStoreCommitOperationCount].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreCompactOperationLatency,
|
||||
prometheus.GaugeValue,
|
||||
page[dataStoreCompactOperationLatency].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreCompactOperationCount,
|
||||
prometheus.CounterValue,
|
||||
page[dataStoreCompactOperationCount].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreLoadFileOperationLatency,
|
||||
prometheus.GaugeValue,
|
||||
page[dataStoreLoadFileOperationLatency].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreLoadFileOperationCount,
|
||||
prometheus.CounterValue,
|
||||
page[dataStoreLoadFileOperationCount].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreRemoveOperationLatency,
|
||||
prometheus.GaugeValue,
|
||||
page[dataStoreRemoveOperationLatency].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreRemoveOperationCount,
|
||||
prometheus.CounterValue,
|
||||
page[dataStoreRemoveOperationCount].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreQuerySizeOperationLatency,
|
||||
prometheus.GaugeValue,
|
||||
page[dataStoreQuerySizeOperationLatency].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreQuerySizeOperationCount,
|
||||
prometheus.CounterValue,
|
||||
page[dataStoreQuerySizeOperationCount].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreSetOperationLatencyMicro,
|
||||
prometheus.GaugeValue,
|
||||
page[dataStoreSetOperationLatencyMicro].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.dataStoreSetOperationCount,
|
||||
prometheus.CounterValue,
|
||||
page[dataStoreSetOperationCount].FirstValue,
|
||||
name,
|
||||
)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
123
internal/collector/hyperv/hyperv_dynamic_memory_balancer.go
Normal file
123
internal/collector/hyperv/hyperv_dynamic_memory_balancer.go
Normal file
@@ -0,0 +1,123 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package hyperv
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus-community/windows_exporter/internal/utils"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
// collectorDynamicMemoryBalancer Hyper-V Dynamic Memory Balancer metrics
|
||||
type collectorDynamicMemoryBalancer struct {
|
||||
perfDataCollectorDynamicMemoryBalancer *perfdata.Collector
|
||||
vmDynamicMemoryBalancerAvailableMemoryForBalancing *prometheus.Desc // \Hyper-V Dynamic Memory Balancer(*)\Available Memory For Balancing
|
||||
vmDynamicMemoryBalancerSystemCurrentPressure *prometheus.Desc // \Hyper-V Dynamic Memory Balancer(*)\System Current Pressure
|
||||
vmDynamicMemoryBalancerAvailableMemory *prometheus.Desc // \Hyper-V Dynamic Memory Balancer(*)\Available Memory
|
||||
vmDynamicMemoryBalancerAveragePressure *prometheus.Desc // \Hyper-V Dynamic Memory Balancer(*)\Average Pressure
|
||||
}
|
||||
|
||||
const (
|
||||
// Hyper-V Dynamic Memory Balancer metrics
|
||||
vmDynamicMemoryBalancerAvailableMemory = "Available Memory"
|
||||
vmDynamicMemoryBalancerAvailableMemoryForBalancing = "Available Memory For Balancing"
|
||||
vmDynamicMemoryBalancerAveragePressure = "Average Pressure"
|
||||
vmDynamicMemoryBalancerSystemCurrentPressure = "System Current Pressure"
|
||||
)
|
||||
|
||||
func (c *Collector) buildDynamicMemoryBalancer() error {
|
||||
var err error
|
||||
|
||||
// https://learn.microsoft.com/en-us/archive/blogs/chrisavis/monitoring-dynamic-memory-in-windows-server-hyper-v-2012
|
||||
c.perfDataCollectorDynamicMemoryBalancer, err = perfdata.NewCollector("Hyper-V Dynamic Memory Balancer", perfdata.InstancesAll, []string{
|
||||
vmDynamicMemoryBalancerAvailableMemory,
|
||||
vmDynamicMemoryBalancerAvailableMemoryForBalancing,
|
||||
vmDynamicMemoryBalancerAveragePressure,
|
||||
vmDynamicMemoryBalancerSystemCurrentPressure,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create Hyper-V Virtual Machine Health Summary collector: %w", err)
|
||||
}
|
||||
|
||||
c.vmDynamicMemoryBalancerAvailableMemory = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dynamic_memory_balancer_available_memory_bytes"),
|
||||
"Represents the amount of memory left on the node.",
|
||||
[]string{"balancer"},
|
||||
nil,
|
||||
)
|
||||
c.vmDynamicMemoryBalancerAvailableMemoryForBalancing = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dynamic_memory_balancer_available_memory_for_balancing_bytes"),
|
||||
"Represents the available memory for balancing purposes.",
|
||||
[]string{"balancer"},
|
||||
nil,
|
||||
)
|
||||
c.vmDynamicMemoryBalancerAveragePressure = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dynamic_memory_balancer_average_pressure_ratio"),
|
||||
"Represents the average system pressure on the balancer node among all balanced objects.",
|
||||
[]string{"balancer"},
|
||||
nil,
|
||||
)
|
||||
c.vmDynamicMemoryBalancerSystemCurrentPressure = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dynamic_memory_balancer_system_current_pressure_ratio"),
|
||||
"Represents the current pressure in the system.",
|
||||
[]string{"balancer"},
|
||||
nil,
|
||||
)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) collectDynamicMemoryBalancer(ch chan<- prometheus.Metric) error {
|
||||
data, err := c.perfDataCollectorDynamicMemoryBalancer.Collect()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect Hyper-V Dynamic Memory Balancer metrics: %w", err)
|
||||
}
|
||||
|
||||
for name, page := range data {
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.vmDynamicMemoryBalancerAvailableMemory,
|
||||
prometheus.GaugeValue,
|
||||
utils.MBToBytes(page[vmDynamicMemoryBalancerAvailableMemory].FirstValue),
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.vmDynamicMemoryBalancerAvailableMemoryForBalancing,
|
||||
prometheus.GaugeValue,
|
||||
utils.MBToBytes(page[vmDynamicMemoryBalancerAvailableMemoryForBalancing].FirstValue),
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.vmDynamicMemoryBalancerAveragePressure,
|
||||
prometheus.GaugeValue,
|
||||
utils.PercentageToRatio(page[vmDynamicMemoryBalancerAveragePressure].FirstValue),
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.vmDynamicMemoryBalancerSystemCurrentPressure,
|
||||
prometheus.GaugeValue,
|
||||
utils.PercentageToRatio(page[vmDynamicMemoryBalancerSystemCurrentPressure].FirstValue),
|
||||
name,
|
||||
)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
218
internal/collector/hyperv/hyperv_dynamic_memory_vm.go
Normal file
218
internal/collector/hyperv/hyperv_dynamic_memory_vm.go
Normal file
@@ -0,0 +1,218 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package hyperv
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus-community/windows_exporter/internal/utils"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
// collectorDynamicMemoryVM Hyper-V Dynamic Memory VM metrics
|
||||
type collectorDynamicMemoryVM struct {
|
||||
perfDataCollectorDynamicMemoryVM *perfdata.Collector
|
||||
vmMemoryAddedMemory *prometheus.Desc // \Hyper-V Dynamic Memory VM(*)\Added Memory
|
||||
vmMemoryCurrentPressure *prometheus.Desc // \Hyper-V Dynamic Memory VM(*)\Current Pressure
|
||||
vmMemoryGuestVisiblePhysicalMemory *prometheus.Desc // \Hyper-V Dynamic Memory VM(*)\Guest Visible Physical Memory
|
||||
vmMemoryMaximumPressure *prometheus.Desc // \Hyper-V Dynamic Memory VM(*)\Maximum Pressure
|
||||
vmMemoryMemoryAddOperations *prometheus.Desc // \Hyper-V Dynamic Memory VM(*)\Memory Add Operations
|
||||
vmMemoryMemoryRemoveOperations *prometheus.Desc // \Hyper-V Dynamic Memory VM(*)\Memory Remove Operations
|
||||
vmMemoryMinimumPressure *prometheus.Desc // \Hyper-V Dynamic Memory VM(*)\Minimum Pressure
|
||||
vmMemoryPhysicalMemory *prometheus.Desc // \Hyper-V Dynamic Memory VM(*)\Physical Memory
|
||||
vmMemoryRemovedMemory *prometheus.Desc // \Hyper-V Dynamic Memory VM(*)\Removed Memory
|
||||
vmMemoryGuestAvailableMemory *prometheus.Desc // \Hyper-V Dynamic Memory VM(*)\Guest Available Memory
|
||||
}
|
||||
|
||||
const (
|
||||
// Hyper-V Dynamic Memory VM metrics
|
||||
vmMemoryAddedMemory = "Added Memory"
|
||||
vmMemoryCurrentPressure = "Current Pressure"
|
||||
vmMemoryGuestAvailableMemory = "Guest Available Memory"
|
||||
vmMemoryGuestVisiblePhysicalMemory = "Guest Visible Physical Memory"
|
||||
vmMemoryMaximumPressure = "Maximum Pressure"
|
||||
vmMemoryMemoryAddOperations = "Memory Add Operations"
|
||||
vmMemoryMemoryRemoveOperations = "Memory Remove Operations"
|
||||
vmMemoryMinimumPressure = "Minimum Pressure"
|
||||
vmMemoryPhysicalMemory = "Physical Memory"
|
||||
vmMemoryRemovedMemory = "Removed Memory"
|
||||
)
|
||||
|
||||
func (c *Collector) buildDynamicMemoryVM() error {
|
||||
var err error
|
||||
|
||||
c.perfDataCollectorDynamicMemoryVM, err = perfdata.NewCollector("Hyper-V Dynamic Memory VM", perfdata.InstancesAll, []string{
|
||||
vmMemoryAddedMemory,
|
||||
vmMemoryCurrentPressure,
|
||||
vmMemoryGuestVisiblePhysicalMemory,
|
||||
vmMemoryMaximumPressure,
|
||||
vmMemoryMemoryAddOperations,
|
||||
vmMemoryMemoryRemoveOperations,
|
||||
vmMemoryMinimumPressure,
|
||||
vmMemoryPhysicalMemory,
|
||||
vmMemoryRemovedMemory,
|
||||
vmMemoryGuestAvailableMemory,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create Hyper-V Dynamic Memory VM collector: %w", err)
|
||||
}
|
||||
|
||||
c.vmMemoryAddedMemory = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dynamic_memory_vm_added_total"),
|
||||
"Represents the cumulative amount of memory added to the VM.",
|
||||
[]string{"vm"},
|
||||
nil,
|
||||
)
|
||||
c.vmMemoryCurrentPressure = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dynamic_memory_vm_pressure_current_ratio"),
|
||||
"Represents the current pressure in the VM.",
|
||||
[]string{"vm"},
|
||||
nil,
|
||||
)
|
||||
c.vmMemoryGuestAvailableMemory = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dynamic_memory_vm_guest_available_bytes"),
|
||||
"Represents the current amount of available memory in the VM (reported by the VM).",
|
||||
[]string{"vm"},
|
||||
nil,
|
||||
)
|
||||
c.vmMemoryGuestVisiblePhysicalMemory = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dynamic_memory_vm_guest_visible_physical_memory_bytes"),
|
||||
"Represents the amount of memory visible in the VM.'",
|
||||
[]string{"vm"},
|
||||
nil,
|
||||
)
|
||||
c.vmMemoryMaximumPressure = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dynamic_memory_vm_pressure_maximum_ratio"),
|
||||
"Represents the maximum pressure band in the VM.",
|
||||
[]string{"vm"},
|
||||
nil,
|
||||
)
|
||||
c.vmMemoryMemoryAddOperations = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dynamic_memory_vm_add_operations_total"),
|
||||
"Represents the total number of add operations for the VM.",
|
||||
[]string{"vm"},
|
||||
nil,
|
||||
)
|
||||
c.vmMemoryMemoryRemoveOperations = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dynamic_memory_vm_remove_operations_total"),
|
||||
"Represents the total number of remove operations for the VM.",
|
||||
[]string{"vm"},
|
||||
nil,
|
||||
)
|
||||
c.vmMemoryMinimumPressure = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dynamic_memory_vm_pressure_minimum_ratio"),
|
||||
"Represents the minimum pressure band in the VM.",
|
||||
[]string{"vm"},
|
||||
nil,
|
||||
)
|
||||
c.vmMemoryPhysicalMemory = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dynamic_memory_vm_physical_bytes"),
|
||||
"Represents the current amount of memory in the VM.",
|
||||
[]string{"vm"},
|
||||
nil,
|
||||
)
|
||||
c.vmMemoryRemovedMemory = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "dynamic_memory_vm_removed_bytes_total"),
|
||||
"Represents the cumulative amount of memory removed from the VM.",
|
||||
[]string{"vm"},
|
||||
nil,
|
||||
)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) collectDynamicMemoryVM(ch chan<- prometheus.Metric) error {
|
||||
data, err := c.perfDataCollectorDynamicMemoryVM.Collect()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect Hyper-V Dynamic Memory VM metrics: %w", err)
|
||||
}
|
||||
|
||||
for vmName, vmData := range data {
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.vmMemoryAddedMemory,
|
||||
prometheus.CounterValue,
|
||||
utils.MBToBytes(vmData[vmMemoryAddedMemory].FirstValue),
|
||||
vmName,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.vmMemoryCurrentPressure,
|
||||
prometheus.GaugeValue,
|
||||
utils.PercentageToRatio(vmData[vmMemoryCurrentPressure].FirstValue),
|
||||
vmName,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.vmMemoryGuestAvailableMemory,
|
||||
prometheus.GaugeValue,
|
||||
utils.MBToBytes(vmData[vmMemoryGuestAvailableMemory].FirstValue),
|
||||
vmName,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.vmMemoryGuestVisiblePhysicalMemory,
|
||||
prometheus.GaugeValue,
|
||||
utils.MBToBytes(vmData[vmMemoryGuestVisiblePhysicalMemory].FirstValue),
|
||||
vmName,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.vmMemoryMaximumPressure,
|
||||
prometheus.GaugeValue,
|
||||
utils.PercentageToRatio(vmData[vmMemoryMaximumPressure].FirstValue),
|
||||
vmName,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.vmMemoryMemoryAddOperations,
|
||||
prometheus.CounterValue,
|
||||
vmData[vmMemoryMemoryAddOperations].FirstValue,
|
||||
vmName,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.vmMemoryMemoryRemoveOperations,
|
||||
prometheus.CounterValue,
|
||||
vmData[vmMemoryMemoryRemoveOperations].FirstValue,
|
||||
vmName,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.vmMemoryMinimumPressure,
|
||||
prometheus.GaugeValue,
|
||||
utils.PercentageToRatio(vmData[vmMemoryMinimumPressure].FirstValue),
|
||||
vmName,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.vmMemoryPhysicalMemory,
|
||||
prometheus.GaugeValue,
|
||||
utils.MBToBytes(vmData[vmMemoryPhysicalMemory].FirstValue),
|
||||
vmName,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.vmMemoryRemovedMemory,
|
||||
prometheus.CounterValue,
|
||||
utils.MBToBytes(vmData[vmMemoryRemovedMemory].FirstValue),
|
||||
vmName,
|
||||
)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
136
internal/collector/hyperv/hyperv_hypervisor_logical_processor.go
Normal file
136
internal/collector/hyperv/hyperv_hypervisor_logical_processor.go
Normal file
@@ -0,0 +1,136 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package hyperv
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
// collectorHypervisorLogicalProcessor Hyper-V Hypervisor Logical Processor metrics
|
||||
type collectorHypervisorLogicalProcessor struct {
|
||||
perfDataCollectorHypervisorLogicalProcessor *perfdata.Collector
|
||||
|
||||
// \Hyper-V Hypervisor Logical Processor(*)\% Guest Run Time
|
||||
// \Hyper-V Hypervisor Logical Processor(*)\% Hypervisor Run Time
|
||||
// \Hyper-V Hypervisor Logical Processor(*)\% Idle Time
|
||||
hypervisorLogicalProcessorTimeTotal *prometheus.Desc
|
||||
hypervisorLogicalProcessorTotalRunTimeTotal *prometheus.Desc // \Hyper-V Hypervisor Logical Processor(*)\% Total Run Time
|
||||
hypervisorLogicalProcessorContextSwitches *prometheus.Desc // \Hyper-V Hypervisor Logical Processor(*)\Context Switches/sec
|
||||
}
|
||||
|
||||
const (
|
||||
hypervisorLogicalProcessorGuestRunTimePercent = "% Guest Run Time"
|
||||
hypervisorLogicalProcessorHypervisorRunTimePercent = "% Hypervisor Run Time"
|
||||
hypervisorLogicalProcessorTotalRunTimePercent = "% Total Run Time"
|
||||
hypervisorLogicalProcessorIdleRunTimePercent = "% Idle Time"
|
||||
hypervisorLogicalProcessorContextSwitches = "Context Switches/sec"
|
||||
)
|
||||
|
||||
func (c *Collector) buildHypervisorLogicalProcessor() error {
|
||||
var err error
|
||||
|
||||
c.perfDataCollectorHypervisorLogicalProcessor, err = perfdata.NewCollector("Hyper-V Hypervisor Logical Processor", perfdata.InstancesAll, []string{
|
||||
hypervisorLogicalProcessorGuestRunTimePercent,
|
||||
hypervisorLogicalProcessorHypervisorRunTimePercent,
|
||||
hypervisorLogicalProcessorTotalRunTimePercent,
|
||||
hypervisorLogicalProcessorIdleRunTimePercent,
|
||||
hypervisorLogicalProcessorContextSwitches,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create Hyper-V Hypervisor Logical Processor collector: %w", err)
|
||||
}
|
||||
|
||||
c.hypervisorLogicalProcessorTimeTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "hypervisor_logical_processor_time_total"),
|
||||
"Time that processor spent in different modes (hypervisor, guest, idle)",
|
||||
[]string{"core", "state"},
|
||||
nil,
|
||||
)
|
||||
c.hypervisorLogicalProcessorTotalRunTimeTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "hypervisor_logical_processor_total_run_time_total"),
|
||||
"Time that processor spent",
|
||||
[]string{"core"},
|
||||
nil,
|
||||
)
|
||||
|
||||
c.hypervisorLogicalProcessorContextSwitches = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "hypervisor_logical_processor_context_switches_total"),
|
||||
"The rate of virtual processor context switches on the processor.",
|
||||
[]string{"core"},
|
||||
nil,
|
||||
)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) collectHypervisorLogicalProcessor(ch chan<- prometheus.Metric) error {
|
||||
data, err := c.perfDataCollectorHypervisorLogicalProcessor.Collect()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect Hyper-V Hypervisor Logical Processor metrics: %w", err)
|
||||
}
|
||||
|
||||
for coreName, coreData := range data {
|
||||
// The name format is Hv LP <core id>
|
||||
parts := strings.Split(coreName, " ")
|
||||
if len(parts) != 3 {
|
||||
return fmt.Errorf("unexpected Hyper-V Hypervisor Logical Processor name format: %s", coreName)
|
||||
}
|
||||
|
||||
coreId := parts[2]
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorLogicalProcessorTimeTotal,
|
||||
prometheus.CounterValue,
|
||||
coreData[hypervisorLogicalProcessorGuestRunTimePercent].FirstValue,
|
||||
coreId, "guest",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorLogicalProcessorTimeTotal,
|
||||
prometheus.CounterValue,
|
||||
coreData[hypervisorLogicalProcessorHypervisorRunTimePercent].FirstValue,
|
||||
coreId, "hypervisor",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorLogicalProcessorTimeTotal,
|
||||
prometheus.CounterValue,
|
||||
coreData[hypervisorLogicalProcessorIdleRunTimePercent].FirstValue,
|
||||
coreId, "idle",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorLogicalProcessorTotalRunTimeTotal,
|
||||
prometheus.CounterValue,
|
||||
coreData[hypervisorLogicalProcessorTotalRunTimePercent].FirstValue,
|
||||
coreId,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorLogicalProcessorContextSwitches,
|
||||
prometheus.CounterValue,
|
||||
coreData[hypervisorLogicalProcessorContextSwitches].FirstValue,
|
||||
coreId,
|
||||
)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
364
internal/collector/hyperv/hyperv_hypervisor_root_partition.go
Normal file
364
internal/collector/hyperv/hyperv_hypervisor_root_partition.go
Normal file
@@ -0,0 +1,364 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package hyperv
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
// collectorHypervisorRootPartition Hyper-V Hypervisor Root Partition metrics
|
||||
type collectorHypervisorRootPartition struct {
|
||||
perfDataCollectorHypervisorRootPartition *perfdata.Collector
|
||||
hypervisorRootPartitionAddressSpaces *prometheus.Desc // \Hyper-V Hypervisor Root Partition(*)\Address Spaces
|
||||
hypervisorRootPartitionAttachedDevices *prometheus.Desc // \Hyper-V Hypervisor Root Partition(*)\Attached Devices
|
||||
hypervisorRootPartitionDepositedPages *prometheus.Desc // \Hyper-V Hypervisor Root Partition(*)\Deposited Pages
|
||||
hypervisorRootPartitionDeviceDMAErrors *prometheus.Desc // \Hyper-V Hypervisor Root Partition(*)\Device DMA Errors
|
||||
hypervisorRootPartitionDeviceInterruptErrors *prometheus.Desc // \Hyper-V Hypervisor Root Partition(*)\Device Interrupt Errors
|
||||
hypervisorRootPartitionDeviceInterruptMappings *prometheus.Desc // \Hyper-V Hypervisor Root Partition(*)\Device Interrupt Mappings
|
||||
hypervisorRootPartitionDeviceInterruptThrottleEvents *prometheus.Desc // \Hyper-V Hypervisor Root Partition(*)\Device Interrupt Throttle Events
|
||||
hypervisorRootPartitionGPAPages *prometheus.Desc // \Hyper-V Hypervisor Root Partition(*)\GPA Pages
|
||||
hypervisorRootPartitionGPASpaceModifications *prometheus.Desc // \Hyper-V Hypervisor Root Partition(*)\GPA Space Modifications/sec
|
||||
hypervisorRootPartitionIOTLBFlushCost *prometheus.Desc // \Hyper-V Hypervisor Root Partition(*)\I/O TLB Flush Cost
|
||||
hypervisorRootPartitionIOTLBFlushes *prometheus.Desc // \Hyper-V Hypervisor Root Partition(*)\I/O TLB Flushes/sec
|
||||
hypervisorRootPartitionRecommendedVirtualTLBSize *prometheus.Desc // \Hyper-V Hypervisor Root Partition(*)\Recommended Virtual TLB Size
|
||||
hypervisorRootPartitionSkippedTimerTicks *prometheus.Desc // \Hyper-V Hypervisor Root Partition(*)\Skipped Timer Ticks
|
||||
hypervisorRootPartition1GDevicePages *prometheus.Desc // \Hyper-V Hypervisor Root Partition(*)\1G device pages
|
||||
hypervisorRootPartition1GGPAPages *prometheus.Desc // \Hyper-V Hypervisor Root Partition(*)\1G GPA pages
|
||||
hypervisorRootPartition2MDevicePages *prometheus.Desc // \Hyper-V Hypervisor Root Partition(*)\2M device pages
|
||||
hypervisorRootPartition2MGPAPages *prometheus.Desc // \Hyper-V Hypervisor Root Partition(*)\2M GPA pages
|
||||
hypervisorRootPartition4KDevicePages *prometheus.Desc // \Hyper-V Hypervisor Root Partition(*)\4K device pages
|
||||
hypervisorRootPartition4KGPAPages *prometheus.Desc // \Hyper-V Hypervisor Root Partition(*)\4K GPA pages
|
||||
hypervisorRootPartitionVirtualTLBFlushEntries *prometheus.Desc // \Hyper-V Hypervisor Root Partition(*)\Virtual TLB Flush Entries/sec
|
||||
hypervisorRootPartitionVirtualTLBPages *prometheus.Desc // \Hyper-V Hypervisor Root Partition(*)\Virtual TLB Pages
|
||||
}
|
||||
|
||||
const (
|
||||
hypervisorRootPartitionAddressSpaces = "Address Spaces"
|
||||
hypervisorRootPartitionAttachedDevices = "Attached Devices"
|
||||
hypervisorRootPartitionDepositedPages = "Deposited Pages"
|
||||
hypervisorRootPartitionDeviceDMAErrors = "Device DMA Errors"
|
||||
hypervisorRootPartitionDeviceInterruptErrors = "Device Interrupt Errors"
|
||||
hypervisorRootPartitionDeviceInterruptMappings = "Device Interrupt Mappings"
|
||||
hypervisorRootPartitionDeviceInterruptThrottleEvents = "Device Interrupt Throttle Events"
|
||||
hypervisorRootPartitionGPAPages = "GPA Pages"
|
||||
hypervisorRootPartitionGPASpaceModifications = "GPA Space Modifications/sec"
|
||||
hypervisorRootPartitionIOTLBFlushCost = "I/O TLB Flush Cost"
|
||||
hypervisorRootPartitionIOTLBFlushes = "I/O TLB Flushes/sec"
|
||||
hypervisorRootPartitionRecommendedVirtualTLBSize = "Recommended Virtual TLB Size"
|
||||
hypervisorRootPartitionSkippedTimerTicks = "Skipped Timer Ticks"
|
||||
hypervisorRootPartition1GDevicePages = "1G device pages"
|
||||
hypervisorRootPartition1GGPAPages = "1G GPA pages"
|
||||
hypervisorRootPartition2MDevicePages = "2M device pages"
|
||||
hypervisorRootPartition2MGPAPages = "2M GPA pages"
|
||||
hypervisorRootPartition4KDevicePages = "4K device pages"
|
||||
hypervisorRootPartition4KGPAPages = "4K GPA pages"
|
||||
hypervisorRootPartitionVirtualTLBFlushEntries = "Virtual TLB Flush Entires/sec"
|
||||
hypervisorRootPartitionVirtualTLBPages = "Virtual TLB Pages"
|
||||
)
|
||||
|
||||
func (c *Collector) buildHypervisorRootPartition() error {
|
||||
var err error
|
||||
|
||||
c.perfDataCollectorHypervisorRootPartition, err = perfdata.NewCollector("Hyper-V Hypervisor Root Partition", []string{"Root"}, []string{
|
||||
hypervisorRootPartitionAddressSpaces,
|
||||
hypervisorRootPartitionAttachedDevices,
|
||||
hypervisorRootPartitionDepositedPages,
|
||||
hypervisorRootPartitionDeviceDMAErrors,
|
||||
hypervisorRootPartitionDeviceInterruptErrors,
|
||||
hypervisorRootPartitionDeviceInterruptMappings,
|
||||
hypervisorRootPartitionDeviceInterruptThrottleEvents,
|
||||
hypervisorRootPartitionGPAPages,
|
||||
hypervisorRootPartitionGPASpaceModifications,
|
||||
hypervisorRootPartitionIOTLBFlushCost,
|
||||
hypervisorRootPartitionIOTLBFlushes,
|
||||
hypervisorRootPartitionRecommendedVirtualTLBSize,
|
||||
hypervisorRootPartitionSkippedTimerTicks,
|
||||
hypervisorRootPartition1GDevicePages,
|
||||
hypervisorRootPartition1GGPAPages,
|
||||
hypervisorRootPartition2MDevicePages,
|
||||
hypervisorRootPartition2MGPAPages,
|
||||
hypervisorRootPartition4KDevicePages,
|
||||
hypervisorRootPartition4KGPAPages,
|
||||
hypervisorRootPartitionVirtualTLBFlushEntries,
|
||||
hypervisorRootPartitionVirtualTLBPages,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create Hyper-V Hypervisor Root Partition collector: %w", err)
|
||||
}
|
||||
|
||||
c.hypervisorRootPartitionAddressSpaces = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_address_spaces"),
|
||||
"The number of address spaces in the virtual TLB of the partition",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.hypervisorRootPartitionAttachedDevices = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_attached_devices"),
|
||||
"The number of devices attached to the partition",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.hypervisorRootPartitionDepositedPages = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_deposited_pages"),
|
||||
"The number of pages deposited into the partition",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.hypervisorRootPartitionDeviceDMAErrors = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_device_dma_errors"),
|
||||
"An indicator of illegal DMA requests generated by all devices assigned to the partition",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.hypervisorRootPartitionDeviceInterruptErrors = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_device_interrupt_errors"),
|
||||
"An indicator of illegal interrupt requests generated by all devices assigned to the partition",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.hypervisorRootPartitionDeviceInterruptMappings = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_device_interrupt_mappings"),
|
||||
"The number of device interrupt mappings used by the partition",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.hypervisorRootPartitionDeviceInterruptThrottleEvents = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_device_interrupt_throttle_events"),
|
||||
"The number of times an interrupt from a device assigned to the partition was temporarily throttled because the device was generating too many interrupts",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.hypervisorRootPartitionGPAPages = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_preferred_numa_node_index"),
|
||||
"The number of pages present in the GPA space of the partition (zero for root partition)",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.hypervisorRootPartitionGPASpaceModifications = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_gpa_space_modifications"),
|
||||
"The rate of modifications to the GPA space of the partition",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.hypervisorRootPartitionIOTLBFlushCost = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_io_tlb_flush_cost"),
|
||||
"The average time (in nanoseconds) spent processing an I/O TLB flush",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.hypervisorRootPartitionIOTLBFlushes = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_io_tlb_flush"),
|
||||
"The rate of flushes of I/O TLBs of the partition",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.hypervisorRootPartitionRecommendedVirtualTLBSize = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_recommended_virtual_tlb_size"),
|
||||
"The recommended number of pages to be deposited for the virtual TLB",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.hypervisorRootPartitionSkippedTimerTicks = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_physical_pages_allocated"),
|
||||
"The number of timer interrupts skipped for the partition",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.hypervisorRootPartition1GDevicePages = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_1G_device_pages"),
|
||||
"The number of 1G pages present in the device space of the partition",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.hypervisorRootPartition1GGPAPages = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_1G_gpa_pages"),
|
||||
"The number of 1G pages present in the GPA space of the partition",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.hypervisorRootPartition2MDevicePages = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_2M_device_pages"),
|
||||
"The number of 2M pages present in the device space of the partition",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.hypervisorRootPartition2MGPAPages = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_2M_gpa_pages"),
|
||||
"The number of 2M pages present in the GPA space of the partition",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.hypervisorRootPartition4KDevicePages = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_4K_device_pages"),
|
||||
"The number of 4K pages present in the device space of the partition",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.hypervisorRootPartition4KGPAPages = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_4K_gpa_pages"),
|
||||
"The number of 4K pages present in the GPA space of the partition",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.hypervisorRootPartitionVirtualTLBFlushEntries = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_virtual_tlb_flush_entries"),
|
||||
"The rate of flushes of the entire virtual TLB",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
c.hypervisorRootPartitionVirtualTLBPages = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "root_partition_virtual_tlb_pages"),
|
||||
"The number of pages used by the virtual TLB of the partition",
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) collectHypervisorRootPartition(ch chan<- prometheus.Metric) error {
|
||||
data, err := c.perfDataCollectorHypervisorRootPartition.Collect()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect Hyper-V Hypervisor Root Partition metrics: %w", err)
|
||||
}
|
||||
|
||||
rootData, ok := data["Root"]
|
||||
if !ok {
|
||||
return errors.New("no data returned from Hyper-V Hypervisor Root Partition")
|
||||
}
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorRootPartitionAddressSpaces,
|
||||
prometheus.GaugeValue,
|
||||
rootData[hypervisorRootPartitionAddressSpaces].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorRootPartitionAttachedDevices,
|
||||
prometheus.GaugeValue,
|
||||
rootData[hypervisorRootPartitionAttachedDevices].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorRootPartitionDepositedPages,
|
||||
prometheus.GaugeValue,
|
||||
rootData[hypervisorRootPartitionDepositedPages].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorRootPartitionDeviceDMAErrors,
|
||||
prometheus.GaugeValue,
|
||||
rootData[hypervisorRootPartitionDeviceDMAErrors].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorRootPartitionDeviceInterruptErrors,
|
||||
prometheus.GaugeValue,
|
||||
rootData[hypervisorRootPartitionDeviceInterruptErrors].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorRootPartitionDeviceInterruptThrottleEvents,
|
||||
prometheus.GaugeValue,
|
||||
rootData[hypervisorRootPartitionDeviceInterruptThrottleEvents].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorRootPartitionGPAPages,
|
||||
prometheus.GaugeValue,
|
||||
rootData[hypervisorRootPartitionGPAPages].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorRootPartitionGPASpaceModifications,
|
||||
prometheus.CounterValue,
|
||||
rootData[hypervisorRootPartitionGPASpaceModifications].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorRootPartitionIOTLBFlushCost,
|
||||
prometheus.GaugeValue,
|
||||
rootData[hypervisorRootPartitionIOTLBFlushCost].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorRootPartitionIOTLBFlushes,
|
||||
prometheus.CounterValue,
|
||||
rootData[hypervisorRootPartitionIOTLBFlushes].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorRootPartitionRecommendedVirtualTLBSize,
|
||||
prometheus.GaugeValue,
|
||||
rootData[hypervisorRootPartitionRecommendedVirtualTLBSize].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorRootPartitionSkippedTimerTicks,
|
||||
prometheus.GaugeValue,
|
||||
rootData[hypervisorRootPartitionSkippedTimerTicks].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorRootPartition1GDevicePages,
|
||||
prometheus.GaugeValue,
|
||||
rootData[hypervisorRootPartition1GDevicePages].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorRootPartition1GGPAPages,
|
||||
prometheus.GaugeValue,
|
||||
rootData[hypervisorRootPartition1GGPAPages].FirstValue,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorRootPartition2MDevicePages,
|
||||
prometheus.GaugeValue,
|
||||
rootData[hypervisorRootPartition2MDevicePages].FirstValue,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorRootPartition2MGPAPages,
|
||||
prometheus.GaugeValue,
|
||||
rootData[hypervisorRootPartition2MGPAPages].FirstValue,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorRootPartition4KDevicePages,
|
||||
prometheus.GaugeValue,
|
||||
rootData[hypervisorRootPartition4KDevicePages].FirstValue,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorRootPartition4KGPAPages,
|
||||
prometheus.GaugeValue,
|
||||
rootData[hypervisorRootPartition4KGPAPages].FirstValue,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorRootPartitionVirtualTLBFlushEntries,
|
||||
prometheus.CounterValue,
|
||||
rootData[hypervisorRootPartitionVirtualTLBFlushEntries].FirstValue,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorRootPartitionVirtualTLBPages,
|
||||
prometheus.GaugeValue,
|
||||
rootData[hypervisorRootPartitionVirtualTLBPages].FirstValue,
|
||||
)
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package hyperv
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
// collectorHypervisorRootVirtualProcessor Hyper-V Hypervisor Root Virtual Processor metrics
|
||||
type collectorHypervisorRootVirtualProcessor struct {
|
||||
perfDataCollectorHypervisorRootVirtualProcessor *perfdata.Collector
|
||||
|
||||
// \Hyper-V Hypervisor Root Virtual Processor(*)\% Guest Idle Time
|
||||
// \Hyper-V Hypervisor Root Virtual Processor(*)\% Guest Run Time
|
||||
// \Hyper-V Hypervisor Root Virtual Processor(*)\% Hypervisor Run Time
|
||||
// \Hyper-V Hypervisor Root Virtual Processor(*)\% Remote Run Time
|
||||
// \Hyper-V Hypervisor Root Virtual Processor(*)\% Total Run Time
|
||||
hypervisorRootVirtualProcessorTimeTotal *prometheus.Desc
|
||||
hypervisorRootVirtualProcessorTotalRunTimeTotal *prometheus.Desc
|
||||
hypervisorRootVirtualProcessorCPUWaitTimePerDispatch *prometheus.Desc // \Hyper-V Hypervisor Root Virtual Processor(*)\CPU Wait Time Per Dispatch
|
||||
}
|
||||
|
||||
const (
|
||||
hypervisorRootVirtualProcessorGuestIdleTimePercent = "% Guest Idle Time"
|
||||
hypervisorRootVirtualProcessorGuestRunTimePercent = "% Guest Run Time"
|
||||
hypervisorRootVirtualProcessorHypervisorRunTimePercent = "% Hypervisor Run Time"
|
||||
hypervisorRootVirtualProcessorTotalRunTimePercent = "% Total Run Time"
|
||||
hypervisorRootVirtualProcessorRemoteRunTimePercent = "% Remote Run Time"
|
||||
hypervisorRootVirtualProcessorCPUWaitTimePerDispatch = "CPU Wait Time Per Dispatch"
|
||||
)
|
||||
|
||||
func (c *Collector) buildHypervisorRootVirtualProcessor() error {
|
||||
var err error
|
||||
|
||||
c.perfDataCollectorHypervisorRootVirtualProcessor, err = perfdata.NewCollector("Hyper-V Hypervisor Root Virtual Processor", perfdata.InstancesAll, []string{
|
||||
hypervisorRootVirtualProcessorGuestIdleTimePercent,
|
||||
hypervisorRootVirtualProcessorGuestRunTimePercent,
|
||||
hypervisorRootVirtualProcessorHypervisorRunTimePercent,
|
||||
hypervisorRootVirtualProcessorTotalRunTimePercent,
|
||||
hypervisorRootVirtualProcessorRemoteRunTimePercent,
|
||||
hypervisorRootVirtualProcessorCPUWaitTimePerDispatch,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create Hyper-V Hypervisor Root Virtual Processor collector: %w", err)
|
||||
}
|
||||
|
||||
c.hypervisorRootVirtualProcessorTimeTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "hypervisor_root_virtual_processor_time_total"),
|
||||
"Time that processor spent in different modes (hypervisor, guest_run, guest_idle, remote)",
|
||||
[]string{"core", "state"},
|
||||
nil,
|
||||
)
|
||||
|
||||
c.hypervisorRootVirtualProcessorTotalRunTimeTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "hypervisor_root_virtual_processor_total_run_time_total"),
|
||||
"Time that processor spent",
|
||||
[]string{"core"},
|
||||
nil,
|
||||
)
|
||||
|
||||
c.hypervisorRootVirtualProcessorCPUWaitTimePerDispatch = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "hypervisor_root_virtual_cpu_wait_time_per_dispatch_total"),
|
||||
"The average time (in nanoseconds) spent waiting for a virtual processor to be dispatched onto a logical processor.",
|
||||
[]string{"core"},
|
||||
nil,
|
||||
)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) collectHypervisorRootVirtualProcessor(ch chan<- prometheus.Metric) error {
|
||||
data, err := c.perfDataCollectorHypervisorRootVirtualProcessor.Collect()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect Hyper-V Hypervisor Root Virtual Processor metrics: %w", err)
|
||||
}
|
||||
|
||||
for coreName, coreData := range data {
|
||||
// The name format is Hv LP <core id>
|
||||
parts := strings.Split(coreName, " ")
|
||||
if len(parts) != 3 {
|
||||
return fmt.Errorf("unexpected Hyper-V Hypervisor Root Virtual Processor name format: %s", coreName)
|
||||
}
|
||||
|
||||
coreId := parts[2]
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorRootVirtualProcessorTimeTotal,
|
||||
prometheus.CounterValue,
|
||||
coreData[hypervisorRootVirtualProcessorGuestRunTimePercent].FirstValue,
|
||||
coreId, "guest_run",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorRootVirtualProcessorTimeTotal,
|
||||
prometheus.CounterValue,
|
||||
coreData[hypervisorRootVirtualProcessorHypervisorRunTimePercent].FirstValue,
|
||||
coreId, "hypervisor",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorRootVirtualProcessorTimeTotal,
|
||||
prometheus.CounterValue,
|
||||
coreData[hypervisorRootVirtualProcessorGuestIdleTimePercent].FirstValue,
|
||||
coreId, "guest_idle",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorRootVirtualProcessorTimeTotal,
|
||||
prometheus.CounterValue,
|
||||
coreData[hypervisorRootVirtualProcessorRemoteRunTimePercent].FirstValue,
|
||||
coreId, "remote",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorRootVirtualProcessorTotalRunTimeTotal,
|
||||
prometheus.CounterValue,
|
||||
coreData[hypervisorRootVirtualProcessorTotalRunTimePercent].FirstValue,
|
||||
coreId,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorRootVirtualProcessorCPUWaitTimePerDispatch,
|
||||
prometheus.CounterValue,
|
||||
coreData[hypervisorRootVirtualProcessorCPUWaitTimePerDispatch].FirstValue,
|
||||
coreId,
|
||||
)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
151
internal/collector/hyperv/hyperv_hypervisor_virtual_processor.go
Normal file
151
internal/collector/hyperv/hyperv_hypervisor_virtual_processor.go
Normal file
@@ -0,0 +1,151 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package hyperv
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
// collectorHypervisorVirtualProcessor Hyper-V Hypervisor Virtual Processor metrics
|
||||
type collectorHypervisorVirtualProcessor struct {
|
||||
perfDataCollectorHypervisorVirtualProcessor *perfdata.Collector
|
||||
|
||||
// \Hyper-V Hypervisor Virtual Processor(*)\% Guest Idle Time
|
||||
// \Hyper-V Hypervisor Virtual Processor(*)\% Guest Run Time
|
||||
// \Hyper-V Hypervisor Virtual Processor(*)\% Hypervisor Run Time
|
||||
// \Hyper-V Hypervisor Virtual Processor(*)\% Remote Run Time
|
||||
hypervisorVirtualProcessorTimeTotal *prometheus.Desc
|
||||
hypervisorVirtualProcessorTotalRunTimeTotal *prometheus.Desc // \Hyper-V Hypervisor Virtual Processor(*)\% Total Run Time
|
||||
hypervisorVirtualProcessorContextSwitches *prometheus.Desc // \Hyper-V Hypervisor Virtual Processor(*)\CPU Wait Time Per Dispatch
|
||||
}
|
||||
|
||||
const (
|
||||
hypervisorVirtualProcessorGuestRunTimePercent = "% Guest Run Time"
|
||||
hypervisorVirtualProcessorGuestIdleTimePercent = "% Guest Idle Time"
|
||||
hypervisorVirtualProcessorHypervisorRunTimePercent = "% Hypervisor Run Time"
|
||||
hypervisorVirtualProcessorTotalRunTimePercent = "% Total Run Time"
|
||||
hypervisorVirtualProcessorRemoteRunTimePercent = "% Remote Run Time"
|
||||
hypervisorVirtualProcessorCPUWaitTimePerDispatch = "CPU Wait Time Per Dispatch"
|
||||
)
|
||||
|
||||
func (c *Collector) buildHypervisorVirtualProcessor() error {
|
||||
var err error
|
||||
|
||||
c.perfDataCollectorHypervisorVirtualProcessor, err = perfdata.NewCollector("Hyper-V Hypervisor Virtual Processor", perfdata.InstancesAll, []string{
|
||||
hypervisorVirtualProcessorGuestRunTimePercent,
|
||||
hypervisorVirtualProcessorGuestIdleTimePercent,
|
||||
hypervisorVirtualProcessorHypervisorRunTimePercent,
|
||||
hypervisorVirtualProcessorTotalRunTimePercent,
|
||||
hypervisorVirtualProcessorRemoteRunTimePercent,
|
||||
hypervisorVirtualProcessorCPUWaitTimePerDispatch,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create Hyper-V Hypervisor Virtual Processor collector: %w", err)
|
||||
}
|
||||
|
||||
c.hypervisorVirtualProcessorTimeTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "hypervisor_virtual_processor_time_total"),
|
||||
"Time that processor spent in different modes (hypervisor, guest_run, guest_idle, remote)",
|
||||
[]string{"vm", "core", "state"},
|
||||
nil,
|
||||
)
|
||||
c.hypervisorVirtualProcessorTotalRunTimeTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "hypervisor_virtual_processor_total_run_time_total"),
|
||||
"Time that processor spent",
|
||||
[]string{"vm", "core"},
|
||||
nil,
|
||||
)
|
||||
c.hypervisorVirtualProcessorContextSwitches = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "hypervisor_virtual_processor_cpu_wait_time_per_dispatch_total"),
|
||||
"The average time (in nanoseconds) spent waiting for a virtual processor to be dispatched onto a logical processor.",
|
||||
[]string{"vm", "core"},
|
||||
nil,
|
||||
)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) collectHypervisorVirtualProcessor(ch chan<- prometheus.Metric) error {
|
||||
data, err := c.perfDataCollectorHypervisorVirtualProcessor.Collect()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect Hyper-V Hypervisor Virtual Processor metrics: %w", err)
|
||||
}
|
||||
|
||||
for coreName, coreData := range data {
|
||||
// The name format is <VM Name>:Hv VP <vcore id>
|
||||
parts := strings.Split(coreName, ":")
|
||||
if len(parts) != 2 {
|
||||
return fmt.Errorf("unexpected format of Name in Hyper-V Hypervisor Virtual Processor: %q, expected %q", coreName, "<VM Name>:Hv VP <vcore id>")
|
||||
}
|
||||
|
||||
coreParts := strings.Split(parts[1], " ")
|
||||
if len(coreParts) != 3 {
|
||||
return fmt.Errorf("unexpected format of core identifier in Hyper-V Hypervisor Virtual Processor: %q, expected %q", parts[1], "Hv VP <vcore id>")
|
||||
}
|
||||
|
||||
vmName := parts[0]
|
||||
coreId := coreParts[2]
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorVirtualProcessorTimeTotal,
|
||||
prometheus.CounterValue,
|
||||
coreData[hypervisorVirtualProcessorGuestRunTimePercent].FirstValue,
|
||||
vmName, coreId, "guest_run",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorVirtualProcessorTimeTotal,
|
||||
prometheus.CounterValue,
|
||||
coreData[hypervisorVirtualProcessorHypervisorRunTimePercent].FirstValue,
|
||||
vmName, coreId, "hypervisor",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorVirtualProcessorTimeTotal,
|
||||
prometheus.CounterValue,
|
||||
coreData[hypervisorVirtualProcessorGuestIdleTimePercent].FirstValue,
|
||||
vmName, coreId, "guest_idle",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorVirtualProcessorTimeTotal,
|
||||
prometheus.CounterValue,
|
||||
coreData[hypervisorVirtualProcessorGuestIdleTimePercent].FirstValue,
|
||||
vmName, coreId, "guest_idle",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorVirtualProcessorTotalRunTimeTotal,
|
||||
prometheus.CounterValue,
|
||||
coreData[hypervisorVirtualProcessorTotalRunTimePercent].FirstValue,
|
||||
vmName, coreId,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.hypervisorVirtualProcessorContextSwitches,
|
||||
prometheus.CounterValue,
|
||||
coreData[hypervisorVirtualProcessorCPUWaitTimePerDispatch].FirstValue,
|
||||
vmName, coreId,
|
||||
)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
153
internal/collector/hyperv/hyperv_legacy_network_adapter.go
Normal file
153
internal/collector/hyperv/hyperv_legacy_network_adapter.go
Normal file
@@ -0,0 +1,153 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package hyperv
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
// collectorLegacyNetworkAdapter Hyper-V Legacy Network Adapter metrics
|
||||
type collectorLegacyNetworkAdapter struct {
|
||||
perfDataCollectorLegacyNetworkAdapter *perfdata.Collector
|
||||
|
||||
legacyNetworkAdapterBytesDropped *prometheus.Desc // \Hyper-V Legacy Network Adapter(*)\Bytes Dropped
|
||||
legacyNetworkAdapterBytesReceived *prometheus.Desc // \Hyper-V Legacy Network Adapter(*)\Bytes Received/sec
|
||||
legacyNetworkAdapterBytesSent *prometheus.Desc // \Hyper-V Legacy Network Adapter(*)\Bytes Sent/sec
|
||||
legacyNetworkAdapterFramesDropped *prometheus.Desc // \Hyper-V Legacy Network Adapter(*)\Frames Dropped
|
||||
legacyNetworkAdapterFramesReceived *prometheus.Desc // \Hyper-V Legacy Network Adapter(*)\Frames Received/sec
|
||||
legacyNetworkAdapterFramesSent *prometheus.Desc // \Hyper-V Legacy Network Adapter(*)\Frames Sent/sec
|
||||
}
|
||||
|
||||
const (
|
||||
legacyNetworkAdapterBytesDropped = "Bytes Dropped"
|
||||
legacyNetworkAdapterBytesReceived = "Bytes Received/sec"
|
||||
legacyNetworkAdapterBytesSent = "Bytes Sent/sec"
|
||||
legacyNetworkAdapterFramesDropped = "Frames Dropped"
|
||||
legacyNetworkAdapterFramesReceived = "Frames Received/sec"
|
||||
legacyNetworkAdapterFramesSent = "Frames Sent/sec"
|
||||
)
|
||||
|
||||
func (c *Collector) buildLegacyNetworkAdapter() error {
|
||||
var err error
|
||||
|
||||
c.perfDataCollectorLegacyNetworkAdapter, err = perfdata.NewCollector("Hyper-V Legacy Network Adapter", perfdata.InstancesAll, []string{
|
||||
legacyNetworkAdapterBytesDropped,
|
||||
legacyNetworkAdapterBytesReceived,
|
||||
legacyNetworkAdapterBytesSent,
|
||||
legacyNetworkAdapterFramesDropped,
|
||||
legacyNetworkAdapterFramesReceived,
|
||||
legacyNetworkAdapterFramesSent,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create Hyper-V Legacy Network Adapter collector: %w", err)
|
||||
}
|
||||
|
||||
c.legacyNetworkAdapterBytesDropped = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "legacy_network_adapter_bytes_dropped_total"),
|
||||
"Bytes Dropped is the number of bytes dropped on the network adapter",
|
||||
[]string{"adapter"},
|
||||
nil,
|
||||
)
|
||||
c.legacyNetworkAdapterBytesReceived = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "legacy_network_adapter_bytes_received_total"),
|
||||
"Bytes received is the number of bytes received on the network adapter",
|
||||
[]string{"adapter"},
|
||||
nil,
|
||||
)
|
||||
c.legacyNetworkAdapterBytesSent = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "legacy_network_adapter_bytes_sent_total"),
|
||||
"Bytes sent is the number of bytes sent over the network adapter",
|
||||
[]string{"adapter"},
|
||||
nil,
|
||||
)
|
||||
c.legacyNetworkAdapterFramesDropped = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "legacy_network_adapter_frames_dropped_total"),
|
||||
"Frames Dropped is the number of frames dropped on the network adapter",
|
||||
[]string{"adapter"},
|
||||
nil,
|
||||
)
|
||||
c.legacyNetworkAdapterFramesReceived = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "legacy_network_adapter_frames_received_total"),
|
||||
"Frames received is the number of frames received on the network adapter",
|
||||
[]string{"adapter"},
|
||||
nil,
|
||||
)
|
||||
c.legacyNetworkAdapterFramesSent = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "legacy_network_adapter_frames_sent_total"),
|
||||
"Frames sent is the number of frames sent over the network adapter",
|
||||
[]string{"adapter"},
|
||||
nil,
|
||||
)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) collectLegacyNetworkAdapter(ch chan<- prometheus.Metric) error {
|
||||
data, err := c.perfDataCollectorLegacyNetworkAdapter.Collect()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect Hyper-V Legacy Network Adapter metrics: %w", err)
|
||||
}
|
||||
|
||||
for name, adapter := range data {
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.legacyNetworkAdapterBytesDropped,
|
||||
prometheus.GaugeValue,
|
||||
adapter[legacyNetworkAdapterBytesDropped].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.legacyNetworkAdapterBytesReceived,
|
||||
prometheus.CounterValue,
|
||||
adapter[legacyNetworkAdapterBytesReceived].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.legacyNetworkAdapterBytesSent,
|
||||
prometheus.CounterValue,
|
||||
adapter[legacyNetworkAdapterBytesSent].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.legacyNetworkAdapterFramesReceived,
|
||||
prometheus.CounterValue,
|
||||
adapter[legacyNetworkAdapterFramesReceived].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.legacyNetworkAdapterFramesDropped,
|
||||
prometheus.CounterValue,
|
||||
adapter[legacyNetworkAdapterFramesDropped].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.legacyNetworkAdapterFramesSent,
|
||||
prometheus.CounterValue,
|
||||
adapter[legacyNetworkAdapterFramesSent].FirstValue,
|
||||
name,
|
||||
)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
27
internal/collector/hyperv/hyperv_test.go
Normal file
27
internal/collector/hyperv/hyperv_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package hyperv_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/collector/hyperv"
|
||||
"github.com/prometheus-community/windows_exporter/internal/utils/testutils"
|
||||
)
|
||||
|
||||
func BenchmarkCollector(b *testing.B) {
|
||||
testutils.FuncBenchmarkCollector(b, hyperv.Name, hyperv.NewWithFlags)
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package hyperv
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
// collectorVirtualMachineHealthSummary Hyper-V Virtual Machine Health Summary metrics
|
||||
type collectorVirtualMachineHealthSummary struct {
|
||||
perfDataCollectorVirtualMachineHealthSummary *perfdata.Collector
|
||||
|
||||
// \Hyper-V Virtual Machine Health Summary\Health Critical
|
||||
// \Hyper-V Virtual Machine Health Summary\Health Ok
|
||||
health *prometheus.Desc
|
||||
}
|
||||
|
||||
const (
|
||||
// Hyper-V Virtual Machine Health Summary
|
||||
healthCritical = "Health Critical"
|
||||
healthOk = "Health Ok"
|
||||
)
|
||||
|
||||
func (c *Collector) buildVirtualMachineHealthSummary() error {
|
||||
var err error
|
||||
|
||||
c.perfDataCollectorVirtualMachineHealthSummary, err = perfdata.NewCollector("Hyper-V Virtual Machine Health Summary", nil, []string{
|
||||
healthCritical,
|
||||
healthOk,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create Hyper-V Virtual Machine Health Summary collector: %w", err)
|
||||
}
|
||||
|
||||
c.health = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_machine_health_total_count"),
|
||||
"Represents the number of virtual machines with critical health",
|
||||
[]string{"state"},
|
||||
nil,
|
||||
)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) collectVirtualMachineHealthSummary(ch chan<- prometheus.Metric) error {
|
||||
data, err := c.perfDataCollectorVirtualMachineHealthSummary.Collect()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect Hyper-V Virtual Machine Health Summary metrics: %w", err)
|
||||
}
|
||||
|
||||
healthData, ok := data[perfdata.InstanceEmpty]
|
||||
if !ok {
|
||||
return errors.New("no data returned for Hyper-V Virtual Machine Health Summary")
|
||||
}
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.health,
|
||||
prometheus.GaugeValue,
|
||||
healthData[healthCritical].FirstValue,
|
||||
"critical",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.health,
|
||||
prometheus.GaugeValue,
|
||||
healthData[healthOk].FirstValue,
|
||||
"ok",
|
||||
)
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package hyperv
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
// collectorVirtualMachineVidPartition Hyper-V VM Vid Partition metrics
|
||||
type collectorVirtualMachineVidPartition struct {
|
||||
perfDataCollectorVirtualMachineVidPartition *perfdata.Collector
|
||||
physicalPagesAllocated *prometheus.Desc // \Hyper-V VM Vid Partition(*)\Physical Pages Allocated
|
||||
preferredNUMANodeIndex *prometheus.Desc // \Hyper-V VM Vid Partition(*)\Preferred NUMA Node Index
|
||||
remotePhysicalPages *prometheus.Desc // \Hyper-V VM Vid Partition(*)\Remote Physical Pages
|
||||
}
|
||||
|
||||
const (
|
||||
physicalPagesAllocated = "Physical Pages Allocated"
|
||||
preferredNUMANodeIndex = "Preferred NUMA Node Index"
|
||||
remotePhysicalPages = "Remote Physical Pages"
|
||||
)
|
||||
|
||||
func (c *Collector) buildVirtualMachineVidPartition() error {
|
||||
var err error
|
||||
|
||||
c.perfDataCollectorVirtualMachineVidPartition, err = perfdata.NewCollector("Hyper-V VM Vid Partition", perfdata.InstancesAll, []string{
|
||||
physicalPagesAllocated,
|
||||
preferredNUMANodeIndex,
|
||||
remotePhysicalPages,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create Hyper-V VM Vid Partition collector: %w", err)
|
||||
}
|
||||
|
||||
c.physicalPagesAllocated = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "vid_physical_pages_allocated"),
|
||||
"The number of physical pages allocated",
|
||||
[]string{"vm"},
|
||||
nil,
|
||||
)
|
||||
c.preferredNUMANodeIndex = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "vid_preferred_numa_node_index"),
|
||||
"The preferred NUMA node index associated with this partition",
|
||||
[]string{"vm"},
|
||||
nil,
|
||||
)
|
||||
c.remotePhysicalPages = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "vid_remote_physical_pages"),
|
||||
"The number of physical pages not allocated from the preferred NUMA node",
|
||||
[]string{"vm"},
|
||||
nil,
|
||||
)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) collectVirtualMachineVidPartition(ch chan<- prometheus.Metric) error {
|
||||
data, err := c.perfDataCollectorVirtualMachineVidPartition.Collect()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect Hyper-V VM Vid Partition metrics: %w", err)
|
||||
}
|
||||
|
||||
for name, page := range data {
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.physicalPagesAllocated,
|
||||
prometheus.GaugeValue,
|
||||
page[physicalPagesAllocated].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.preferredNUMANodeIndex,
|
||||
prometheus.GaugeValue,
|
||||
page[preferredNUMANodeIndex].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.remotePhysicalPages,
|
||||
prometheus.GaugeValue,
|
||||
page[remotePhysicalPages].FirstValue,
|
||||
name,
|
||||
)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
153
internal/collector/hyperv/hyperv_virtual_network_adapter.go
Normal file
153
internal/collector/hyperv/hyperv_virtual_network_adapter.go
Normal file
@@ -0,0 +1,153 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package hyperv
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
// collectorVirtualNetworkAdapter Hyper-V Virtual Network Adapter metrics
|
||||
type collectorVirtualNetworkAdapter struct {
|
||||
perfDataCollectorVirtualNetworkAdapter *perfdata.Collector
|
||||
|
||||
virtualNetworkAdapterBytesReceived *prometheus.Desc // \Hyper-V Virtual Network Adapter(*)\Bytes Received/sec
|
||||
virtualNetworkAdapterBytesSent *prometheus.Desc // \Hyper-V Virtual Network Adapter(*)\Bytes Sent/sec
|
||||
virtualNetworkAdapterDroppedPacketsIncoming *prometheus.Desc // \Hyper-V Virtual Network Adapter(*)\Dropped Packets Incoming/sec
|
||||
virtualNetworkAdapterDroppedPacketsOutgoing *prometheus.Desc // \Hyper-V Virtual Network Adapter(*)\Dropped Packets Outgoing/sec
|
||||
virtualNetworkAdapterPacketsReceived *prometheus.Desc // \Hyper-V Virtual Network Adapter(*)\Packets Received/sec
|
||||
virtualNetworkAdapterPacketsSent *prometheus.Desc // \Hyper-V Virtual Network Adapter(*)\Packets Sent/sec
|
||||
}
|
||||
|
||||
const (
|
||||
virtualNetworkAdapterBytesReceived = "Bytes Received/sec"
|
||||
virtualNetworkAdapterBytesSent = "Bytes Sent/sec"
|
||||
virtualNetworkAdapterDroppedPacketsIncoming = "Dropped Packets Incoming/sec"
|
||||
virtualNetworkAdapterDroppedPacketsOutgoing = "Dropped Packets Outgoing/sec"
|
||||
virtualNetworkAdapterPacketsReceived = "Packets Received/sec"
|
||||
virtualNetworkAdapterPacketsSent = "Packets Sent/sec"
|
||||
)
|
||||
|
||||
func (c *Collector) buildVirtualNetworkAdapter() error {
|
||||
var err error
|
||||
|
||||
c.perfDataCollectorVirtualNetworkAdapter, err = perfdata.NewCollector("Hyper-V Virtual Network Adapter", perfdata.InstancesAll, []string{
|
||||
virtualNetworkAdapterBytesReceived,
|
||||
virtualNetworkAdapterBytesSent,
|
||||
virtualNetworkAdapterDroppedPacketsIncoming,
|
||||
virtualNetworkAdapterDroppedPacketsOutgoing,
|
||||
virtualNetworkAdapterPacketsReceived,
|
||||
virtualNetworkAdapterPacketsSent,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create Hyper-V Virtual Network Adapter collector: %w", err)
|
||||
}
|
||||
|
||||
c.virtualNetworkAdapterBytesReceived = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_network_adapter_received_bytes_total"),
|
||||
"Represents the total number of bytes received per second by the network adapter",
|
||||
[]string{"adapter"},
|
||||
nil,
|
||||
)
|
||||
c.virtualNetworkAdapterBytesSent = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_network_adapter_sent_bytes_total"),
|
||||
"Represents the total number of bytes sent per second by the network adapter",
|
||||
[]string{"adapter"},
|
||||
nil,
|
||||
)
|
||||
c.virtualNetworkAdapterDroppedPacketsIncoming = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_network_adapter_incoming_dropped_packets_total"),
|
||||
"Represents the total number of dropped packets per second in the incoming direction of the network adapter",
|
||||
[]string{"adapter"},
|
||||
nil,
|
||||
)
|
||||
c.virtualNetworkAdapterDroppedPacketsOutgoing = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_network_adapter_outgoing_dropped_packets_total"),
|
||||
"Represents the total number of dropped packets per second in the outgoing direction of the network adapter",
|
||||
[]string{"adapter"},
|
||||
nil,
|
||||
)
|
||||
c.virtualNetworkAdapterPacketsReceived = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_network_adapter_received_packets_total"),
|
||||
"Represents the total number of packets received per second by the network adapter",
|
||||
[]string{"adapter"},
|
||||
nil,
|
||||
)
|
||||
c.virtualNetworkAdapterPacketsSent = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_network_adapter_sent_packets_total"),
|
||||
"Represents the total number of packets sent per second by the network adapter",
|
||||
[]string{"adapter"},
|
||||
nil,
|
||||
)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) collectVirtualNetworkAdapter(ch chan<- prometheus.Metric) error {
|
||||
data, err := c.perfDataCollectorVirtualNetworkAdapter.Collect()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect Hyper-V Virtual Network Adapter metrics: %w", err)
|
||||
}
|
||||
|
||||
for name, adapterData := range data {
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterBytesReceived,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterBytesReceived].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterBytesSent,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterBytesSent].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDroppedPacketsIncoming,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDroppedPacketsIncoming].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDroppedPacketsOutgoing,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDroppedPacketsOutgoing].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterPacketsReceived,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterPacketsReceived].FirstValue,
|
||||
name,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterPacketsSent,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterPacketsSent].FirstValue,
|
||||
name,
|
||||
)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,541 @@
|
||||
// Copyright 2024 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package hyperv
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
// collectorVirtualNetworkAdapterDropReasons Hyper-V Virtual Network Adapter Drop Reasons metrics
|
||||
type collectorVirtualNetworkAdapterDropReasons struct {
|
||||
perfDataCollectorVirtualNetworkAdapterDropReasons *perfdata.Collector
|
||||
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing LowPowerPacketFilter
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming LowPowerPacketFilter
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing InvalidPDQueue
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming InvalidPDQueue
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing FilteredIsolationUntagged
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming FilteredIsolationUntagged
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing SwitchDataFlowDisabled
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming SwitchDataFlowDisabled
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing FailedPacketFilter
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming FailedPacketFilter
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing NicDisabled
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming NicDisabled
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing FailedDestinationListUpdate
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming FailedDestinationListUpdate
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing InjectedIcmp
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming InjectedIcmp
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing StormLimit
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming StormLimit
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing InvalidFirstNBTooSmall
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming InvalidFirstNBTooSmall
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing InvalidSourceMac
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming InvalidSourceMac
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing InvalidDestMac
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming InvalidDestMac
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing InvalidVlanFormat
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming InvalidVlanFormat
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing NativeFwdingReq
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming NativeFwdingReq
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing MTUMismatch
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming MTUMismatch
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing InvalidConfig
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming InvalidConfig
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing RequiredExtensionMissing
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming RequiredExtensionMissing
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing VirtualSubnetId
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming VirtualSubnetId
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing BridgeReserved
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming BridgeReserved
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing RouterGuard
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming RouterGuard
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing DhcpGuard
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming DhcpGuard
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing MacSpoofing
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming MacSpoofing
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing Ipsec
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming Ipsec
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing Qos
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming Qos
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing FailedPvlanSetting
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming FailedPvlanSetting
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing FailedSecurityPolicy
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming FailedSecurityPolicy
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing UnauthorizedMAC
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming UnauthorizedMAC
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing UnauthorizedVLAN
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming UnauthorizedVLAN
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing FilteredVLAN
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming FilteredVLAN
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing Filtered
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming Filtered
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing Busy
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming Busy
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing NotAccepted
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming NotAccepted
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing Disconnected
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming Disconnected
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing NotReady
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming NotReady
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing Resources
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming Resources
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing InvalidPacket
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming InvalidPacket
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing InvalidData
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming InvalidData
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Outgoing Unknown
|
||||
// \Hyper-V Virtual Network Adapter Drop Reasons(*)\Incoming Unknown
|
||||
virtualNetworkAdapterDropReasons *prometheus.Desc
|
||||
}
|
||||
|
||||
const (
|
||||
virtualNetworkAdapterDropReasonsOutgoingNativeFwdingReq = "Outgoing NativeFwdingReq"
|
||||
virtualNetworkAdapterDropReasonsIncomingNativeFwdingReq = "Incoming NativeFwdingReq"
|
||||
virtualNetworkAdapterDropReasonsOutgoingMTUMismatch = "Outgoing MTUMismatch"
|
||||
virtualNetworkAdapterDropReasonsIncomingMTUMismatch = "Incoming MTUMismatch"
|
||||
virtualNetworkAdapterDropReasonsOutgoingInvalidConfig = "Outgoing InvalidConfig"
|
||||
virtualNetworkAdapterDropReasonsIncomingInvalidConfig = "Incoming InvalidConfig"
|
||||
virtualNetworkAdapterDropReasonsOutgoingRequiredExtensionMissing = "Outgoing RequiredExtensionMissing"
|
||||
virtualNetworkAdapterDropReasonsIncomingRequiredExtensionMissing = "Incoming RequiredExtensionMissing"
|
||||
virtualNetworkAdapterDropReasonsOutgoingVirtualSubnetId = "Outgoing VirtualSubnetId"
|
||||
virtualNetworkAdapterDropReasonsIncomingVirtualSubnetId = "Incoming VirtualSubnetId"
|
||||
virtualNetworkAdapterDropReasonsOutgoingBridgeReserved = "Outgoing BridgeReserved"
|
||||
virtualNetworkAdapterDropReasonsIncomingBridgeReserved = "Incoming BridgeReserved"
|
||||
virtualNetworkAdapterDropReasonsOutgoingRouterGuard = "Outgoing RouterGuard"
|
||||
virtualNetworkAdapterDropReasonsIncomingRouterGuard = "Incoming RouterGuard"
|
||||
virtualNetworkAdapterDropReasonsOutgoingDhcpGuard = "Outgoing DhcpGuard"
|
||||
virtualNetworkAdapterDropReasonsIncomingDhcpGuard = "Incoming DhcpGuard"
|
||||
virtualNetworkAdapterDropReasonsOutgoingMacSpoofing = "Outgoing MacSpoofing"
|
||||
virtualNetworkAdapterDropReasonsIncomingMacSpoofing = "Incoming MacSpoofing"
|
||||
virtualNetworkAdapterDropReasonsOutgoingIpsec = "Outgoing Ipsec"
|
||||
virtualNetworkAdapterDropReasonsIncomingIpsec = "Incoming Ipsec"
|
||||
virtualNetworkAdapterDropReasonsOutgoingQos = "Outgoing Qos"
|
||||
virtualNetworkAdapterDropReasonsIncomingQos = "Incoming Qos"
|
||||
virtualNetworkAdapterDropReasonsOutgoingFailedPvlanSetting = "Outgoing FailedPvlanSetting"
|
||||
virtualNetworkAdapterDropReasonsIncomingFailedPvlanSetting = "Incoming FailedPvlanSetting"
|
||||
virtualNetworkAdapterDropReasonsOutgoingFailedSecurityPolicy = "Outgoing FailedSecurityPolicy"
|
||||
virtualNetworkAdapterDropReasonsIncomingFailedSecurityPolicy = "Incoming FailedSecurityPolicy"
|
||||
virtualNetworkAdapterDropReasonsOutgoingUnauthorizedMAC = "Outgoing UnauthorizedMAC"
|
||||
virtualNetworkAdapterDropReasonsIncomingUnauthorizedMAC = "Incoming UnauthorizedMAC"
|
||||
virtualNetworkAdapterDropReasonsOutgoingUnauthorizedVLAN = "Outgoing UnauthorizedVLAN"
|
||||
virtualNetworkAdapterDropReasonsIncomingUnauthorizedVLAN = "Incoming UnauthorizedVLAN"
|
||||
virtualNetworkAdapterDropReasonsOutgoingFilteredVLAN = "Outgoing FilteredVLAN"
|
||||
virtualNetworkAdapterDropReasonsIncomingFilteredVLAN = "Incoming FilteredVLAN"
|
||||
virtualNetworkAdapterDropReasonsOutgoingFiltered = "Outgoing Filtered"
|
||||
virtualNetworkAdapterDropReasonsIncomingFiltered = "Incoming Filtered"
|
||||
virtualNetworkAdapterDropReasonsOutgoingBusy = "Outgoing Busy"
|
||||
virtualNetworkAdapterDropReasonsIncomingBusy = "Incoming Busy"
|
||||
virtualNetworkAdapterDropReasonsOutgoingNotAccepted = "Outgoing NotAccepted"
|
||||
virtualNetworkAdapterDropReasonsIncomingNotAccepted = "Incoming NotAccepted"
|
||||
virtualNetworkAdapterDropReasonsOutgoingDisconnected = "Outgoing Disconnected"
|
||||
virtualNetworkAdapterDropReasonsIncomingDisconnected = "Incoming Disconnected"
|
||||
virtualNetworkAdapterDropReasonsOutgoingNotReady = "Outgoing NotReady"
|
||||
virtualNetworkAdapterDropReasonsIncomingNotReady = "Incoming NotReady"
|
||||
virtualNetworkAdapterDropReasonsOutgoingResources = "Outgoing Resources"
|
||||
virtualNetworkAdapterDropReasonsIncomingResources = "Incoming Resources"
|
||||
virtualNetworkAdapterDropReasonsOutgoingInvalidPacket = "Outgoing InvalidPacket"
|
||||
virtualNetworkAdapterDropReasonsIncomingInvalidPacket = "Incoming InvalidPacket"
|
||||
virtualNetworkAdapterDropReasonsOutgoingInvalidData = "Outgoing InvalidData"
|
||||
virtualNetworkAdapterDropReasonsIncomingInvalidData = "Incoming InvalidData"
|
||||
virtualNetworkAdapterDropReasonsOutgoingUnknown = "Outgoing Unknown"
|
||||
virtualNetworkAdapterDropReasonsIncomingUnknown = "Incoming Unknown"
|
||||
)
|
||||
|
||||
func (c *Collector) buildVirtualNetworkAdapterDropReasons() error {
|
||||
var err error
|
||||
|
||||
c.perfDataCollectorVirtualNetworkAdapterDropReasons, err = perfdata.NewCollector("Hyper-V Virtual Network Adapter Drop Reasons", perfdata.InstancesAll, []string{
|
||||
virtualNetworkAdapterDropReasonsOutgoingNativeFwdingReq,
|
||||
virtualNetworkAdapterDropReasonsIncomingNativeFwdingReq,
|
||||
virtualNetworkAdapterDropReasonsOutgoingMTUMismatch,
|
||||
virtualNetworkAdapterDropReasonsIncomingMTUMismatch,
|
||||
virtualNetworkAdapterDropReasonsOutgoingInvalidConfig,
|
||||
virtualNetworkAdapterDropReasonsIncomingInvalidConfig,
|
||||
virtualNetworkAdapterDropReasonsOutgoingRequiredExtensionMissing,
|
||||
virtualNetworkAdapterDropReasonsIncomingRequiredExtensionMissing,
|
||||
virtualNetworkAdapterDropReasonsOutgoingVirtualSubnetId,
|
||||
virtualNetworkAdapterDropReasonsIncomingVirtualSubnetId,
|
||||
virtualNetworkAdapterDropReasonsOutgoingBridgeReserved,
|
||||
virtualNetworkAdapterDropReasonsIncomingBridgeReserved,
|
||||
virtualNetworkAdapterDropReasonsOutgoingRouterGuard,
|
||||
virtualNetworkAdapterDropReasonsIncomingRouterGuard,
|
||||
virtualNetworkAdapterDropReasonsOutgoingDhcpGuard,
|
||||
virtualNetworkAdapterDropReasonsIncomingDhcpGuard,
|
||||
virtualNetworkAdapterDropReasonsOutgoingMacSpoofing,
|
||||
virtualNetworkAdapterDropReasonsIncomingMacSpoofing,
|
||||
virtualNetworkAdapterDropReasonsOutgoingIpsec,
|
||||
virtualNetworkAdapterDropReasonsIncomingIpsec,
|
||||
virtualNetworkAdapterDropReasonsOutgoingQos,
|
||||
virtualNetworkAdapterDropReasonsIncomingQos,
|
||||
virtualNetworkAdapterDropReasonsOutgoingFailedPvlanSetting,
|
||||
virtualNetworkAdapterDropReasonsIncomingFailedPvlanSetting,
|
||||
virtualNetworkAdapterDropReasonsOutgoingFailedSecurityPolicy,
|
||||
virtualNetworkAdapterDropReasonsIncomingFailedSecurityPolicy,
|
||||
virtualNetworkAdapterDropReasonsOutgoingUnauthorizedMAC,
|
||||
virtualNetworkAdapterDropReasonsIncomingUnauthorizedMAC,
|
||||
virtualNetworkAdapterDropReasonsOutgoingUnauthorizedVLAN,
|
||||
virtualNetworkAdapterDropReasonsIncomingUnauthorizedVLAN,
|
||||
virtualNetworkAdapterDropReasonsOutgoingFilteredVLAN,
|
||||
virtualNetworkAdapterDropReasonsIncomingFilteredVLAN,
|
||||
virtualNetworkAdapterDropReasonsOutgoingFiltered,
|
||||
virtualNetworkAdapterDropReasonsIncomingFiltered,
|
||||
virtualNetworkAdapterDropReasonsOutgoingBusy,
|
||||
virtualNetworkAdapterDropReasonsIncomingBusy,
|
||||
virtualNetworkAdapterDropReasonsOutgoingNotAccepted,
|
||||
virtualNetworkAdapterDropReasonsIncomingNotAccepted,
|
||||
virtualNetworkAdapterDropReasonsOutgoingDisconnected,
|
||||
virtualNetworkAdapterDropReasonsIncomingDisconnected,
|
||||
virtualNetworkAdapterDropReasonsOutgoingNotReady,
|
||||
virtualNetworkAdapterDropReasonsIncomingNotReady,
|
||||
virtualNetworkAdapterDropReasonsOutgoingResources,
|
||||
virtualNetworkAdapterDropReasonsIncomingResources,
|
||||
virtualNetworkAdapterDropReasonsOutgoingInvalidPacket,
|
||||
virtualNetworkAdapterDropReasonsIncomingInvalidPacket,
|
||||
virtualNetworkAdapterDropReasonsOutgoingInvalidData,
|
||||
virtualNetworkAdapterDropReasonsIncomingInvalidData,
|
||||
virtualNetworkAdapterDropReasonsOutgoingUnknown,
|
||||
virtualNetworkAdapterDropReasonsIncomingUnknown,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create Hyper-V Virtual Network Adapter Drop Reasons collector: %w", err)
|
||||
}
|
||||
|
||||
c.virtualNetworkAdapterDropReasons = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "virtual_network_adapter_drop_reasons"),
|
||||
"Hyper-V Virtual Network Adapter Drop Reasons",
|
||||
[]string{"adapter", "reason", "direction"},
|
||||
nil,
|
||||
)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Collector) collectVirtualNetworkAdapterDropReasons(ch chan<- prometheus.Metric) error {
|
||||
data, err := c.perfDataCollectorVirtualNetworkAdapterDropReasons.Collect()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect Hyper-V Virtual Network Adapter Drop Reasons metrics: %w", err)
|
||||
}
|
||||
|
||||
for name, adapterData := range data {
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsOutgoingNativeFwdingReq].FirstValue,
|
||||
name, "NativeFwdingReq", "outgoing",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsIncomingNativeFwdingReq].FirstValue,
|
||||
name, "NativeFwdingReq", "incoming",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsOutgoingMTUMismatch].FirstValue,
|
||||
name, "MTUMismatch", "outgoing",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsIncomingMTUMismatch].FirstValue,
|
||||
name, "MTUMismatch", "incoming",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsOutgoingInvalidConfig].FirstValue,
|
||||
name, "InvalidConfig", "outgoing",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsIncomingInvalidConfig].FirstValue,
|
||||
name, "InvalidConfig", "incoming",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsOutgoingRequiredExtensionMissing].FirstValue,
|
||||
name, "RequiredExtensionMissing", "outgoing",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsIncomingRequiredExtensionMissing].FirstValue,
|
||||
name, "RequiredExtensionMissing", "incoming",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsOutgoingVirtualSubnetId].FirstValue,
|
||||
name, "VirtualSubnetId", "outgoing",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsIncomingVirtualSubnetId].FirstValue,
|
||||
name, "VirtualSubnetId", "incoming",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsOutgoingBridgeReserved].FirstValue,
|
||||
name, "BridgeReserved", "outgoing",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsIncomingBridgeReserved].FirstValue,
|
||||
name, "BridgeReserved", "incoming",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsOutgoingRouterGuard].FirstValue,
|
||||
name, "RouterGuard", "outgoing",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsIncomingRouterGuard].FirstValue,
|
||||
name, "RouterGuard", "incoming",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsOutgoingDhcpGuard].FirstValue,
|
||||
name, "DhcpGuard", "outgoing",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsIncomingDhcpGuard].FirstValue,
|
||||
name, "DhcpGuard", "incoming",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsOutgoingMacSpoofing].FirstValue,
|
||||
name, "MacSpoofing", "outgoing",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsIncomingMacSpoofing].FirstValue,
|
||||
name, "MacSpoofing", "incoming",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsOutgoingIpsec].FirstValue,
|
||||
name, "Ipsec", "outgoing",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsIncomingIpsec].FirstValue,
|
||||
name, "Ipsec", "incoming",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsOutgoingQos].FirstValue,
|
||||
name, "Qos", "outgoing",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsIncomingQos].FirstValue,
|
||||
name, "Qos", "incoming",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsOutgoingFailedPvlanSetting].FirstValue,
|
||||
name, "FailedPvlanSetting", "outgoing",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsIncomingFailedPvlanSetting].FirstValue,
|
||||
name, "FailedPvlanSetting", "incoming",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsOutgoingFailedSecurityPolicy].FirstValue,
|
||||
name, "FailedSecurityPolicy", "outgoing",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsIncomingFailedSecurityPolicy].FirstValue,
|
||||
name, "FailedSecurityPolicy", "incoming",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsOutgoingUnauthorizedMAC].FirstValue,
|
||||
name, "UnauthorizedMAC", "outgoing",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsIncomingUnauthorizedMAC].FirstValue,
|
||||
name, "UnauthorizedMAC", "incoming",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsOutgoingUnauthorizedVLAN].FirstValue,
|
||||
name, "UnauthorizedVLAN", "outgoing",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsIncomingUnauthorizedVLAN].FirstValue,
|
||||
name, "UnauthorizedVLAN", "incoming",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsOutgoingFilteredVLAN].FirstValue,
|
||||
name, "FilteredVLAN", "outgoing",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsIncomingFilteredVLAN].FirstValue,
|
||||
name, "FilteredVLAN", "incoming",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsOutgoingFiltered].FirstValue,
|
||||
name, "Filtered", "outgoing",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsIncomingFiltered].FirstValue,
|
||||
name, "Filtered", "incoming",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsOutgoingBusy].FirstValue,
|
||||
name, "Busy", "outgoing",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsIncomingBusy].FirstValue,
|
||||
name, "Busy", "incoming",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsOutgoingNotAccepted].FirstValue,
|
||||
name, "NotAccepted", "outgoing",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsIncomingNotAccepted].FirstValue,
|
||||
name, "NotAccepted", "incoming",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsOutgoingDisconnected].FirstValue,
|
||||
name, "Disconnected", "outgoing",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsIncomingDisconnected].FirstValue,
|
||||
name, "Disconnected", "incoming",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsOutgoingNotReady].FirstValue,
|
||||
name, "NotReady", "outgoing",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsIncomingNotReady].FirstValue,
|
||||
name, "NotReady", "incoming",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsOutgoingResources].FirstValue,
|
||||
name, "Resources", "outgoing",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsIncomingResources].FirstValue,
|
||||
name, "Resources", "incoming",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsOutgoingInvalidPacket].FirstValue,
|
||||
name, "InvalidPacket", "outgoing",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsIncomingInvalidPacket].FirstValue,
|
||||
name, "InvalidPacket", "incoming",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsOutgoingInvalidData].FirstValue,
|
||||
name, "InvalidData", "outgoing",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsIncomingInvalidData].FirstValue,
|
||||
name, "InvalidData", "incoming",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsOutgoingUnknown].FirstValue,
|
||||
name, "Unknown", "outgoing",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.virtualNetworkAdapterDropReasons,
|
||||
prometheus.CounterValue,
|
||||
adapterData[virtualNetworkAdapterDropReasonsIncomingUnknown].FirstValue,
|
||||
name, "Unknown", "incoming",
|
||||
)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user