diff --git a/README.md b/README.md
index 9b85380cf..95c2ce618 100644
--- a/README.md
+++ b/README.md
@@ -42,7 +42,7 @@ Name | Description | Enabled by default
[net](docs/collector.net.md) | Network interface I/O | ✓
[os](docs/collector.os.md) | OS metrics (memory, processes, users) | ✓
[pagefile](docs/collector.pagefile.md) | pagefile metrics |
-[perfdata](docs/collector.perfdata.md) | Custom perfdata metrics |
+[performancecounter](docs/collector.performancecounter.md) | Custom performance counter metrics |
[physical_disk](docs/collector.physical_disk.md) | physical disk metrics | ✓
[printer](docs/collector.printer.md) | Printer metrics |
[process](docs/collector.process.md) | Per-process metrics |
diff --git a/docs/README.md b/docs/README.md
index 879c8ad1f..a470a89fc 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -18,6 +18,7 @@ This directory contains documentation of the collectors in the windows_exporter,
- [`fsrmquota`](collector.fsrmquota.md)
- [`hyperv`](collector.hyperv.md)
- [`iis`](collector.iis.md)
+- [`license`](collector.license.md)
- [`logical_disk`](collector.logical_disk.md)
- [`logon`](collector.logon.md)
- [`memory`](collector.memory.md)
@@ -28,12 +29,16 @@ This directory contains documentation of the collectors in the windows_exporter,
- [`netframework`](collector.netframework.md)
- [`nps`](collector.nps.md)
- [`os`](collector.os.md)
+- [`pagefile`](collector.pagefile.md)
+- [`performancecounter`](collector.performancecounter.md)
- [`physical_disk`](collector.physical_disk.md)
+- [`printer`](collector.printer.md)
- [`process`](collector.process.md)
- [`remote_fx`](collector.remote_fx.md)
- [`scheduled_task`](collector.scheduled_task.md)
- [`service`](collector.service.md)
- [`smb`](collector.smb.md)
+- [`smbclient`](collector.smbclient.md)
- [`smtp`](collector.smtp.md)
- [`system`](collector.system.md)
- [`tcp`](collector.tcp.md)
diff --git a/docs/collector.perfdata.md b/docs/collector.perfdata.md
deleted file mode 100644
index ef1271cc1..000000000
--- a/docs/collector.perfdata.md
+++ /dev/null
@@ -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.
diff --git a/docs/collector.performancecounter.md b/docs/collector.performancecounter.md
new file mode 100644
index 000000000..958d607ee
--- /dev/null
+++ b/docs/collector.performancecounter.md
@@ -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:
+
+
+Click to expand YAML schema
+
+```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
+```
+
+
+
+
+Click to expand JSON schema
+
+```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.
diff --git a/internal/collector/perfdata/perfdata.go b/internal/collector/performancecounter/performancecounter.go
similarity index 61%
rename from internal/collector/perfdata/perfdata.go
rename to internal/collector/performancecounter/performancecounter.go
index f2aeb9f37..aed4b0c22 100644
--- a/internal/collector/perfdata/perfdata.go
+++ b/internal/collector/performancecounter/performancecounter.go
@@ -13,14 +13,12 @@
//go:build windows
-package perfdata
+package performancecounter
import (
"encoding/json"
"fmt"
"log/slog"
- "maps"
- "slices"
"strings"
"github.com/alecthomas/kingpin/v2"
@@ -30,7 +28,7 @@ import (
"github.com/prometheus/client_golang/prometheus"
)
-const Name = "perfdata"
+const Name = "performancecounter"
type Config struct {
Objects []Object `yaml:"objects"`
@@ -41,9 +39,11 @@ var ConfigDefaults = Config{
Objects: make([]Object, 0),
}
-// A Collector is a Prometheus collector for perfdata metrics.
+// A Collector is a Prometheus collector for performance counter metrics.
type Collector struct {
config Config
+
+ logger *slog.Logger
}
func New(config *Config) *Collector {
@@ -70,7 +70,7 @@ func NewWithFlags(app *kingpin.Application) *Collector {
var objects string
app.Flag(
- "collector.perfdata.objects",
+ "collector.performancecounter.objects",
"Objects of performance data to observe. See docs for more information on how to use this flag. By default, no objects are observed.",
).Default("").StringVar(&objects)
@@ -102,10 +102,19 @@ func (c *Collector) Close() error {
}
func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
- logger.Warn("The perfdata collector is in an experimental state! The configuration may change in future. Please report any issues.")
+ c.logger = logger.With(slog.String("collector", Name))
for i, object := range c.config.Objects {
- collector, err := perfdata.NewCollector(object.Object, object.Instances, slices.Sorted(maps.Keys(object.Counters)))
+ counters := make([]string, 0, len(object.Counters))
+ for j, counter := range object.Counters {
+ counters = append(counters, counter.Name)
+
+ if counter.Metric == "" {
+ c.config.Objects[i].Counters[j].Metric = sanitizeMetricName(fmt.Sprintf("%s_%s_%s_%s", types.Namespace, Name, object.Object, counter.Name))
+ }
+ }
+
+ collector, err := perfdata.NewCollector(object.Object, object.Instances, counters)
if err != nil {
return fmt.Errorf("failed to create v2 collector: %w", err)
}
@@ -123,40 +132,64 @@ func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
// Collect sends the metric values for each metric
// to the provided prometheus Metric channel.
func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
- for _, object := range c.config.Objects {
- data, err := object.collector.Collect()
+ for _, perfDataObject := range c.config.Objects {
+ collectedPerfData, err := perfDataObject.collector.Collect()
if err != nil {
return fmt.Errorf("failed to collect data: %w", err)
}
- for instance, counters := range data {
- for counter, value := range counters {
- var labels prometheus.Labels
- if instance != perfdata.InstanceEmpty {
- labels = prometheus.Labels{object.InstanceLabel: instance}
+ for collectedInstance, collectedInstanceCounters := range collectedPerfData {
+ for _, counter := range perfDataObject.Counters {
+ collectedCounterValue, ok := collectedInstanceCounters[counter.Name]
+ if !ok {
+ c.logger.Warn(fmt.Sprintf("counter %s not found in collected data", counter.Name))
+
+ continue
}
- metricType := value.Type
+ labels := make(prometheus.Labels, len(counter.Labels)+1)
+ if collectedInstance != perfdata.InstanceEmpty {
+ labels[perfDataObject.InstanceLabel] = collectedInstance
+ }
+
+ for key, value := range counter.Labels {
+ labels[key] = value
+ }
- if val, ok := object.Counters[counter]; ok {
- switch val.Type {
- case "counter":
- metricType = prometheus.CounterValue
- case "gauge":
- metricType = prometheus.GaugeValue
- }
+ var metricType prometheus.ValueType
+
+ switch counter.Type {
+ case "counter":
+ metricType = prometheus.CounterValue
+ case "gauge":
+ metricType = prometheus.GaugeValue
+ default:
+ metricType = collectedCounterValue.Type
}
ch <- prometheus.MustNewConstMetric(
prometheus.NewDesc(
- sanitizeMetricName(fmt.Sprintf("%s_perfdata_%s_%s", types.Namespace, object.Object, counter)),
- fmt.Sprintf("Performance data for \\%s\\%s", object.Object, counter),
+ counter.Metric,
+ "windows_exporter: custom Performance Counter metric",
nil,
labels,
),
metricType,
- value.FirstValue,
+ collectedCounterValue.FirstValue,
)
+
+ if collectedCounterValue.SecondValue != 0 {
+ ch <- prometheus.MustNewConstMetric(
+ prometheus.NewDesc(
+ counter.Metric+"_second",
+ "windows_exporter: custom Performance Counter metric",
+ nil,
+ labels,
+ ),
+ metricType,
+ collectedCounterValue.SecondValue,
+ )
+ }
}
}
}
diff --git a/internal/collector/perfdata/perfdata_test.go b/internal/collector/performancecounter/performancecounter_test.go
similarity index 65%
rename from internal/collector/perfdata/perfdata_test.go
rename to internal/collector/performancecounter/performancecounter_test.go
index 75488e2e8..d9a74698a 100644
--- a/internal/collector/perfdata/perfdata_test.go
+++ b/internal/collector/performancecounter/performancecounter_test.go
@@ -13,19 +13,19 @@
//go:build windows
-package perfdata_test
+package performancecounter_test
import (
"testing"
"github.com/alecthomas/kingpin/v2"
- "github.com/prometheus-community/windows_exporter/internal/collector/perfdata"
+ "github.com/prometheus-community/windows_exporter/internal/collector/performancecounter"
"github.com/prometheus-community/windows_exporter/internal/utils/testutils"
)
func BenchmarkCollector(b *testing.B) {
- perfDataObjects := `[{"object":"Processor Information","instances":["*"],"counters":{"*": {}}}]`
+ perfDataObjects := `[{"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"}]}]`
kingpin.CommandLine.GetArg("collector.perfdata.objects").StringVar(&perfDataObjects)
- testutils.FuncBenchmarkCollector(b, perfdata.Name, perfdata.NewWithFlags)
+ testutils.FuncBenchmarkCollector(b, performancecounter.Name, performancecounter.NewWithFlags)
}
diff --git a/internal/collector/perfdata/perfdata_collector_test.go b/internal/collector/performancecounter/performancecounter_test_test.go
similarity index 52%
rename from internal/collector/perfdata/perfdata_collector_test.go
rename to internal/collector/performancecounter/performancecounter_test_test.go
index 7401db71d..6424156d3 100644
--- a/internal/collector/perfdata/perfdata_collector_test.go
+++ b/internal/collector/performancecounter/performancecounter_test_test.go
@@ -13,7 +13,7 @@
//go:build windows
-package perfdata_test
+package performancecounter_test
import (
"fmt"
@@ -24,7 +24,7 @@ import (
"regexp"
"testing"
- "github.com/prometheus-community/windows_exporter/internal/collector/perfdata"
+ "github.com/prometheus-community/windows_exporter/internal/collector/performancecounter"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/stretchr/testify/assert"
@@ -32,7 +32,7 @@ import (
)
type collectorAdapter struct {
- perfdata.Collector
+ performancecounter.Collector
}
// Describe implements the prometheus.Collector interface.
@@ -51,31 +51,40 @@ func TestCollector(t *testing.T) {
for _, tc := range []struct {
object string
instances []string
- counters map[string]perfdata.Counter
+ instanceLabel string
+ counters []performancecounter.Counter
expectedMetrics *regexp.Regexp
}{
{
object: "Memory",
instances: nil,
- counters: map[string]perfdata.Counter{"Available Bytes": {Type: "gauge"}},
- expectedMetrics: regexp.MustCompile(`^# HELP windows_perfdata_memory_available_bytes Performance data for \\\\Memory\\\\Available Bytes\s*# TYPE windows_perfdata_memory_available_bytes gauge\s*windows_perfdata_memory_available_bytes \d`),
+ counters: []performancecounter.Counter{{Name: "Available Bytes", Type: "gauge"}},
+ expectedMetrics: regexp.MustCompile(`^# HELP windows_performancecounter_memory_available_bytes windows_exporter: custom Performance Counter metric\S*\s*# TYPE windows_performancecounter_memory_available_bytes gauge\s*windows_performancecounter_memory_available_bytes \d`),
},
{
object: "Process",
instances: []string{"*"},
- counters: map[string]perfdata.Counter{"Thread Count": {Type: "counter"}},
- expectedMetrics: regexp.MustCompile(`^# HELP windows_perfdata_process_thread_count Performance data for \\\\Process\\\\Thread Count\s*# TYPE windows_perfdata_process_thread_count counter\s*windows_perfdata_process_thread_count\{instance=".+"} \d`),
+ counters: []performancecounter.Counter{{Name: "Thread Count", Type: "counter"}},
+ expectedMetrics: regexp.MustCompile(`^# HELP windows_performancecounter_process_thread_count windows_exporter: custom Performance Counter metric\S*\s*# TYPE windows_performancecounter_process_thread_count counter\s*windows_performancecounter_process_thread_count\{instance=".+"} \d`),
+ },
+ {
+ object: "Processor Information",
+ instances: []string{"*"},
+ instanceLabel: "core",
+ counters: []performancecounter.Counter{{Name: "% Processor Time", Metric: "windows_performancecounter_processor_information_processor_time", Labels: map[string]string{"state": "active"}}, {Name: "% Idle Time", Metric: "windows_performancecounter_processor_information_processor_time", Labels: map[string]string{"state": "idle"}}},
+ expectedMetrics: regexp.MustCompile(`^# HELP windows_performancecounter_processor_information_processor_time windows_exporter: custom Performance Counter metric\s+# TYPE windows_performancecounter_processor_information_processor_time counter\s+windows_performancecounter_processor_information_processor_time\{core="0,0",state="active"} [0-9.e+]+\s+windows_performancecounter_processor_information_processor_time\{core="0,0",state="idle"} [0-9.e+]+`),
},
} {
t.Run(tc.object, func(t *testing.T) {
t.Parallel()
- perfDataCollector := perfdata.New(&perfdata.Config{
- Objects: []perfdata.Object{
+ perfDataCollector := performancecounter.New(&performancecounter.Config{
+ Objects: []performancecounter.Object{
{
- Object: tc.object,
- Instances: tc.instances,
- Counters: tc.counters,
+ Object: tc.object,
+ Instances: tc.instances,
+ InstanceLabel: tc.instanceLabel,
+ Counters: tc.counters,
},
},
})
diff --git a/internal/collector/perfdata/types.go b/internal/collector/performancecounter/types.go
similarity index 52%
rename from internal/collector/perfdata/types.go
rename to internal/collector/performancecounter/types.go
index 80162df97..3fe91c0a3 100644
--- a/internal/collector/perfdata/types.go
+++ b/internal/collector/performancecounter/types.go
@@ -13,19 +13,24 @@
//go:build windows
-package perfdata
+package performancecounter
import "github.com/prometheus-community/windows_exporter/internal/perfdata"
type Object struct {
- Object string `json:"object" yaml:"object"`
- Instances []string `json:"instances" yaml:"instances"`
- Counters map[string]Counter `json:"counters" yaml:"counters"`
- InstanceLabel string `json:"instance_label" yaml:"instance_label"` //nolint:tagliatelle
+ Object string `json:"object" yaml:"object"`
+ Instances []string `json:"instances" yaml:"instances"`
+ Counters []Counter `json:"counters" yaml:"counters"`
+ InstanceLabel string `json:"instance_label" yaml:"instance_label"` //nolint:tagliatelle
collector *perfdata.Collector
}
type Counter struct {
- Type string `json:"type" yaml:"type"`
+ Name string `json:"name" yaml:"name"`
+ Type string `json:"type" yaml:"type"`
+ Metric string `json:"metric" yaml:"metric"`
+ Labels map[string]string `json:"labels" yaml:"labels"`
}
+
+// https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/54691ebe11bb9ec32b4e35cd31fcb94a352de134/receiver/windowsperfcountersreceiver/README.md?plain=1#L150
diff --git a/pkg/collector/collection.go b/pkg/collector/collection.go
index 4d1312242..de71a2d68 100644
--- a/pkg/collector/collection.go
+++ b/pkg/collector/collection.go
@@ -54,7 +54,7 @@ import (
"github.com/prometheus-community/windows_exporter/internal/collector/nps"
"github.com/prometheus-community/windows_exporter/internal/collector/os"
"github.com/prometheus-community/windows_exporter/internal/collector/pagefile"
- "github.com/prometheus-community/windows_exporter/internal/collector/perfdata"
+ "github.com/prometheus-community/windows_exporter/internal/collector/performancecounter"
"github.com/prometheus-community/windows_exporter/internal/collector/physical_disk"
"github.com/prometheus-community/windows_exporter/internal/collector/printer"
"github.com/prometheus-community/windows_exporter/internal/collector/process"
@@ -123,7 +123,7 @@ func NewWithConfig(config Config) *Collection {
collectors[nps.Name] = nps.New(&config.Nps)
collectors[os.Name] = os.New(&config.OS)
collectors[pagefile.Name] = pagefile.New(&config.Paging)
- collectors[perfdata.Name] = perfdata.New(&config.PerfData)
+ collectors[performancecounter.Name] = performancecounter.New(&config.PerformanceCounter)
collectors[physical_disk.Name] = physical_disk.New(&config.PhysicalDisk)
collectors[printer.Name] = printer.New(&config.Printer)
collectors[process.Name] = process.New(&config.Process)
diff --git a/pkg/collector/config.go b/pkg/collector/config.go
index 533947e38..b66051120 100644
--- a/pkg/collector/config.go
+++ b/pkg/collector/config.go
@@ -45,7 +45,7 @@ import (
"github.com/prometheus-community/windows_exporter/internal/collector/nps"
"github.com/prometheus-community/windows_exporter/internal/collector/os"
"github.com/prometheus-community/windows_exporter/internal/collector/pagefile"
- "github.com/prometheus-community/windows_exporter/internal/collector/perfdata"
+ "github.com/prometheus-community/windows_exporter/internal/collector/performancecounter"
"github.com/prometheus-community/windows_exporter/internal/collector/physical_disk"
"github.com/prometheus-community/windows_exporter/internal/collector/printer"
"github.com/prometheus-community/windows_exporter/internal/collector/process"
@@ -67,54 +67,54 @@ import (
)
type Config struct {
- AD ad.Config `yaml:"ad"`
- ADCS adcs.Config `yaml:"adcs"`
- ADFS adfs.Config `yaml:"adfs"`
- Cache cache.Config `yaml:"cache"`
- Container container.Config `yaml:"container"`
- CPU cpu.Config `yaml:"cpu"`
- CPUInfo cpu_info.Config `yaml:"cpu_info"`
- Cs cs.Config `yaml:"cs"`
- DFSR dfsr.Config `yaml:"dfsr"`
- Dhcp dhcp.Config `yaml:"dhcp"`
- DiskDrive diskdrive.Config `yaml:"disk_drive"`
- DNS dns.Config `yaml:"dns"`
- Exchange exchange.Config `yaml:"exchange"`
- Filetime filetime.Config `yaml:"filetime"`
- Fsrmquota fsrmquota.Config `yaml:"fsrmquota"`
- HyperV hyperv.Config `yaml:"hyper_v"`
- IIS iis.Config `yaml:"iis"`
- License license.Config `yaml:"license"`
- LogicalDisk logical_disk.Config `yaml:"logical_disk"`
- Logon logon.Config `yaml:"logon"`
- Memory memory.Config `yaml:"memory"`
- MSCluster mscluster.Config `yaml:"ms_cluster"`
- Msmq msmq.Config `yaml:"msmq"`
- Mssql mssql.Config `yaml:"mssql"`
- Net net.Config `yaml:"net"`
- NetFramework netframework.Config `yaml:"net_framework"`
- Nps nps.Config `yaml:"nps"`
- OS os.Config `yaml:"os"`
- Paging pagefile.Config `yaml:"paging"`
- PerfData perfdata.Config `yaml:"perf_data"`
- PhysicalDisk physical_disk.Config `yaml:"physical_disk"`
- Printer printer.Config `yaml:"printer"`
- Process process.Config `yaml:"process"`
- RemoteFx remote_fx.Config `yaml:"remote_fx"`
- ScheduledTask scheduled_task.Config `yaml:"scheduled_task"`
- Service service.Config `yaml:"service"`
- SMB smb.Config `yaml:"smb"`
- SMBClient smbclient.Config `yaml:"smb_client"`
- SMTP smtp.Config `yaml:"smtp"`
- System system.Config `yaml:"system"`
- TCP tcp.Config `yaml:"tcp"`
- TerminalServices terminal_services.Config `yaml:"terminal_services"`
- Textfile textfile.Config `yaml:"textfile"`
- ThermalZone thermalzone.Config `yaml:"thermal_zone"`
- Time time.Config `yaml:"time"`
- UDP udp.Config `yaml:"udp"`
- Update update.Config `yaml:"update"`
- Vmware vmware.Config `yaml:"vmware"`
+ AD ad.Config `yaml:"ad"`
+ ADCS adcs.Config `yaml:"adcs"`
+ ADFS adfs.Config `yaml:"adfs"`
+ Cache cache.Config `yaml:"cache"`
+ Container container.Config `yaml:"container"`
+ CPU cpu.Config `yaml:"cpu"`
+ CPUInfo cpu_info.Config `yaml:"cpu_info"`
+ Cs cs.Config `yaml:"cs"`
+ DFSR dfsr.Config `yaml:"dfsr"`
+ Dhcp dhcp.Config `yaml:"dhcp"`
+ DiskDrive diskdrive.Config `yaml:"disk_drive"`
+ DNS dns.Config `yaml:"dns"`
+ Exchange exchange.Config `yaml:"exchange"`
+ Filetime filetime.Config `yaml:"filetime"`
+ Fsrmquota fsrmquota.Config `yaml:"fsrmquota"`
+ HyperV hyperv.Config `yaml:"hyper_v"`
+ IIS iis.Config `yaml:"iis"`
+ License license.Config `yaml:"license"`
+ LogicalDisk logical_disk.Config `yaml:"logical_disk"`
+ Logon logon.Config `yaml:"logon"`
+ Memory memory.Config `yaml:"memory"`
+ MSCluster mscluster.Config `yaml:"ms_cluster"`
+ Msmq msmq.Config `yaml:"msmq"`
+ Mssql mssql.Config `yaml:"mssql"`
+ Net net.Config `yaml:"net"`
+ NetFramework netframework.Config `yaml:"net_framework"`
+ Nps nps.Config `yaml:"nps"`
+ OS os.Config `yaml:"os"`
+ Paging pagefile.Config `yaml:"paging"`
+ PerformanceCounter performancecounter.Config `yaml:"performance_counter"`
+ PhysicalDisk physical_disk.Config `yaml:"physical_disk"`
+ Printer printer.Config `yaml:"printer"`
+ Process process.Config `yaml:"process"`
+ RemoteFx remote_fx.Config `yaml:"remote_fx"`
+ ScheduledTask scheduled_task.Config `yaml:"scheduled_task"`
+ Service service.Config `yaml:"service"`
+ SMB smb.Config `yaml:"smb"`
+ SMBClient smbclient.Config `yaml:"smb_client"`
+ SMTP smtp.Config `yaml:"smtp"`
+ System system.Config `yaml:"system"`
+ TCP tcp.Config `yaml:"tcp"`
+ TerminalServices terminal_services.Config `yaml:"terminal_services"`
+ Textfile textfile.Config `yaml:"textfile"`
+ ThermalZone thermalzone.Config `yaml:"thermal_zone"`
+ Time time.Config `yaml:"time"`
+ UDP udp.Config `yaml:"udp"`
+ Update update.Config `yaml:"update"`
+ Vmware vmware.Config `yaml:"vmware"`
}
// ConfigDefaults Is an interface to be used by the external libraries. It holds all ConfigDefaults form all collectors
@@ -122,52 +122,52 @@ type Config struct {
//nolint:gochecknoglobals
//goland:noinspection GoUnusedGlobalVariable
var ConfigDefaults = Config{
- AD: ad.ConfigDefaults,
- ADCS: adcs.ConfigDefaults,
- ADFS: adfs.ConfigDefaults,
- Cache: cache.ConfigDefaults,
- Container: container.ConfigDefaults,
- CPU: cpu.ConfigDefaults,
- CPUInfo: cpu_info.ConfigDefaults,
- Cs: cs.ConfigDefaults,
- DFSR: dfsr.ConfigDefaults,
- Dhcp: dhcp.ConfigDefaults,
- DiskDrive: diskdrive.ConfigDefaults,
- DNS: dns.ConfigDefaults,
- Exchange: exchange.ConfigDefaults,
- Filetime: filetime.ConfigDefaults,
- Fsrmquota: fsrmquota.ConfigDefaults,
- HyperV: hyperv.ConfigDefaults,
- IIS: iis.ConfigDefaults,
- License: license.ConfigDefaults,
- LogicalDisk: logical_disk.ConfigDefaults,
- Logon: logon.ConfigDefaults,
- Memory: memory.ConfigDefaults,
- MSCluster: mscluster.ConfigDefaults,
- Msmq: msmq.ConfigDefaults,
- Mssql: mssql.ConfigDefaults,
- Net: net.ConfigDefaults,
- NetFramework: netframework.ConfigDefaults,
- Nps: nps.ConfigDefaults,
- OS: os.ConfigDefaults,
- Paging: pagefile.ConfigDefaults,
- PerfData: perfdata.ConfigDefaults,
- PhysicalDisk: physical_disk.ConfigDefaults,
- Printer: printer.ConfigDefaults,
- Process: process.ConfigDefaults,
- RemoteFx: remote_fx.ConfigDefaults,
- ScheduledTask: scheduled_task.ConfigDefaults,
- Service: service.ConfigDefaults,
- SMB: smb.ConfigDefaults,
- SMBClient: smbclient.ConfigDefaults,
- SMTP: smtp.ConfigDefaults,
- System: system.ConfigDefaults,
- TCP: tcp.ConfigDefaults,
- TerminalServices: terminal_services.ConfigDefaults,
- Textfile: textfile.ConfigDefaults,
- ThermalZone: thermalzone.ConfigDefaults,
- Time: time.ConfigDefaults,
- UDP: udp.ConfigDefaults,
- Update: update.ConfigDefaults,
- Vmware: vmware.ConfigDefaults,
+ AD: ad.ConfigDefaults,
+ ADCS: adcs.ConfigDefaults,
+ ADFS: adfs.ConfigDefaults,
+ Cache: cache.ConfigDefaults,
+ Container: container.ConfigDefaults,
+ CPU: cpu.ConfigDefaults,
+ CPUInfo: cpu_info.ConfigDefaults,
+ Cs: cs.ConfigDefaults,
+ DFSR: dfsr.ConfigDefaults,
+ Dhcp: dhcp.ConfigDefaults,
+ DiskDrive: diskdrive.ConfigDefaults,
+ DNS: dns.ConfigDefaults,
+ Exchange: exchange.ConfigDefaults,
+ Filetime: filetime.ConfigDefaults,
+ Fsrmquota: fsrmquota.ConfigDefaults,
+ HyperV: hyperv.ConfigDefaults,
+ IIS: iis.ConfigDefaults,
+ License: license.ConfigDefaults,
+ LogicalDisk: logical_disk.ConfigDefaults,
+ Logon: logon.ConfigDefaults,
+ Memory: memory.ConfigDefaults,
+ MSCluster: mscluster.ConfigDefaults,
+ Msmq: msmq.ConfigDefaults,
+ Mssql: mssql.ConfigDefaults,
+ Net: net.ConfigDefaults,
+ NetFramework: netframework.ConfigDefaults,
+ Nps: nps.ConfigDefaults,
+ OS: os.ConfigDefaults,
+ Paging: pagefile.ConfigDefaults,
+ PerformanceCounter: performancecounter.ConfigDefaults,
+ PhysicalDisk: physical_disk.ConfigDefaults,
+ Printer: printer.ConfigDefaults,
+ Process: process.ConfigDefaults,
+ RemoteFx: remote_fx.ConfigDefaults,
+ ScheduledTask: scheduled_task.ConfigDefaults,
+ Service: service.ConfigDefaults,
+ SMB: smb.ConfigDefaults,
+ SMBClient: smbclient.ConfigDefaults,
+ SMTP: smtp.ConfigDefaults,
+ System: system.ConfigDefaults,
+ TCP: tcp.ConfigDefaults,
+ TerminalServices: terminal_services.ConfigDefaults,
+ Textfile: textfile.ConfigDefaults,
+ ThermalZone: thermalzone.ConfigDefaults,
+ Time: time.ConfigDefaults,
+ UDP: udp.ConfigDefaults,
+ Update: update.ConfigDefaults,
+ Vmware: vmware.ConfigDefaults,
}
diff --git a/pkg/collector/map.go b/pkg/collector/map.go
index 979a86281..ec45e7751 100644
--- a/pkg/collector/map.go
+++ b/pkg/collector/map.go
@@ -49,7 +49,7 @@ import (
"github.com/prometheus-community/windows_exporter/internal/collector/nps"
"github.com/prometheus-community/windows_exporter/internal/collector/os"
"github.com/prometheus-community/windows_exporter/internal/collector/pagefile"
- "github.com/prometheus-community/windows_exporter/internal/collector/perfdata"
+ "github.com/prometheus-community/windows_exporter/internal/collector/performancecounter"
"github.com/prometheus-community/windows_exporter/internal/collector/physical_disk"
"github.com/prometheus-community/windows_exporter/internal/collector/printer"
"github.com/prometheus-community/windows_exporter/internal/collector/process"
@@ -78,54 +78,54 @@ func NewBuilderWithFlags[C Collector](fn BuilderWithFlags[C]) BuilderWithFlags[C
//nolint:gochecknoglobals
var BuildersWithFlags = map[string]BuilderWithFlags[Collector]{
- ad.Name: NewBuilderWithFlags(ad.NewWithFlags),
- adcs.Name: NewBuilderWithFlags(adcs.NewWithFlags),
- adfs.Name: NewBuilderWithFlags(adfs.NewWithFlags),
- cache.Name: NewBuilderWithFlags(cache.NewWithFlags),
- container.Name: NewBuilderWithFlags(container.NewWithFlags),
- cpu.Name: NewBuilderWithFlags(cpu.NewWithFlags),
- cpu_info.Name: NewBuilderWithFlags(cpu_info.NewWithFlags),
- cs.Name: NewBuilderWithFlags(cs.NewWithFlags),
- dfsr.Name: NewBuilderWithFlags(dfsr.NewWithFlags),
- dhcp.Name: NewBuilderWithFlags(dhcp.NewWithFlags),
- diskdrive.Name: NewBuilderWithFlags(diskdrive.NewWithFlags),
- dns.Name: NewBuilderWithFlags(dns.NewWithFlags),
- exchange.Name: NewBuilderWithFlags(exchange.NewWithFlags),
- filetime.Name: NewBuilderWithFlags(filetime.NewWithFlags),
- fsrmquota.Name: NewBuilderWithFlags(fsrmquota.NewWithFlags),
- hyperv.Name: NewBuilderWithFlags(hyperv.NewWithFlags),
- iis.Name: NewBuilderWithFlags(iis.NewWithFlags),
- license.Name: NewBuilderWithFlags(license.NewWithFlags),
- logical_disk.Name: NewBuilderWithFlags(logical_disk.NewWithFlags),
- logon.Name: NewBuilderWithFlags(logon.NewWithFlags),
- memory.Name: NewBuilderWithFlags(memory.NewWithFlags),
- mscluster.Name: NewBuilderWithFlags(mscluster.NewWithFlags),
- msmq.Name: NewBuilderWithFlags(msmq.NewWithFlags),
- mssql.Name: NewBuilderWithFlags(mssql.NewWithFlags),
- net.Name: NewBuilderWithFlags(net.NewWithFlags),
- netframework.Name: NewBuilderWithFlags(netframework.NewWithFlags),
- nps.Name: NewBuilderWithFlags(nps.NewWithFlags),
- os.Name: NewBuilderWithFlags(os.NewWithFlags),
- pagefile.Name: NewBuilderWithFlags(pagefile.NewWithFlags),
- perfdata.Name: NewBuilderWithFlags(perfdata.NewWithFlags),
- physical_disk.Name: NewBuilderWithFlags(physical_disk.NewWithFlags),
- printer.Name: NewBuilderWithFlags(printer.NewWithFlags),
- process.Name: NewBuilderWithFlags(process.NewWithFlags),
- remote_fx.Name: NewBuilderWithFlags(remote_fx.NewWithFlags),
- scheduled_task.Name: NewBuilderWithFlags(scheduled_task.NewWithFlags),
- service.Name: NewBuilderWithFlags(service.NewWithFlags),
- smb.Name: NewBuilderWithFlags(smb.NewWithFlags),
- smbclient.Name: NewBuilderWithFlags(smbclient.NewWithFlags),
- smtp.Name: NewBuilderWithFlags(smtp.NewWithFlags),
- system.Name: NewBuilderWithFlags(system.NewWithFlags),
- tcp.Name: NewBuilderWithFlags(tcp.NewWithFlags),
- terminal_services.Name: NewBuilderWithFlags(terminal_services.NewWithFlags),
- textfile.Name: NewBuilderWithFlags(textfile.NewWithFlags),
- thermalzone.Name: NewBuilderWithFlags(thermalzone.NewWithFlags),
- time.Name: NewBuilderWithFlags(time.NewWithFlags),
- udp.Name: NewBuilderWithFlags(udp.NewWithFlags),
- update.Name: NewBuilderWithFlags(update.NewWithFlags),
- vmware.Name: NewBuilderWithFlags(vmware.NewWithFlags),
+ ad.Name: NewBuilderWithFlags(ad.NewWithFlags),
+ adcs.Name: NewBuilderWithFlags(adcs.NewWithFlags),
+ adfs.Name: NewBuilderWithFlags(adfs.NewWithFlags),
+ cache.Name: NewBuilderWithFlags(cache.NewWithFlags),
+ container.Name: NewBuilderWithFlags(container.NewWithFlags),
+ cpu.Name: NewBuilderWithFlags(cpu.NewWithFlags),
+ cpu_info.Name: NewBuilderWithFlags(cpu_info.NewWithFlags),
+ cs.Name: NewBuilderWithFlags(cs.NewWithFlags),
+ dfsr.Name: NewBuilderWithFlags(dfsr.NewWithFlags),
+ dhcp.Name: NewBuilderWithFlags(dhcp.NewWithFlags),
+ diskdrive.Name: NewBuilderWithFlags(diskdrive.NewWithFlags),
+ dns.Name: NewBuilderWithFlags(dns.NewWithFlags),
+ exchange.Name: NewBuilderWithFlags(exchange.NewWithFlags),
+ filetime.Name: NewBuilderWithFlags(filetime.NewWithFlags),
+ fsrmquota.Name: NewBuilderWithFlags(fsrmquota.NewWithFlags),
+ hyperv.Name: NewBuilderWithFlags(hyperv.NewWithFlags),
+ iis.Name: NewBuilderWithFlags(iis.NewWithFlags),
+ license.Name: NewBuilderWithFlags(license.NewWithFlags),
+ logical_disk.Name: NewBuilderWithFlags(logical_disk.NewWithFlags),
+ logon.Name: NewBuilderWithFlags(logon.NewWithFlags),
+ memory.Name: NewBuilderWithFlags(memory.NewWithFlags),
+ mscluster.Name: NewBuilderWithFlags(mscluster.NewWithFlags),
+ msmq.Name: NewBuilderWithFlags(msmq.NewWithFlags),
+ mssql.Name: NewBuilderWithFlags(mssql.NewWithFlags),
+ net.Name: NewBuilderWithFlags(net.NewWithFlags),
+ netframework.Name: NewBuilderWithFlags(netframework.NewWithFlags),
+ nps.Name: NewBuilderWithFlags(nps.NewWithFlags),
+ os.Name: NewBuilderWithFlags(os.NewWithFlags),
+ pagefile.Name: NewBuilderWithFlags(pagefile.NewWithFlags),
+ performancecounter.Name: NewBuilderWithFlags(performancecounter.NewWithFlags),
+ physical_disk.Name: NewBuilderWithFlags(physical_disk.NewWithFlags),
+ printer.Name: NewBuilderWithFlags(printer.NewWithFlags),
+ process.Name: NewBuilderWithFlags(process.NewWithFlags),
+ remote_fx.Name: NewBuilderWithFlags(remote_fx.NewWithFlags),
+ scheduled_task.Name: NewBuilderWithFlags(scheduled_task.NewWithFlags),
+ service.Name: NewBuilderWithFlags(service.NewWithFlags),
+ smb.Name: NewBuilderWithFlags(smb.NewWithFlags),
+ smbclient.Name: NewBuilderWithFlags(smbclient.NewWithFlags),
+ smtp.Name: NewBuilderWithFlags(smtp.NewWithFlags),
+ system.Name: NewBuilderWithFlags(system.NewWithFlags),
+ tcp.Name: NewBuilderWithFlags(tcp.NewWithFlags),
+ terminal_services.Name: NewBuilderWithFlags(terminal_services.NewWithFlags),
+ textfile.Name: NewBuilderWithFlags(textfile.NewWithFlags),
+ thermalzone.Name: NewBuilderWithFlags(thermalzone.NewWithFlags),
+ time.Name: NewBuilderWithFlags(time.NewWithFlags),
+ udp.Name: NewBuilderWithFlags(udp.NewWithFlags),
+ update.Name: NewBuilderWithFlags(update.NewWithFlags),
+ vmware.Name: NewBuilderWithFlags(vmware.NewWithFlags),
}
func Available() []string {
diff --git a/tools/e2e-output.txt b/tools/e2e-output.txt
index b1152c9a7..680ed5e96 100644
--- a/tools/e2e-output.txt
+++ b/tools/e2e-output.txt
@@ -123,7 +123,7 @@ windows_exporter_collector_success{collector="memory"} 1
windows_exporter_collector_success{collector="net"} 1
windows_exporter_collector_success{collector="os"} 1
windows_exporter_collector_success{collector="pagefile"} 1
-windows_exporter_collector_success{collector="perfdata"} 1
+windows_exporter_collector_success{collector="performancecounter"} 1
windows_exporter_collector_success{collector="physical_disk"} 1
windows_exporter_collector_success{collector="printer"} 1
windows_exporter_collector_success{collector="process"} 1
@@ -146,7 +146,7 @@ windows_exporter_collector_timeout{collector="memory"} 0
windows_exporter_collector_timeout{collector="net"} 0
windows_exporter_collector_timeout{collector="os"} 0
windows_exporter_collector_timeout{collector="pagefile"} 0
-windows_exporter_collector_timeout{collector="perfdata"} 0
+windows_exporter_collector_timeout{collector="performancecounter"} 0
windows_exporter_collector_timeout{collector="physical_disk"} 0
windows_exporter_collector_timeout{collector="printer"} 0
windows_exporter_collector_timeout{collector="process"} 0
@@ -319,12 +319,10 @@ windows_exporter_collector_timeout{collector="udp"} 0
# TYPE windows_pagefile_free_bytes gauge
# HELP windows_pagefile_limit_bytes Number of bytes that can be stored in the operating system paging files. 0 (zero) indicates that there are no paging files
# TYPE windows_pagefile_limit_bytes gauge
-# HELP windows_perfdata_memory_cache_faults_sec Performance data for \\Memory\\Cache Faults/sec
-# TYPE windows_perfdata_memory_cache_faults_sec counter
-# HELP windows_perfdata_processor_information__privileged_time Performance data for \\Processor Information\\% Privileged Time
-# TYPE windows_perfdata_processor_information__privileged_time counter
-# HELP windows_perfdata_processor_information__processor_time Performance data for \\Processor Information\\% Processor Time
-# TYPE windows_perfdata_processor_information__processor_time counter
+# HELP windows_performancecounter_memory_cache_faults_sec windows_exporter: custom Performance Counter metric
+# TYPE windows_performancecounter_memory_cache_faults_sec counter
+# HELP windows_performancecounter_processor_information_processor_time windows_exporter: custom Performance Counter metric
+# TYPE windows_performancecounter_processor_information_processor_time counter
# HELP windows_physical_disk_idle_seconds_total Seconds that the disk was idle (PhysicalDisk.PercentIdleTime)
# TYPE windows_physical_disk_idle_seconds_total counter
# HELP windows_physical_disk_read_bytes_total The number of bytes transferred from the disk during read operations (PhysicalDisk.DiskReadBytesPerSec)
diff --git a/tools/end-to-end-test.ps1 b/tools/end-to-end-test.ps1
index e4d05fb07..85e5bc9cb 100644
--- a/tools/end-to-end-test.ps1
+++ b/tools/end-to-end-test.ps1
@@ -18,15 +18,15 @@ mkdir $textfile_dir | Out-Null
Copy-Item 'e2e-textfile.prom' -Destination "$($textfile_dir)/e2e-textfile.prom"
# Omit dynamic collector information that will change after each run
-$skip_re = "^(go_|windows_exporter_build_info|windows_exporter_collector_duration_seconds|windows_exporter_scrape_duration_seconds|process_|windows_textfile_mtime_seconds|windows_cpu|windows_cs|windows_cache|windows_logon|windows_pagefile|windows_logical_disk|windows_physical_disk|windows_memory|windows_net|windows_os|windows_process|windows_service_process|windows_printer|windows_udp|windows_tcp|windows_system|windows_time|windows_session|windows_perfdata|windows_textfile_mtime_seconds)"
+$skip_re = "^(go_|windows_exporter_build_info|windows_exporter_collector_duration_seconds|windows_exporter_scrape_duration_seconds|process_|windows_textfile_mtime_seconds|windows_cpu|windows_cs|windows_cache|windows_logon|windows_pagefile|windows_logical_disk|windows_physical_disk|windows_memory|windows_net|windows_os|windows_process|windows_service_process|windows_printer|windows_udp|windows_tcp|windows_system|windows_time|windows_session|windows_performancecounter|windows_performancecounter|windows_textfile_mtime_seconds)"
# Start process in background, awaiting HTTP requests.
# Use default collectors, port and address: http://localhost:9182/metrics
$exporter_proc = Start-Process `
-PassThru `
-FilePath ..\windows_exporter.exe `
- -ArgumentList "--log.level=debug","--web.disable-exporter-metrics","--collectors.enabled=[defaults],cpu_info,textfile,process,pagefile,perfdata,scheduled_task,tcp,udp,time,system,service,logical_disk,printer,os,net,memory,logon,cache","--collector.process.include=explorer.exe","--collector.scheduled_task.include=.*GAEvents","--collector.service.include=Themes","--collector.textfile.directories=$($textfile_dir)",@"
---collector.perfdata.objects="[{\"object\":\"Processor Information\",\"instance_label\":\"core\",\"instances\":[\"*\"],\"counters\":{\"% Processor Time\":{},\"% Privileged Time\":{}}},{\"object\":\"Memory\",\"counters\":{\"Cache Faults/sec\":{\"type\":\"counter\"}}}]"
+ -ArgumentList "--log.level=debug","--web.disable-exporter-metrics","--collectors.enabled=[defaults],cpu_info,textfile,process,pagefile,performancecounter,scheduled_task,tcp,udp,time,system,service,logical_disk,printer,os,net,memory,logon,cache","--collector.process.include=explorer.exe","--collector.scheduled_task.include=.*GAEvents","--collector.service.include=Themes","--collector.textfile.directories=$($textfile_dir)",@"
+--collector.performancecounter.objects="[{\"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\"}]}]"
"@ `
-WindowStyle Hidden `
-RedirectStandardOutput "$($temp_dir)/windows_exporter.log" `