-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Send available perfmon data on error (#6542)
When the windows/perfmon metricset encountered any error it would discard any valid metrics it had read and send a single error event. With this change it will send one event per counter. If an individual counter returns an error then it will send an event for that counter containing the error.message field and a zero-value measurement field. Depending on your use case you may want to update any metric aggregations you have to ignore error events. I'm also adding more documentation for the configuration options.
- Loading branch information
1 parent
0de34ab
commit d4eac97
Showing
7 changed files
with
182 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,76 @@ | ||
The `perfmon` metricset of the Windows module reads Windows | ||
performance counters. | ||
The `perfmon` metricset of the Windows module reads Windows performance | ||
counters. | ||
|
||
[float] | ||
=== Configuration | ||
|
||
You must configure queries for the Windows performance counters that you wish | ||
to collect. The example below collects processor time and disk writes. | ||
`ignore_non_existent_counters` ignores failures for non-existent counters without | ||
to interrupt the service. With `format` you can set the output format for a specific counter. | ||
Possible values are `float` and `long`. If nothing is selected the default value is `float`. | ||
With `instance_name`, you can specify the name of the instance. Use this setting when: | ||
- You want to use an instance name that is different from the computed name. For example, `Total` instead of `_Total`. | ||
- You specify a counter that has no instance. For example, `\TCPIP Performance Diagnostics\IPv4 NBLs/sec indicated without prevalidation`. | ||
For wildcard queries this setting has no effect. | ||
|
||
to collect. The example below collects processor time and disk writes every | ||
10 seconds. If either of the counters do not exist it will ignore the error. | ||
|
||
[source,yaml] | ||
---- | ||
- module: windows | ||
metricsets: ["perfmon"] | ||
metricsets: [perfmon] | ||
period: 10s | ||
perfmon.ignore_non_existent_counters: true | ||
perfmon.counters: | ||
- instance_label: "processor.name" | ||
instance_name: "Total" | ||
measurement_label: "processor.time.total.pct" | ||
- instance_label: processor.name | ||
instance_name: total | ||
measurement_label: processor.time.total.pct | ||
query: '\Processor Information(_Total)\% Processor Time' | ||
- instance_label: "diskio.name" | ||
measurement_label: "diskio.write.bytes" | ||
- instance_label: physical_disk.name | ||
measurement_label: physical_disk.write.per_sec | ||
query: '\PhysicalDisk(*)\Disk Writes/sec' | ||
format: "long" | ||
- instance_label: physical_disk.name | ||
measurement_label: physical_disk.write.time.pct | ||
query: '\PhysicalDisk(*)\% Disk Write Time' | ||
---- | ||
|
||
*`ignore_non_existent_counters`*:: A boolean option that causes the | ||
metricset to ignore errors caused by counters that do not exist when set to | ||
true. Instead of an error, a message will be logged at the info level stating | ||
that the counter does not exist. | ||
|
||
*`counters`*:: Counters specifies a list of queries to perform. Each individual | ||
counter requires three config options - `instance_label`, `measurement_label`, | ||
and `query`. | ||
|
||
[float] | ||
==== Counter Configuration | ||
|
||
Each item in the `counters` list specifies a perfmon query to perform. In the | ||
events generated by the metricset these configuration options map to the field | ||
values as shown below. | ||
|
||
---- | ||
"%[instance_label]": "%[instance_name] or <perfmon_counter_name>", | ||
"%[measurement_label]": <perfmon_counter_value>, | ||
---- | ||
|
||
*`instance_label`*:: The label used to identify the counter instance. This | ||
field is required. | ||
|
||
*`instance_name`*:: The instance name to use in the event when the counter's | ||
path (`query`) does not include an instance or when you want to override the | ||
instance name. For example with `\Processor Information(_Total)` the | ||
instance name would be `_Total` and by setting `instance_name: total` you can | ||
override the value. | ||
+ | ||
The setting has no effect with wildcard queries (e.g. | ||
`\PhysicalDisk(*)\Disk Writes/sec`). | ||
|
||
*`measurement_label`*:: The label used for the value returned by the query. | ||
This field is required. | ||
|
||
*`query`*:: The perfmon query. This is the counter path specified in | ||
Performance Data Helper (PDH) syntax. This field is required. For example | ||
`\Processor Information(_Total)\% Processor Time`. An asterisk can be used in | ||
place of an instance name to perform a wildcard query that generates an event | ||
for each counter instance (e.g. `\PhysicalDisk(*)\Disk Writes/sec`). | ||
|
||
*`format`*:: Format of the measurement value. The value can be either `float` or | ||
`long`. The default is `float`. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.