mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-23 21:26:36 +00:00
Compare commits
25 Commits
v0.30.0-be
...
v0.30.0-rc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f5ff75ebc2 | ||
|
|
71e5e5ec5f | ||
|
|
40ff2f2e57 | ||
|
|
9db94aa66a | ||
|
|
a359acb3d1 | ||
|
|
487de0c20b | ||
|
|
aaa4ce07f6 | ||
|
|
a2db81494e | ||
|
|
64bf0a6551 | ||
|
|
40b6f53479 | ||
|
|
ca04ad8fd2 | ||
|
|
fd55ac4894 | ||
|
|
c8eeb595c0 | ||
|
|
1a4c6c5ce7 | ||
|
|
fd76be38e0 | ||
|
|
eff124250f | ||
|
|
1badb34506 | ||
|
|
f9e41294c3 | ||
|
|
86ace68978 | ||
|
|
e812584f27 | ||
|
|
1ecc340659 | ||
|
|
4c0574536f | ||
|
|
26d6dddf25 | ||
|
|
75c6a4c182 | ||
|
|
a602d7be9d |
@@ -11,7 +11,6 @@ linters:
|
|||||||
- exportloopref
|
- exportloopref
|
||||||
- fatcontext
|
- fatcontext
|
||||||
- funlen
|
- funlen
|
||||||
- gochecknoglobals
|
|
||||||
- gocognit
|
- gocognit
|
||||||
- goconst
|
- goconst
|
||||||
- gocyclo
|
- gocyclo
|
||||||
@@ -26,7 +25,10 @@ linters:
|
|||||||
- wrapcheck
|
- wrapcheck
|
||||||
|
|
||||||
run:
|
run:
|
||||||
timeout: 5m
|
timeout: 15m
|
||||||
|
|
||||||
|
output:
|
||||||
|
sort-results: true
|
||||||
|
|
||||||
linters-settings:
|
linters-settings:
|
||||||
gosec:
|
gosec:
|
||||||
@@ -85,7 +87,3 @@ issues:
|
|||||||
- text: "don't use ALL_CAPS in Go names; use CamelCase"
|
- text: "don't use ALL_CAPS in Go names; use CamelCase"
|
||||||
linters:
|
linters:
|
||||||
- revive
|
- revive
|
||||||
- path: internal/perfdata/v1/
|
|
||||||
linters:
|
|
||||||
- godox
|
|
||||||
- stylecheck
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ repository:
|
|||||||
build:
|
build:
|
||||||
binaries:
|
binaries:
|
||||||
- name: windows_exporter
|
- name: windows_exporter
|
||||||
|
path: ./cmd/windows_exporter
|
||||||
tags:
|
tags:
|
||||||
all:
|
all:
|
||||||
- trimpath
|
- trimpath
|
||||||
|
|||||||
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,performancecounter,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>
|
||||||
10
README.md
10
README.md
@@ -42,7 +42,7 @@ Name | Description | Enabled by default
|
|||||||
[net](docs/collector.net.md) | Network interface I/O | ✓
|
[net](docs/collector.net.md) | Network interface I/O | ✓
|
||||||
[os](docs/collector.os.md) | OS metrics (memory, processes, users) | ✓
|
[os](docs/collector.os.md) | OS metrics (memory, processes, users) | ✓
|
||||||
[pagefile](docs/collector.pagefile.md) | pagefile metrics |
|
[pagefile](docs/collector.pagefile.md) | pagefile metrics |
|
||||||
[perfdata](docs/collector.perfdata.md) | Custom perfdata metrics |
|
[performancecounter](docs/collector.performancecounter.md) | Custom performance counter metrics |
|
||||||
[physical_disk](docs/collector.physical_disk.md) | physical disk metrics | ✓
|
[physical_disk](docs/collector.physical_disk.md) | physical disk metrics | ✓
|
||||||
[printer](docs/collector.printer.md) | Printer metrics |
|
[printer](docs/collector.printer.md) | Printer metrics |
|
||||||
[process](docs/collector.process.md) | Per-process metrics |
|
[process](docs/collector.process.md) | Per-process metrics |
|
||||||
@@ -199,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)
|
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
|
## Examples
|
||||||
|
|
||||||
### Enable only service collector and specify a custom query
|
### 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: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
|
//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
|
||||||
@@ -29,6 +42,7 @@ import (
|
|||||||
"github.com/prometheus-community/windows_exporter/internal/httphandler"
|
"github.com/prometheus-community/windows_exporter/internal/httphandler"
|
||||||
"github.com/prometheus-community/windows_exporter/internal/log"
|
"github.com/prometheus-community/windows_exporter/internal/log"
|
||||||
"github.com/prometheus-community/windows_exporter/internal/log/flag"
|
"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/collector"
|
||||||
"github.com/prometheus/common/version"
|
"github.com/prometheus/common/version"
|
||||||
"github.com/prometheus/exporter-toolkit/web"
|
"github.com/prometheus/exporter-toolkit/web"
|
||||||
@@ -51,6 +65,8 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func run() int {
|
func run() int {
|
||||||
|
startTime := time.Now()
|
||||||
|
|
||||||
app := kingpin.New("windows_exporter", "A metrics collector for Windows.")
|
app := kingpin.New("windows_exporter", "A metrics collector for Windows.")
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -71,10 +87,6 @@ func run() int {
|
|||||||
"web.disable-exporter-metrics",
|
"web.disable-exporter-metrics",
|
||||||
"Exclude metrics about the exporter itself (promhttp_*, process_*, go_*).",
|
"Exclude metrics about the exporter itself (promhttp_*, process_*, go_*).",
|
||||||
).Bool()
|
).Bool()
|
||||||
maxRequests = app.Flag(
|
|
||||||
"telemetry.max-requests",
|
|
||||||
"Maximum number of concurrent requests. 0 to disable.",
|
|
||||||
).Default("5").Int()
|
|
||||||
enabledCollectors = app.Flag(
|
enabledCollectors = app.Flag(
|
||||||
"collectors.enabled",
|
"collectors.enabled",
|
||||||
"Comma-separated list of collectors to use. Use '[defaults]' as a placeholder for all the collectors enabled by default.").
|
"Comma-separated list of collectors to use. Use '[defaults]' as a placeholder for all the collectors enabled by default.").
|
||||||
@@ -93,7 +105,14 @@ func run() int {
|
|||||||
).Default("normal").String()
|
).Default("normal").String()
|
||||||
)
|
)
|
||||||
|
|
||||||
logConfig := &log.Config{}
|
logFile := &log.AllowedFile{}
|
||||||
|
|
||||||
|
_ = logFile.Set("stdout")
|
||||||
|
if windowsservice.IsService {
|
||||||
|
_ = logFile.Set("eventlog")
|
||||||
|
}
|
||||||
|
|
||||||
|
logConfig := &log.Config{File: logFile}
|
||||||
flag.AddFlags(app, logConfig)
|
flag.AddFlags(app, logConfig)
|
||||||
|
|
||||||
app.Version(version.Print("windows_exporter"))
|
app.Version(version.Print("windows_exporter"))
|
||||||
@@ -178,7 +197,7 @@ func run() int {
|
|||||||
|
|
||||||
enabledCollectorList := expandEnabledCollectors(*enabledCollectors)
|
enabledCollectorList := expandEnabledCollectors(*enabledCollectors)
|
||||||
if err := collectors.Enable(enabledCollectorList); err != nil {
|
if err := collectors.Enable(enabledCollectorList); err != nil {
|
||||||
logger.Error("Couldn't enable collectors",
|
logger.Error("couldn't enable collectors",
|
||||||
slog.Any("err", err),
|
slog.Any("err", err),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -187,11 +206,11 @@ func run() int {
|
|||||||
|
|
||||||
// Initialize collectors before loading
|
// Initialize collectors before loading
|
||||||
if err = collectors.Build(logger); err != nil {
|
if err = collectors.Build(logger); err != nil {
|
||||||
logger.Error("Couldn't load collectors",
|
for _, err := range utils.SplitError(err) {
|
||||||
slog.Any("err", err),
|
logger.Warn("couldn't initialize collector",
|
||||||
)
|
slog.Any("err", err),
|
||||||
|
)
|
||||||
return 1
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logCurrentUser(logger)
|
logCurrentUser(logger)
|
||||||
@@ -204,7 +223,6 @@ func run() int {
|
|||||||
mux.Handle("GET "+*metricsPath, httphandler.New(logger, collectors, &httphandler.Options{
|
mux.Handle("GET "+*metricsPath, httphandler.New(logger, collectors, &httphandler.Options{
|
||||||
DisableExporterMetrics: *disableExporterMetrics,
|
DisableExporterMetrics: *disableExporterMetrics,
|
||||||
TimeoutMargin: *timeoutMargin,
|
TimeoutMargin: *timeoutMargin,
|
||||||
MaxRequests: *maxRequests,
|
|
||||||
}))
|
}))
|
||||||
|
|
||||||
if *debugEnabled {
|
if *debugEnabled {
|
||||||
@@ -215,7 +233,7 @@ func run() int {
|
|||||||
mux.HandleFunc("GET /debug/pprof/trace", pprof.Trace)
|
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("version", version.Version),
|
||||||
slog.String("branch", version.Branch),
|
slog.String("branch", version.Branch),
|
||||||
slog.String("revision", version.GetRevision()),
|
slog.String("revision", version.GetRevision()),
|
||||||
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": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,6 +18,7 @@ This directory contains documentation of the collectors in the windows_exporter,
|
|||||||
- [`fsrmquota`](collector.fsrmquota.md)
|
- [`fsrmquota`](collector.fsrmquota.md)
|
||||||
- [`hyperv`](collector.hyperv.md)
|
- [`hyperv`](collector.hyperv.md)
|
||||||
- [`iis`](collector.iis.md)
|
- [`iis`](collector.iis.md)
|
||||||
|
- [`license`](collector.license.md)
|
||||||
- [`logical_disk`](collector.logical_disk.md)
|
- [`logical_disk`](collector.logical_disk.md)
|
||||||
- [`logon`](collector.logon.md)
|
- [`logon`](collector.logon.md)
|
||||||
- [`memory`](collector.memory.md)
|
- [`memory`](collector.memory.md)
|
||||||
@@ -28,12 +29,16 @@ This directory contains documentation of the collectors in the windows_exporter,
|
|||||||
- [`netframework`](collector.netframework.md)
|
- [`netframework`](collector.netframework.md)
|
||||||
- [`nps`](collector.nps.md)
|
- [`nps`](collector.nps.md)
|
||||||
- [`os`](collector.os.md)
|
- [`os`](collector.os.md)
|
||||||
|
- [`pagefile`](collector.pagefile.md)
|
||||||
|
- [`performancecounter`](collector.performancecounter.md)
|
||||||
- [`physical_disk`](collector.physical_disk.md)
|
- [`physical_disk`](collector.physical_disk.md)
|
||||||
|
- [`printer`](collector.printer.md)
|
||||||
- [`process`](collector.process.md)
|
- [`process`](collector.process.md)
|
||||||
- [`remote_fx`](collector.remote_fx.md)
|
- [`remote_fx`](collector.remote_fx.md)
|
||||||
- [`scheduled_task`](collector.scheduled_task.md)
|
- [`scheduled_task`](collector.scheduled_task.md)
|
||||||
- [`service`](collector.service.md)
|
- [`service`](collector.service.md)
|
||||||
- [`smb`](collector.smb.md)
|
- [`smb`](collector.smb.md)
|
||||||
|
- [`smbclient`](collector.smbclient.md)
|
||||||
- [`smtp`](collector.smtp.md)
|
- [`smtp`](collector.smtp.md)
|
||||||
- [`system`](collector.system.md)
|
- [`system`](collector.system.md)
|
||||||
- [`tcp`](collector.tcp.md)
|
- [`tcp`](collector.tcp.md)
|
||||||
|
|||||||
@@ -2,26 +2,22 @@
|
|||||||
|
|
||||||
The msmq collector exposes metrics about the queues on a MSMQ server
|
The msmq collector exposes metrics about the queues on a MSMQ server
|
||||||
|
|
||||||
|||
|
| | |
|
||||||
-|-
|
|---------------------|----------------------|
|
||||||
Metric name prefix | `msmq`
|
| Metric name prefix | `msmq` |
|
||||||
Classes | `Win32_PerfRawData_MSMQ_MSMQQueue`
|
| Spource | Performance Counters |
|
||||||
Enabled by default? | No
|
| Enabled by default? | No |
|
||||||
|
|
||||||
## Flags
|
## 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
|
## Metrics
|
||||||
|
|
||||||
Name | Description | Type | Labels
|
| Name | Description | Type | Labels |
|
||||||
-----|-------------|------|-------
|
|------------------------------------------|---------------------------------|-------|--------|
|
||||||
`windows_msmq_bytes_in_journal_queue` | Size of queue journal in bytes | gauge | `name`
|
| `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_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_journal_queue` | Count messages in queue journal | gauge | `name` |
|
||||||
`windows_msmq_messages_in_queue` | Count messages in queue | gauge | `name`
|
| `windows_msmq_messages_in_queue` | Count messages in queue | gauge | `name` |
|
||||||
|
|
||||||
### Example metric
|
### Example metric
|
||||||
_This collector does not yet have explained examples, we would appreciate your help adding them!_
|
_This collector does not yet have explained examples, we would appreciate your help adding them!_
|
||||||
|
|||||||
@@ -1,114 +0,0 @@
|
|||||||
# Perfdata collector
|
|
||||||
|
|
||||||
The perfdata collector exposes any configured metric.
|
|
||||||
|
|
||||||
| | |
|
|
||||||
|---------------------|-------------------------|
|
|
||||||
| Metric name prefix | `perfdata` |
|
|
||||||
| Data source | Performance Data Helper |
|
|
||||||
| Enabled by default? | No |
|
|
||||||
|
|
||||||
## Flags
|
|
||||||
|
|
||||||
|
|
||||||
### `--collector.perfdata.objects`
|
|
||||||
|
|
||||||
Objects is a list of objects to collect metrics from. The value takes the form of a JSON array of strings. YAML is also supported.
|
|
||||||
|
|
||||||
The collector supports only english named counter. Localized counter-names are not supported.
|
|
||||||
|
|
||||||
#### Schema
|
|
||||||
|
|
||||||
YAML:
|
|
||||||
```yaml
|
|
||||||
- object: "Processor Information"
|
|
||||||
instances: ["*"]
|
|
||||||
instance_label: "core"
|
|
||||||
counters:
|
|
||||||
"% Processor Time": {}
|
|
||||||
- object: "Memory"
|
|
||||||
counters:
|
|
||||||
"Cache Faults/sec":
|
|
||||||
type: "counter"
|
|
||||||
```
|
|
||||||
|
|
||||||
JSON:
|
|
||||||
|
|
||||||
```json
|
|
||||||
[
|
|
||||||
{"object":"Processor Information","instance_label": "core","instances":["*"],"counters": {"% Processor Time": {}}},
|
|
||||||
{"object":"Memory","counters": {"Cache Faults/sec": {"type": "counter"}}}
|
|
||||||
]
|
|
||||||
```
|
|
||||||
|
|
||||||
#### name
|
|
||||||
|
|
||||||
ObjectName is the Object to query for, like Processor, DirectoryServices, LogicalDisk or similar.
|
|
||||||
|
|
||||||
The collector supports only english named counter. Localized counter-names are not supported.
|
|
||||||
|
|
||||||
#### instances
|
|
||||||
|
|
||||||
The instances key (this is an array) declares the instances of a counter you would like returned, it can be one or more values.
|
|
||||||
|
|
||||||
Example: Instances = `["C:","D:","E:"]`
|
|
||||||
|
|
||||||
This will return only for the instances C:, D: and E: where relevant. To get all instances of a Counter, use `["*"]` only.
|
|
||||||
|
|
||||||
Some Objects like `Memory` do not have instances to select from at all. In this case, the `instances` key can be omitted.
|
|
||||||
|
|
||||||
#### counters
|
|
||||||
|
|
||||||
The Counters key (this is an object) declares the counters of the ObjectName you would like returned, it can also be one or more values.
|
|
||||||
|
|
||||||
Example: Counters = `{"% Idle Time": {}, "% Disk Read Time": {}, "% Disk Write Time": {}}`
|
|
||||||
|
|
||||||
This must be specified for every counter you want the results. Wildcards are not supported.
|
|
||||||
|
|
||||||
#### counters Sub-Schema
|
|
||||||
|
|
||||||
##### type
|
|
||||||
|
|
||||||
This key is optional. It indicates the type of the counter. The value can be `counter` or `gauge`.
|
|
||||||
If not specified, the windows_exporter will try to determine the type based on the counter type.
|
|
||||||
|
|
||||||
### Example
|
|
||||||
|
|
||||||
```
|
|
||||||
# HELP windows_perfdata_memory_cache_faults_sec
|
|
||||||
# TYPE windows_perfdata_memory_cache_faults_sec counter
|
|
||||||
windows_perfdata_memory_cache_faults_sec 2.369977e+07
|
|
||||||
# HELP windows_perfdata_processor_information__processor_time
|
|
||||||
# TYPE windows_perfdata_processor_information__processor_time gauge
|
|
||||||
windows_perfdata_processor_information__processor_time{instance="0,0"} 1.7259640625e+11
|
|
||||||
windows_perfdata_processor_information__processor_time{instance="0,1"} 1.7576796875e+11
|
|
||||||
windows_perfdata_processor_information__processor_time{instance="0,10"} 2.2704234375e+11
|
|
||||||
windows_perfdata_processor_information__processor_time{instance="0,11"} 2.3069296875e+11
|
|
||||||
windows_perfdata_processor_information__processor_time{instance="0,12"} 2.3302265625e+11
|
|
||||||
windows_perfdata_processor_information__processor_time{instance="0,13"} 2.32851875e+11
|
|
||||||
windows_perfdata_processor_information__processor_time{instance="0,14"} 2.3282421875e+11
|
|
||||||
windows_perfdata_processor_information__processor_time{instance="0,15"} 2.3271234375e+11
|
|
||||||
windows_perfdata_processor_information__processor_time{instance="0,16"} 2.329590625e+11
|
|
||||||
windows_perfdata_processor_information__processor_time{instance="0,17"} 2.32800625e+11
|
|
||||||
windows_perfdata_processor_information__processor_time{instance="0,18"} 2.3194359375e+11
|
|
||||||
windows_perfdata_processor_information__processor_time{instance="0,19"} 2.32380625e+11
|
|
||||||
windows_perfdata_processor_information__processor_time{instance="0,2"} 1.954765625e+11
|
|
||||||
windows_perfdata_processor_information__processor_time{instance="0,20"} 2.3259765625e+11
|
|
||||||
windows_perfdata_processor_information__processor_time{instance="0,21"} 2.3268515625e+11
|
|
||||||
windows_perfdata_processor_information__processor_time{instance="0,22"} 2.3301765625e+11
|
|
||||||
windows_perfdata_processor_information__processor_time{instance="0,23"} 2.3264328125e+11
|
|
||||||
windows_perfdata_processor_information__processor_time{instance="0,3"} 1.94745625e+11
|
|
||||||
windows_perfdata_processor_information__processor_time{instance="0,4"} 2.2011453125e+11
|
|
||||||
windows_perfdata_processor_information__processor_time{instance="0,5"} 2.27244375e+11
|
|
||||||
windows_perfdata_processor_information__processor_time{instance="0,6"} 2.25501875e+11
|
|
||||||
windows_perfdata_processor_information__processor_time{instance="0,7"} 2.2995265625e+11
|
|
||||||
windows_perfdata_processor_information__processor_time{instance="0,8"} 2.2929890625e+11
|
|
||||||
windows_perfdata_processor_information__processor_time{instance="0,9"} 2.313540625e+11
|
|
||||||
windows_perfdata_processor_information__processor_time{instance="0,_Total"} 2.23009459635e+11
|
|
||||||
```
|
|
||||||
|
|
||||||
## Metrics
|
|
||||||
|
|
||||||
The perfdata collector returns metrics based on the user configuration.
|
|
||||||
The metrics are named based on the object name and the counter name.
|
|
||||||
The instance name is added as a label to the metric.
|
|
||||||
193
docs/collector.performancecounter.md
Normal file
193
docs/collector.performancecounter.md
Normal file
@@ -0,0 +1,193 @@
|
|||||||
|
# performancecounter collector
|
||||||
|
|
||||||
|
The performancecounter collector exposes any configured metric.
|
||||||
|
|
||||||
|
| | |
|
||||||
|
|---------------------|-------------------------|
|
||||||
|
| Metric name prefix | `performancecounter` |
|
||||||
|
| Data source | Performance Data Helper |
|
||||||
|
| Enabled by default? | No |
|
||||||
|
|
||||||
|
## Flags
|
||||||
|
|
||||||
|
|
||||||
|
### `--collector.performancecounter.objects`
|
||||||
|
|
||||||
|
Objects is a list of objects to collect metrics from. The value takes the form of a JSON array of strings. YAML is also supported.
|
||||||
|
|
||||||
|
The collector supports only english named counter. Localized counter-names are not supported.
|
||||||
|
|
||||||
|
#### Schema
|
||||||
|
|
||||||
|
YAML:
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Click to expand YAML schema</summary>
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- object: "Processor Information"
|
||||||
|
instances: ["*"]
|
||||||
|
instance_label: "core"
|
||||||
|
counters:
|
||||||
|
- name: "% Processor Time"
|
||||||
|
metric: windows_performancecounter_processor_information_processor_time # optional
|
||||||
|
labels:
|
||||||
|
state: active
|
||||||
|
- name: "% Idle Time"
|
||||||
|
metric: windows_performancecounter_processor_information_processor_time # optional
|
||||||
|
labels:
|
||||||
|
state: idle
|
||||||
|
- object: "Memory"
|
||||||
|
counters:
|
||||||
|
- name: "Cache Faults/sec"
|
||||||
|
type: "counter" # optional
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Click to expand JSON schema</summary>
|
||||||
|
|
||||||
|
```json
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"object": "Processor Information",
|
||||||
|
"instances": [
|
||||||
|
"*"
|
||||||
|
],
|
||||||
|
"instance_label": "core",
|
||||||
|
"counters": [
|
||||||
|
{
|
||||||
|
"name": "% Processor Time",
|
||||||
|
"metric": "windows_performancecounter_processor_information_processor_time",
|
||||||
|
"labels": {
|
||||||
|
"state": "active"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "% Idle Time",
|
||||||
|
"metric": "windows_performancecounter_processor_information_processor_time",
|
||||||
|
"labels": {
|
||||||
|
"state": "idle"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"object": "Memory",
|
||||||
|
"counters": [
|
||||||
|
{
|
||||||
|
"name": "Cache Faults/sec",
|
||||||
|
"type": "counter"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
#### name
|
||||||
|
|
||||||
|
ObjectName is the Object to query for, like Processor, DirectoryServices, LogicalDisk or similar.
|
||||||
|
|
||||||
|
The collector supports only english named counter. Localized counter-names are not supported.
|
||||||
|
|
||||||
|
#### instances
|
||||||
|
|
||||||
|
The instances key (this is an array) declares the instances of a counter you would like returned, it can be one or more values.
|
||||||
|
|
||||||
|
Example: Instances = `["C:","D:","E:"]`
|
||||||
|
|
||||||
|
This will return only for the instances C:, D: and E: where relevant. To get all instances of a Counter, use `["*"]` only.
|
||||||
|
|
||||||
|
Some Objects like `Memory` do not have instances to select from at all. In this case, the `instances` key can be omitted.
|
||||||
|
|
||||||
|
#### counters
|
||||||
|
|
||||||
|
List of counters to collect from the object. See the counters sub-schema for more information.
|
||||||
|
|
||||||
|
#### counters Sub-Schema
|
||||||
|
|
||||||
|
##### name
|
||||||
|
|
||||||
|
The name of the counter to collect.
|
||||||
|
|
||||||
|
##### metric
|
||||||
|
|
||||||
|
It indicates the name of the metric to be exposed. If not specified, the metric name will be generated based on the object name and the counter name.
|
||||||
|
|
||||||
|
This key is optional.
|
||||||
|
|
||||||
|
##### type
|
||||||
|
|
||||||
|
It indicates the type of the counter. The value can be `counter` or `gauge`.
|
||||||
|
If not specified, the windows_exporter will try to determine the type based on the counter type.
|
||||||
|
|
||||||
|
This key is optional.
|
||||||
|
|
||||||
|
##### labels
|
||||||
|
|
||||||
|
Labels is a map of key-value pairs that will be added as labels to the metric.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```
|
||||||
|
# HELP windows_performancecounter_memory_cache_faults_sec
|
||||||
|
# TYPE windows_performancecounter_memory_cache_faults_sec counter
|
||||||
|
windows_performancecounter_memory_cache_faults_sec 7.028097e+06
|
||||||
|
# HELP windows_performancecounter_processor_information_processor_time
|
||||||
|
# TYPE windows_performancecounter_processor_information_processor_time counter
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,0",state="active"} 8.3809375e+10
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,0",state="idle"} 8380.9375
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,1",state="active"} 8.2868125e+10
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,1",state="idle"} 8286.8125
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,10",state="active"} 9.720046875e+10
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,10",state="idle"} 9720.046875
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,11",state="active"} 9.994921875e+10
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,11",state="idle"} 9994.921875
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,12",state="active"} 1.014403125e+11
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,12",state="idle"} 10144.03125
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,13",state="active"} 1.0155453125e+11
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,13",state="idle"} 10155.453125
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,14",state="active"} 1.01290625e+11
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,14",state="idle"} 10129.0625
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,15",state="active"} 1.0134890625e+11
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,15",state="idle"} 10134.890625
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,16",state="active"} 1.01405625e+11
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,16",state="idle"} 10140.5625
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,17",state="active"} 1.0153421875e+11
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,17",state="idle"} 10153.421875
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,18",state="active"} 1.0086390625e+11
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,18",state="idle"} 10086.390625
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,19",state="active"} 1.0123453125e+11
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,19",state="idle"} 10123.453125
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,2",state="active"} 8.3548125e+10
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,2",state="idle"} 8354.8125
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,20",state="active"} 1.011703125e+11
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,20",state="idle"} 10117.03125
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,21",state="active"} 1.0140984375e+11
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,21",state="idle"} 10140.984375
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,22",state="active"} 1.014615625e+11
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,22",state="idle"} 10146.15625
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,23",state="active"} 1.0145125e+11
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,23",state="idle"} 10145.125
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,3",state="active"} 8.488953125e+10
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,3",state="idle"} 8488.953125
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,4",state="active"} 9.338234375e+10
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,4",state="idle"} 9338.234375
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,5",state="active"} 9.776453125e+10
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,5",state="idle"} 9776.453125
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,6",state="active"} 9.736265625e+10
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,6",state="idle"} 9736.265625
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,7",state="active"} 9.959375e+10
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,7",state="idle"} 9959.375
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,8",state="active"} 9.939421875e+10
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,8",state="idle"} 9939.421875
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,9",state="active"} 1.0059484375e+11
|
||||||
|
windows_performancecounter_processor_information_processor_time{core="0,9",state="idle"} 10059.484375
|
||||||
|
```
|
||||||
|
|
||||||
|
## Metrics
|
||||||
|
|
||||||
|
The perfdata collector returns metrics based on the user configuration.
|
||||||
|
The metrics are named based on the object name and the counter name.
|
||||||
|
The instance name is added as a label to the metric.
|
||||||
@@ -14,16 +14,16 @@ None
|
|||||||
|
|
||||||
## Metrics
|
## Metrics
|
||||||
|
|
||||||
| Name | Description | Type | Labels |
|
| Name | Description | Type | Labels |
|
||||||
|---------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|--------|
|
|----------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|--------|
|
||||||
| `windows_system_context_switches_total` | Total number of [context switches](https://en.wikipedia.org/wiki/Context_switch) | counter | None |
|
| `windows_system_boot_time_timestamp_seconds` | Unix timestamp of last system boot | gauge | None |
|
||||||
| `windows_system_exception_dispatches_total` | Total exceptions dispatched by the system | counter | None |
|
| `windows_system_context_switches_total` | Total number of [context switches](https://en.wikipedia.org/wiki/Context_switch) | counter | None |
|
||||||
| `windows_system_processes` | Number of process contexts currently loaded or running on the operating system | gauge | None |
|
| `windows_system_exception_dispatches_total` | Total exceptions dispatched by the system | counter | None |
|
||||||
| `windows_system_process_limit` | The size of the user-mode portion of the virtual address space of the calling process, in bytes. This value depends on the type of process, the type of processor, and the configuration of the operating system. | gauge | None |
|
| `windows_system_processes` | Number of process contexts currently loaded or running on the operating system | gauge | None |
|
||||||
| `windows_system_processor_queue_length` | Number of threads in the processor queue. There is a single queue for processor time even on computers with multiple processors. | gauge | None |
|
| `windows_system_process_limit` | The size of the user-mode portion of the virtual address space of the calling process, in bytes. This value depends on the type of process, the type of processor, and the configuration of the operating system. | gauge | None |
|
||||||
| `windows_system_system_calls_total` | Total combined calls to Windows NT system service routines by all processes running on the computer | counter | None |
|
| `windows_system_processor_queue_length` | Number of threads in the processor queue. There is a single queue for processor time even on computers with multiple processors. | gauge | None |
|
||||||
| `windows_system_system_up_time` | Time of last boot of system | gauge | None |
|
| `windows_system_system_calls_total` | Total combined calls to Windows NT system service routines by all processes running on the computer | counter | None |
|
||||||
| `windows_system_threads` | Number of Windows system [threads](https://en.wikipedia.org/wiki/Thread_(computing)) | gauge | None |
|
| `windows_system_threads` | Number of Windows system [threads](https://en.wikipedia.org/wiki/Thread_(computing)) | gauge | None |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ windows_system_processes{instance="localhost"}
|
|||||||
## Useful queries
|
## Useful queries
|
||||||
Find hosts that have rebooted in the last 24 hours
|
Find hosts that have rebooted in the last 24 hours
|
||||||
```
|
```
|
||||||
time() - windows_system_system_up_time < 86400
|
time() - windows_system_boot_time_timestamp_seconds < 86400
|
||||||
```
|
```
|
||||||
|
|
||||||
## Alerting examples
|
## Alerting examples
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -14,7 +14,7 @@ require (
|
|||||||
github.com/prometheus/client_model v0.6.1
|
github.com/prometheus/client_model v0.6.1
|
||||||
github.com/prometheus/common v0.60.1
|
github.com/prometheus/common v0.60.1
|
||||||
github.com/prometheus/exporter-toolkit v0.13.1
|
github.com/prometheus/exporter-toolkit v0.13.1
|
||||||
github.com/stretchr/testify v1.9.0
|
github.com/stretchr/testify v1.10.0
|
||||||
golang.org/x/sys v0.27.0
|
golang.org/x/sys v0.27.0
|
||||||
gopkg.in/yaml.v3 v3.0.1
|
gopkg.in/yaml.v3 v3.0.1
|
||||||
)
|
)
|
||||||
|
|||||||
3
go.sum
3
go.sum
@@ -114,8 +114,9 @@ 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.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.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
|
||||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
|
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||||
|
github.com/stretchr/testify v1.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 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8Ydu2Bstc=
|
||||||
github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU=
|
github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU=
|
||||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
|
|||||||
@@ -1,5 +1,20 @@
|
|||||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
|
<!--
|
||||||
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>
|
<Fragment>
|
||||||
<DirectoryRef Id="APPLICATIONFOLDER">
|
<DirectoryRef Id="APPLICATIONFOLDER">
|
||||||
<Component Transitive="yes">
|
<Component Transitive="yes">
|
||||||
@@ -13,7 +28,7 @@
|
|||||||
Start="auto"
|
Start="auto"
|
||||||
Type="ownProcess"
|
Type="ownProcess"
|
||||||
Vital="yes"
|
Vital="yes"
|
||||||
Arguments="--log.file eventlog [ConfigFileFlag] [CollectorsFlag] [ListenFlag] [MetricsPathFlag] [TextfileDirsFlag] [ExtraFlags]">
|
Arguments="[ConfigFileFlag] [CollectorsFlag] [ListenFlag] [MetricsPathFlag] [TextfileDirsFlag] [ExtraFlags]">
|
||||||
<util:ServiceConfig
|
<util:ServiceConfig
|
||||||
ResetPeriodInDays="1"
|
ResetPeriodInDays="1"
|
||||||
FirstFailureActionType="restart"
|
FirstFailureActionType="restart"
|
||||||
|
|||||||
@@ -9,9 +9,24 @@
|
|||||||
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
|
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
|
||||||
<?endif?>
|
<?endif?>
|
||||||
|
|
||||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
|
<!--
|
||||||
xmlns:fw="http://wixtoolset.org/schemas/v4/wxs/firewall"
|
~ Copyright 2024 The Prometheus Authors
|
||||||
xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
|
~ 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)"
|
<Package UpgradeCode="66a6eb5b-1fc2-4b14-a362-5ceec6413308" Name="$(var.ProductName)" Version="$(var.Version)"
|
||||||
Manufacturer="prometheus-community" Language="1033" Scope="perMachine">
|
Manufacturer="prometheus-community" Language="1033" Scope="perMachine">
|
||||||
<SummaryInformation Manufacturer="prometheus-community" Description="$(var.ProductName) $(var.Version) installer" />
|
<SummaryInformation Manufacturer="prometheus-community" Description="$(var.ProductName) $(var.Version) installer" />
|
||||||
|
|||||||
@@ -1,9 +1,21 @@
|
|||||||
|
// 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:build windows
|
||||||
|
|
||||||
package ad
|
package ad
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
|
|
||||||
@@ -18,6 +30,7 @@ const Name = "ad"
|
|||||||
|
|
||||||
type Config struct{}
|
type Config struct{}
|
||||||
|
|
||||||
|
//nolint:gochecknoglobals
|
||||||
var ConfigDefaults = Config{}
|
var ConfigDefaults = Config{}
|
||||||
|
|
||||||
type Collector struct {
|
type Collector struct {
|
||||||
@@ -265,7 +278,7 @@ func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
|
|||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollector, err = perfdata.NewCollector("DirectoryServices", perfdata.InstanceAll, counters)
|
c.perfDataCollector, err = perfdata.NewCollector("DirectoryServices", perfdata.InstancesAll, counters)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create DirectoryServices collector: %w", err)
|
return fmt.Errorf("failed to create DirectoryServices collector: %w", err)
|
||||||
}
|
}
|
||||||
@@ -658,7 +671,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
|
|||||||
data, ok := perfData["NTDS"]
|
data, ok := perfData["NTDS"]
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
return errors.New("perflib query for DirectoryServices (AD) returned empty result set")
|
return fmt.Errorf("failed to collect DirectoryServices (AD) metrics: %w", types.ErrNoData)
|
||||||
}
|
}
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package ad_test
|
package ad_test
|
||||||
|
|||||||
@@ -1,3 +1,18 @@
|
|||||||
|
// 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
|
package ad
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -1,9 +1,21 @@
|
|||||||
|
// 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:build windows
|
||||||
|
|
||||||
package adcs
|
package adcs
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
|
|
||||||
@@ -19,6 +31,7 @@ const Name = "adcs"
|
|||||||
|
|
||||||
type Config struct{}
|
type Config struct{}
|
||||||
|
|
||||||
|
//nolint:gochecknoglobals
|
||||||
var ConfigDefaults = Config{}
|
var ConfigDefaults = Config{}
|
||||||
|
|
||||||
type Collector struct {
|
type Collector struct {
|
||||||
@@ -70,7 +83,7 @@ func (c *Collector) Close() error {
|
|||||||
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
|
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollector, err = perfdata.NewCollector("Certification Authority", perfdata.InstanceAll, []string{
|
c.perfDataCollector, err = perfdata.NewCollector("Certification Authority", perfdata.InstancesAll, []string{
|
||||||
requestsPerSecond,
|
requestsPerSecond,
|
||||||
requestProcessingTime,
|
requestProcessingTime,
|
||||||
retrievalsPerSecond,
|
retrievalsPerSecond,
|
||||||
@@ -178,7 +191,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(perfData) == 0 {
|
if len(perfData) == 0 {
|
||||||
return errors.New("perflib query for Certification Authority (ADCS) returned empty result set")
|
return fmt.Errorf("failed to collect Certification Authority (ADCS) metrics: %w", types.ErrNoData)
|
||||||
}
|
}
|
||||||
|
|
||||||
for name, data := range perfData {
|
for name, data := range perfData {
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package adcs_test
|
package adcs_test
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package adcs
|
package adcs
|
||||||
|
|||||||
@@ -1,9 +1,21 @@
|
|||||||
|
// 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:build windows
|
||||||
|
|
||||||
package adfs
|
package adfs
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"maps"
|
"maps"
|
||||||
@@ -21,6 +33,7 @@ const Name = "adfs"
|
|||||||
|
|
||||||
type Config struct{}
|
type Config struct{}
|
||||||
|
|
||||||
|
//nolint:gochecknoglobals
|
||||||
var ConfigDefaults = Config{}
|
var ConfigDefaults = Config{}
|
||||||
|
|
||||||
type Collector struct {
|
type Collector struct {
|
||||||
@@ -102,7 +115,7 @@ func (c *Collector) Close() error {
|
|||||||
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
|
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollector, err = perfdata.NewCollector("AD FS", perfdata.InstanceAll, []string{
|
c.perfDataCollector, err = perfdata.NewCollector("AD FS", nil, []string{
|
||||||
adLoginConnectionFailures,
|
adLoginConnectionFailures,
|
||||||
certificateAuthentications,
|
certificateAuthentications,
|
||||||
deviceAuthentications,
|
deviceAuthentications,
|
||||||
@@ -422,13 +435,13 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
|
|||||||
instanceKey := slices.Collect(maps.Keys(data))
|
instanceKey := slices.Collect(maps.Keys(data))
|
||||||
|
|
||||||
if len(instanceKey) == 0 {
|
if len(instanceKey) == 0 {
|
||||||
return errors.New("perflib query for ADFS returned empty result set")
|
return fmt.Errorf("failed to collect ADFS metrics: %w", types.ErrNoData)
|
||||||
}
|
}
|
||||||
|
|
||||||
adfsData, ok := data[instanceKey[0]]
|
adfsData, ok := data[instanceKey[0]]
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
return errors.New("perflib query for ADFS returned empty result set")
|
return fmt.Errorf("failed to collect ADFS metrics: %w", types.ErrNoData)
|
||||||
}
|
}
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package adfs_test
|
package adfs_test
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package adfs
|
package adfs
|
||||||
@@ -19,7 +32,7 @@ const (
|
|||||||
oAuthClientAuthenticationFailures = "OAuth Client Authentications Failures"
|
oAuthClientAuthenticationFailures = "OAuth Client Authentications Failures"
|
||||||
oAuthClientAuthentications = "OAuth Client Authentications"
|
oAuthClientAuthentications = "OAuth Client Authentications"
|
||||||
oAuthClientBasicAuthenticationFailures = "OAuth Client Secret Basic Authentication Failures"
|
oAuthClientBasicAuthenticationFailures = "OAuth Client Secret Basic Authentication Failures"
|
||||||
oAuthClientBasicAuthentications = "OAuth Client Secret Basic Authentication Requests"
|
oAuthClientBasicAuthentications = "OAuth Client Secret Basic Authentications"
|
||||||
oAuthClientCredentialRequestFailures = "OAuth Client Credentials Request Failures"
|
oAuthClientCredentialRequestFailures = "OAuth Client Credentials Request Failures"
|
||||||
oAuthClientCredentialRequests = "OAuth Client Credentials Requests"
|
oAuthClientCredentialRequests = "OAuth Client Credentials Requests"
|
||||||
oAuthClientPrivateKeyJWTAuthenticationFailures = "OAuth Client Private Key Jwt Authentication Failures"
|
oAuthClientPrivateKeyJWTAuthenticationFailures = "OAuth Client Private Key Jwt Authentication Failures"
|
||||||
|
|||||||
21
internal/collector/cache/cache.go
vendored
21
internal/collector/cache/cache.go
vendored
@@ -1,9 +1,21 @@
|
|||||||
|
// 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:build windows
|
||||||
|
|
||||||
package cache
|
package cache
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
|
|
||||||
@@ -18,6 +30,7 @@ const Name = "cache"
|
|||||||
|
|
||||||
type Config struct{}
|
type Config struct{}
|
||||||
|
|
||||||
|
//nolint:gochecknoglobals
|
||||||
var ConfigDefaults = Config{}
|
var ConfigDefaults = Config{}
|
||||||
|
|
||||||
// A Collector is a Prometheus Collector for Perflib Cache metrics.
|
// A Collector is a Prometheus Collector for Perflib Cache metrics.
|
||||||
@@ -86,7 +99,7 @@ func (c *Collector) Close() error {
|
|||||||
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
|
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollector, err = perfdata.NewCollector("Cache", perfdata.InstanceAll, []string{
|
c.perfDataCollector, err = perfdata.NewCollector("Cache", perfdata.InstancesAll, []string{
|
||||||
asyncCopyReadsTotal,
|
asyncCopyReadsTotal,
|
||||||
asyncDataMapsTotal,
|
asyncDataMapsTotal,
|
||||||
asyncFastReadsTotal,
|
asyncFastReadsTotal,
|
||||||
@@ -306,10 +319,10 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
|
|||||||
return fmt.Errorf("failed to collect Cache metrics: %w", err)
|
return fmt.Errorf("failed to collect Cache metrics: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
cacheData, ok := data[perfdata.EmptyInstance]
|
cacheData, ok := data[perfdata.InstanceEmpty]
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
return errors.New("perflib query for Cache returned empty result set")
|
return fmt.Errorf("failed to collect Cache metrics: %w", types.ErrNoData)
|
||||||
}
|
}
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
|||||||
13
internal/collector/cache/cache_test.go
vendored
13
internal/collector/cache/cache_test.go
vendored
@@ -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:build windows
|
||||||
|
|
||||||
package cache_test
|
package cache_test
|
||||||
|
|||||||
13
internal/collector/cache/const.go
vendored
13
internal/collector/cache/const.go
vendored
@@ -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:build windows
|
||||||
|
|
||||||
package cache
|
package cache
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package container
|
package container
|
||||||
@@ -20,6 +33,7 @@ const Name = "container"
|
|||||||
|
|
||||||
type Config struct{}
|
type Config struct{}
|
||||||
|
|
||||||
|
//nolint:gochecknoglobals
|
||||||
var ConfigDefaults = Config{}
|
var ConfigDefaults = Config{}
|
||||||
|
|
||||||
// A Collector is a Prometheus Collector for containers metrics.
|
// A Collector is a Prometheus Collector for containers metrics.
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package container_test
|
package container_test
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package cpu
|
package cpu
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package cpu
|
package cpu
|
||||||
@@ -19,6 +32,7 @@ const Name = "cpu"
|
|||||||
|
|
||||||
type Config struct{}
|
type Config struct{}
|
||||||
|
|
||||||
|
//nolint:gochecknoglobals
|
||||||
var ConfigDefaults = Config{}
|
var ConfigDefaults = Config{}
|
||||||
|
|
||||||
type Collector struct {
|
type Collector struct {
|
||||||
@@ -78,7 +92,7 @@ func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
|
|||||||
|
|
||||||
c.mu = sync.Mutex{}
|
c.mu = sync.Mutex{}
|
||||||
|
|
||||||
c.perfDataCollector, err = perfdata.NewCollector("Processor Information", perfdata.InstanceAll, []string{
|
c.perfDataCollector, err = perfdata.NewCollector("Processor Information", perfdata.InstancesAll, []string{
|
||||||
c1TimeSeconds,
|
c1TimeSeconds,
|
||||||
c2TimeSeconds,
|
c2TimeSeconds,
|
||||||
c3TimeSeconds,
|
c3TimeSeconds,
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package cpu_test
|
package cpu_test
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package cpu_info
|
package cpu_info
|
||||||
@@ -19,6 +32,7 @@ const Name = "cpu_info"
|
|||||||
|
|
||||||
type Config struct{}
|
type Config struct{}
|
||||||
|
|
||||||
|
//nolint:gochecknoglobals
|
||||||
var ConfigDefaults = Config{}
|
var ConfigDefaults = Config{}
|
||||||
|
|
||||||
// A Collector is a Prometheus Collector for a few WMI metrics in Win32_Processor.
|
// A Collector is a Prometheus Collector for a few WMI metrics in Win32_Processor.
|
||||||
@@ -134,6 +148,11 @@ func (c *Collector) Build(_ *slog.Logger, miSession *mi.Session) error {
|
|||||||
nil,
|
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
|
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
|
//go:build windows
|
||||||
|
|
||||||
package cpu_info_test
|
package cpu_info_test
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package cs
|
package cs
|
||||||
@@ -16,6 +29,7 @@ const Name = "cs"
|
|||||||
|
|
||||||
type Config struct{}
|
type Config struct{}
|
||||||
|
|
||||||
|
//nolint:gochecknoglobals
|
||||||
var ConfigDefaults = Config{}
|
var ConfigDefaults = Config{}
|
||||||
|
|
||||||
// A Collector is a Prometheus Collector for WMI metrics.
|
// A Collector is a Prometheus Collector for WMI metrics.
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package cs_test
|
package cs_test
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package dfsr
|
package dfsr
|
||||||
@@ -40,5 +53,5 @@ const (
|
|||||||
databaseLookupsTotal = "Database Lookups"
|
databaseLookupsTotal = "Database Lookups"
|
||||||
usnJournalRecordsReadTotal = "USN Journal Records Read"
|
usnJournalRecordsReadTotal = "USN Journal Records Read"
|
||||||
usnJournalRecordsAcceptedTotal = "USN Journal Records Accepted"
|
usnJournalRecordsAcceptedTotal = "USN Journal Records Accepted"
|
||||||
usnJournalUnreadPercentage = "USN Journal Records Unread Percentage"
|
usnJournalUnreadPercentage = "USN Journal Unread Percentage"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package dfsr
|
package dfsr
|
||||||
@@ -22,6 +35,7 @@ type Config struct {
|
|||||||
CollectorsEnabled []string `yaml:"collectors_enabled"`
|
CollectorsEnabled []string `yaml:"collectors_enabled"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint:gochecknoglobals
|
||||||
var ConfigDefaults = Config{
|
var ConfigDefaults = Config{
|
||||||
CollectorsEnabled: []string{"connection", "folder", "volume"},
|
CollectorsEnabled: []string{"connection", "folder", "volume"},
|
||||||
}
|
}
|
||||||
@@ -146,7 +160,7 @@ func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
|
|||||||
var err error
|
var err error
|
||||||
|
|
||||||
if slices.Contains(c.config.CollectorsEnabled, "connection") {
|
if slices.Contains(c.config.CollectorsEnabled, "connection") {
|
||||||
c.perfDataCollectorConnection, err = perfdata.NewCollector("DFS Replication Connections", perfdata.InstanceAll, []string{
|
c.perfDataCollectorConnection, err = perfdata.NewCollector("DFS Replication Connections", perfdata.InstancesAll, []string{
|
||||||
bandwidthSavingsUsingDFSReplicationTotal,
|
bandwidthSavingsUsingDFSReplicationTotal,
|
||||||
bytesReceivedTotal,
|
bytesReceivedTotal,
|
||||||
compressedSizeOfFilesReceivedTotal,
|
compressedSizeOfFilesReceivedTotal,
|
||||||
@@ -163,7 +177,7 @@ func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if slices.Contains(c.config.CollectorsEnabled, "folder") {
|
if slices.Contains(c.config.CollectorsEnabled, "folder") {
|
||||||
c.perfDataCollectorFolder, err = perfdata.NewCollector("DFS Replicated Folders", perfdata.InstanceAll, []string{
|
c.perfDataCollectorFolder, err = perfdata.NewCollector("DFS Replicated Folders", perfdata.InstancesAll, []string{
|
||||||
bandwidthSavingsUsingDFSReplicationTotal,
|
bandwidthSavingsUsingDFSReplicationTotal,
|
||||||
compressedSizeOfFilesReceivedTotal,
|
compressedSizeOfFilesReceivedTotal,
|
||||||
conflictBytesCleanedUpTotal,
|
conflictBytesCleanedUpTotal,
|
||||||
@@ -198,7 +212,7 @@ func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if slices.Contains(c.config.CollectorsEnabled, "volume") {
|
if slices.Contains(c.config.CollectorsEnabled, "volume") {
|
||||||
c.perfDataCollectorVolume, err = perfdata.NewCollector("DFS Replication Service Volumes", perfdata.InstanceAll, []string{
|
c.perfDataCollectorVolume, err = perfdata.NewCollector("DFS Replication Service Volumes", perfdata.InstancesAll, []string{
|
||||||
databaseCommitsTotal,
|
databaseCommitsTotal,
|
||||||
databaseLookupsTotal,
|
databaseLookupsTotal,
|
||||||
usnJournalRecordsReadTotal,
|
usnJournalRecordsReadTotal,
|
||||||
@@ -529,7 +543,7 @@ func (c *Collector) collectPDHConnection(ch chan<- prometheus.Metric) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(perfData) == 0 {
|
if len(perfData) == 0 {
|
||||||
return errors.New("perflib query for DFS Replication Connections returned empty result set")
|
return fmt.Errorf("failed to collect DFS Replication Connections metrics: %w", types.ErrNoData)
|
||||||
}
|
}
|
||||||
|
|
||||||
for name, connection := range perfData {
|
for name, connection := range perfData {
|
||||||
@@ -607,7 +621,7 @@ func (c *Collector) collectPDHFolder(ch chan<- prometheus.Metric) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(perfData) == 0 {
|
if len(perfData) == 0 {
|
||||||
return errors.New("perflib query for DFS Replicated Folders returned empty result set")
|
return fmt.Errorf("failed to collect DFS Replicated Folders metrics: %w", types.ErrNoData)
|
||||||
}
|
}
|
||||||
|
|
||||||
for name, folder := range perfData {
|
for name, folder := range perfData {
|
||||||
@@ -811,7 +825,7 @@ func (c *Collector) collectPDHVolume(ch chan<- prometheus.Metric) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(perfData) == 0 {
|
if len(perfData) == 0 {
|
||||||
return errors.New("perflib query for DFS Replication Volumes returned empty result set")
|
return fmt.Errorf("failed to collect DFS Replication Volumes metrics: %w", types.ErrNoData)
|
||||||
}
|
}
|
||||||
|
|
||||||
for name, volume := range perfData {
|
for name, volume := range perfData {
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package dfsr_test
|
package dfsr_test
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package dhcp
|
package dhcp
|
||||||
|
|||||||
@@ -1,9 +1,21 @@
|
|||||||
|
// 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:build windows
|
||||||
|
|
||||||
package dhcp
|
package dhcp
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
|
|
||||||
@@ -18,6 +30,7 @@ const Name = "dhcp"
|
|||||||
|
|
||||||
type Config struct{}
|
type Config struct{}
|
||||||
|
|
||||||
|
//nolint:gochecknoglobals
|
||||||
var ConfigDefaults = Config{}
|
var ConfigDefaults = Config{}
|
||||||
|
|
||||||
// A Collector is a Prometheus Collector perflib DHCP metrics.
|
// A Collector is a Prometheus Collector perflib DHCP metrics.
|
||||||
@@ -82,7 +95,7 @@ func (c *Collector) Close() error {
|
|||||||
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
|
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollector, err = perfdata.NewCollector("DHCP Server", perfdata.InstanceAll, []string{
|
c.perfDataCollector, err = perfdata.NewCollector("DHCP Server", nil, []string{
|
||||||
acksTotal,
|
acksTotal,
|
||||||
activeQueueLength,
|
activeQueueLength,
|
||||||
conflictCheckQueueLength,
|
conflictCheckQueueLength,
|
||||||
@@ -273,9 +286,9 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
|
|||||||
return fmt.Errorf("failed to collect DHCP Server metrics: %w", err)
|
return fmt.Errorf("failed to collect DHCP Server metrics: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
data, ok := perfData[perfdata.EmptyInstance]
|
data, ok := perfData[perfdata.InstanceEmpty]
|
||||||
if !ok {
|
if !ok {
|
||||||
return errors.New("perflib query for DHCP Server returned empty result set")
|
return fmt.Errorf("failed to collect DHCP Server metrics: %w", types.ErrNoData)
|
||||||
}
|
}
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package dhcp_test
|
package dhcp_test
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package diskdrive
|
package diskdrive
|
||||||
@@ -18,6 +31,7 @@ const Name = "diskdrive"
|
|||||||
|
|
||||||
type Config struct{}
|
type Config struct{}
|
||||||
|
|
||||||
|
//nolint:gochecknoglobals
|
||||||
var ConfigDefaults = Config{}
|
var ConfigDefaults = Config{}
|
||||||
|
|
||||||
// A Collector is a Prometheus Collector for a few WMI metrics in Win32_DiskDrive.
|
// A Collector is a Prometheus Collector for a few WMI metrics in Win32_DiskDrive.
|
||||||
@@ -106,6 +120,11 @@ func (c *Collector) Build(_ *slog.Logger, miSession *mi.Session) error {
|
|||||||
nil,
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,6 +139,7 @@ type diskDrive struct {
|
|||||||
Availability uint16 `mi:"Availability"`
|
Availability uint16 `mi:"Availability"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint:gochecknoglobals
|
||||||
var (
|
var (
|
||||||
allDiskStatus = []string{
|
allDiskStatus = []string{
|
||||||
"OK",
|
"OK",
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package diskdrive_test
|
package diskdrive_test
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package dns
|
package dns
|
||||||
|
|||||||
@@ -1,9 +1,21 @@
|
|||||||
|
// 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:build windows
|
||||||
|
|
||||||
package dns
|
package dns
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
|
|
||||||
@@ -18,6 +30,7 @@ const Name = "dns"
|
|||||||
|
|
||||||
type Config struct{}
|
type Config struct{}
|
||||||
|
|
||||||
|
//nolint:gochecknoglobals
|
||||||
var ConfigDefaults = Config{}
|
var ConfigDefaults = Config{}
|
||||||
|
|
||||||
// A Collector is a Prometheus Collector for WMI Win32_PerfRawData_DNS_DNS metrics.
|
// A Collector is a Prometheus Collector for WMI Win32_PerfRawData_DNS_DNS metrics.
|
||||||
@@ -79,7 +92,7 @@ func (c *Collector) Close() error {
|
|||||||
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
|
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollector, err = perfdata.NewCollector("DNS", perfdata.InstanceAll, []string{
|
c.perfDataCollector, err = perfdata.NewCollector("DNS", perfdata.InstancesAll, []string{
|
||||||
axfrRequestReceived,
|
axfrRequestReceived,
|
||||||
axfrRequestSent,
|
axfrRequestSent,
|
||||||
axfrResponseReceived,
|
axfrResponseReceived,
|
||||||
@@ -269,9 +282,9 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
|
|||||||
return fmt.Errorf("failed to collect DNS metrics: %w", err)
|
return fmt.Errorf("failed to collect DNS metrics: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
data, ok := perfData[perfdata.EmptyInstance]
|
data, ok := perfData[perfdata.InstanceEmpty]
|
||||||
if !ok {
|
if !ok {
|
||||||
return errors.New("perflib query for DNS returned empty result set")
|
return fmt.Errorf("failed to collect DNS metrics: %w", types.ErrNoData)
|
||||||
}
|
}
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package dns_test
|
package dns_test
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package exchange
|
package exchange
|
||||||
@@ -34,6 +47,7 @@ type Config struct {
|
|||||||
CollectorsEnabled []string `yaml:"collectors_enabled"`
|
CollectorsEnabled []string `yaml:"collectors_enabled"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint:gochecknoglobals
|
||||||
var ConfigDefaults = Config{
|
var ConfigDefaults = Config{
|
||||||
CollectorsEnabled: []string{
|
CollectorsEnabled: []string{
|
||||||
adAccessProcesses,
|
adAccessProcesses,
|
||||||
|
|||||||
@@ -1,9 +1,21 @@
|
|||||||
|
// 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:build windows
|
||||||
|
|
||||||
package exchange
|
package exchange
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||||
@@ -26,7 +38,7 @@ func (c *Collector) buildActiveSync() error {
|
|||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollectorActiveSync, err = perfdata.NewCollector("MSExchange ActiveSync", perfdata.InstanceAll, counters)
|
c.perfDataCollectorActiveSync, err = perfdata.NewCollector("MSExchange ActiveSync", perfdata.InstancesAll, counters)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create MSExchange ActiveSync collector: %w", err)
|
return fmt.Errorf("failed to create MSExchange ActiveSync collector: %w", err)
|
||||||
}
|
}
|
||||||
@@ -60,7 +72,7 @@ func (c *Collector) collectActiveSync(ch chan<- prometheus.Metric) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(perfData) == 0 {
|
if len(perfData) == 0 {
|
||||||
return errors.New("perflib query for MSExchange ActiveSync returned empty result set")
|
return fmt.Errorf("failed to collect MSExchange ActiveSync metrics: %w", types.ErrNoData)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, data := range perfData {
|
for _, data := range perfData {
|
||||||
|
|||||||
@@ -1,9 +1,21 @@
|
|||||||
|
// 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:build windows
|
||||||
|
|
||||||
package exchange
|
package exchange
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||||
@@ -30,7 +42,7 @@ func (c *Collector) buildADAccessProcesses() error {
|
|||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollectorADAccessProcesses, err = perfdata.NewCollector("MSExchange ADAccess Processes", perfdata.InstanceAll, counters)
|
c.perfDataCollectorADAccessProcesses, err = perfdata.NewCollector("MSExchange ADAccess Processes", perfdata.InstancesAll, counters)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create MSExchange ADAccess Processes collector: %w", err)
|
return fmt.Errorf("failed to create MSExchange ADAccess Processes collector: %w", err)
|
||||||
}
|
}
|
||||||
@@ -76,7 +88,7 @@ func (c *Collector) collectADAccessProcesses(ch chan<- prometheus.Metric) error
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(perfData) == 0 {
|
if len(perfData) == 0 {
|
||||||
return errors.New("perflib query for MSExchange ADAccess Processes returned empty result set")
|
return fmt.Errorf("failed to collect MSExchange ADAccess Processes metrics: %w", types.ErrNoData)
|
||||||
}
|
}
|
||||||
|
|
||||||
labelUseCount := make(map[string]int)
|
labelUseCount := make(map[string]int)
|
||||||
|
|||||||
@@ -1,9 +1,21 @@
|
|||||||
|
// 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:build windows
|
||||||
|
|
||||||
package exchange
|
package exchange
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||||
@@ -18,7 +30,7 @@ func (c *Collector) buildAutoDiscover() error {
|
|||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollectorAutoDiscover, err = perfdata.NewCollector("MSExchange Autodiscover", perfdata.InstanceAll, counters)
|
c.perfDataCollectorAutoDiscover, err = perfdata.NewCollector("MSExchange Autodiscover", perfdata.InstancesAll, counters)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create MSExchange Autodiscover collector: %w", err)
|
return fmt.Errorf("failed to create MSExchange Autodiscover collector: %w", err)
|
||||||
}
|
}
|
||||||
@@ -40,7 +52,7 @@ func (c *Collector) collectAutoDiscover(ch chan<- prometheus.Metric) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(perfData) == 0 {
|
if len(perfData) == 0 {
|
||||||
return errors.New("perflib query for MSExchange Autodiscover returned empty result set")
|
return fmt.Errorf("failed to collect MSExchange Autodiscover metrics: %w", types.ErrNoData)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, data := range perfData {
|
for _, data := range perfData {
|
||||||
|
|||||||
@@ -1,9 +1,21 @@
|
|||||||
|
// 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:build windows
|
||||||
|
|
||||||
package exchange
|
package exchange
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||||
@@ -18,7 +30,7 @@ func (c *Collector) buildAvailabilityService() error {
|
|||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollectorAvailabilityService, err = perfdata.NewCollector("MSExchange Availability Service", perfdata.InstanceAll, counters)
|
c.perfDataCollectorAvailabilityService, err = perfdata.NewCollector("MSExchange Availability Service", perfdata.InstancesAll, counters)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create MSExchange Availability Service collector: %w", err)
|
return fmt.Errorf("failed to create MSExchange Availability Service collector: %w", err)
|
||||||
}
|
}
|
||||||
@@ -40,7 +52,7 @@ func (c *Collector) collectAvailabilityService(ch chan<- prometheus.Metric) erro
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(perfData) == 0 {
|
if len(perfData) == 0 {
|
||||||
return errors.New("perflib query for MSExchange Availability Service returned empty result set")
|
return fmt.Errorf("failed to collect MSExchange Availability Service metrics: %w", types.ErrNoData)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, data := range perfData {
|
for _, data := range perfData {
|
||||||
|
|||||||
@@ -1,9 +1,21 @@
|
|||||||
|
// 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:build windows
|
||||||
|
|
||||||
package exchange
|
package exchange
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||||
@@ -32,7 +44,7 @@ func (c *Collector) buildHTTPProxy() error {
|
|||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollectorHttpProxy, err = perfdata.NewCollector("MSExchange HttpProxy", perfdata.InstanceAll, counters)
|
c.perfDataCollectorHttpProxy, err = perfdata.NewCollector("MSExchange HttpProxy", perfdata.InstancesAll, counters)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create MSExchange HttpProxy collector: %w", err)
|
return fmt.Errorf("failed to create MSExchange HttpProxy collector: %w", err)
|
||||||
}
|
}
|
||||||
@@ -84,7 +96,7 @@ func (c *Collector) collectHTTPProxy(ch chan<- prometheus.Metric) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(perfData) == 0 {
|
if len(perfData) == 0 {
|
||||||
return errors.New("perflib query for MSExchange HttpProxy Service returned empty result set")
|
return fmt.Errorf("failed to collect MSExchange HttpProxy Service metrics: %w", types.ErrNoData)
|
||||||
}
|
}
|
||||||
|
|
||||||
for name, data := range perfData {
|
for name, data := range perfData {
|
||||||
|
|||||||
@@ -1,9 +1,21 @@
|
|||||||
|
// 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:build windows
|
||||||
|
|
||||||
package exchange
|
package exchange
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||||
@@ -22,7 +34,7 @@ func (c *Collector) buildMapiHttpEmsmdb() error {
|
|||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollectorMapiHttpEmsmdb, err = perfdata.NewCollector("MSExchange MapiHttp Emsmdb", perfdata.InstanceAll, counters)
|
c.perfDataCollectorMapiHttpEmsmdb, err = perfdata.NewCollector("MSExchange MapiHttp Emsmdb", perfdata.InstancesAll, counters)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create MSExchange MapiHttp Emsmdb: %w", err)
|
return fmt.Errorf("failed to create MSExchange MapiHttp Emsmdb: %w", err)
|
||||||
}
|
}
|
||||||
@@ -44,7 +56,7 @@ func (c *Collector) collectMapiHttpEmsmdb(ch chan<- prometheus.Metric) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(perfData) == 0 {
|
if len(perfData) == 0 {
|
||||||
return errors.New("perflib query for MSExchange MapiHttp Emsmdb returned empty result set")
|
return fmt.Errorf("failed to collect MSExchange MapiHttp Emsmdb metrics: %w", types.ErrNoData)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, data := range perfData {
|
for _, data := range perfData {
|
||||||
|
|||||||
@@ -1,9 +1,21 @@
|
|||||||
|
// 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:build windows
|
||||||
|
|
||||||
package exchange
|
package exchange
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||||
@@ -24,7 +36,7 @@ func (c *Collector) buildOWA() error {
|
|||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollectorOWA, err = perfdata.NewCollector("MSExchange OWA", perfdata.InstanceAll, counters)
|
c.perfDataCollectorOWA, err = perfdata.NewCollector("MSExchange OWA", perfdata.InstancesAll, counters)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create MSExchange OWA collector: %w", err)
|
return fmt.Errorf("failed to create MSExchange OWA collector: %w", err)
|
||||||
}
|
}
|
||||||
@@ -52,7 +64,7 @@ func (c *Collector) collectOWA(ch chan<- prometheus.Metric) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(perfData) == 0 {
|
if len(perfData) == 0 {
|
||||||
return errors.New("perflib query for MSExchange OWA returned empty result set")
|
return fmt.Errorf("failed to collect MSExchange OWA metrics: %w", types.ErrNoData)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, data := range perfData {
|
for _, data := range perfData {
|
||||||
|
|||||||
@@ -1,9 +1,21 @@
|
|||||||
|
// 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:build windows
|
||||||
|
|
||||||
package exchange
|
package exchange
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||||
@@ -32,7 +44,7 @@ func (c *Collector) buildRPC() error {
|
|||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollectorRpcClientAccess, err = perfdata.NewCollector("MSExchange RpcClientAccess", perfdata.InstanceAll, counters)
|
c.perfDataCollectorRpcClientAccess, err = perfdata.NewCollector("MSExchange RpcClientAccess", perfdata.InstancesAll, counters)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create MSExchange RpcClientAccess collector: %w", err)
|
return fmt.Errorf("failed to create MSExchange RpcClientAccess collector: %w", err)
|
||||||
}
|
}
|
||||||
@@ -84,7 +96,7 @@ func (c *Collector) collectRPC(ch chan<- prometheus.Metric) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(perfData) == 0 {
|
if len(perfData) == 0 {
|
||||||
return errors.New("perflib query for MSExchange RpcClientAccess returned empty result set")
|
return fmt.Errorf("failed to collect MSExchange RpcClientAccess metrics: %w", types.ErrNoData)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, data := range perfData {
|
for _, data := range perfData {
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package exchange_test
|
package exchange_test
|
||||||
|
|||||||
@@ -1,9 +1,21 @@
|
|||||||
|
// 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:build windows
|
||||||
|
|
||||||
package exchange
|
package exchange
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||||
@@ -58,7 +70,7 @@ func (c *Collector) buildTransportQueues() error {
|
|||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollectorTransportQueues, err = perfdata.NewCollector("MSExchangeTransport Queues", perfdata.InstanceAll, counters)
|
c.perfDataCollectorTransportQueues, err = perfdata.NewCollector("MSExchangeTransport Queues", perfdata.InstancesAll, counters)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create MSExchangeTransport Queues collector: %w", err)
|
return fmt.Errorf("failed to create MSExchangeTransport Queues collector: %w", err)
|
||||||
}
|
}
|
||||||
@@ -188,7 +200,7 @@ func (c *Collector) collectTransportQueues(ch chan<- prometheus.Metric) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(perfData) == 0 {
|
if len(perfData) == 0 {
|
||||||
return errors.New("perflib query for MSExchangeTransport Queues returned empty result set")
|
return fmt.Errorf("failed to collect MSExchangeTransport Queues metrics: %w", types.ErrNoData)
|
||||||
}
|
}
|
||||||
|
|
||||||
for name, data := range perfData {
|
for name, data := range perfData {
|
||||||
|
|||||||
@@ -1,9 +1,21 @@
|
|||||||
|
// 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:build windows
|
||||||
|
|
||||||
package exchange
|
package exchange
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||||
@@ -30,7 +42,7 @@ func (c *Collector) buildWorkloadManagementWorkloads() error {
|
|||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollectorWorkloadManagementWorkloads, err = perfdata.NewCollector("MSExchange WorkloadManagement Workloads", perfdata.InstanceAll, counters)
|
c.perfDataCollectorWorkloadManagementWorkloads, err = perfdata.NewCollector("MSExchange WorkloadManagement Workloads", perfdata.InstancesAll, counters)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create MSExchange WorkloadManagement Workloads collector: %w", err)
|
return fmt.Errorf("failed to create MSExchange WorkloadManagement Workloads collector: %w", err)
|
||||||
}
|
}
|
||||||
@@ -76,7 +88,7 @@ func (c *Collector) collectWorkloadManagementWorkloads(ch chan<- prometheus.Metr
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(perfData) == 0 {
|
if len(perfData) == 0 {
|
||||||
return errors.New("perflib query for MSExchange WorkloadManagement Workloads returned empty result set")
|
return fmt.Errorf("failed to collect MSExchange WorkloadManagement Workloads metrics: %w", types.ErrNoData)
|
||||||
}
|
}
|
||||||
|
|
||||||
for name, data := range perfData {
|
for name, data := range perfData {
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package filetime
|
package filetime
|
||||||
@@ -23,6 +36,7 @@ type Config struct {
|
|||||||
FilePatterns []string
|
FilePatterns []string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint:gochecknoglobals
|
||||||
var ConfigDefaults = Config{
|
var ConfigDefaults = Config{
|
||||||
FilePatterns: []string{},
|
FilePatterns: []string{},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package filetime_test
|
package filetime_test
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package fsrmquota
|
package fsrmquota
|
||||||
@@ -18,6 +31,7 @@ const Name = "fsrmquota"
|
|||||||
|
|
||||||
type Config struct{}
|
type Config struct{}
|
||||||
|
|
||||||
|
//nolint:gochecknoglobals
|
||||||
var ConfigDefaults = Config{}
|
var ConfigDefaults = Config{}
|
||||||
|
|
||||||
type Collector struct {
|
type Collector struct {
|
||||||
@@ -129,30 +143,32 @@ func (c *Collector) Build(_ *slog.Logger, miSession *mi.Session) error {
|
|||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// MSFT_FSRMQuota docs:
|
// MSFT_FSRMQuota docs:
|
||||||
// https://docs.microsoft.com/en-us/previous-versions/windows/desktop/fsrm/msft-fsrmquota
|
// https://docs.microsoft.com/en-us/previous-versions/windows/desktop/fsrm/msft-fsrmquota
|
||||||
type MSFT_FSRMQuota struct {
|
type msftFSRMQuota struct {
|
||||||
Name string `mi:"Name"`
|
Path string `mi:"Path"`
|
||||||
|
PeakUsage uint64 `mi:"PeakUsage"`
|
||||||
Path string `mi:"Path"`
|
Size uint64 `mi:"Size"`
|
||||||
PeakUsage uint64 `mi:"PeakUsage"`
|
Usage uint64 `mi:"Usage"`
|
||||||
Size uint64 `mi:"Size"`
|
Description string `mi:"Description"`
|
||||||
Usage uint64 `mi:"Usage"`
|
Template string `mi:"Template"`
|
||||||
Description string `mi:"Description"`
|
Disabled bool `mi:"Disabled"`
|
||||||
Template string `mi:"Template"`
|
MatchesTemplate bool `mi:"MatchesTemplate"`
|
||||||
// Threshold string `mi:"Threshold"`
|
SoftLimit bool `mi:"SoftLimit"`
|
||||||
Disabled bool `mi:"Disabled"`
|
|
||||||
MatchesTemplate bool `mi:"MatchesTemplate"`
|
|
||||||
SoftLimit bool `mi:"SoftLimit"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collect sends the metric values for each metric
|
// Collect sends the metric values for each metric
|
||||||
// to the provided prometheus Metric channel.
|
// to the provided prometheus Metric channel.
|
||||||
func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
|
func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
|
||||||
var dst []MSFT_FSRMQuota
|
var dst []msftFSRMQuota
|
||||||
if err := c.miSession.Query(&dst, mi.NamespaceRootWindowsFSRM, c.miQuery); err != nil {
|
if err := c.miSession.Query(&dst, mi.NamespaceRootWindowsFSRM, c.miQuery); err != nil {
|
||||||
return fmt.Errorf("WMI query failed: %w", err)
|
return fmt.Errorf("WMI query failed: %w", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package fsrmquota_test
|
package fsrmquota_test
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package hyperv
|
package hyperv
|
||||||
@@ -12,7 +25,9 @@ import (
|
|||||||
|
|
||||||
"github.com/alecthomas/kingpin/v2"
|
"github.com/alecthomas/kingpin/v2"
|
||||||
"github.com/prometheus-community/windows_exporter/internal/mi"
|
"github.com/prometheus-community/windows_exporter/internal/mi"
|
||||||
|
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
"golang.org/x/sys/windows"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -39,6 +54,7 @@ type Config struct {
|
|||||||
CollectorsEnabled []string `yaml:"collectors_enabled"`
|
CollectorsEnabled []string `yaml:"collectors_enabled"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint:gochecknoglobals
|
||||||
var ConfigDefaults = Config{
|
var ConfigDefaults = Config{
|
||||||
CollectorsEnabled: []string{
|
CollectorsEnabled: []string{
|
||||||
subCollectorDataStore,
|
subCollectorDataStore,
|
||||||
@@ -141,15 +157,19 @@ func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
version := windows.RtlGetVersion()
|
||||||
|
|
||||||
subCollectors := map[string]struct {
|
subCollectors := map[string]struct {
|
||||||
build func() error
|
build func() error
|
||||||
collect func(ch chan<- prometheus.Metric) error
|
collect func(ch chan<- prometheus.Metric) error
|
||||||
close func()
|
close func()
|
||||||
|
minBuildNumber uint32
|
||||||
}{
|
}{
|
||||||
subCollectorDataStore: {
|
subCollectorDataStore: {
|
||||||
build: c.buildDataStore,
|
build: c.buildDataStore,
|
||||||
collect: c.collectDataStore,
|
collect: c.collectDataStore,
|
||||||
close: c.perfDataCollectorDataStore.Close,
|
close: c.perfDataCollectorDataStore.Close,
|
||||||
|
minBuildNumber: types.BuildNumberWindowsServer2022,
|
||||||
},
|
},
|
||||||
subCollectorDynamicMemoryBalancer: {
|
subCollectorDynamicMemoryBalancer: {
|
||||||
build: c.buildDynamicMemoryBalancer,
|
build: c.buildDynamicMemoryBalancer,
|
||||||
@@ -226,20 +246,30 @@ func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
|
|||||||
// Result must order, to prevent test failures.
|
// Result must order, to prevent test failures.
|
||||||
sort.Strings(c.config.CollectorsEnabled)
|
sort.Strings(c.config.CollectorsEnabled)
|
||||||
|
|
||||||
|
errs := make([]error, 0, len(c.config.CollectorsEnabled))
|
||||||
|
|
||||||
for _, name := range c.config.CollectorsEnabled {
|
for _, name := range c.config.CollectorsEnabled {
|
||||||
if _, ok := subCollectors[name]; !ok {
|
if _, ok := subCollectors[name]; !ok {
|
||||||
return fmt.Errorf("unknown collector: %s", name)
|
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 {
|
if err := subCollectors[name].build(); err != nil {
|
||||||
return fmt.Errorf("failed to build %s collector: %w", name, err)
|
errs = append(errs, fmt.Errorf("failed to build %s collector: %w", name, err))
|
||||||
|
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
c.collectorFns = append(c.collectorFns, subCollectors[name].collect)
|
c.collectorFns = append(c.collectorFns, subCollectors[name].collect)
|
||||||
c.closeFns = append(c.closeFns, subCollectors[name].close)
|
c.closeFns = append(c.closeFns, subCollectors[name].close)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return errors.Join(errs...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collect sends the metric values for each metric
|
// Collect sends the metric values for each metric
|
||||||
|
|||||||
@@ -1,7 +1,21 @@
|
|||||||
|
// 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
|
package hyperv
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||||
@@ -114,7 +128,7 @@ const (
|
|||||||
func (c *Collector) buildDataStore() error {
|
func (c *Collector) buildDataStore() error {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollectorDataStore, err = perfdata.NewCollector("Hyper-V DataStore", perfdata.InstanceAll, []string{
|
c.perfDataCollectorDataStore, err = perfdata.NewCollector("Hyper-V DataStore", perfdata.InstancesAll, []string{
|
||||||
dataStoreFragmentationRatio,
|
dataStoreFragmentationRatio,
|
||||||
dataStoreSectorSize,
|
dataStoreSectorSize,
|
||||||
dataStoreDataAlignment,
|
dataStoreDataAlignment,
|
||||||
@@ -162,7 +176,7 @@ func (c *Collector) buildDataStore() error {
|
|||||||
dataStoreSetOperationLatencyMicro,
|
dataStoreSetOperationLatencyMicro,
|
||||||
dataStoreSetOperationCount,
|
dataStoreSetOperationCount,
|
||||||
})
|
})
|
||||||
if err != nil && !errors.Is(err, perfdata.ErrNoData) {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create Hyper-V DataStore collector: %w", err)
|
return fmt.Errorf("failed to create Hyper-V DataStore collector: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -448,7 +462,7 @@ func (c *Collector) buildDataStore() error {
|
|||||||
|
|
||||||
func (c *Collector) collectDataStore(ch chan<- prometheus.Metric) error {
|
func (c *Collector) collectDataStore(ch chan<- prometheus.Metric) error {
|
||||||
data, err := c.perfDataCollectorDataStore.Collect()
|
data, err := c.perfDataCollectorDataStore.Collect()
|
||||||
if err != nil && !errors.Is(err, perfdata.ErrNoData) {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to collect Hyper-V DataStore metrics: %w", err)
|
return fmt.Errorf("failed to collect Hyper-V DataStore metrics: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,18 @@
|
|||||||
|
// 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
|
package hyperv
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -30,7 +45,7 @@ func (c *Collector) buildDynamicMemoryBalancer() error {
|
|||||||
var err error
|
var err error
|
||||||
|
|
||||||
// https://learn.microsoft.com/en-us/archive/blogs/chrisavis/monitoring-dynamic-memory-in-windows-server-hyper-v-2012
|
// 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.InstanceAll, []string{
|
c.perfDataCollectorDynamicMemoryBalancer, err = perfdata.NewCollector("Hyper-V Dynamic Memory Balancer", perfdata.InstancesAll, []string{
|
||||||
vmDynamicMemoryBalancerAvailableMemory,
|
vmDynamicMemoryBalancerAvailableMemory,
|
||||||
vmDynamicMemoryBalancerAvailableMemoryForBalancing,
|
vmDynamicMemoryBalancerAvailableMemoryForBalancing,
|
||||||
vmDynamicMemoryBalancerAveragePressure,
|
vmDynamicMemoryBalancerAveragePressure,
|
||||||
|
|||||||
@@ -1,7 +1,21 @@
|
|||||||
|
// 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
|
package hyperv
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||||
@@ -42,7 +56,7 @@ const (
|
|||||||
func (c *Collector) buildDynamicMemoryVM() error {
|
func (c *Collector) buildDynamicMemoryVM() error {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollectorDynamicMemoryVM, err = perfdata.NewCollector("Hyper-V Dynamic Memory VM", perfdata.InstanceAll, []string{
|
c.perfDataCollectorDynamicMemoryVM, err = perfdata.NewCollector("Hyper-V Dynamic Memory VM", perfdata.InstancesAll, []string{
|
||||||
vmMemoryAddedMemory,
|
vmMemoryAddedMemory,
|
||||||
vmMemoryCurrentPressure,
|
vmMemoryCurrentPressure,
|
||||||
vmMemoryGuestVisiblePhysicalMemory,
|
vmMemoryGuestVisiblePhysicalMemory,
|
||||||
@@ -54,7 +68,7 @@ func (c *Collector) buildDynamicMemoryVM() error {
|
|||||||
vmMemoryRemovedMemory,
|
vmMemoryRemovedMemory,
|
||||||
vmMemoryGuestAvailableMemory,
|
vmMemoryGuestAvailableMemory,
|
||||||
})
|
})
|
||||||
if err != nil && !errors.Is(err, perfdata.ErrNoData) {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create Hyper-V Dynamic Memory VM collector: %w", err)
|
return fmt.Errorf("failed to create Hyper-V Dynamic Memory VM collector: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +138,7 @@ func (c *Collector) buildDynamicMemoryVM() error {
|
|||||||
|
|
||||||
func (c *Collector) collectDynamicMemoryVM(ch chan<- prometheus.Metric) error {
|
func (c *Collector) collectDynamicMemoryVM(ch chan<- prometheus.Metric) error {
|
||||||
data, err := c.perfDataCollectorDynamicMemoryVM.Collect()
|
data, err := c.perfDataCollectorDynamicMemoryVM.Collect()
|
||||||
if err != nil && !errors.Is(err, perfdata.ErrNoData) {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to collect Hyper-V Dynamic Memory VM metrics: %w", err)
|
return fmt.Errorf("failed to collect Hyper-V Dynamic Memory VM metrics: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,18 @@
|
|||||||
|
// 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
|
package hyperv
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -32,7 +47,7 @@ const (
|
|||||||
func (c *Collector) buildHypervisorLogicalProcessor() error {
|
func (c *Collector) buildHypervisorLogicalProcessor() error {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollectorHypervisorLogicalProcessor, err = perfdata.NewCollector("Hyper-V Hypervisor Logical Processor", perfdata.InstanceAll, []string{
|
c.perfDataCollectorHypervisorLogicalProcessor, err = perfdata.NewCollector("Hyper-V Hypervisor Logical Processor", perfdata.InstancesAll, []string{
|
||||||
hypervisorLogicalProcessorGuestRunTimePercent,
|
hypervisorLogicalProcessorGuestRunTimePercent,
|
||||||
hypervisorLogicalProcessorHypervisorRunTimePercent,
|
hypervisorLogicalProcessorHypervisorRunTimePercent,
|
||||||
hypervisorLogicalProcessorTotalRunTimePercent,
|
hypervisorLogicalProcessorTotalRunTimePercent,
|
||||||
|
|||||||
@@ -1,3 +1,18 @@
|
|||||||
|
// 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
|
package hyperv
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|||||||
@@ -1,3 +1,18 @@
|
|||||||
|
// 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
|
package hyperv
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -13,7 +28,6 @@ import (
|
|||||||
type collectorHypervisorRootVirtualProcessor struct {
|
type collectorHypervisorRootVirtualProcessor struct {
|
||||||
perfDataCollectorHypervisorRootVirtualProcessor *perfdata.Collector
|
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(*)\% Guest Run Time
|
||||||
// \Hyper-V Hypervisor Root Virtual Processor(*)\% Hypervisor 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(*)\% Remote Run Time
|
||||||
@@ -24,7 +38,6 @@ type collectorHypervisorRootVirtualProcessor struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
hypervisorRootVirtualProcessorGuestIdleTimePercent = "% Guest Idle Time"
|
|
||||||
hypervisorRootVirtualProcessorGuestRunTimePercent = "% Guest Run Time"
|
hypervisorRootVirtualProcessorGuestRunTimePercent = "% Guest Run Time"
|
||||||
hypervisorRootVirtualProcessorHypervisorRunTimePercent = "% Hypervisor Run Time"
|
hypervisorRootVirtualProcessorHypervisorRunTimePercent = "% Hypervisor Run Time"
|
||||||
hypervisorRootVirtualProcessorTotalRunTimePercent = "% Total Run Time"
|
hypervisorRootVirtualProcessorTotalRunTimePercent = "% Total Run Time"
|
||||||
@@ -35,8 +48,7 @@ const (
|
|||||||
func (c *Collector) buildHypervisorRootVirtualProcessor() error {
|
func (c *Collector) buildHypervisorRootVirtualProcessor() error {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollectorHypervisorRootVirtualProcessor, err = perfdata.NewCollector("Hyper-V Hypervisor Root Virtual Processor", perfdata.InstanceAll, []string{
|
c.perfDataCollectorHypervisorRootVirtualProcessor, err = perfdata.NewCollector("Hyper-V Hypervisor Root Virtual Processor", perfdata.InstancesAll, []string{
|
||||||
hypervisorRootVirtualProcessorGuestIdleTimePercent,
|
|
||||||
hypervisorRootVirtualProcessorGuestRunTimePercent,
|
hypervisorRootVirtualProcessorGuestRunTimePercent,
|
||||||
hypervisorRootVirtualProcessorHypervisorRunTimePercent,
|
hypervisorRootVirtualProcessorHypervisorRunTimePercent,
|
||||||
hypervisorRootVirtualProcessorTotalRunTimePercent,
|
hypervisorRootVirtualProcessorTotalRunTimePercent,
|
||||||
@@ -100,13 +112,6 @@ func (c *Collector) collectHypervisorRootVirtualProcessor(ch chan<- prometheus.M
|
|||||||
coreId, "hypervisor",
|
coreId, "hypervisor",
|
||||||
)
|
)
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
|
||||||
c.hypervisorRootVirtualProcessorTimeTotal,
|
|
||||||
prometheus.CounterValue,
|
|
||||||
coreData[hypervisorRootVirtualProcessorGuestIdleTimePercent].FirstValue,
|
|
||||||
coreId, "guest_idle",
|
|
||||||
)
|
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.hypervisorRootVirtualProcessorTimeTotal,
|
c.hypervisorRootVirtualProcessorTimeTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
|
|||||||
@@ -1,7 +1,21 @@
|
|||||||
|
// 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
|
package hyperv
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -14,7 +28,6 @@ import (
|
|||||||
type collectorHypervisorVirtualProcessor struct {
|
type collectorHypervisorVirtualProcessor struct {
|
||||||
perfDataCollectorHypervisorVirtualProcessor *perfdata.Collector
|
perfDataCollectorHypervisorVirtualProcessor *perfdata.Collector
|
||||||
|
|
||||||
// \Hyper-V Hypervisor Virtual Processor(*)\% Guest Idle Time
|
|
||||||
// \Hyper-V Hypervisor Virtual Processor(*)\% Guest Run Time
|
// \Hyper-V Hypervisor Virtual Processor(*)\% Guest Run Time
|
||||||
// \Hyper-V Hypervisor Virtual Processor(*)\% Hypervisor Run Time
|
// \Hyper-V Hypervisor Virtual Processor(*)\% Hypervisor Run Time
|
||||||
// \Hyper-V Hypervisor Virtual Processor(*)\% Remote Run Time
|
// \Hyper-V Hypervisor Virtual Processor(*)\% Remote Run Time
|
||||||
@@ -24,7 +37,6 @@ type collectorHypervisorVirtualProcessor struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
hypervisorVirtualProcessorGuestRunTimePercent = "% Guest Run Time"
|
|
||||||
hypervisorVirtualProcessorGuestIdleTimePercent = "% Guest Idle Time"
|
hypervisorVirtualProcessorGuestIdleTimePercent = "% Guest Idle Time"
|
||||||
hypervisorVirtualProcessorHypervisorRunTimePercent = "% Hypervisor Run Time"
|
hypervisorVirtualProcessorHypervisorRunTimePercent = "% Hypervisor Run Time"
|
||||||
hypervisorVirtualProcessorTotalRunTimePercent = "% Total Run Time"
|
hypervisorVirtualProcessorTotalRunTimePercent = "% Total Run Time"
|
||||||
@@ -35,15 +47,14 @@ const (
|
|||||||
func (c *Collector) buildHypervisorVirtualProcessor() error {
|
func (c *Collector) buildHypervisorVirtualProcessor() error {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollectorHypervisorVirtualProcessor, err = perfdata.NewCollector("Hyper-V Hypervisor Virtual Processor", perfdata.InstanceAll, []string{
|
c.perfDataCollectorHypervisorVirtualProcessor, err = perfdata.NewCollector("Hyper-V Hypervisor Virtual Processor", perfdata.InstancesAll, []string{
|
||||||
hypervisorVirtualProcessorGuestRunTimePercent,
|
|
||||||
hypervisorVirtualProcessorGuestIdleTimePercent,
|
hypervisorVirtualProcessorGuestIdleTimePercent,
|
||||||
hypervisorVirtualProcessorHypervisorRunTimePercent,
|
hypervisorVirtualProcessorHypervisorRunTimePercent,
|
||||||
hypervisorVirtualProcessorTotalRunTimePercent,
|
hypervisorVirtualProcessorTotalRunTimePercent,
|
||||||
hypervisorVirtualProcessorRemoteRunTimePercent,
|
hypervisorVirtualProcessorRemoteRunTimePercent,
|
||||||
hypervisorVirtualProcessorCPUWaitTimePerDispatch,
|
hypervisorVirtualProcessorCPUWaitTimePerDispatch,
|
||||||
})
|
})
|
||||||
if err != nil && !errors.Is(err, perfdata.ErrNoData) {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create Hyper-V Hypervisor Virtual Processor collector: %w", err)
|
return fmt.Errorf("failed to create Hyper-V Hypervisor Virtual Processor collector: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +82,7 @@ func (c *Collector) buildHypervisorVirtualProcessor() error {
|
|||||||
|
|
||||||
func (c *Collector) collectHypervisorVirtualProcessor(ch chan<- prometheus.Metric) error {
|
func (c *Collector) collectHypervisorVirtualProcessor(ch chan<- prometheus.Metric) error {
|
||||||
data, err := c.perfDataCollectorHypervisorVirtualProcessor.Collect()
|
data, err := c.perfDataCollectorHypervisorVirtualProcessor.Collect()
|
||||||
if err != nil && !errors.Is(err, perfdata.ErrNoData) {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to collect Hyper-V Hypervisor Virtual Processor metrics: %w", err)
|
return fmt.Errorf("failed to collect Hyper-V Hypervisor Virtual Processor metrics: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,13 +101,6 @@ func (c *Collector) collectHypervisorVirtualProcessor(ch chan<- prometheus.Metri
|
|||||||
vmName := parts[0]
|
vmName := parts[0]
|
||||||
coreId := coreParts[2]
|
coreId := coreParts[2]
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
|
||||||
c.hypervisorVirtualProcessorTimeTotal,
|
|
||||||
prometheus.CounterValue,
|
|
||||||
coreData[hypervisorVirtualProcessorGuestRunTimePercent].FirstValue,
|
|
||||||
vmName, coreId, "guest_run",
|
|
||||||
)
|
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.hypervisorVirtualProcessorTimeTotal,
|
c.hypervisorVirtualProcessorTimeTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
|
|||||||
@@ -1,7 +1,21 @@
|
|||||||
|
// 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
|
package hyperv
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||||
@@ -33,7 +47,7 @@ const (
|
|||||||
func (c *Collector) buildLegacyNetworkAdapter() error {
|
func (c *Collector) buildLegacyNetworkAdapter() error {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollectorLegacyNetworkAdapter, err = perfdata.NewCollector("Hyper-V Legacy Network Adapter", perfdata.InstanceAll, []string{
|
c.perfDataCollectorLegacyNetworkAdapter, err = perfdata.NewCollector("Hyper-V Legacy Network Adapter", perfdata.InstancesAll, []string{
|
||||||
legacyNetworkAdapterBytesDropped,
|
legacyNetworkAdapterBytesDropped,
|
||||||
legacyNetworkAdapterBytesReceived,
|
legacyNetworkAdapterBytesReceived,
|
||||||
legacyNetworkAdapterBytesSent,
|
legacyNetworkAdapterBytesSent,
|
||||||
@@ -41,7 +55,7 @@ func (c *Collector) buildLegacyNetworkAdapter() error {
|
|||||||
legacyNetworkAdapterFramesReceived,
|
legacyNetworkAdapterFramesReceived,
|
||||||
legacyNetworkAdapterFramesSent,
|
legacyNetworkAdapterFramesSent,
|
||||||
})
|
})
|
||||||
if err != nil && !errors.Is(err, perfdata.ErrNoData) {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create Hyper-V Legacy Network Adapter collector: %w", err)
|
return fmt.Errorf("failed to create Hyper-V Legacy Network Adapter collector: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,7 +101,7 @@ func (c *Collector) buildLegacyNetworkAdapter() error {
|
|||||||
|
|
||||||
func (c *Collector) collectLegacyNetworkAdapter(ch chan<- prometheus.Metric) error {
|
func (c *Collector) collectLegacyNetworkAdapter(ch chan<- prometheus.Metric) error {
|
||||||
data, err := c.perfDataCollectorLegacyNetworkAdapter.Collect()
|
data, err := c.perfDataCollectorLegacyNetworkAdapter.Collect()
|
||||||
if err != nil && !errors.Is(err, perfdata.ErrNoData) {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to collect Hyper-V Legacy Network Adapter metrics: %w", err)
|
return fmt.Errorf("failed to collect Hyper-V Legacy Network Adapter metrics: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package hyperv_test
|
package hyperv_test
|
||||||
|
|||||||
@@ -1,3 +1,18 @@
|
|||||||
|
// 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
|
package hyperv
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -51,7 +66,7 @@ func (c *Collector) collectVirtualMachineHealthSummary(ch chan<- prometheus.Metr
|
|||||||
return fmt.Errorf("failed to collect Hyper-V Virtual Machine Health Summary metrics: %w", err)
|
return fmt.Errorf("failed to collect Hyper-V Virtual Machine Health Summary metrics: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
healthData, ok := data[perfdata.EmptyInstance]
|
healthData, ok := data[perfdata.InstanceEmpty]
|
||||||
if !ok {
|
if !ok {
|
||||||
return errors.New("no data returned for Hyper-V Virtual Machine Health Summary")
|
return errors.New("no data returned for Hyper-V Virtual Machine Health Summary")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,21 @@
|
|||||||
|
// 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
|
package hyperv
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||||
@@ -26,12 +40,12 @@ const (
|
|||||||
func (c *Collector) buildVirtualMachineVidPartition() error {
|
func (c *Collector) buildVirtualMachineVidPartition() error {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollectorVirtualMachineVidPartition, err = perfdata.NewCollector("Hyper-V VM Vid Partition", perfdata.InstanceAll, []string{
|
c.perfDataCollectorVirtualMachineVidPartition, err = perfdata.NewCollector("Hyper-V VM Vid Partition", perfdata.InstancesAll, []string{
|
||||||
physicalPagesAllocated,
|
physicalPagesAllocated,
|
||||||
preferredNUMANodeIndex,
|
preferredNUMANodeIndex,
|
||||||
remotePhysicalPages,
|
remotePhysicalPages,
|
||||||
})
|
})
|
||||||
if err != nil && !errors.Is(err, perfdata.ErrNoData) {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create Hyper-V VM Vid Partition collector: %w", err)
|
return fmt.Errorf("failed to create Hyper-V VM Vid Partition collector: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +73,7 @@ func (c *Collector) buildVirtualMachineVidPartition() error {
|
|||||||
|
|
||||||
func (c *Collector) collectVirtualMachineVidPartition(ch chan<- prometheus.Metric) error {
|
func (c *Collector) collectVirtualMachineVidPartition(ch chan<- prometheus.Metric) error {
|
||||||
data, err := c.perfDataCollectorVirtualMachineVidPartition.Collect()
|
data, err := c.perfDataCollectorVirtualMachineVidPartition.Collect()
|
||||||
if err != nil && !errors.Is(err, perfdata.ErrNoData) {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to collect Hyper-V VM Vid Partition metrics: %w", err)
|
return fmt.Errorf("failed to collect Hyper-V VM Vid Partition metrics: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,21 @@
|
|||||||
|
// 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
|
package hyperv
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||||
@@ -33,7 +47,7 @@ const (
|
|||||||
func (c *Collector) buildVirtualNetworkAdapter() error {
|
func (c *Collector) buildVirtualNetworkAdapter() error {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollectorVirtualNetworkAdapter, err = perfdata.NewCollector("Hyper-V Virtual Network Adapter", perfdata.InstanceAll, []string{
|
c.perfDataCollectorVirtualNetworkAdapter, err = perfdata.NewCollector("Hyper-V Virtual Network Adapter", perfdata.InstancesAll, []string{
|
||||||
virtualNetworkAdapterBytesReceived,
|
virtualNetworkAdapterBytesReceived,
|
||||||
virtualNetworkAdapterBytesSent,
|
virtualNetworkAdapterBytesSent,
|
||||||
virtualNetworkAdapterDroppedPacketsIncoming,
|
virtualNetworkAdapterDroppedPacketsIncoming,
|
||||||
@@ -41,7 +55,7 @@ func (c *Collector) buildVirtualNetworkAdapter() error {
|
|||||||
virtualNetworkAdapterPacketsReceived,
|
virtualNetworkAdapterPacketsReceived,
|
||||||
virtualNetworkAdapterPacketsSent,
|
virtualNetworkAdapterPacketsSent,
|
||||||
})
|
})
|
||||||
if err != nil && !errors.Is(err, perfdata.ErrNoData) {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create Hyper-V Virtual Network Adapter collector: %w", err)
|
return fmt.Errorf("failed to create Hyper-V Virtual Network Adapter collector: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,7 +101,7 @@ func (c *Collector) buildVirtualNetworkAdapter() error {
|
|||||||
|
|
||||||
func (c *Collector) collectVirtualNetworkAdapter(ch chan<- prometheus.Metric) error {
|
func (c *Collector) collectVirtualNetworkAdapter(ch chan<- prometheus.Metric) error {
|
||||||
data, err := c.perfDataCollectorVirtualNetworkAdapter.Collect()
|
data, err := c.perfDataCollectorVirtualNetworkAdapter.Collect()
|
||||||
if err != nil && !errors.Is(err, perfdata.ErrNoData) {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to collect Hyper-V Virtual Network Adapter metrics: %w", err)
|
return fmt.Errorf("failed to collect Hyper-V Virtual Network Adapter metrics: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,21 @@
|
|||||||
|
// 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
|
package hyperv
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||||
@@ -148,7 +162,7 @@ const (
|
|||||||
func (c *Collector) buildVirtualNetworkAdapterDropReasons() error {
|
func (c *Collector) buildVirtualNetworkAdapterDropReasons() error {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollectorVirtualNetworkAdapterDropReasons, err = perfdata.NewCollector("Hyper-V Virtual Network Adapter Drop Reasons", perfdata.InstanceAll, []string{
|
c.perfDataCollectorVirtualNetworkAdapterDropReasons, err = perfdata.NewCollector("Hyper-V Virtual Network Adapter Drop Reasons", perfdata.InstancesAll, []string{
|
||||||
virtualNetworkAdapterDropReasonsOutgoingNativeFwdingReq,
|
virtualNetworkAdapterDropReasonsOutgoingNativeFwdingReq,
|
||||||
virtualNetworkAdapterDropReasonsIncomingNativeFwdingReq,
|
virtualNetworkAdapterDropReasonsIncomingNativeFwdingReq,
|
||||||
virtualNetworkAdapterDropReasonsOutgoingMTUMismatch,
|
virtualNetworkAdapterDropReasonsOutgoingMTUMismatch,
|
||||||
@@ -200,7 +214,7 @@ func (c *Collector) buildVirtualNetworkAdapterDropReasons() error {
|
|||||||
virtualNetworkAdapterDropReasonsOutgoingUnknown,
|
virtualNetworkAdapterDropReasonsOutgoingUnknown,
|
||||||
virtualNetworkAdapterDropReasonsIncomingUnknown,
|
virtualNetworkAdapterDropReasonsIncomingUnknown,
|
||||||
})
|
})
|
||||||
if err != nil && !errors.Is(err, perfdata.ErrNoData) {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create Hyper-V Virtual Network Adapter Drop Reasons collector: %w", err)
|
return fmt.Errorf("failed to create Hyper-V Virtual Network Adapter Drop Reasons collector: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,7 +230,7 @@ func (c *Collector) buildVirtualNetworkAdapterDropReasons() error {
|
|||||||
|
|
||||||
func (c *Collector) collectVirtualNetworkAdapterDropReasons(ch chan<- prometheus.Metric) error {
|
func (c *Collector) collectVirtualNetworkAdapterDropReasons(ch chan<- prometheus.Metric) error {
|
||||||
data, err := c.perfDataCollectorVirtualNetworkAdapterDropReasons.Collect()
|
data, err := c.perfDataCollectorVirtualNetworkAdapterDropReasons.Collect()
|
||||||
if err != nil && !errors.Is(err, perfdata.ErrNoData) {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to collect Hyper-V Virtual Network Adapter Drop Reasons metrics: %w", err)
|
return fmt.Errorf("failed to collect Hyper-V Virtual Network Adapter Drop Reasons metrics: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,21 @@
|
|||||||
|
// 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
|
package hyperv
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||||
@@ -55,7 +69,7 @@ const (
|
|||||||
func (c *Collector) buildVirtualSMB() error {
|
func (c *Collector) buildVirtualSMB() error {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollectorVirtualSMB, err = perfdata.NewCollector("Hyper-V Virtual SMB", perfdata.InstanceAll, []string{
|
c.perfDataCollectorVirtualSMB, err = perfdata.NewCollector("Hyper-V Virtual SMB", perfdata.InstancesAll, []string{
|
||||||
virtualSMBDirectMappedSections,
|
virtualSMBDirectMappedSections,
|
||||||
virtualSMBDirectMappedPages,
|
virtualSMBDirectMappedPages,
|
||||||
virtualSMBWriteBytesRDMA,
|
virtualSMBWriteBytesRDMA,
|
||||||
@@ -74,7 +88,7 @@ func (c *Collector) buildVirtualSMB() error {
|
|||||||
virtualSMBSentBytes,
|
virtualSMBSentBytes,
|
||||||
virtualSMBReceivedBytes,
|
virtualSMBReceivedBytes,
|
||||||
})
|
})
|
||||||
if err != nil && !errors.Is(err, perfdata.ErrNoData) {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create Hyper-V Virtual SMB collector: %w", err)
|
return fmt.Errorf("failed to create Hyper-V Virtual SMB collector: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,7 +200,7 @@ func (c *Collector) buildVirtualSMB() error {
|
|||||||
|
|
||||||
func (c *Collector) collectVirtualSMB(ch chan<- prometheus.Metric) error {
|
func (c *Collector) collectVirtualSMB(ch chan<- prometheus.Metric) error {
|
||||||
data, err := c.perfDataCollectorVirtualSMB.Collect()
|
data, err := c.perfDataCollectorVirtualSMB.Collect()
|
||||||
if err != nil && !errors.Is(err, perfdata.ErrNoData) {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to collect Hyper-V Virtual SMB metrics: %w", err)
|
return fmt.Errorf("failed to collect Hyper-V Virtual SMB metrics: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,21 @@
|
|||||||
|
// 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
|
package hyperv
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||||
@@ -45,7 +59,7 @@ const (
|
|||||||
func (c *Collector) buildVirtualStorageDevice() error {
|
func (c *Collector) buildVirtualStorageDevice() error {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollectorVirtualStorageDevice, err = perfdata.NewCollector("Hyper-V Virtual Storage Device", perfdata.InstanceAll, []string{
|
c.perfDataCollectorVirtualStorageDevice, err = perfdata.NewCollector("Hyper-V Virtual Storage Device", perfdata.InstancesAll, []string{
|
||||||
virtualStorageDeviceErrorCount,
|
virtualStorageDeviceErrorCount,
|
||||||
virtualStorageDeviceQueueLength,
|
virtualStorageDeviceQueueLength,
|
||||||
virtualStorageDeviceReadBytes,
|
virtualStorageDeviceReadBytes,
|
||||||
@@ -59,7 +73,7 @@ func (c *Collector) buildVirtualStorageDevice() error {
|
|||||||
virtualStorageDeviceLowerLatency,
|
virtualStorageDeviceLowerLatency,
|
||||||
virtualStorageDeviceIOQuotaReplenishmentRate,
|
virtualStorageDeviceIOQuotaReplenishmentRate,
|
||||||
})
|
})
|
||||||
if err != nil && !errors.Is(err, perfdata.ErrNoData) {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create Hyper-V Virtual Storage Device collector: %w", err)
|
return fmt.Errorf("failed to create Hyper-V Virtual Storage Device collector: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,7 +155,7 @@ func (c *Collector) buildVirtualStorageDevice() error {
|
|||||||
|
|
||||||
func (c *Collector) collectVirtualStorageDevice(ch chan<- prometheus.Metric) error {
|
func (c *Collector) collectVirtualStorageDevice(ch chan<- prometheus.Metric) error {
|
||||||
data, err := c.perfDataCollectorVirtualStorageDevice.Collect()
|
data, err := c.perfDataCollectorVirtualStorageDevice.Collect()
|
||||||
if err != nil && !errors.Is(err, perfdata.ErrNoData) {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to collect Hyper-V Virtual Storage Device metrics: %w", err)
|
return fmt.Errorf("failed to collect Hyper-V Virtual Storage Device metrics: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,21 @@
|
|||||||
|
// 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
|
package hyperv
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||||
@@ -62,7 +76,7 @@ const (
|
|||||||
func (c *Collector) buildVirtualSwitch() error {
|
func (c *Collector) buildVirtualSwitch() error {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollectorVirtualSwitch, err = perfdata.NewCollector("Hyper-V Virtual Switch", perfdata.InstanceAll, []string{
|
c.perfDataCollectorVirtualSwitch, err = perfdata.NewCollector("Hyper-V Virtual Switch", perfdata.InstancesAll, []string{
|
||||||
virtualSwitchBroadcastPacketsReceived,
|
virtualSwitchBroadcastPacketsReceived,
|
||||||
virtualSwitchBroadcastPacketsSent,
|
virtualSwitchBroadcastPacketsSent,
|
||||||
virtualSwitchBytes,
|
virtualSwitchBytes,
|
||||||
@@ -85,7 +99,7 @@ func (c *Collector) buildVirtualSwitch() error {
|
|||||||
virtualSwitchPacketsSent,
|
virtualSwitchPacketsSent,
|
||||||
virtualSwitchPurgedMacAddresses,
|
virtualSwitchPurgedMacAddresses,
|
||||||
})
|
})
|
||||||
if err != nil && !errors.Is(err, perfdata.ErrNoData) {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create Hyper-V Virtual Switch collector: %w", err)
|
return fmt.Errorf("failed to create Hyper-V Virtual Switch collector: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,7 +235,7 @@ func (c *Collector) buildVirtualSwitch() error {
|
|||||||
|
|
||||||
func (c *Collector) collectVirtualSwitch(ch chan<- prometheus.Metric) error {
|
func (c *Collector) collectVirtualSwitch(ch chan<- prometheus.Metric) error {
|
||||||
data, err := c.perfDataCollectorVirtualSwitch.Collect()
|
data, err := c.perfDataCollectorVirtualSwitch.Collect()
|
||||||
if err != nil && !errors.Is(err, perfdata.ErrNoData) {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to collect Hyper-V Virtual Switch metrics: %w", err)
|
return fmt.Errorf("failed to collect Hyper-V Virtual Switch metrics: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package iis
|
package iis
|
||||||
@@ -28,6 +41,7 @@ type Config struct {
|
|||||||
AppExclude *regexp.Regexp `yaml:"app_exclude"`
|
AppExclude *regexp.Regexp `yaml:"app_exclude"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint:gochecknoglobals
|
||||||
var ConfigDefaults = Config{
|
var ConfigDefaults = Config{
|
||||||
SiteInclude: types.RegExpAny,
|
SiteInclude: types.RegExpAny,
|
||||||
SiteExclude: types.RegExpEmpty,
|
SiteExclude: types.RegExpEmpty,
|
||||||
@@ -137,8 +151,8 @@ func (c *Collector) GetName() string {
|
|||||||
func (c *Collector) Close() error {
|
func (c *Collector) Close() error {
|
||||||
c.perfDataCollectorWebService.Close()
|
c.perfDataCollectorWebService.Close()
|
||||||
c.perfDataCollectorAppPoolWAS.Close()
|
c.perfDataCollectorAppPoolWAS.Close()
|
||||||
c.perfDataCollectorW3SVCW3WP.Close()
|
c.w3SVCW3WPPerfDataCollector.Close()
|
||||||
c.perfDataCollectorWebServiceCache.Close()
|
c.serviceCachePerfDataCollector.Close()
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -155,23 +169,25 @@ func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
|
|||||||
prometheus.Labels{"version": fmt.Sprintf("%d.%d", c.iisVersion.major, c.iisVersion.minor)},
|
prometheus.Labels{"version": fmt.Sprintf("%d.%d", c.iisVersion.major, c.iisVersion.minor)},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
errs := make([]error, 0, 4)
|
||||||
|
|
||||||
if err := c.buildWebService(); err != nil {
|
if err := c.buildWebService(); err != nil {
|
||||||
return fmt.Errorf("failed to build Web Service collector: %w", err)
|
errs = append(errs, fmt.Errorf("failed to build Web Service collector: %w", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := c.buildAppPoolWAS(); err != nil {
|
if err := c.buildAppPoolWAS(); err != nil {
|
||||||
return fmt.Errorf("failed to build APP_POOL_WAS collector: %w", err)
|
errs = append(errs, fmt.Errorf("failed to build APP_POOL_WAS collector: %w", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := c.buildW3SVCW3WP(); err != nil {
|
if err := c.buildW3SVCW3WP(); err != nil {
|
||||||
return fmt.Errorf("failed to build W3SVC_W3WP collector: %w", err)
|
errs = append(errs, fmt.Errorf("failed to build W3SVC_W3WP collector: %w", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := c.buildWebServiceCache(); err != nil {
|
if err := c.buildWebServiceCache(); err != nil {
|
||||||
return fmt.Errorf("failed to build Web Service Cache collector: %w", err)
|
errs = append(errs, fmt.Errorf("failed to build Web Service Cache collector: %w", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return errors.Join(errs...)
|
||||||
}
|
}
|
||||||
|
|
||||||
type simpleVersion struct {
|
type simpleVersion struct {
|
||||||
@@ -182,7 +198,7 @@ type simpleVersion struct {
|
|||||||
func (c *Collector) getIISVersion(logger *slog.Logger) simpleVersion {
|
func (c *Collector) getIISVersion(logger *slog.Logger) simpleVersion {
|
||||||
k, err := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\Microsoft\InetStp\`, registry.QUERY_VALUE)
|
k, err := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\Microsoft\InetStp\`, registry.QUERY_VALUE)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Warn("Couldn't open registry to determine IIS version",
|
logger.Warn("couldn't open registry to determine IIS version",
|
||||||
slog.Any("err", err),
|
slog.Any("err", err),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -260,7 +276,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
|
|||||||
// discarded, and "Site_B#2" would be kept and presented as "Site_B" in the
|
// discarded, and "Site_B#2" would be kept and presented as "Site_B" in the
|
||||||
// Collector metrics.
|
// Collector metrics.
|
||||||
// [ "Site_A", "Site_B", "Site_C", "Site_B#2" ].
|
// [ "Site_A", "Site_B", "Site_C", "Site_B#2" ].
|
||||||
func deduplicateIISNames(counterValues map[string]map[string]perfdata.CounterValues) {
|
func deduplicateIISNames(counterValues map[string]map[string]perfdata.CounterValue) {
|
||||||
services := slices.Collect(maps.Keys(counterValues))
|
services := slices.Collect(maps.Keys(counterValues))
|
||||||
|
|
||||||
// Ensure IIS entry with the highest suffix occurs last
|
// Ensure IIS entry with the highest suffix occurs last
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package iis
|
package iis
|
||||||
@@ -44,6 +57,7 @@ const (
|
|||||||
TotalWorkerProcessStartupFailures = "Total Worker Process Startup Failures"
|
TotalWorkerProcessStartupFailures = "Total Worker Process Startup Failures"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//nolint:gochecknoglobals
|
||||||
var applicationStates = map[uint32]string{
|
var applicationStates = map[uint32]string{
|
||||||
1: "Uninitialized",
|
1: "Uninitialized",
|
||||||
2: "Initialized",
|
2: "Initialized",
|
||||||
@@ -57,7 +71,7 @@ var applicationStates = map[uint32]string{
|
|||||||
func (c *Collector) buildAppPoolWAS() error {
|
func (c *Collector) buildAppPoolWAS() error {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollectorAppPoolWAS, err = perfdata.NewCollector("APP_POOL_WAS", perfdata.InstanceAll, []string{
|
c.perfDataCollectorAppPoolWAS, err = perfdata.NewCollector("APP_POOL_WAS", perfdata.InstancesAll, []string{
|
||||||
CurrentApplicationPoolState,
|
CurrentApplicationPoolState,
|
||||||
CurrentApplicationPoolUptime,
|
CurrentApplicationPoolUptime,
|
||||||
CurrentWorkerProcesses,
|
CurrentWorkerProcesses,
|
||||||
@@ -160,7 +174,7 @@ func (c *Collector) buildAppPoolWAS() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Collector) collectAppPoolWAS(ch chan<- prometheus.Metric) error {
|
func (c *Collector) collectAppPoolWAS(ch chan<- prometheus.Metric) error {
|
||||||
perfData, err := c.perfDataCollectorWebService.Collect()
|
perfData, err := c.perfDataCollectorAppPoolWAS.Collect()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to collect APP_POOL_WAS metrics: %w", err)
|
return fmt.Errorf("failed to collect APP_POOL_WAS metrics: %w", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package iis_test
|
package iis_test
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package iis
|
package iis
|
||||||
@@ -13,399 +26,385 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type collectorW3SVCW3WP struct {
|
type collectorW3SVCW3WP struct {
|
||||||
perfDataCollectorW3SVCW3WP *perfdata.Collector
|
w3SVCW3WPPerfDataCollector *perfdata.Collector
|
||||||
|
|
||||||
// W3SVC_W3WP
|
// W3SVC_W3WP
|
||||||
threads *prometheus.Desc
|
w3SVCW3WPThreads *prometheus.Desc
|
||||||
maximumThreads *prometheus.Desc
|
w3SVCW3WPMaximumThreads *prometheus.Desc
|
||||||
|
|
||||||
requestsTotal *prometheus.Desc
|
w3SVCW3WPRequestsTotal *prometheus.Desc
|
||||||
requestsActive *prometheus.Desc
|
w3SVCW3WPRequestsActive *prometheus.Desc
|
||||||
|
|
||||||
activeFlushedEntries *prometheus.Desc
|
w3SVCW3WPActiveFlushedEntries *prometheus.Desc
|
||||||
|
|
||||||
currentFileCacheMemoryUsage *prometheus.Desc
|
w3SVCW3WPCurrentFileCacheMemoryUsage *prometheus.Desc
|
||||||
maximumFileCacheMemoryUsage *prometheus.Desc
|
w3SVCW3WPMaximumFileCacheMemoryUsage *prometheus.Desc
|
||||||
fileCacheFlushesTotal *prometheus.Desc
|
w3SVCW3WPFileCacheFlushesTotal *prometheus.Desc
|
||||||
fileCacheQueriesTotal *prometheus.Desc
|
w3SVCW3WPFileCacheQueriesTotal *prometheus.Desc
|
||||||
fileCacheHitsTotal *prometheus.Desc
|
w3SVCW3WPFileCacheHitsTotal *prometheus.Desc
|
||||||
filesCached *prometheus.Desc
|
w3SVCW3WPFilesCached *prometheus.Desc
|
||||||
filesCachedTotal *prometheus.Desc
|
w3SVCW3WPFilesCachedTotal *prometheus.Desc
|
||||||
filesFlushedTotal *prometheus.Desc
|
w3SVCW3WPFilesFlushedTotal *prometheus.Desc
|
||||||
|
|
||||||
uriCacheFlushesTotal *prometheus.Desc
|
w3SVCW3WPURICacheFlushesTotal *prometheus.Desc
|
||||||
uriCacheQueriesTotal *prometheus.Desc
|
w3SVCW3WPURICacheQueriesTotal *prometheus.Desc
|
||||||
uriCacheHitsTotal *prometheus.Desc
|
w3SVCW3WPURICacheHitsTotal *prometheus.Desc
|
||||||
urisCached *prometheus.Desc
|
w3SVCW3WPURIsCached *prometheus.Desc
|
||||||
urisCachedTotal *prometheus.Desc
|
w3SVCW3WPURIsCachedTotal *prometheus.Desc
|
||||||
urisFlushedTotal *prometheus.Desc
|
w3SVCW3WPURIsFlushedTotal *prometheus.Desc
|
||||||
|
|
||||||
metadataCached *prometheus.Desc
|
w3SVCW3WPMetadataCached *prometheus.Desc
|
||||||
metadataCacheFlushes *prometheus.Desc
|
w3SVCW3WPMetadataCacheFlushes *prometheus.Desc
|
||||||
metadataCacheQueriesTotal *prometheus.Desc
|
w3SVCW3WPMetadataCacheQueriesTotal *prometheus.Desc
|
||||||
metadataCacheHitsTotal *prometheus.Desc
|
w3SVCW3WPMetadataCacheHitsTotal *prometheus.Desc
|
||||||
metadataCachedTotal *prometheus.Desc
|
w3SVCW3WPMetadataCachedTotal *prometheus.Desc
|
||||||
metadataFlushedTotal *prometheus.Desc
|
w3SVCW3WPMetadataFlushedTotal *prometheus.Desc
|
||||||
|
|
||||||
outputCacheActiveFlushedItems *prometheus.Desc
|
w3SVCW3WPOutputCacheActiveFlushedItems *prometheus.Desc
|
||||||
outputCacheItems *prometheus.Desc
|
w3SVCW3WPOutputCacheItems *prometheus.Desc
|
||||||
outputCacheMemoryUsage *prometheus.Desc
|
w3SVCW3WPOutputCacheMemoryUsage *prometheus.Desc
|
||||||
outputCacheQueriesTotal *prometheus.Desc
|
w3SVCW3WPOutputCacheQueriesTotal *prometheus.Desc
|
||||||
outputCacheHitsTotal *prometheus.Desc
|
w3SVCW3WPOutputCacheHitsTotal *prometheus.Desc
|
||||||
outputCacheFlushedItemsTotal *prometheus.Desc
|
w3SVCW3WPOutputCacheFlushedItemsTotal *prometheus.Desc
|
||||||
outputCacheFlushesTotal *prometheus.Desc
|
w3SVCW3WPOutputCacheFlushesTotal *prometheus.Desc
|
||||||
|
|
||||||
// IIS 8+ Only
|
// IIS 8+ Only
|
||||||
requestErrorsTotal *prometheus.Desc
|
w3SVCW3WPRequestErrorsTotal *prometheus.Desc
|
||||||
webSocketRequestsActive *prometheus.Desc
|
w3SVCW3WPWebSocketRequestsActive *prometheus.Desc
|
||||||
webSocketConnectionAttempts *prometheus.Desc
|
w3SVCW3WPWebSocketConnectionAttempts *prometheus.Desc
|
||||||
webSocketConnectionsAccepted *prometheus.Desc
|
w3SVCW3WPWebSocketConnectionsAccepted *prometheus.Desc
|
||||||
webSocketConnectionsRejected *prometheus.Desc
|
w3SVCW3WPWebSocketConnectionsRejected *prometheus.Desc
|
||||||
}
|
}
|
||||||
|
|
||||||
var workerProcessNameExtractor = regexp.MustCompile(`^(\d+)_(.+)$`)
|
var workerProcessNameExtractor = regexp.MustCompile(`^(\d+)_(.+)$`)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Threads = "Active Threads Count"
|
w3SVCW3WPThreads = "Active Threads Count"
|
||||||
MaximumThreads = "Maximum Threads Count"
|
w3SVCW3WPMaximumThreads = "Maximum Threads Count"
|
||||||
|
|
||||||
RequestsTotal = "Total HTTP Requests Served"
|
w3SVCW3WPRequestsTotal = "Total HTTP Requests Served"
|
||||||
RequestsActive = "Active Requests"
|
w3SVCW3WPRequestsActive = "Active Requests"
|
||||||
|
|
||||||
ActiveFlushedEntries = "Active Flushed Entries"
|
w3SVCW3WPActiveFlushedEntries = "Active Flushed Entries"
|
||||||
|
|
||||||
CurrentFileCacheMemoryUsage = "Current File Cache Memory Usage"
|
w3SVCW3WPCurrentFileCacheMemoryUsage = "Current File Cache Memory Usage"
|
||||||
MaximumFileCacheMemoryUsage = "Maximum File Cache Memory Usage"
|
w3SVCW3WPMaximumFileCacheMemoryUsage = "Maximum File Cache Memory Usage"
|
||||||
FileCacheFlushesTotal = "File Cache Flushes"
|
w3SVCW3WPFileCacheFlushesTotal = "File Cache Flushes"
|
||||||
FileCacheHitsTotal = "File Cache Hits"
|
w3SVCW3WPFileCacheHitsTotal = "File Cache Hits"
|
||||||
FileCacheMissesTotal = "File Cache Misses"
|
w3SVCW3WPFileCacheMissesTotal = "File Cache Misses"
|
||||||
FilesCached = "Current Files Cached"
|
w3SVCW3WPFilesCached = "Current Files Cached"
|
||||||
FilesCachedTotal = "Total Files Cached"
|
w3SVCW3WPFilesCachedTotal = "Total Files Cached"
|
||||||
FilesFlushedTotal = "Total Flushed Files"
|
w3SVCW3WPFilesFlushedTotal = "Total Flushed Files"
|
||||||
|
|
||||||
URICacheFlushesTotal = "Total Flushed URIs"
|
w3SVCW3WPURICacheFlushesTotal = "Total Flushed URIs"
|
||||||
URICacheFlushesTotalKernel = "Total Flushed URIs"
|
w3SVCW3WPURICacheHitsTotal = "URI Cache Hits"
|
||||||
URIsFlushedTotalKernel = "Kernel: Total Flushed URIs"
|
w3SVCW3WPURICacheMissesTotal = "URI Cache Misses"
|
||||||
URICacheHitsTotal = "URI Cache Hits"
|
w3SVCW3WPURIsCached = "Current URIs Cached"
|
||||||
URICacheHitsTotalKernel = "Kernel: URI Cache Hits"
|
w3SVCW3WPURIsCachedTotal = "Total URIs Cached"
|
||||||
URICacheMissesTotal = "URI Cache Misses"
|
w3SVCW3WPURIsFlushedTotal = "Total Flushed URIs"
|
||||||
URICacheMissesTotalKernel = "Kernel: URI Cache Misses"
|
|
||||||
URIsCached = "Current URIs Cached"
|
|
||||||
URIsCachedKernel = "Kernel: Current URIs Cached"
|
|
||||||
URIsCachedTotal = "Total URIs Cached"
|
|
||||||
URIsCachedTotalKernel = "Total URIs Cached"
|
|
||||||
URIsFlushedTotal = "Total Flushed URIs"
|
|
||||||
|
|
||||||
MetaDataCacheHits = "Metadata Cache Hits"
|
w3SVCW3WPMetaDataCacheHits = "Metadata Cache Hits"
|
||||||
MetaDataCacheMisses = "Metadata Cache Misses"
|
w3SVCW3WPMetaDataCacheMisses = "Metadata Cache Misses"
|
||||||
MetadataCached = "Current Metadata Cached"
|
w3SVCW3WPMetadataCached = "Current Metadata Cached"
|
||||||
MetadataCacheFlushes = "Metadata Cache Flushes"
|
w3SVCW3WPMetadataCacheFlushes = "Metadata Cache Flushes"
|
||||||
MetadataCachedTotal = "Total Metadata Cached"
|
w3SVCW3WPMetadataCachedTotal = "Total Metadata Cached"
|
||||||
MetadataFlushedTotal = "Total Flushed Metadata"
|
w3SVCW3WPMetadataFlushedTotal = "Total Flushed Metadata"
|
||||||
|
|
||||||
OutputCacheActiveFlushedItems = "Output Cache Current Flushed Items"
|
w3SVCW3WPOutputCacheActiveFlushedItems = "Output Cache Current Flushed Items"
|
||||||
OutputCacheItems = "Output Cache Current Items"
|
w3SVCW3WPOutputCacheItems = "Output Cache Current Items"
|
||||||
OutputCacheMemoryUsage = "Output Cache Current Memory Usage"
|
w3SVCW3WPOutputCacheMemoryUsage = "Output Cache Current Memory Usage"
|
||||||
OutputCacheHitsTotal = "Output Cache Total Hits"
|
w3SVCW3WPOutputCacheHitsTotal = "Output Cache Total Hits"
|
||||||
OutputCacheMissesTotal = "Output Cache Total Misses"
|
w3SVCW3WPOutputCacheMissesTotal = "Output Cache Total Misses"
|
||||||
OutputCacheFlushedItemsTotal = "Output Cache Total Flushed Items"
|
w3SVCW3WPOutputCacheFlushedItemsTotal = "Output Cache Total Flushed Items"
|
||||||
OutputCacheFlushesTotal = "Output Cache Total Flushes"
|
w3SVCW3WPOutputCacheFlushesTotal = "Output Cache Total Flushes"
|
||||||
|
|
||||||
// IIS8
|
// IIS8
|
||||||
RequestErrors500 = "% 500 HTTP Response Sent"
|
w3SVCW3WPRequestErrors500 = "% 500 HTTP Response Sent"
|
||||||
RequestErrors503 = "% 503 HTTP Response Sent"
|
w3SVCW3WPRequestErrors404 = "% 404 HTTP Response Sent"
|
||||||
RequestErrors404 = "% 404 HTTP Response Sent"
|
w3SVCW3WPRequestErrors403 = "% 403 HTTP Response Sent"
|
||||||
RequestErrors403 = "% 403 HTTP Response Sent"
|
w3SVCW3WPRequestErrors401 = "% 401 HTTP Response Sent"
|
||||||
RequestErrors401 = "% 401 HTTP Response Sent"
|
|
||||||
|
|
||||||
WebSocketRequestsActive = "WebSocket Active Requests"
|
w3SVCW3WPWebSocketRequestsActive = "WebSocket Active Requests"
|
||||||
WebSocketConnectionAttempts = "WebSocket Connection Attempts / Sec"
|
w3SVCW3WPWebSocketConnectionAttempts = "WebSocket Connection Attempts / Sec"
|
||||||
WebSocketConnectionsAccepted = "WebSocket Connections Accepted / Sec"
|
w3SVCW3WPWebSocketConnectionsAccepted = "WebSocket Connections Accepted / Sec"
|
||||||
WebSocketConnectionsRejected = "WebSocket Connections Rejected / Sec"
|
w3SVCW3WPWebSocketConnectionsRejected = "WebSocket Connections Rejected / Sec"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (c *Collector) buildW3SVCW3WP() error {
|
func (c *Collector) buildW3SVCW3WP() error {
|
||||||
counters := []string{
|
counters := []string{
|
||||||
Threads,
|
w3SVCW3WPThreads,
|
||||||
MaximumThreads,
|
w3SVCW3WPMaximumThreads,
|
||||||
RequestsTotal,
|
w3SVCW3WPRequestsTotal,
|
||||||
RequestsActive,
|
w3SVCW3WPRequestsActive,
|
||||||
ActiveFlushedEntries,
|
w3SVCW3WPActiveFlushedEntries,
|
||||||
CurrentFileCacheMemoryUsage,
|
w3SVCW3WPCurrentFileCacheMemoryUsage,
|
||||||
MaximumFileCacheMemoryUsage,
|
w3SVCW3WPMaximumFileCacheMemoryUsage,
|
||||||
FileCacheFlushesTotal,
|
w3SVCW3WPFileCacheFlushesTotal,
|
||||||
FileCacheHitsTotal,
|
w3SVCW3WPFileCacheHitsTotal,
|
||||||
FileCacheMissesTotal,
|
w3SVCW3WPFileCacheMissesTotal,
|
||||||
FilesCached,
|
w3SVCW3WPFilesCached,
|
||||||
FilesCachedTotal,
|
w3SVCW3WPFilesCachedTotal,
|
||||||
FilesFlushedTotal,
|
w3SVCW3WPFilesFlushedTotal,
|
||||||
URICacheFlushesTotal,
|
w3SVCW3WPURICacheFlushesTotal,
|
||||||
URICacheFlushesTotalKernel,
|
w3SVCW3WPURICacheHitsTotal,
|
||||||
URIsFlushedTotalKernel,
|
w3SVCW3WPURICacheMissesTotal,
|
||||||
URICacheHitsTotal,
|
w3SVCW3WPURIsCached,
|
||||||
URICacheHitsTotalKernel,
|
w3SVCW3WPURIsCachedTotal,
|
||||||
URICacheMissesTotal,
|
w3SVCW3WPURIsFlushedTotal,
|
||||||
URICacheMissesTotalKernel,
|
w3SVCW3WPMetaDataCacheHits,
|
||||||
URIsCached,
|
w3SVCW3WPMetaDataCacheMisses,
|
||||||
URIsCachedKernel,
|
w3SVCW3WPMetadataCached,
|
||||||
URIsCachedTotal,
|
w3SVCW3WPMetadataCacheFlushes,
|
||||||
URIsCachedTotalKernel,
|
w3SVCW3WPMetadataCachedTotal,
|
||||||
URIsFlushedTotal,
|
w3SVCW3WPMetadataFlushedTotal,
|
||||||
MetaDataCacheHits,
|
w3SVCW3WPOutputCacheActiveFlushedItems,
|
||||||
MetaDataCacheMisses,
|
w3SVCW3WPOutputCacheItems,
|
||||||
MetadataCached,
|
w3SVCW3WPOutputCacheMemoryUsage,
|
||||||
MetadataCacheFlushes,
|
w3SVCW3WPOutputCacheHitsTotal,
|
||||||
MetadataCachedTotal,
|
w3SVCW3WPOutputCacheMissesTotal,
|
||||||
MetadataFlushedTotal,
|
w3SVCW3WPOutputCacheFlushedItemsTotal,
|
||||||
OutputCacheActiveFlushedItems,
|
w3SVCW3WPOutputCacheFlushesTotal,
|
||||||
OutputCacheItems,
|
|
||||||
OutputCacheMemoryUsage,
|
|
||||||
OutputCacheHitsTotal,
|
|
||||||
OutputCacheMissesTotal,
|
|
||||||
OutputCacheFlushedItemsTotal,
|
|
||||||
OutputCacheFlushesTotal,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.iisVersion.major >= 8 {
|
if c.iisVersion.major >= 8 {
|
||||||
counters = append(counters, []string{
|
counters = append(counters, []string{
|
||||||
RequestErrors500,
|
w3SVCW3WPRequestErrors500,
|
||||||
RequestErrors503,
|
w3SVCW3WPRequestErrors404,
|
||||||
RequestErrors404,
|
w3SVCW3WPRequestErrors403,
|
||||||
RequestErrors403,
|
w3SVCW3WPRequestErrors401,
|
||||||
RequestErrors401,
|
w3SVCW3WPWebSocketRequestsActive,
|
||||||
WebSocketRequestsActive,
|
w3SVCW3WPWebSocketConnectionAttempts,
|
||||||
WebSocketConnectionAttempts,
|
w3SVCW3WPWebSocketConnectionsAccepted,
|
||||||
WebSocketConnectionsAccepted,
|
w3SVCW3WPWebSocketConnectionsRejected,
|
||||||
WebSocketConnectionsRejected,
|
|
||||||
}...)
|
}...)
|
||||||
}
|
}
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollectorW3SVCW3WP, err = perfdata.NewCollector("W3SVC_W3WP", perfdata.InstanceAll, counters)
|
c.w3SVCW3WPPerfDataCollector, err = perfdata.NewCollector("W3SVC_W3WP", perfdata.InstancesAll, counters)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create W3SVC_W3WP collector: %w", err)
|
return fmt.Errorf("failed to create W3SVC_W3WP collector: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// W3SVC_W3WP
|
// W3SVC_W3WP
|
||||||
c.threads = prometheus.NewDesc(
|
c.w3SVCW3WPThreads = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_threads"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_threads"),
|
||||||
"Number of threads actively processing requests in the worker process",
|
"Number of threads actively processing requests in the worker process",
|
||||||
[]string{"app", "pid", "state"},
|
[]string{"app", "pid", "state"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.maximumThreads = prometheus.NewDesc(
|
c.w3SVCW3WPMaximumThreads = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_max_threads"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_max_threads"),
|
||||||
"Maximum number of threads to which the thread pool can grow as needed",
|
"Maximum number of threads to which the thread pool can grow as needed",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.requestsTotal = prometheus.NewDesc(
|
c.w3SVCW3WPRequestsTotal = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_requests_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_requests_total"),
|
||||||
"Total number of HTTP requests served by the worker process",
|
"Total number of HTTP requests served by the worker process",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.requestsActive = prometheus.NewDesc(
|
c.w3SVCW3WPRequestsActive = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_current_requests"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_current_requests"),
|
||||||
"Current number of requests being processed by the worker process",
|
"Current number of requests being processed by the worker process",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.activeFlushedEntries = prometheus.NewDesc(
|
c.w3SVCW3WPActiveFlushedEntries = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_cache_active_flushed_entries"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_cache_active_flushed_entries"),
|
||||||
"Number of file handles cached in user-mode that will be closed when all current transfers complete.",
|
"Number of file handles cached in user-mode that will be closed when all current transfers complete.",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.currentFileCacheMemoryUsage = prometheus.NewDesc(
|
c.w3SVCW3WPCurrentFileCacheMemoryUsage = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_memory_bytes"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_memory_bytes"),
|
||||||
"Current number of bytes used by user-mode file cache",
|
"Current number of bytes used by user-mode file cache",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.maximumFileCacheMemoryUsage = prometheus.NewDesc(
|
c.w3SVCW3WPMaximumFileCacheMemoryUsage = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_max_memory_bytes"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_max_memory_bytes"),
|
||||||
"Maximum number of bytes used by user-mode file cache",
|
"Maximum number of bytes used by user-mode file cache",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.fileCacheFlushesTotal = prometheus.NewDesc(
|
c.w3SVCW3WPFileCacheFlushesTotal = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_flushes_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_flushes_total"),
|
||||||
"Total number of files removed from the user-mode cache",
|
"Total number of files removed from the user-mode cache",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.fileCacheQueriesTotal = prometheus.NewDesc(
|
c.w3SVCW3WPFileCacheQueriesTotal = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_queries_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_queries_total"),
|
||||||
"Total file cache queries (hits + misses)",
|
"Total file cache queries (hits + misses)",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.fileCacheHitsTotal = prometheus.NewDesc(
|
c.w3SVCW3WPFileCacheHitsTotal = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_hits_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_hits_total"),
|
||||||
"Total number of successful lookups in the user-mode file cache",
|
"Total number of successful lookups in the user-mode file cache",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.filesCached = prometheus.NewDesc(
|
c.w3SVCW3WPFilesCached = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_items"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_items"),
|
||||||
"Current number of files whose contents are present in user-mode cache",
|
"Current number of files whose contents are present in user-mode cache",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.filesCachedTotal = prometheus.NewDesc(
|
c.w3SVCW3WPFilesCachedTotal = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_items_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_items_total"),
|
||||||
"Total number of files whose contents were ever added to the user-mode cache (since service startup)",
|
"Total number of files whose contents were ever added to the user-mode cache (since service startup)",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.filesFlushedTotal = prometheus.NewDesc(
|
c.w3SVCW3WPFilesFlushedTotal = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_items_flushed_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_file_cache_items_flushed_total"),
|
||||||
"Total number of file handles that have been removed from the user-mode cache (since service startup)",
|
"Total number of file handles that have been removed from the user-mode cache (since service startup)",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.uriCacheFlushesTotal = prometheus.NewDesc(
|
c.w3SVCW3WPURICacheFlushesTotal = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_uri_cache_flushes_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_uri_cache_flushes_total"),
|
||||||
"Total number of URI cache flushes (since service startup)",
|
"Total number of URI cache flushes (since service startup)",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.uriCacheQueriesTotal = prometheus.NewDesc(
|
c.w3SVCW3WPURICacheQueriesTotal = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_uri_cache_queries_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_uri_cache_queries_total"),
|
||||||
"Total number of uri cache queries (hits + misses)",
|
"Total number of uri cache queries (hits + misses)",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.uriCacheHitsTotal = prometheus.NewDesc(
|
c.w3SVCW3WPURICacheHitsTotal = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_uri_cache_hits_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_uri_cache_hits_total"),
|
||||||
"Total number of successful lookups in the user-mode URI cache (since service startup)",
|
"Total number of successful lookups in the user-mode URI cache (since service startup)",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.urisCached = prometheus.NewDesc(
|
c.w3SVCW3WPURIsCached = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_uri_cache_items"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_uri_cache_items"),
|
||||||
"Number of URI information blocks currently in the user-mode cache",
|
"Number of URI information blocks currently in the user-mode cache",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.urisCachedTotal = prometheus.NewDesc(
|
c.w3SVCW3WPURIsCachedTotal = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_uri_cache_items_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_uri_cache_items_total"),
|
||||||
"Total number of URI information blocks added to the user-mode cache (since service startup)",
|
"Total number of URI information blocks added to the user-mode cache (since service startup)",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.urisFlushedTotal = prometheus.NewDesc(
|
c.w3SVCW3WPURIsFlushedTotal = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_uri_cache_items_flushed_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_uri_cache_items_flushed_total"),
|
||||||
"The number of URI information blocks that have been removed from the user-mode cache (since service startup)",
|
"The number of URI information blocks that have been removed from the user-mode cache (since service startup)",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.metadataCached = prometheus.NewDesc(
|
c.w3SVCW3WPMetadataCached = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_metadata_cache_items"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_metadata_cache_items"),
|
||||||
"Number of metadata information blocks currently present in user-mode cache",
|
"Number of metadata information blocks currently present in user-mode cache",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.metadataCacheFlushes = prometheus.NewDesc(
|
c.w3SVCW3WPMetadataCacheFlushes = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_metadata_cache_flushes_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_metadata_cache_flushes_total"),
|
||||||
"Total number of user-mode metadata cache flushes (since service startup)",
|
"Total number of user-mode metadata cache flushes (since service startup)",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.metadataCacheQueriesTotal = prometheus.NewDesc(
|
c.w3SVCW3WPMetadataCacheQueriesTotal = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_metadata_cache_queries_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_metadata_cache_queries_total"),
|
||||||
"Total metadata cache queries (hits + misses)",
|
"Total metadata cache queries (hits + misses)",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.metadataCacheHitsTotal = prometheus.NewDesc(
|
c.w3SVCW3WPMetadataCacheHitsTotal = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_metadata_cache_hits_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_metadata_cache_hits_total"),
|
||||||
"Total number of successful lookups in the user-mode metadata cache (since service startup)",
|
"Total number of successful lookups in the user-mode metadata cache (since service startup)",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.metadataCachedTotal = prometheus.NewDesc(
|
c.w3SVCW3WPMetadataCachedTotal = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_metadata_cache_items_cached_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_metadata_cache_items_cached_total"),
|
||||||
"Total number of metadata information blocks added to the user-mode cache (since service startup)",
|
"Total number of metadata information blocks added to the user-mode cache (since service startup)",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.metadataFlushedTotal = prometheus.NewDesc(
|
c.w3SVCW3WPMetadataFlushedTotal = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_metadata_cache_items_flushed_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_metadata_cache_items_flushed_total"),
|
||||||
"Total number of metadata information blocks removed from the user-mode cache (since service startup)",
|
"Total number of metadata information blocks removed from the user-mode cache (since service startup)",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.outputCacheActiveFlushedItems = prometheus.NewDesc(
|
c.w3SVCW3WPOutputCacheActiveFlushedItems = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_output_cache_active_flushed_items"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_output_cache_active_flushed_items"),
|
||||||
"",
|
"",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.outputCacheItems = prometheus.NewDesc(
|
c.w3SVCW3WPOutputCacheItems = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_output_cache_items"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_output_cache_items"),
|
||||||
"Number of items current present in output cache",
|
"Number of items current present in output cache",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.outputCacheMemoryUsage = prometheus.NewDesc(
|
c.w3SVCW3WPOutputCacheMemoryUsage = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_output_cache_memory_bytes"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_output_cache_memory_bytes"),
|
||||||
"Current number of bytes used by output cache",
|
"Current number of bytes used by output cache",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.outputCacheQueriesTotal = prometheus.NewDesc(
|
c.w3SVCW3WPOutputCacheQueriesTotal = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_output_queries_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_output_queries_total"),
|
||||||
"Total number of output cache queries (hits + misses)",
|
"Total number of output cache queries (hits + misses)",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.outputCacheHitsTotal = prometheus.NewDesc(
|
c.w3SVCW3WPOutputCacheHitsTotal = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_output_cache_hits_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_output_cache_hits_total"),
|
||||||
"Total number of successful lookups in output cache (since service startup)",
|
"Total number of successful lookups in output cache (since service startup)",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.outputCacheFlushedItemsTotal = prometheus.NewDesc(
|
c.w3SVCW3WPOutputCacheFlushedItemsTotal = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_output_cache_items_flushed_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_output_cache_items_flushed_total"),
|
||||||
"Total number of items flushed from output cache (since service startup)",
|
"Total number of items flushed from output cache (since service startup)",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.outputCacheFlushesTotal = prometheus.NewDesc(
|
c.w3SVCW3WPOutputCacheFlushesTotal = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_output_cache_flushes_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_output_cache_flushes_total"),
|
||||||
"Total number of flushes of output cache (since service startup)",
|
"Total number of flushes of output cache (since service startup)",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
// W3SVC_W3WP_IIS8
|
// W3SVC_W3WP_IIS8
|
||||||
c.requestErrorsTotal = prometheus.NewDesc(
|
c.w3SVCW3WPRequestErrorsTotal = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_request_errors_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_request_errors_total"),
|
||||||
"Total number of requests that returned an error",
|
"Total number of requests that returned an error",
|
||||||
[]string{"app", "pid", "status_code"},
|
[]string{"app", "pid", "status_code"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.webSocketRequestsActive = prometheus.NewDesc(
|
c.w3SVCW3WPWebSocketRequestsActive = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_current_websocket_requests"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_current_websocket_requests"),
|
||||||
"",
|
"",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.webSocketConnectionAttempts = prometheus.NewDesc(
|
c.w3SVCW3WPWebSocketConnectionAttempts = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_websocket_connection_attempts_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_websocket_connection_attempts_total"),
|
||||||
"",
|
"",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.webSocketConnectionsAccepted = prometheus.NewDesc(
|
c.w3SVCW3WPWebSocketConnectionsAccepted = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_websocket_connection_accepted_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_websocket_connection_accepted_total"),
|
||||||
"",
|
"",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.webSocketConnectionsRejected = prometheus.NewDesc(
|
c.w3SVCW3WPWebSocketConnectionsRejected = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "worker_websocket_connection_rejected_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "worker_websocket_connection_rejected_total"),
|
||||||
"",
|
"",
|
||||||
[]string{"app", "pid"},
|
[]string{"app", "pid"},
|
||||||
@@ -416,7 +415,7 @@ func (c *Collector) buildW3SVCW3WP() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Collector) collectW3SVCW3WP(ch chan<- prometheus.Metric) error {
|
func (c *Collector) collectW3SVCW3WP(ch chan<- prometheus.Metric) error {
|
||||||
perfData, err := c.perfDataCollectorW3SVCW3WP.Collect()
|
perfData, err := c.w3SVCW3WPPerfDataCollector.Collect()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to collect APP_POOL_WAS metrics: %w", err)
|
return fmt.Errorf("failed to collect APP_POOL_WAS metrics: %w", err)
|
||||||
}
|
}
|
||||||
@@ -432,8 +431,7 @@ func (c *Collector) collectW3SVCW3WP(ch chan<- prometheus.Metric) error {
|
|||||||
pid := workerProcessNameExtractor.ReplaceAllString(name, "$1")
|
pid := workerProcessNameExtractor.ReplaceAllString(name, "$1")
|
||||||
|
|
||||||
name := workerProcessNameExtractor.ReplaceAllString(name, "$2")
|
name := workerProcessNameExtractor.ReplaceAllString(name, "$2")
|
||||||
if name == "" || name == "_Total" ||
|
if name == "" || c.config.AppExclude.MatchString(name) ||
|
||||||
c.config.AppExclude.MatchString(name) ||
|
|
||||||
!c.config.AppInclude.MatchString(name) {
|
!c.config.AppInclude.MatchString(name) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -444,297 +442,289 @@ func (c *Collector) collectW3SVCW3WP(ch chan<- prometheus.Metric) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.threads,
|
c.w3SVCW3WPThreads,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
app[Threads].FirstValue,
|
app[w3SVCW3WPThreads].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
"busy",
|
"busy",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.maximumThreads,
|
c.w3SVCW3WPMaximumThreads,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[MaximumThreads].FirstValue,
|
app[w3SVCW3WPMaximumThreads].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.requestsTotal,
|
c.w3SVCW3WPRequestsTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[RequestsTotal].FirstValue,
|
app[w3SVCW3WPRequestsTotal].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.requestsActive,
|
c.w3SVCW3WPRequestsActive,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[RequestsActive].FirstValue,
|
app[w3SVCW3WPRequestsActive].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.activeFlushedEntries,
|
c.w3SVCW3WPActiveFlushedEntries,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
app[ActiveFlushedEntries].FirstValue,
|
app[w3SVCW3WPActiveFlushedEntries].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.currentFileCacheMemoryUsage,
|
c.w3SVCW3WPCurrentFileCacheMemoryUsage,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
app[CurrentFileCacheMemoryUsage].FirstValue,
|
app[w3SVCW3WPCurrentFileCacheMemoryUsage].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.maximumFileCacheMemoryUsage,
|
c.w3SVCW3WPMaximumFileCacheMemoryUsage,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[MaximumFileCacheMemoryUsage].FirstValue,
|
app[w3SVCW3WPMaximumFileCacheMemoryUsage].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.fileCacheFlushesTotal,
|
c.w3SVCW3WPFileCacheFlushesTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[FileCacheFlushesTotal].FirstValue,
|
app[w3SVCW3WPFileCacheFlushesTotal].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.fileCacheQueriesTotal,
|
c.w3SVCW3WPFileCacheQueriesTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[FileCacheHitsTotal].FirstValue+app[FileCacheMissesTotal].FirstValue,
|
app[w3SVCW3WPFileCacheHitsTotal].FirstValue+app[w3SVCW3WPFileCacheMissesTotal].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.fileCacheHitsTotal,
|
c.w3SVCW3WPFileCacheHitsTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[FileCacheHitsTotal].FirstValue,
|
app[w3SVCW3WPFileCacheHitsTotal].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.filesCached,
|
c.w3SVCW3WPFilesCached,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
app[FilesCached].FirstValue,
|
app[w3SVCW3WPFilesCached].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.filesCachedTotal,
|
c.w3SVCW3WPFilesCachedTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[FilesCachedTotal].FirstValue,
|
app[w3SVCW3WPFilesCachedTotal].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.filesFlushedTotal,
|
c.w3SVCW3WPFilesFlushedTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[FilesFlushedTotal].FirstValue,
|
app[w3SVCW3WPFilesFlushedTotal].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.uriCacheFlushesTotal,
|
c.w3SVCW3WPURICacheFlushesTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[URICacheFlushesTotal].FirstValue,
|
app[w3SVCW3WPURICacheFlushesTotal].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.uriCacheQueriesTotal,
|
c.w3SVCW3WPURICacheQueriesTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[URICacheHitsTotal].FirstValue+app[URICacheMissesTotal].FirstValue,
|
app[w3SVCW3WPURICacheHitsTotal].FirstValue+app[w3SVCW3WPURICacheMissesTotal].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.uriCacheHitsTotal,
|
c.w3SVCW3WPURICacheHitsTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[URICacheHitsTotal].FirstValue,
|
app[w3SVCW3WPURICacheHitsTotal].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.urisCached,
|
c.w3SVCW3WPURIsCached,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
app[URIsCached].FirstValue,
|
app[w3SVCW3WPURIsCached].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.urisCachedTotal,
|
c.w3SVCW3WPURIsCachedTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[URIsCachedTotal].FirstValue,
|
app[w3SVCW3WPURIsCachedTotal].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.urisFlushedTotal,
|
c.w3SVCW3WPURIsFlushedTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[URIsFlushedTotal].FirstValue,
|
app[w3SVCW3WPURIsFlushedTotal].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.metadataCached,
|
c.w3SVCW3WPMetadataCached,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
app[MetadataCached].FirstValue,
|
app[w3SVCW3WPMetadataCached].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.metadataCacheFlushes,
|
c.w3SVCW3WPMetadataCacheFlushes,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[MetadataCacheFlushes].FirstValue,
|
app[w3SVCW3WPMetadataCacheFlushes].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.metadataCacheQueriesTotal,
|
c.w3SVCW3WPMetadataCacheQueriesTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[MetaDataCacheHits].FirstValue+app[MetaDataCacheMisses].FirstValue,
|
app[w3SVCW3WPMetaDataCacheHits].FirstValue+app[w3SVCW3WPMetaDataCacheMisses].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.metadataCacheHitsTotal,
|
c.w3SVCW3WPMetadataCacheHitsTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[MetaDataCacheHits].FirstValue,
|
app[w3SVCW3WPMetaDataCacheHits].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.metadataCachedTotal,
|
c.w3SVCW3WPMetadataCachedTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[MetadataCachedTotal].FirstValue,
|
app[w3SVCW3WPMetadataCachedTotal].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.metadataFlushedTotal,
|
c.w3SVCW3WPMetadataFlushedTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[MetadataFlushedTotal].FirstValue,
|
app[w3SVCW3WPMetadataFlushedTotal].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.outputCacheActiveFlushedItems,
|
c.w3SVCW3WPOutputCacheActiveFlushedItems,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[OutputCacheActiveFlushedItems].FirstValue,
|
app[w3SVCW3WPOutputCacheActiveFlushedItems].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.outputCacheItems,
|
c.w3SVCW3WPOutputCacheItems,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[OutputCacheItems].FirstValue,
|
app[w3SVCW3WPOutputCacheItems].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.outputCacheMemoryUsage,
|
c.w3SVCW3WPOutputCacheMemoryUsage,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[OutputCacheMemoryUsage].FirstValue,
|
app[w3SVCW3WPOutputCacheMemoryUsage].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.outputCacheQueriesTotal,
|
c.w3SVCW3WPOutputCacheQueriesTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[OutputCacheHitsTotal].FirstValue+app[OutputCacheMissesTotal].FirstValue,
|
app[w3SVCW3WPOutputCacheHitsTotal].FirstValue+app[w3SVCW3WPOutputCacheMissesTotal].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.outputCacheHitsTotal,
|
c.w3SVCW3WPOutputCacheHitsTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[OutputCacheHitsTotal].FirstValue,
|
app[w3SVCW3WPOutputCacheHitsTotal].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.outputCacheFlushedItemsTotal,
|
c.w3SVCW3WPOutputCacheFlushedItemsTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[OutputCacheFlushedItemsTotal].FirstValue,
|
app[w3SVCW3WPOutputCacheFlushedItemsTotal].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.outputCacheFlushesTotal,
|
c.w3SVCW3WPOutputCacheFlushesTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[OutputCacheFlushesTotal].FirstValue,
|
app[w3SVCW3WPOutputCacheFlushesTotal].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
|
|
||||||
if c.iisVersion.major >= 8 {
|
if c.iisVersion.major >= 8 {
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.requestErrorsTotal,
|
c.w3SVCW3WPRequestErrorsTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[RequestErrors401].FirstValue,
|
app[w3SVCW3WPRequestErrors401].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
"401",
|
"401",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.requestErrorsTotal,
|
c.w3SVCW3WPRequestErrorsTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[RequestErrors403].FirstValue,
|
app[w3SVCW3WPRequestErrors403].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
"403",
|
"403",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.requestErrorsTotal,
|
c.w3SVCW3WPRequestErrorsTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[RequestErrors404].FirstValue,
|
app[w3SVCW3WPRequestErrors404].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
"404",
|
"404",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.requestErrorsTotal,
|
c.w3SVCW3WPRequestErrorsTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[RequestErrors500].FirstValue,
|
app[w3SVCW3WPRequestErrors500].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
"500",
|
"500",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.requestErrorsTotal,
|
c.w3SVCW3WPWebSocketRequestsActive,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[RequestErrors503].FirstValue,
|
app[w3SVCW3WPWebSocketRequestsActive].FirstValue,
|
||||||
name,
|
|
||||||
pid,
|
|
||||||
"503",
|
|
||||||
)
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
|
||||||
c.webSocketRequestsActive,
|
|
||||||
prometheus.CounterValue,
|
|
||||||
app[WebSocketRequestsActive].FirstValue,
|
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.webSocketConnectionAttempts,
|
c.w3SVCW3WPWebSocketConnectionAttempts,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[WebSocketConnectionAttempts].FirstValue,
|
app[w3SVCW3WPWebSocketConnectionAttempts].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.webSocketConnectionsAccepted,
|
c.w3SVCW3WPWebSocketConnectionsAccepted,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[WebSocketConnectionsAccepted].FirstValue,
|
app[w3SVCW3WPWebSocketConnectionsAccepted].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.webSocketConnectionsRejected,
|
c.w3SVCW3WPWebSocketConnectionsRejected,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[WebSocketConnectionsRejected].FirstValue,
|
app[w3SVCW3WPWebSocketConnectionsRejected].FirstValue,
|
||||||
name,
|
name,
|
||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package iis
|
package iis
|
||||||
@@ -13,243 +26,243 @@ import (
|
|||||||
type collectorWebService struct {
|
type collectorWebService struct {
|
||||||
perfDataCollectorWebService *perfdata.Collector
|
perfDataCollectorWebService *perfdata.Collector
|
||||||
|
|
||||||
currentAnonymousUsers *prometheus.Desc
|
webServiceCurrentAnonymousUsers *prometheus.Desc
|
||||||
currentBlockedAsyncIORequests *prometheus.Desc
|
webServiceCurrentBlockedAsyncIORequests *prometheus.Desc
|
||||||
currentCGIRequests *prometheus.Desc
|
webServiceCurrentCGIRequests *prometheus.Desc
|
||||||
currentConnections *prometheus.Desc
|
webServiceCurrentConnections *prometheus.Desc
|
||||||
currentISAPIExtensionRequests *prometheus.Desc
|
webServiceCurrentISAPIExtensionRequests *prometheus.Desc
|
||||||
currentNonAnonymousUsers *prometheus.Desc
|
webServiceCurrentNonAnonymousUsers *prometheus.Desc
|
||||||
serviceUptime *prometheus.Desc
|
webServiceServiceUptime *prometheus.Desc
|
||||||
totalBytesReceived *prometheus.Desc
|
webServiceTotalBytesReceived *prometheus.Desc
|
||||||
totalBytesSent *prometheus.Desc
|
webServiceTotalBytesSent *prometheus.Desc
|
||||||
totalAnonymousUsers *prometheus.Desc
|
webServiceTotalAnonymousUsers *prometheus.Desc
|
||||||
totalBlockedAsyncIORequests *prometheus.Desc
|
webServiceTotalBlockedAsyncIORequests *prometheus.Desc
|
||||||
totalCGIRequests *prometheus.Desc
|
webServiceTotalCGIRequests *prometheus.Desc
|
||||||
totalConnectionAttemptsAllInstances *prometheus.Desc
|
webServiceTotalConnectionAttemptsAllInstances *prometheus.Desc
|
||||||
totalRequests *prometheus.Desc
|
webServiceTotalRequests *prometheus.Desc
|
||||||
totalFilesReceived *prometheus.Desc
|
webServiceTotalFilesReceived *prometheus.Desc
|
||||||
totalFilesSent *prometheus.Desc
|
webServiceTotalFilesSent *prometheus.Desc
|
||||||
totalISAPIExtensionRequests *prometheus.Desc
|
webServiceTotalISAPIExtensionRequests *prometheus.Desc
|
||||||
totalLockedErrors *prometheus.Desc
|
webServiceTotalLockedErrors *prometheus.Desc
|
||||||
totalLogonAttempts *prometheus.Desc
|
webServiceTotalLogonAttempts *prometheus.Desc
|
||||||
totalNonAnonymousUsers *prometheus.Desc
|
webServiceTotalNonAnonymousUsers *prometheus.Desc
|
||||||
totalNotFoundErrors *prometheus.Desc
|
webServiceTotalNotFoundErrors *prometheus.Desc
|
||||||
totalRejectedAsyncIORequests *prometheus.Desc
|
webServiceTotalRejectedAsyncIORequests *prometheus.Desc
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
CurrentAnonymousUsers = "Current Anonymous Users"
|
webServiceCurrentAnonymousUsers = "Current Anonymous Users"
|
||||||
CurrentBlockedAsyncIORequests = "Current Blocked Async I/O Requests"
|
webServiceCurrentBlockedAsyncIORequests = "Current Blocked Async I/O Requests"
|
||||||
CurrentCGIRequests = "Current CGI Requests"
|
webServiceCurrentCGIRequests = "Current CGI Requests"
|
||||||
CurrentConnections = "Current Connections"
|
webServiceCurrentConnections = "Current Connections"
|
||||||
CurrentISAPIExtensionRequests = "Current ISAPI Extension Requests"
|
webServiceCurrentISAPIExtensionRequests = "Current ISAPI Extension Requests"
|
||||||
CurrentNonAnonymousUsers = "Current NonAnonymous Users"
|
webServiceCurrentNonAnonymousUsers = "Current NonAnonymous Users"
|
||||||
ServiceUptime = "Service Uptime"
|
webServiceServiceUptime = "Service Uptime"
|
||||||
TotalBytesReceived = "Total Bytes Received"
|
webServiceTotalBytesReceived = "Total Bytes Received"
|
||||||
TotalBytesSent = "Total Bytes Sent"
|
webServiceTotalBytesSent = "Total Bytes Sent"
|
||||||
TotalAnonymousUsers = "Total Anonymous Users"
|
webServiceTotalAnonymousUsers = "Total Anonymous Users"
|
||||||
TotalBlockedAsyncIORequests = "Total Blocked Async I/O Requests"
|
webServiceTotalBlockedAsyncIORequests = "Total Blocked Async I/O Requests"
|
||||||
TotalCGIRequests = "Total CGI Requests"
|
webServiceTotalCGIRequests = "Total CGI Requests"
|
||||||
TotalConnectionAttemptsAllInstances = "Total Connection Attempts (all instances)"
|
webServiceTotalConnectionAttemptsAllInstances = "Total Connection Attempts (all instances)"
|
||||||
TotalFilesReceived = "Total Files Received"
|
webServiceTotalFilesReceived = "Total Files Received"
|
||||||
TotalFilesSent = "Total Files Sent"
|
webServiceTotalFilesSent = "Total Files Sent"
|
||||||
TotalISAPIExtensionRequests = "Total ISAPI Extension Requests"
|
webServiceTotalISAPIExtensionRequests = "Total ISAPI Extension Requests"
|
||||||
TotalLockedErrors = "Total Locked Errors"
|
webServiceTotalLockedErrors = "Total Locked Errors"
|
||||||
TotalLogonAttempts = "Total Logon Attempts"
|
webServiceTotalLogonAttempts = "Total Logon Attempts"
|
||||||
TotalNonAnonymousUsers = "Total NonAnonymous Users"
|
webServiceTotalNonAnonymousUsers = "Total NonAnonymous Users"
|
||||||
TotalNotFoundErrors = "Total Not Found Errors"
|
webServiceTotalNotFoundErrors = "Total Not Found Errors"
|
||||||
TotalRejectedAsyncIORequests = "Total Rejected Async I/O Requests"
|
webServiceTotalRejectedAsyncIORequests = "Total Rejected Async I/O Requests"
|
||||||
TotalCopyRequests = "Total Copy Requests"
|
webServiceTotalCopyRequests = "Total Copy Requests"
|
||||||
TotalDeleteRequests = "Total Delete Requests"
|
webServiceTotalDeleteRequests = "Total Delete Requests"
|
||||||
TotalGetRequests = "Total Get Requests"
|
webServiceTotalGetRequests = "Total Get Requests"
|
||||||
TotalHeadRequests = "Total Head Requests"
|
webServiceTotalHeadRequests = "Total Head Requests"
|
||||||
TotalLockRequests = "Total Lock Requests"
|
webServiceTotalLockRequests = "Total Lock Requests"
|
||||||
TotalMkcolRequests = "Total Mkcol Requests"
|
webServiceTotalMkcolRequests = "Total Mkcol Requests"
|
||||||
TotalMoveRequests = "Total Move Requests"
|
webServiceTotalMoveRequests = "Total Move Requests"
|
||||||
TotalOptionsRequests = "Total Options Requests"
|
webServiceTotalOptionsRequests = "Total Options Requests"
|
||||||
TotalOtherRequests = "Total Other Request Methods"
|
webServiceTotalOtherRequests = "Total Other Request Methods"
|
||||||
TotalPostRequests = "Total Post Requests"
|
webServiceTotalPostRequests = "Total Post Requests"
|
||||||
TotalPropfindRequests = "Total Propfind Requests"
|
webServiceTotalPropfindRequests = "Total Propfind Requests"
|
||||||
TotalProppatchRequests = "Total Proppatch Requests"
|
webServiceTotalProppatchRequests = "Total Proppatch Requests"
|
||||||
TotalPutRequests = "Total Put Requests"
|
webServiceTotalPutRequests = "Total Put Requests"
|
||||||
TotalSearchRequests = "Total Search Requests"
|
webServiceTotalSearchRequests = "Total Search Requests"
|
||||||
TotalTraceRequests = "Total Trace Requests"
|
webServiceTotalTraceRequests = "Total Trace Requests"
|
||||||
TotalUnlockRequests = "Total Unlock Requests"
|
webServiceTotalUnlockRequests = "Total Unlock Requests"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (c *Collector) buildWebService() error {
|
func (c *Collector) buildWebService() error {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollectorWebService, err = perfdata.NewCollector("Web Service", perfdata.InstanceAll, []string{
|
c.perfDataCollectorWebService, err = perfdata.NewCollector("Web Service", perfdata.InstancesAll, []string{
|
||||||
CurrentAnonymousUsers,
|
webServiceCurrentAnonymousUsers,
|
||||||
CurrentBlockedAsyncIORequests,
|
webServiceCurrentBlockedAsyncIORequests,
|
||||||
CurrentCGIRequests,
|
webServiceCurrentCGIRequests,
|
||||||
CurrentConnections,
|
webServiceCurrentConnections,
|
||||||
CurrentISAPIExtensionRequests,
|
webServiceCurrentISAPIExtensionRequests,
|
||||||
CurrentNonAnonymousUsers,
|
webServiceCurrentNonAnonymousUsers,
|
||||||
ServiceUptime,
|
webServiceServiceUptime,
|
||||||
TotalBytesReceived,
|
webServiceTotalBytesReceived,
|
||||||
TotalBytesSent,
|
webServiceTotalBytesSent,
|
||||||
TotalAnonymousUsers,
|
webServiceTotalAnonymousUsers,
|
||||||
TotalBlockedAsyncIORequests,
|
webServiceTotalBlockedAsyncIORequests,
|
||||||
TotalCGIRequests,
|
webServiceTotalCGIRequests,
|
||||||
TotalConnectionAttemptsAllInstances,
|
webServiceTotalConnectionAttemptsAllInstances,
|
||||||
TotalFilesReceived,
|
webServiceTotalFilesReceived,
|
||||||
TotalFilesSent,
|
webServiceTotalFilesSent,
|
||||||
TotalISAPIExtensionRequests,
|
webServiceTotalISAPIExtensionRequests,
|
||||||
TotalLockedErrors,
|
webServiceTotalLockedErrors,
|
||||||
TotalLogonAttempts,
|
webServiceTotalLogonAttempts,
|
||||||
TotalNonAnonymousUsers,
|
webServiceTotalNonAnonymousUsers,
|
||||||
TotalNotFoundErrors,
|
webServiceTotalNotFoundErrors,
|
||||||
TotalRejectedAsyncIORequests,
|
webServiceTotalRejectedAsyncIORequests,
|
||||||
TotalCopyRequests,
|
webServiceTotalCopyRequests,
|
||||||
TotalDeleteRequests,
|
webServiceTotalDeleteRequests,
|
||||||
TotalGetRequests,
|
webServiceTotalGetRequests,
|
||||||
TotalHeadRequests,
|
webServiceTotalHeadRequests,
|
||||||
TotalLockRequests,
|
webServiceTotalLockRequests,
|
||||||
TotalMkcolRequests,
|
webServiceTotalMkcolRequests,
|
||||||
TotalMoveRequests,
|
webServiceTotalMoveRequests,
|
||||||
TotalOptionsRequests,
|
webServiceTotalOptionsRequests,
|
||||||
TotalOtherRequests,
|
webServiceTotalOtherRequests,
|
||||||
TotalPostRequests,
|
webServiceTotalPostRequests,
|
||||||
TotalPropfindRequests,
|
webServiceTotalPropfindRequests,
|
||||||
TotalProppatchRequests,
|
webServiceTotalProppatchRequests,
|
||||||
TotalPutRequests,
|
webServiceTotalPutRequests,
|
||||||
TotalSearchRequests,
|
webServiceTotalSearchRequests,
|
||||||
TotalTraceRequests,
|
webServiceTotalTraceRequests,
|
||||||
TotalUnlockRequests,
|
webServiceTotalUnlockRequests,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create Web Service collector: %w", err)
|
return fmt.Errorf("failed to create Web Service collector: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
c.currentAnonymousUsers = prometheus.NewDesc(
|
c.webServiceCurrentAnonymousUsers = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "current_anonymous_users"),
|
prometheus.BuildFQName(types.Namespace, Name, "current_anonymous_users"),
|
||||||
"Number of users who currently have an anonymous connection using the Web service (WebService.CurrentAnonymousUsers)",
|
"Number of users who currently have an anonymous connection using the Web service (WebService.CurrentAnonymousUsers)",
|
||||||
[]string{"site"},
|
[]string{"site"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.currentBlockedAsyncIORequests = prometheus.NewDesc(
|
c.webServiceCurrentBlockedAsyncIORequests = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "current_blocked_async_io_requests"),
|
prometheus.BuildFQName(types.Namespace, Name, "current_blocked_async_io_requests"),
|
||||||
"Current requests temporarily blocked due to bandwidth throttling settings (WebService.CurrentBlockedAsyncIORequests)",
|
"Current requests temporarily blocked due to bandwidth throttling settings (WebService.CurrentBlockedAsyncIORequests)",
|
||||||
[]string{"site"},
|
[]string{"site"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.currentCGIRequests = prometheus.NewDesc(
|
c.webServiceCurrentCGIRequests = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "current_cgi_requests"),
|
prometheus.BuildFQName(types.Namespace, Name, "current_cgi_requests"),
|
||||||
"Current number of CGI requests being simultaneously processed by the Web service (WebService.CurrentCGIRequests)",
|
"Current number of CGI requests being simultaneously processed by the Web service (WebService.CurrentCGIRequests)",
|
||||||
[]string{"site"},
|
[]string{"site"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.currentConnections = prometheus.NewDesc(
|
c.webServiceCurrentConnections = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "current_connections"),
|
prometheus.BuildFQName(types.Namespace, Name, "current_connections"),
|
||||||
"Current number of connections established with the Web service (WebService.CurrentConnections)",
|
"Current number of connections established with the Web service (WebService.CurrentConnections)",
|
||||||
[]string{"site"},
|
[]string{"site"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.currentISAPIExtensionRequests = prometheus.NewDesc(
|
c.webServiceCurrentISAPIExtensionRequests = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "current_isapi_extension_requests"),
|
prometheus.BuildFQName(types.Namespace, Name, "current_isapi_extension_requests"),
|
||||||
"Current number of ISAPI requests being simultaneously processed by the Web service (WebService.CurrentISAPIExtensionRequests)",
|
"Current number of ISAPI requests being simultaneously processed by the Web service (WebService.CurrentISAPIExtensionRequests)",
|
||||||
[]string{"site"},
|
[]string{"site"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.currentNonAnonymousUsers = prometheus.NewDesc(
|
c.webServiceCurrentNonAnonymousUsers = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "current_non_anonymous_users"),
|
prometheus.BuildFQName(types.Namespace, Name, "current_non_anonymous_users"),
|
||||||
"Number of users who currently have a non-anonymous connection using the Web service (WebService.CurrentNonAnonymousUsers)",
|
"Number of users who currently have a non-anonymous connection using the Web service (WebService.CurrentNonAnonymousUsers)",
|
||||||
[]string{"site"},
|
[]string{"site"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.serviceUptime = prometheus.NewDesc(
|
c.webServiceServiceUptime = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "service_uptime"),
|
prometheus.BuildFQName(types.Namespace, Name, "service_uptime"),
|
||||||
"Number of seconds the WebService is up (WebService.ServiceUptime)",
|
"Number of seconds the WebService is up (WebService.ServiceUptime)",
|
||||||
[]string{"site"},
|
[]string{"site"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.totalBytesReceived = prometheus.NewDesc(
|
c.webServiceTotalBytesReceived = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "received_bytes_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "received_bytes_total"),
|
||||||
"Number of data bytes that have been received by the Web service (WebService.TotalBytesReceived)",
|
"Number of data bytes that have been received by the Web service (WebService.TotalBytesReceived)",
|
||||||
[]string{"site"},
|
[]string{"site"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.totalBytesSent = prometheus.NewDesc(
|
c.webServiceTotalBytesSent = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "sent_bytes_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "sent_bytes_total"),
|
||||||
"Number of data bytes that have been sent by the Web service (WebService.TotalBytesSent)",
|
"Number of data bytes that have been sent by the Web service (WebService.TotalBytesSent)",
|
||||||
[]string{"site"},
|
[]string{"site"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.totalAnonymousUsers = prometheus.NewDesc(
|
c.webServiceTotalAnonymousUsers = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "anonymous_users_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "anonymous_users_total"),
|
||||||
"Total number of users who established an anonymous connection with the Web service (WebService.TotalAnonymousUsers)",
|
"Total number of users who established an anonymous connection with the Web service (WebService.TotalAnonymousUsers)",
|
||||||
[]string{"site"},
|
[]string{"site"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.totalBlockedAsyncIORequests = prometheus.NewDesc(
|
c.webServiceTotalBlockedAsyncIORequests = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "blocked_async_io_requests_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "blocked_async_io_requests_total"),
|
||||||
"Total requests temporarily blocked due to bandwidth throttling settings (WebService.TotalBlockedAsyncIORequests)",
|
"Total requests temporarily blocked due to bandwidth throttling settings (WebService.TotalBlockedAsyncIORequests)",
|
||||||
[]string{"site"},
|
[]string{"site"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.totalCGIRequests = prometheus.NewDesc(
|
c.webServiceTotalCGIRequests = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "cgi_requests_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "cgi_requests_total"),
|
||||||
"Total CGI requests is the total number of CGI requests (WebService.TotalCGIRequests)",
|
"Total CGI requests is the total number of CGI requests (WebService.TotalCGIRequests)",
|
||||||
[]string{"site"},
|
[]string{"site"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.totalConnectionAttemptsAllInstances = prometheus.NewDesc(
|
c.webServiceTotalConnectionAttemptsAllInstances = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "connection_attempts_all_instances_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "connection_attempts_all_instances_total"),
|
||||||
"Number of connections that have been attempted using the Web service (WebService.TotalConnectionAttemptsAllInstances)",
|
"Number of connections that have been attempted using the Web service (WebService.TotalConnectionAttemptsAllInstances)",
|
||||||
[]string{"site"},
|
[]string{"site"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.totalRequests = prometheus.NewDesc(
|
c.webServiceTotalRequests = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "requests_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "requests_total"),
|
||||||
"Number of HTTP requests (WebService.TotalRequests)",
|
"Number of HTTP requests (WebService.TotalRequests)",
|
||||||
[]string{"site", "method"},
|
[]string{"site", "method"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.totalFilesReceived = prometheus.NewDesc(
|
c.webServiceTotalFilesReceived = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "files_received_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "files_received_total"),
|
||||||
"Number of files received by the Web service (WebService.TotalFilesReceived)",
|
"Number of files received by the Web service (WebService.TotalFilesReceived)",
|
||||||
[]string{"site"},
|
[]string{"site"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.totalFilesSent = prometheus.NewDesc(
|
c.webServiceTotalFilesSent = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "files_sent_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "files_sent_total"),
|
||||||
"Number of files sent by the Web service (WebService.TotalFilesSent)",
|
"Number of files sent by the Web service (WebService.TotalFilesSent)",
|
||||||
[]string{"site"},
|
[]string{"site"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.totalISAPIExtensionRequests = prometheus.NewDesc(
|
c.webServiceTotalISAPIExtensionRequests = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "ipapi_extension_requests_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "ipapi_extension_requests_total"),
|
||||||
"ISAPI Extension Requests received (WebService.TotalISAPIExtensionRequests)",
|
"ISAPI Extension Requests received (WebService.TotalISAPIExtensionRequests)",
|
||||||
[]string{"site"},
|
[]string{"site"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.totalLockedErrors = prometheus.NewDesc(
|
c.webServiceTotalLockedErrors = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "locked_errors_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "locked_errors_total"),
|
||||||
"Number of requests that couldn't be satisfied by the server because the requested resource was locked (WebService.TotalLockedErrors)",
|
"Number of requests that couldn't be satisfied by the server because the requested resource was locked (WebService.TotalLockedErrors)",
|
||||||
[]string{"site"},
|
[]string{"site"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.totalLogonAttempts = prometheus.NewDesc(
|
c.webServiceTotalLogonAttempts = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "logon_attempts_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "logon_attempts_total"),
|
||||||
"Number of logons attempts to the Web Service (WebService.TotalLogonAttempts)",
|
"Number of logons attempts to the Web Service (WebService.TotalLogonAttempts)",
|
||||||
[]string{"site"},
|
[]string{"site"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.totalNonAnonymousUsers = prometheus.NewDesc(
|
c.webServiceTotalNonAnonymousUsers = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "non_anonymous_users_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "non_anonymous_users_total"),
|
||||||
"Number of users who established a non-anonymous connection with the Web service (WebService.TotalNonAnonymousUsers)",
|
"Number of users who established a non-anonymous connection with the Web service (WebService.TotalNonAnonymousUsers)",
|
||||||
[]string{"site"},
|
[]string{"site"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.totalNotFoundErrors = prometheus.NewDesc(
|
c.webServiceTotalNotFoundErrors = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "not_found_errors_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "not_found_errors_total"),
|
||||||
"Number of requests that couldn't be satisfied by the server because the requested document could not be found (WebService.TotalNotFoundErrors)",
|
"Number of requests that couldn't be satisfied by the server because the requested document could not be found (WebService.TotalNotFoundErrors)",
|
||||||
[]string{"site"},
|
[]string{"site"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
c.totalRejectedAsyncIORequests = prometheus.NewDesc(
|
c.webServiceTotalRejectedAsyncIORequests = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "rejected_async_io_requests_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "rejected_async_io_requests_total"),
|
||||||
"Requests rejected due to bandwidth throttling settings (WebService.TotalRejectedAsyncIORequests)",
|
"Requests rejected due to bandwidth throttling settings (WebService.TotalRejectedAsyncIORequests)",
|
||||||
[]string{"site"},
|
[]string{"site"},
|
||||||
@@ -273,240 +286,240 @@ func (c *Collector) collectWebService(ch chan<- prometheus.Metric) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.currentAnonymousUsers,
|
c.webServiceCurrentAnonymousUsers,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
app[CurrentAnonymousUsers].FirstValue,
|
app[webServiceCurrentAnonymousUsers].FirstValue,
|
||||||
name,
|
name,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.currentBlockedAsyncIORequests,
|
c.webServiceCurrentBlockedAsyncIORequests,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
app[CurrentBlockedAsyncIORequests].FirstValue,
|
app[webServiceCurrentBlockedAsyncIORequests].FirstValue,
|
||||||
name,
|
name,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.currentCGIRequests,
|
c.webServiceCurrentCGIRequests,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
app[CurrentCGIRequests].FirstValue,
|
app[webServiceCurrentCGIRequests].FirstValue,
|
||||||
name,
|
name,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.currentConnections,
|
c.webServiceCurrentConnections,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
app[CurrentConnections].FirstValue,
|
app[webServiceCurrentConnections].FirstValue,
|
||||||
name,
|
name,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.currentISAPIExtensionRequests,
|
c.webServiceCurrentISAPIExtensionRequests,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
app[CurrentISAPIExtensionRequests].FirstValue,
|
app[webServiceCurrentISAPIExtensionRequests].FirstValue,
|
||||||
name,
|
name,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.currentNonAnonymousUsers,
|
c.webServiceCurrentNonAnonymousUsers,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
app[CurrentNonAnonymousUsers].FirstValue,
|
app[webServiceCurrentNonAnonymousUsers].FirstValue,
|
||||||
name,
|
name,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceUptime,
|
c.webServiceServiceUptime,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
app[ServiceUptime].FirstValue,
|
app[webServiceServiceUptime].FirstValue,
|
||||||
name,
|
name,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.totalBytesReceived,
|
c.webServiceTotalBytesReceived,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[TotalBytesReceived].FirstValue,
|
app[webServiceTotalBytesReceived].FirstValue,
|
||||||
name,
|
name,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.totalBytesSent,
|
c.webServiceTotalBytesSent,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[TotalBytesSent].FirstValue,
|
app[webServiceTotalBytesSent].FirstValue,
|
||||||
name,
|
name,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.totalAnonymousUsers,
|
c.webServiceTotalAnonymousUsers,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[TotalAnonymousUsers].FirstValue,
|
app[webServiceTotalAnonymousUsers].FirstValue,
|
||||||
name,
|
name,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.totalBlockedAsyncIORequests,
|
c.webServiceTotalBlockedAsyncIORequests,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[TotalBlockedAsyncIORequests].FirstValue,
|
app[webServiceTotalBlockedAsyncIORequests].FirstValue,
|
||||||
name,
|
name,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.totalCGIRequests,
|
c.webServiceTotalCGIRequests,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[TotalCGIRequests].FirstValue,
|
app[webServiceTotalCGIRequests].FirstValue,
|
||||||
name,
|
name,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.totalConnectionAttemptsAllInstances,
|
c.webServiceTotalConnectionAttemptsAllInstances,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[TotalConnectionAttemptsAllInstances].FirstValue,
|
app[webServiceTotalConnectionAttemptsAllInstances].FirstValue,
|
||||||
name,
|
name,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.totalFilesReceived,
|
c.webServiceTotalFilesReceived,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[TotalFilesReceived].FirstValue,
|
app[webServiceTotalFilesReceived].FirstValue,
|
||||||
name,
|
name,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.totalFilesSent,
|
c.webServiceTotalFilesSent,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[TotalFilesSent].FirstValue,
|
app[webServiceTotalFilesSent].FirstValue,
|
||||||
name,
|
name,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.totalISAPIExtensionRequests,
|
c.webServiceTotalISAPIExtensionRequests,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[TotalISAPIExtensionRequests].FirstValue,
|
app[webServiceTotalISAPIExtensionRequests].FirstValue,
|
||||||
name,
|
name,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.totalLockedErrors,
|
c.webServiceTotalLockedErrors,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[TotalLockedErrors].FirstValue,
|
app[webServiceTotalLockedErrors].FirstValue,
|
||||||
name,
|
name,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.totalLogonAttempts,
|
c.webServiceTotalLogonAttempts,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[TotalLogonAttempts].FirstValue,
|
app[webServiceTotalLogonAttempts].FirstValue,
|
||||||
name,
|
name,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.totalNonAnonymousUsers,
|
c.webServiceTotalNonAnonymousUsers,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[TotalNonAnonymousUsers].FirstValue,
|
app[webServiceTotalNonAnonymousUsers].FirstValue,
|
||||||
name,
|
name,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.totalNotFoundErrors,
|
c.webServiceTotalNotFoundErrors,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[TotalNotFoundErrors].FirstValue,
|
app[webServiceTotalNotFoundErrors].FirstValue,
|
||||||
name,
|
name,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.totalRejectedAsyncIORequests,
|
c.webServiceTotalRejectedAsyncIORequests,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[TotalRejectedAsyncIORequests].FirstValue,
|
app[webServiceTotalRejectedAsyncIORequests].FirstValue,
|
||||||
name,
|
name,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.totalRequests,
|
c.webServiceTotalRequests,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[TotalOtherRequests].FirstValue,
|
app[webServiceTotalOtherRequests].FirstValue,
|
||||||
name,
|
name,
|
||||||
"other",
|
"other",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.totalRequests,
|
c.webServiceTotalRequests,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[TotalCopyRequests].FirstValue,
|
app[webServiceTotalCopyRequests].FirstValue,
|
||||||
name,
|
name,
|
||||||
"COPY",
|
"COPY",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.totalRequests,
|
c.webServiceTotalRequests,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[TotalDeleteRequests].FirstValue,
|
app[webServiceTotalDeleteRequests].FirstValue,
|
||||||
name,
|
name,
|
||||||
"DELETE",
|
"DELETE",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.totalRequests,
|
c.webServiceTotalRequests,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[TotalGetRequests].FirstValue,
|
app[webServiceTotalGetRequests].FirstValue,
|
||||||
name,
|
name,
|
||||||
"GET",
|
"GET",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.totalRequests,
|
c.webServiceTotalRequests,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[TotalHeadRequests].FirstValue,
|
app[webServiceTotalHeadRequests].FirstValue,
|
||||||
name,
|
name,
|
||||||
"HEAD",
|
"HEAD",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.totalRequests,
|
c.webServiceTotalRequests,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[TotalLockRequests].FirstValue,
|
app[webServiceTotalLockRequests].FirstValue,
|
||||||
name,
|
name,
|
||||||
"LOCK",
|
"LOCK",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.totalRequests,
|
c.webServiceTotalRequests,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[TotalMkcolRequests].FirstValue,
|
app[webServiceTotalMkcolRequests].FirstValue,
|
||||||
name,
|
name,
|
||||||
"MKCOL",
|
"MKCOL",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.totalRequests,
|
c.webServiceTotalRequests,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[TotalMoveRequests].FirstValue,
|
app[webServiceTotalMoveRequests].FirstValue,
|
||||||
name,
|
name,
|
||||||
"MOVE",
|
"MOVE",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.totalRequests,
|
c.webServiceTotalRequests,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[TotalOptionsRequests].FirstValue,
|
app[webServiceTotalOptionsRequests].FirstValue,
|
||||||
name,
|
name,
|
||||||
"OPTIONS",
|
"OPTIONS",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.totalRequests,
|
c.webServiceTotalRequests,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[TotalPostRequests].FirstValue,
|
app[webServiceTotalPostRequests].FirstValue,
|
||||||
name,
|
name,
|
||||||
"POST",
|
"POST",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.totalRequests,
|
c.webServiceTotalRequests,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[TotalPropfindRequests].FirstValue,
|
app[webServiceTotalPropfindRequests].FirstValue,
|
||||||
name,
|
name,
|
||||||
"PROPFIND",
|
"PROPFIND",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.totalRequests,
|
c.webServiceTotalRequests,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[TotalProppatchRequests].FirstValue,
|
app[webServiceTotalProppatchRequests].FirstValue,
|
||||||
name,
|
name,
|
||||||
"PROPPATCH",
|
"PROPPATCH",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.totalRequests,
|
c.webServiceTotalRequests,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[TotalPutRequests].FirstValue,
|
app[webServiceTotalPutRequests].FirstValue,
|
||||||
name,
|
name,
|
||||||
"PUT",
|
"PUT",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.totalRequests,
|
c.webServiceTotalRequests,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[TotalSearchRequests].FirstValue,
|
app[webServiceTotalSearchRequests].FirstValue,
|
||||||
name,
|
name,
|
||||||
"SEARCH",
|
"SEARCH",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.totalRequests,
|
c.webServiceTotalRequests,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[TotalTraceRequests].FirstValue,
|
app[webServiceTotalTraceRequests].FirstValue,
|
||||||
name,
|
name,
|
||||||
"TRACE",
|
"TRACE",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.totalRequests,
|
c.webServiceTotalRequests,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[TotalUnlockRequests].FirstValue,
|
app[webServiceTotalUnlockRequests].FirstValue,
|
||||||
name,
|
name,
|
||||||
"UNLOCK",
|
"UNLOCK",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package iis
|
package iis
|
||||||
@@ -11,7 +24,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type collectorWebServiceCache struct {
|
type collectorWebServiceCache struct {
|
||||||
perfDataCollectorWebServiceCache *perfdata.Collector
|
serviceCachePerfDataCollector *perfdata.Collector
|
||||||
|
|
||||||
serviceCacheActiveFlushedEntries *prometheus.Desc
|
serviceCacheActiveFlushedEntries *prometheus.Desc
|
||||||
|
|
||||||
@@ -48,80 +61,80 @@ type collectorWebServiceCache struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ServiceCacheActiveFlushedEntries = "Active Flushed Entries"
|
serviceCacheActiveFlushedEntries = "Active Flushed Entries"
|
||||||
ServiceCacheCurrentFileCacheMemoryUsage = "Current File Cache Memory Usage"
|
serviceCacheCurrentFileCacheMemoryUsage = "Current File Cache Memory Usage"
|
||||||
ServiceCacheMaximumFileCacheMemoryUsage = "Maximum File Cache Memory Usage"
|
serviceCacheMaximumFileCacheMemoryUsage = "Maximum File Cache Memory Usage"
|
||||||
ServiceCacheFileCacheFlushesTotal = "File Cache Flushes"
|
serviceCacheFileCacheFlushesTotal = "File Cache Flushes"
|
||||||
ServiceCacheFileCacheHitsTotal = "File Cache Hits"
|
serviceCacheFileCacheHitsTotal = "File Cache Hits"
|
||||||
ServiceCacheFileCacheMissesTotal = "File Cache Misses"
|
serviceCacheFileCacheMissesTotal = "File Cache Misses"
|
||||||
ServiceCacheFilesCached = "Current Files Cached"
|
serviceCacheFilesCached = "Current Files Cached"
|
||||||
ServiceCacheFilesCachedTotal = "Total Files Cached"
|
serviceCacheFilesCachedTotal = "Total Files Cached"
|
||||||
ServiceCacheFilesFlushedTotal = "Total Flushed Files"
|
serviceCacheFilesFlushedTotal = "Total Flushed Files"
|
||||||
ServiceCacheURICacheFlushesTotal = "Total Flushed URIs"
|
serviceCacheURICacheFlushesTotal = "Total Flushed URIs"
|
||||||
ServiceCacheURICacheFlushesTotalKernel = "Total Flushed URIs"
|
serviceCacheURICacheFlushesTotalKernel = "Total Flushed URIs"
|
||||||
ServiceCacheURIsFlushedTotalKernel = "Kernel: Total Flushed URIs"
|
serviceCacheURIsFlushedTotalKernel = "Kernel: Total Flushed URIs"
|
||||||
ServiceCacheURICacheHitsTotal = "URI Cache Hits"
|
serviceCacheURICacheHitsTotal = "URI Cache Hits"
|
||||||
ServiceCacheURICacheHitsTotalKernel = "Kernel: URI Cache Hits"
|
serviceCacheURICacheHitsTotalKernel = "Kernel: URI Cache Hits"
|
||||||
ServiceCacheURICacheMissesTotal = "URI Cache Misses"
|
serviceCacheURICacheMissesTotal = "URI Cache Misses"
|
||||||
ServiceCacheURICacheMissesTotalKernel = "Kernel: URI Cache Misses"
|
serviceCacheURICacheMissesTotalKernel = "Kernel: URI Cache Misses"
|
||||||
ServiceCacheURIsCached = "Current URIs Cached"
|
serviceCacheURIsCached = "Current URIs Cached"
|
||||||
ServiceCacheURIsCachedKernel = "Kernel: Current URIs Cached"
|
serviceCacheURIsCachedKernel = "Kernel: Current URIs Cached"
|
||||||
ServiceCacheURIsCachedTotal = "Total URIs Cached"
|
serviceCacheURIsCachedTotal = "Total URIs Cached"
|
||||||
ServiceCacheURIsCachedTotalKernel = "Total URIs Cached"
|
serviceCacheURIsCachedTotalKernel = "Total URIs Cached"
|
||||||
ServiceCacheURIsFlushedTotal = "Total Flushed URIs"
|
serviceCacheURIsFlushedTotal = "Total Flushed URIs"
|
||||||
ServiceCacheMetaDataCacheHits = "Metadata Cache Hits"
|
serviceCacheMetaDataCacheHits = "Metadata Cache Hits"
|
||||||
ServiceCacheMetaDataCacheMisses = "Metadata Cache Misses"
|
serviceCacheMetaDataCacheMisses = "Metadata Cache Misses"
|
||||||
ServiceCacheMetadataCached = "Current Metadata Cached"
|
serviceCacheMetadataCached = "Current Metadata Cached"
|
||||||
ServiceCacheMetadataCacheFlushes = "Metadata Cache Flushes"
|
serviceCacheMetadataCacheFlushes = "Metadata Cache Flushes"
|
||||||
ServiceCacheMetadataCachedTotal = "Total Metadata Cached"
|
serviceCacheMetadataCachedTotal = "Total Metadata Cached"
|
||||||
ServiceCacheMetadataFlushedTotal = "Total Flushed Metadata"
|
serviceCacheMetadataFlushedTotal = "Total Flushed Metadata"
|
||||||
ServiceCacheOutputCacheActiveFlushedItems = "Output Cache Current Flushed Items"
|
serviceCacheOutputCacheActiveFlushedItems = "Output Cache Current Flushed Items"
|
||||||
ServiceCacheOutputCacheItems = "Output Cache Current Items"
|
serviceCacheOutputCacheItems = "Output Cache Current Items"
|
||||||
ServiceCacheOutputCacheMemoryUsage = "Output Cache Current Memory Usage"
|
serviceCacheOutputCacheMemoryUsage = "Output Cache Current Memory Usage"
|
||||||
ServiceCacheOutputCacheHitsTotal = "Output Cache Total Hits"
|
serviceCacheOutputCacheHitsTotal = "Output Cache Total Hits"
|
||||||
ServiceCacheOutputCacheMissesTotal = "Output Cache Total Misses"
|
serviceCacheOutputCacheMissesTotal = "Output Cache Total Misses"
|
||||||
ServiceCacheOutputCacheFlushedItemsTotal = "Output Cache Total Flushed Items"
|
serviceCacheOutputCacheFlushedItemsTotal = "Output Cache Total Flushed Items"
|
||||||
ServiceCacheOutputCacheFlushesTotal = "Output Cache Total Flushes"
|
serviceCacheOutputCacheFlushesTotal = "Output Cache Total Flushes"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (c *Collector) buildWebServiceCache() error {
|
func (c *Collector) buildWebServiceCache() error {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollectorWebService, err = perfdata.NewCollector("Web Service Cache", perfdata.InstanceAll, []string{
|
c.serviceCachePerfDataCollector, err = perfdata.NewCollector("Web Service Cache", perfdata.InstancesAll, []string{
|
||||||
ServiceCacheActiveFlushedEntries,
|
serviceCacheActiveFlushedEntries,
|
||||||
ServiceCacheCurrentFileCacheMemoryUsage,
|
serviceCacheCurrentFileCacheMemoryUsage,
|
||||||
ServiceCacheMaximumFileCacheMemoryUsage,
|
serviceCacheMaximumFileCacheMemoryUsage,
|
||||||
ServiceCacheFileCacheFlushesTotal,
|
serviceCacheFileCacheFlushesTotal,
|
||||||
ServiceCacheFileCacheHitsTotal,
|
serviceCacheFileCacheHitsTotal,
|
||||||
ServiceCacheFileCacheMissesTotal,
|
serviceCacheFileCacheMissesTotal,
|
||||||
ServiceCacheFilesCached,
|
serviceCacheFilesCached,
|
||||||
ServiceCacheFilesCachedTotal,
|
serviceCacheFilesCachedTotal,
|
||||||
ServiceCacheFilesFlushedTotal,
|
serviceCacheFilesFlushedTotal,
|
||||||
ServiceCacheURICacheFlushesTotal,
|
serviceCacheURICacheFlushesTotal,
|
||||||
ServiceCacheURICacheFlushesTotalKernel,
|
serviceCacheURICacheFlushesTotalKernel,
|
||||||
ServiceCacheURIsFlushedTotalKernel,
|
serviceCacheURIsFlushedTotalKernel,
|
||||||
ServiceCacheURICacheHitsTotal,
|
serviceCacheURICacheHitsTotal,
|
||||||
ServiceCacheURICacheHitsTotalKernel,
|
serviceCacheURICacheHitsTotalKernel,
|
||||||
ServiceCacheURICacheMissesTotal,
|
serviceCacheURICacheMissesTotal,
|
||||||
ServiceCacheURICacheMissesTotalKernel,
|
serviceCacheURICacheMissesTotalKernel,
|
||||||
ServiceCacheURIsCached,
|
serviceCacheURIsCached,
|
||||||
ServiceCacheURIsCachedKernel,
|
serviceCacheURIsCachedKernel,
|
||||||
ServiceCacheURIsCachedTotal,
|
serviceCacheURIsCachedTotal,
|
||||||
ServiceCacheURIsCachedTotalKernel,
|
serviceCacheURIsCachedTotalKernel,
|
||||||
ServiceCacheURIsFlushedTotal,
|
serviceCacheURIsFlushedTotal,
|
||||||
ServiceCacheMetaDataCacheHits,
|
serviceCacheMetaDataCacheHits,
|
||||||
ServiceCacheMetaDataCacheMisses,
|
serviceCacheMetaDataCacheMisses,
|
||||||
ServiceCacheMetadataCached,
|
serviceCacheMetadataCached,
|
||||||
ServiceCacheMetadataCacheFlushes,
|
serviceCacheMetadataCacheFlushes,
|
||||||
ServiceCacheMetadataCachedTotal,
|
serviceCacheMetadataCachedTotal,
|
||||||
ServiceCacheMetadataFlushedTotal,
|
serviceCacheMetadataFlushedTotal,
|
||||||
ServiceCacheOutputCacheActiveFlushedItems,
|
serviceCacheOutputCacheActiveFlushedItems,
|
||||||
ServiceCacheOutputCacheItems,
|
serviceCacheOutputCacheItems,
|
||||||
ServiceCacheOutputCacheMemoryUsage,
|
serviceCacheOutputCacheMemoryUsage,
|
||||||
ServiceCacheOutputCacheHitsTotal,
|
serviceCacheOutputCacheHitsTotal,
|
||||||
ServiceCacheOutputCacheMissesTotal,
|
serviceCacheOutputCacheMissesTotal,
|
||||||
ServiceCacheOutputCacheFlushedItemsTotal,
|
serviceCacheOutputCacheFlushedItemsTotal,
|
||||||
ServiceCacheOutputCacheFlushesTotal,
|
serviceCacheOutputCacheFlushesTotal,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create Web Service Cache collector: %w", err)
|
return fmt.Errorf("failed to create Web Service Cache collector: %w", err)
|
||||||
@@ -301,7 +314,7 @@ func (c *Collector) buildWebServiceCache() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Collector) collectWebServiceCache(ch chan<- prometheus.Metric) error {
|
func (c *Collector) collectWebServiceCache(ch chan<- prometheus.Metric) error {
|
||||||
perfData, err := c.perfDataCollectorWebService.Collect()
|
perfData, err := c.serviceCachePerfDataCollector.Collect()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to collect Web Service Cache metrics: %w", err)
|
return fmt.Errorf("failed to collect Web Service Cache metrics: %w", err)
|
||||||
}
|
}
|
||||||
@@ -316,184 +329,184 @@ func (c *Collector) collectWebServiceCache(ch chan<- prometheus.Metric) error {
|
|||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheActiveFlushedEntries,
|
c.serviceCacheActiveFlushedEntries,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
app[ServiceCacheActiveFlushedEntries].FirstValue,
|
app[serviceCacheActiveFlushedEntries].FirstValue,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheCurrentFileCacheMemoryUsage,
|
c.serviceCacheCurrentFileCacheMemoryUsage,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
app[ServiceCacheCurrentFileCacheMemoryUsage].FirstValue,
|
app[serviceCacheCurrentFileCacheMemoryUsage].FirstValue,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheMaximumFileCacheMemoryUsage,
|
c.serviceCacheMaximumFileCacheMemoryUsage,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[ServiceCacheMaximumFileCacheMemoryUsage].FirstValue,
|
app[serviceCacheMaximumFileCacheMemoryUsage].FirstValue,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheFileCacheFlushesTotal,
|
c.serviceCacheFileCacheFlushesTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[ServiceCacheFileCacheFlushesTotal].FirstValue,
|
app[serviceCacheFileCacheFlushesTotal].FirstValue,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheFileCacheQueriesTotal,
|
c.serviceCacheFileCacheQueriesTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[ServiceCacheFileCacheHitsTotal].FirstValue+app[ServiceCacheFileCacheMissesTotal].FirstValue,
|
app[serviceCacheFileCacheHitsTotal].FirstValue+app[serviceCacheFileCacheMissesTotal].FirstValue,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheFileCacheHitsTotal,
|
c.serviceCacheFileCacheHitsTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[ServiceCacheFileCacheHitsTotal].FirstValue,
|
app[serviceCacheFileCacheHitsTotal].FirstValue,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheFilesCached,
|
c.serviceCacheFilesCached,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
app[ServiceCacheFilesCached].FirstValue,
|
app[serviceCacheFilesCached].FirstValue,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheFilesCachedTotal,
|
c.serviceCacheFilesCachedTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[ServiceCacheFilesCachedTotal].FirstValue,
|
app[serviceCacheFilesCachedTotal].FirstValue,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheFilesFlushedTotal,
|
c.serviceCacheFilesFlushedTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[ServiceCacheFilesFlushedTotal].FirstValue,
|
app[serviceCacheFilesFlushedTotal].FirstValue,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheURICacheFlushesTotal,
|
c.serviceCacheURICacheFlushesTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[ServiceCacheURICacheFlushesTotal].FirstValue,
|
app[serviceCacheURICacheFlushesTotal].FirstValue,
|
||||||
"user",
|
"user",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheURICacheFlushesTotal,
|
c.serviceCacheURICacheFlushesTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[ServiceCacheURICacheFlushesTotalKernel].FirstValue,
|
app[serviceCacheURICacheFlushesTotalKernel].FirstValue,
|
||||||
"kernel",
|
"kernel",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheURICacheQueriesTotal,
|
c.serviceCacheURICacheQueriesTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[ServiceCacheURICacheHitsTotal].FirstValue+app[ServiceCacheURICacheMissesTotal].FirstValue,
|
app[serviceCacheURICacheHitsTotal].FirstValue+app[serviceCacheURICacheMissesTotal].FirstValue,
|
||||||
"user",
|
"user",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheURICacheQueriesTotal,
|
c.serviceCacheURICacheQueriesTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[ServiceCacheURICacheHitsTotalKernel].FirstValue+app[ServiceCacheURICacheMissesTotalKernel].FirstValue,
|
app[serviceCacheURICacheHitsTotalKernel].FirstValue+app[serviceCacheURICacheMissesTotalKernel].FirstValue,
|
||||||
"kernel",
|
"kernel",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheURICacheHitsTotal,
|
c.serviceCacheURICacheHitsTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[ServiceCacheURICacheHitsTotal].FirstValue,
|
app[serviceCacheURICacheHitsTotal].FirstValue,
|
||||||
"user",
|
"user",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheURICacheHitsTotal,
|
c.serviceCacheURICacheHitsTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[ServiceCacheURICacheHitsTotalKernel].FirstValue,
|
app[serviceCacheURICacheHitsTotalKernel].FirstValue,
|
||||||
"kernel",
|
"kernel",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheURIsCached,
|
c.serviceCacheURIsCached,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
app[ServiceCacheURIsCached].FirstValue,
|
app[serviceCacheURIsCached].FirstValue,
|
||||||
"user",
|
"user",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheURIsCached,
|
c.serviceCacheURIsCached,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
app[ServiceCacheURIsCachedKernel].FirstValue,
|
app[serviceCacheURIsCachedKernel].FirstValue,
|
||||||
"kernel",
|
"kernel",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheURIsCachedTotal,
|
c.serviceCacheURIsCachedTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[ServiceCacheURIsCachedTotal].FirstValue,
|
app[serviceCacheURIsCachedTotal].FirstValue,
|
||||||
"user",
|
"user",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheURIsCachedTotal,
|
c.serviceCacheURIsCachedTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[ServiceCacheURIsCachedTotalKernel].FirstValue,
|
app[serviceCacheURIsCachedTotalKernel].FirstValue,
|
||||||
"kernel",
|
"kernel",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheURIsFlushedTotal,
|
c.serviceCacheURIsFlushedTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[ServiceCacheURIsFlushedTotal].FirstValue,
|
app[serviceCacheURIsFlushedTotal].FirstValue,
|
||||||
"user",
|
"user",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheURIsFlushedTotal,
|
c.serviceCacheURIsFlushedTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[ServiceCacheURIsFlushedTotalKernel].FirstValue,
|
app[serviceCacheURIsFlushedTotalKernel].FirstValue,
|
||||||
"kernel",
|
"kernel",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheMetadataCached,
|
c.serviceCacheMetadataCached,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
app[ServiceCacheMetadataCached].FirstValue,
|
app[serviceCacheMetadataCached].FirstValue,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheMetadataCacheFlushes,
|
c.serviceCacheMetadataCacheFlushes,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[ServiceCacheMetadataCacheFlushes].FirstValue,
|
app[serviceCacheMetadataCacheFlushes].FirstValue,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheMetadataCacheQueriesTotal,
|
c.serviceCacheMetadataCacheQueriesTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[ServiceCacheMetaDataCacheHits].FirstValue+app[ServiceCacheMetaDataCacheMisses].FirstValue,
|
app[serviceCacheMetaDataCacheHits].FirstValue+app[serviceCacheMetaDataCacheMisses].FirstValue,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheMetadataCacheHitsTotal,
|
c.serviceCacheMetadataCacheHitsTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
0, // app[ServiceCacheMetadataCacheHitsTotal].FirstValue,
|
0, // app[serviceCacheMetadataCacheHitsTotal].FirstValue,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheMetadataCachedTotal,
|
c.serviceCacheMetadataCachedTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[ServiceCacheMetadataCachedTotal].FirstValue,
|
app[serviceCacheMetadataCachedTotal].FirstValue,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheMetadataFlushedTotal,
|
c.serviceCacheMetadataFlushedTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[ServiceCacheMetadataFlushedTotal].FirstValue,
|
app[serviceCacheMetadataFlushedTotal].FirstValue,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheOutputCacheActiveFlushedItems,
|
c.serviceCacheOutputCacheActiveFlushedItems,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[ServiceCacheOutputCacheActiveFlushedItems].FirstValue,
|
app[serviceCacheOutputCacheActiveFlushedItems].FirstValue,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheOutputCacheItems,
|
c.serviceCacheOutputCacheItems,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[ServiceCacheOutputCacheItems].FirstValue,
|
app[serviceCacheOutputCacheItems].FirstValue,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheOutputCacheMemoryUsage,
|
c.serviceCacheOutputCacheMemoryUsage,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[ServiceCacheOutputCacheMemoryUsage].FirstValue,
|
app[serviceCacheOutputCacheMemoryUsage].FirstValue,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheOutputCacheQueriesTotal,
|
c.serviceCacheOutputCacheQueriesTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[ServiceCacheOutputCacheHitsTotal].FirstValue+app[ServiceCacheOutputCacheMissesTotal].FirstValue,
|
app[serviceCacheOutputCacheHitsTotal].FirstValue+app[serviceCacheOutputCacheMissesTotal].FirstValue,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheOutputCacheHitsTotal,
|
c.serviceCacheOutputCacheHitsTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[ServiceCacheOutputCacheHitsTotal].FirstValue,
|
app[serviceCacheOutputCacheHitsTotal].FirstValue,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheOutputCacheFlushedItemsTotal,
|
c.serviceCacheOutputCacheFlushedItemsTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[ServiceCacheOutputCacheFlushedItemsTotal].FirstValue,
|
app[serviceCacheOutputCacheFlushedItemsTotal].FirstValue,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.serviceCacheOutputCacheFlushesTotal,
|
c.serviceCacheOutputCacheFlushesTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
app[ServiceCacheOutputCacheFlushesTotal].FirstValue,
|
app[serviceCacheOutputCacheFlushesTotal].FirstValue,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package license
|
package license
|
||||||
@@ -14,6 +27,7 @@ import (
|
|||||||
|
|
||||||
const Name = "license"
|
const Name = "license"
|
||||||
|
|
||||||
|
//nolint:gochecknoglobals
|
||||||
var labelMap = map[slc.SL_GENUINE_STATE]string{
|
var labelMap = map[slc.SL_GENUINE_STATE]string{
|
||||||
slc.SL_GEN_STATE_IS_GENUINE: "genuine",
|
slc.SL_GEN_STATE_IS_GENUINE: "genuine",
|
||||||
slc.SL_GEN_STATE_INVALID_LICENSE: "invalid_license",
|
slc.SL_GEN_STATE_INVALID_LICENSE: "invalid_license",
|
||||||
@@ -24,6 +38,7 @@ var labelMap = map[slc.SL_GENUINE_STATE]string{
|
|||||||
|
|
||||||
type Config struct{}
|
type Config struct{}
|
||||||
|
|
||||||
|
//nolint:gochecknoglobals
|
||||||
var ConfigDefaults = Config{}
|
var ConfigDefaults = Config{}
|
||||||
|
|
||||||
// A Collector is a Prometheus Collector for WMI Win32_PerfRawData_DNS_DNS metrics.
|
// A Collector is a Prometheus Collector for WMI Win32_PerfRawData_DNS_DNS metrics.
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package license_test
|
package license_test
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package logical_disk
|
package logical_disk
|
||||||
|
|||||||
@@ -1,9 +1,23 @@
|
|||||||
|
// 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:build windows
|
||||||
|
|
||||||
package logical_disk
|
package logical_disk
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"regexp"
|
"regexp"
|
||||||
@@ -26,6 +40,7 @@ type Config struct {
|
|||||||
VolumeExclude *regexp.Regexp `yaml:"volume_exclude"`
|
VolumeExclude *regexp.Regexp `yaml:"volume_exclude"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint:gochecknoglobals
|
||||||
var ConfigDefaults = Config{
|
var ConfigDefaults = Config{
|
||||||
VolumeInclude: types.RegExpAny,
|
VolumeInclude: types.RegExpAny,
|
||||||
VolumeExclude: types.RegExpEmpty,
|
VolumeExclude: types.RegExpEmpty,
|
||||||
@@ -136,7 +151,7 @@ func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
|
|||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollector, err = perfdata.NewCollector("LogicalDisk", perfdata.InstanceAll, []string{
|
c.perfDataCollector, err = perfdata.NewCollector("LogicalDisk", perfdata.InstancesAll, []string{
|
||||||
currentDiskQueueLength,
|
currentDiskQueueLength,
|
||||||
avgDiskReadQueueLength,
|
avgDiskReadQueueLength,
|
||||||
avgDiskWriteQueueLength,
|
avgDiskWriteQueueLength,
|
||||||
@@ -298,12 +313,17 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
|
|||||||
return fmt.Errorf("failed to collect LogicalDisk metrics: %w", err)
|
return fmt.Errorf("failed to collect LogicalDisk metrics: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
volumes, err := getAllMountedVolumes()
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to get volumes: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
for name, volume := range perfData {
|
for name, volume := range perfData {
|
||||||
if c.config.VolumeExclude.MatchString(name) || !c.config.VolumeInclude.MatchString(name) {
|
if c.config.VolumeExclude.MatchString(name) || !c.config.VolumeInclude.MatchString(name) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
info, err = getVolumeInfo(name)
|
info, err = getVolumeInfo(volumes, name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.logger.Warn("failed to get volume information for "+name,
|
c.logger.Warn("failed to get volume information for "+name,
|
||||||
slog.Any("err", err),
|
slog.Any("err", err),
|
||||||
@@ -463,31 +483,15 @@ func getDriveType(driveType uint32) string {
|
|||||||
const diskExtentSize = 24
|
const diskExtentSize = 24
|
||||||
|
|
||||||
// getDiskIDByVolume returns the disk ID for a given volume.
|
// getDiskIDByVolume returns the disk ID for a given volume.
|
||||||
func getVolumeInfo(rootDrive string) (volumeInfo, error) {
|
func getVolumeInfo(volumes map[string]string, rootDrive string) (volumeInfo, error) {
|
||||||
volumePath := rootDrive
|
volumePath := rootDrive
|
||||||
|
|
||||||
// If rootDrive is a NTFS directory, convert it to a volume GUID.
|
// If rootDrive is a NTFS directory, convert it to a volume GUID.
|
||||||
if strings.Contains(volumePath, `\`) {
|
if volumeGUID, ok := volumes[rootDrive]; ok {
|
||||||
volumePathName, err := windows.UTF16PtrFromString(volumePath + `\`)
|
|
||||||
if err != nil {
|
|
||||||
return volumeInfo{}, fmt.Errorf("could not convert rootDrive to volume path: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
volumeGUIDPtr := make([]uint16, 50)
|
|
||||||
if err := windows.GetVolumeNameForVolumeMountPoint(volumePathName, &volumeGUIDPtr[0], uint32(len(volumeGUIDPtr))); err != nil {
|
|
||||||
panic(fmt.Errorf("could not get volume GUID: %w", err))
|
|
||||||
}
|
|
||||||
|
|
||||||
volumePath = windows.UTF16ToString(volumeGUIDPtr)
|
|
||||||
|
|
||||||
// GetVolumeNameForVolumeMountPoint returns the volume GUID path as \\?\Volume{GUID}\
|
// GetVolumeNameForVolumeMountPoint returns the volume GUID path as \\?\Volume{GUID}\
|
||||||
// According https://learn.microsoft.com/en-us/windows/win32/api/ioapiset/nf-ioapiset-deviceiocontrol#remarks
|
// According https://learn.microsoft.com/en-us/windows/win32/api/ioapiset/nf-ioapiset-deviceiocontrol#remarks
|
||||||
// Win32 Drive Namespace is prefixed with \\.\, so we need to remove the \\?\ prefix.
|
// Win32 Drive Namespace is prefixed with \\.\, so we need to remove the \\?\ prefix.
|
||||||
volumePath, _ = strings.CutPrefix(volumePath, `\\?\`)
|
volumePath, _ = strings.CutPrefix(volumeGUID, `\\?\`)
|
||||||
|
|
||||||
// https://stackoverflow.com/questions/55710326/how-to-get-the-physical-device-that-a-volume-guid-path-belongs-to#comment98104360_55710326
|
|
||||||
// DeviceIoControl expects no trailing backslash in the volume GUID path.
|
|
||||||
volumePath = strings.TrimRight(volumePath, `\`)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
volumePathPtr := windows.StringToUTF16Ptr(`\\.\` + volumePath)
|
volumePathPtr := windows.StringToUTF16Ptr(`\\.\` + volumePath)
|
||||||
@@ -564,3 +568,59 @@ func getVolumeInfo(rootDrive string) (volumeInfo, error) {
|
|||||||
readonly: float64(fsFlags & windows.FILE_READ_ONLY_VOLUME),
|
readonly: float64(fsFlags & windows.FILE_READ_ONLY_VOLUME),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getAllMountedVolumes() (map[string]string, error) {
|
||||||
|
guidBuf := make([]uint16, windows.MAX_PATH+1)
|
||||||
|
guidBufLen := uint32(len(guidBuf) * 2)
|
||||||
|
|
||||||
|
hFindVolume, err := windows.FindFirstVolume(&guidBuf[0], guidBufLen)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("FindFirstVolume: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
_ = windows.FindVolumeClose(hFindVolume)
|
||||||
|
}()
|
||||||
|
|
||||||
|
volumes := map[string]string{}
|
||||||
|
|
||||||
|
for ; ; err = windows.FindNextVolume(hFindVolume, &guidBuf[0], guidBufLen) {
|
||||||
|
if err != nil {
|
||||||
|
switch {
|
||||||
|
case errors.Is(err, windows.ERROR_NO_MORE_FILES):
|
||||||
|
return volumes, nil
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("FindNextVolume: %w", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var rootPathLen uint32
|
||||||
|
|
||||||
|
rootPathBuf := make([]uint16, windows.MAX_PATH+1)
|
||||||
|
rootPathBufLen := uint32(len(rootPathBuf) * 2)
|
||||||
|
|
||||||
|
for {
|
||||||
|
err = windows.GetVolumePathNamesForVolumeName(&guidBuf[0], &rootPathBuf[0], rootPathBufLen, &rootPathLen)
|
||||||
|
if err == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if errors.Is(err, windows.ERROR_NO_MORE_FILES) {
|
||||||
|
rootPathBuf = make([]uint16, (rootPathLen+1)/2)
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil, fmt.Errorf("GetVolumePathNamesForVolumeName: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
mountPoint := windows.UTF16ToString(rootPathBuf)
|
||||||
|
|
||||||
|
// Skip unmounted volumes
|
||||||
|
if len(mountPoint) == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
volumes[strings.TrimSuffix(mountPoint, `\`)] = strings.TrimSuffix(windows.UTF16ToString(guidBuf), `\`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package logical_disk_test
|
package logical_disk_test
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package logon
|
package logon
|
||||||
@@ -17,6 +30,7 @@ const Name = "logon"
|
|||||||
|
|
||||||
type Config struct{}
|
type Config struct{}
|
||||||
|
|
||||||
|
//nolint:gochecknoglobals
|
||||||
var ConfigDefaults = Config{}
|
var ConfigDefaults = Config{}
|
||||||
|
|
||||||
// A Collector is a Prometheus Collector for WMI metrics.
|
// A Collector is a Prometheus Collector for WMI metrics.
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package logon_test
|
package logon_test
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package memory
|
package memory
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|
||||||
// returns data points from Win32_PerfRawData_PerfOS_Memory
|
// returns data points from Win32_PerfRawData_PerfOS_Memory
|
||||||
// <add link to documentation here> - Win32_PerfRawData_PerfOS_Memory class
|
// <add link to documentation here> - Win32_PerfRawData_PerfOS_Memory class
|
||||||
|
|
||||||
@@ -22,6 +35,7 @@ const Name = "memory"
|
|||||||
|
|
||||||
type Config struct{}
|
type Config struct{}
|
||||||
|
|
||||||
|
//nolint:gochecknoglobals
|
||||||
var ConfigDefaults = Config{}
|
var ConfigDefaults = Config{}
|
||||||
|
|
||||||
// A Collector is a Prometheus Collector for perflib Memory metrics.
|
// A Collector is a Prometheus Collector for perflib Memory metrics.
|
||||||
@@ -90,10 +104,6 @@ func (c *Collector) GetName() string {
|
|||||||
return Name
|
return Name
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Collector) GetPerfCounter(_ *slog.Logger) ([]string, error) {
|
|
||||||
return []string{}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) Close() error {
|
func (c *Collector) Close() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -138,7 +148,7 @@ func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
|
|||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
c.perfDataCollector, err = perfdata.NewCollector("Memory", perfdata.InstanceAll, counters)
|
c.perfDataCollector, err = perfdata.NewCollector("Memory", perfdata.InstancesAll, counters)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create Memory collector: %w", err)
|
return fmt.Errorf("failed to create Memory collector: %w", err)
|
||||||
}
|
}
|
||||||
@@ -418,10 +428,10 @@ func (c *Collector) collectPDH(ch chan<- prometheus.Metric) error {
|
|||||||
return fmt.Errorf("failed to collect Memory metrics: %w", err)
|
return fmt.Errorf("failed to collect Memory metrics: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
data, ok := perfData[perfdata.EmptyInstance]
|
data, ok := perfData[perfdata.InstanceEmpty]
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
return errors.New("perflib query for Memory returned empty result set")
|
return fmt.Errorf("failed to collect Memory metrics: %w", types.ErrNoData)
|
||||||
}
|
}
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package memory_test
|
package memory_test
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package mscluster
|
package mscluster
|
||||||
@@ -8,25 +21,35 @@ import (
|
|||||||
"log/slog"
|
"log/slog"
|
||||||
"slices"
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
|
"sync"
|
||||||
|
|
||||||
"github.com/alecthomas/kingpin/v2"
|
"github.com/alecthomas/kingpin/v2"
|
||||||
"github.com/prometheus-community/windows_exporter/internal/mi"
|
"github.com/prometheus-community/windows_exporter/internal/mi"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
)
|
)
|
||||||
|
|
||||||
const Name = "mscluster"
|
const (
|
||||||
|
Name = "mscluster"
|
||||||
|
|
||||||
|
subCollectorCluster = "cluster"
|
||||||
|
subCollectorNetwork = "network"
|
||||||
|
subCollectorNode = "node"
|
||||||
|
subCollectorResource = "resource"
|
||||||
|
subCollectorResourceGroup = "resourcegroup"
|
||||||
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
CollectorsEnabled []string `yaml:"collectors_enabled"`
|
CollectorsEnabled []string `yaml:"collectors_enabled"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint:gochecknoglobals
|
||||||
var ConfigDefaults = Config{
|
var ConfigDefaults = Config{
|
||||||
CollectorsEnabled: []string{
|
CollectorsEnabled: []string{
|
||||||
"cluster",
|
subCollectorCluster,
|
||||||
"network",
|
subCollectorNetwork,
|
||||||
"node",
|
subCollectorNode,
|
||||||
"resource",
|
subCollectorResource,
|
||||||
"resourcegroup",
|
subCollectorResourceGroup,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,10 +107,6 @@ func (c *Collector) GetName() string {
|
|||||||
return Name
|
return Name
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Collector) GetPerfCounter(_ *slog.Logger) ([]string, error) {
|
|
||||||
return []string{"Memory"}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) Close() error {
|
func (c *Collector) Close() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -103,27 +122,39 @@ func (c *Collector) Build(_ *slog.Logger, miSession *mi.Session) error {
|
|||||||
|
|
||||||
c.miSession = miSession
|
c.miSession = miSession
|
||||||
|
|
||||||
if slices.Contains(c.config.CollectorsEnabled, "cluster") {
|
errs := make([]error, 0, 5)
|
||||||
c.buildCluster()
|
|
||||||
|
if slices.Contains(c.config.CollectorsEnabled, subCollectorCluster) {
|
||||||
|
if err := c.buildCluster(); err != nil {
|
||||||
|
errs = append(errs, fmt.Errorf("failed to build cluster collector: %w", err))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if slices.Contains(c.config.CollectorsEnabled, "network") {
|
if slices.Contains(c.config.CollectorsEnabled, subCollectorNetwork) {
|
||||||
c.buildNetwork()
|
if err := c.buildNetwork(); err != nil {
|
||||||
|
errs = append(errs, fmt.Errorf("failed to build network collector: %w", err))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if slices.Contains(c.config.CollectorsEnabled, "node") {
|
if slices.Contains(c.config.CollectorsEnabled, subCollectorNode) {
|
||||||
c.buildNode()
|
if err := c.buildNode(); err != nil {
|
||||||
|
errs = append(errs, fmt.Errorf("failed to build node collector: %w", err))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if slices.Contains(c.config.CollectorsEnabled, "resource") {
|
if slices.Contains(c.config.CollectorsEnabled, subCollectorResource) {
|
||||||
c.buildResource()
|
if err := c.buildResource(); err != nil {
|
||||||
|
errs = append(errs, fmt.Errorf("failed to build resource collector: %w", err))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if slices.Contains(c.config.CollectorsEnabled, "resourcegroup") {
|
if slices.Contains(c.config.CollectorsEnabled, subCollectorResourceGroup) {
|
||||||
c.buildResourceGroup()
|
if err := c.buildResourceGroup(); err != nil {
|
||||||
|
errs = append(errs, fmt.Errorf("failed to build resource group collector: %w", err))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return errors.Join(errs...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collect sends the metric values for each metric
|
// Collect sends the metric values for each metric
|
||||||
@@ -133,40 +164,73 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
errCh := make(chan error, 5)
|
||||||
err error
|
|
||||||
errs []error
|
|
||||||
nodeNames []string
|
|
||||||
)
|
|
||||||
|
|
||||||
if slices.Contains(c.config.CollectorsEnabled, "cluster") {
|
wg := sync.WaitGroup{}
|
||||||
if err = c.collectCluster(ch); err != nil {
|
wg.Add(5)
|
||||||
errs = append(errs, fmt.Errorf("failed to collect cluster metrics: %w", err))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if slices.Contains(c.config.CollectorsEnabled, "network") {
|
go func() {
|
||||||
if err = c.collectNetwork(ch); err != nil {
|
defer wg.Done()
|
||||||
errs = append(errs, fmt.Errorf("failed to collect network metrics: %w", err))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if slices.Contains(c.config.CollectorsEnabled, "node") {
|
if slices.Contains(c.config.CollectorsEnabled, subCollectorCluster) {
|
||||||
if nodeNames, err = c.collectNode(ch); err != nil {
|
if err := c.collectCluster(ch); err != nil {
|
||||||
errs = append(errs, fmt.Errorf("failed to collect node metrics: %w", err))
|
errCh <- fmt.Errorf("failed to collect cluster metrics: %w", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}()
|
||||||
|
|
||||||
if slices.Contains(c.config.CollectorsEnabled, "resource") {
|
go func() {
|
||||||
if err = c.collectResource(ch, nodeNames); err != nil {
|
defer wg.Done()
|
||||||
errs = append(errs, fmt.Errorf("failed to collect resource metrics: %w", err))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if slices.Contains(c.config.CollectorsEnabled, "resourcegroup") {
|
if slices.Contains(c.config.CollectorsEnabled, subCollectorNetwork) {
|
||||||
if err = c.collectResourceGroup(ch, nodeNames); err != nil {
|
if err := c.collectNetwork(ch); err != nil {
|
||||||
errs = append(errs, fmt.Errorf("failed to collect resource group metrics: %w", err))
|
errCh <- fmt.Errorf("failed to collect network metrics: %w", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
|
||||||
|
nodeNames := make([]string, 0)
|
||||||
|
|
||||||
|
if slices.Contains(c.config.CollectorsEnabled, subCollectorNode) {
|
||||||
|
var err error
|
||||||
|
|
||||||
|
nodeNames, err = c.collectNode(ch)
|
||||||
|
if err != nil {
|
||||||
|
errCh <- fmt.Errorf("failed to collect node metrics: %w", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
|
||||||
|
if slices.Contains(c.config.CollectorsEnabled, subCollectorResource) {
|
||||||
|
if err := c.collectResource(ch, nodeNames); err != nil {
|
||||||
|
errCh <- fmt.Errorf("failed to collect resource metrics: %w", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
|
||||||
|
if slices.Contains(c.config.CollectorsEnabled, subCollectorResourceGroup) {
|
||||||
|
if err := c.collectResourceGroup(ch, nodeNames); err != nil {
|
||||||
|
errCh <- fmt.Errorf("failed to collect resource group metrics: %w", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}()
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
|
close(errCh)
|
||||||
|
|
||||||
|
errs := make([]error, 0, 5)
|
||||||
|
|
||||||
|
for err := range errCh {
|
||||||
|
errs = append(errs, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return errors.Join(errs...)
|
return errors.Join(errs...)
|
||||||
|
|||||||
@@ -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:build windows
|
||||||
|
|
||||||
package mscluster
|
package mscluster
|
||||||
@@ -7,13 +20,14 @@ import (
|
|||||||
|
|
||||||
"github.com/prometheus-community/windows_exporter/internal/mi"
|
"github.com/prometheus-community/windows_exporter/internal/mi"
|
||||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||||
"github.com/prometheus-community/windows_exporter/internal/utils"
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
)
|
)
|
||||||
|
|
||||||
const nameCluster = Name + "_cluster"
|
const nameCluster = Name + "_cluster"
|
||||||
|
|
||||||
type collectorCluster struct {
|
type collectorCluster struct {
|
||||||
|
clusterMIQuery mi.Query
|
||||||
|
|
||||||
clusterAddEvictDelay *prometheus.Desc
|
clusterAddEvictDelay *prometheus.Desc
|
||||||
clusterAdminAccessPoint *prometheus.Desc
|
clusterAdminAccessPoint *prometheus.Desc
|
||||||
clusterAutoAssignNodeSite *prometheus.Desc
|
clusterAutoAssignNodeSite *prometheus.Desc
|
||||||
@@ -177,7 +191,14 @@ type msClusterCluster struct {
|
|||||||
WitnessRestartInterval uint `mi:"WitnessRestartInterval"`
|
WitnessRestartInterval uint `mi:"WitnessRestartInterval"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Collector) buildCluster() {
|
func (c *Collector) buildCluster() error {
|
||||||
|
clusterMIQuery, err := mi.NewQuery("SELECT * FROM MSCluster_Cluster")
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to create WMI query: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
c.clusterMIQuery = clusterMIQuery
|
||||||
|
|
||||||
c.clusterAddEvictDelay = prometheus.NewDesc(
|
c.clusterAddEvictDelay = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, nameCluster, "add_evict_delay"),
|
prometheus.BuildFQName(types.Namespace, nameCluster, "add_evict_delay"),
|
||||||
"Provides access to the cluster's AddEvictDelay property, which is the number a seconds that a new node is delayed after an eviction of another node.",
|
"Provides access to the cluster's AddEvictDelay property, which is the number a seconds that a new node is delayed after an eviction of another node.",
|
||||||
@@ -640,11 +661,18 @@ func (c *Collector) buildCluster() {
|
|||||||
[]string{"name"},
|
[]string{"name"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var dst []msClusterCluster
|
||||||
|
if err := c.miSession.Query(&dst, mi.NamespaceRootMSCluster, c.clusterMIQuery); err != nil {
|
||||||
|
return fmt.Errorf("WMI query failed: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Collector) collectCluster(ch chan<- prometheus.Metric) error {
|
func (c *Collector) collectCluster(ch chan<- prometheus.Metric) error {
|
||||||
var dst []msClusterCluster
|
var dst []msClusterCluster
|
||||||
if err := c.miSession.Query(&dst, mi.NamespaceRootMSCluster, utils.Must(mi.NewQuery("SELECT * MSCluster_Cluster"))); err != nil {
|
if err := c.miSession.Query(&dst, mi.NamespaceRootMSCluster, c.clusterMIQuery); err != nil {
|
||||||
return fmt.Errorf("WMI query failed: %w", err)
|
return fmt.Errorf("WMI query failed: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user