Skip to content

Commit f527ce6

Browse files
mergify[bot]herrBezvishaangelova
authored
Wmi fix doc based on feedback (#45068) (#47157)
* Add windows 11 to compatibility section * WIP: Improve documentation after support feedback + Improve cache explanation * Use tag note instead of info * Improve wording * Make sure the warning is marked as such, use a more precise link * Fix comma * Fix some wording * Update docs/reference/metricbeat/metricbeat-metricset-windows-wmi.md * Update docs/reference/metricbeat/metricbeat-metricset-windows-wmi.md * Update docs/reference/metricbeat/metricbeat-metricset-windows-wmi.md * Update docs/reference/metricbeat/metricbeat-metricset-windows-wmi.md * Update docs/reference/metricbeat/metricbeat-metricset-windows-wmi.md * Update docs/reference/metricbeat/metricbeat-metricset-windows-wmi.md * Clarify the wmi.schema_cache_size based on the comments * Make sure to update docs.md as well * Remove erronously added line --------- (cherry picked from commit f23a53a) Co-authored-by: Mirko Bez <[email protected]> Co-authored-by: Visha Angelova <[email protected]>
1 parent c2249c4 commit f527ce6

File tree

2 files changed

+57
-36
lines changed

2 files changed

+57
-36
lines changed

docs/reference/metricbeat/metricbeat-metricset-windows-wmi.md

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ applies_to:
1313
This functionality is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.
1414
::::
1515

16-
17-
The `wmi` metricset of the Windows module reads metrics via Windows Management Instrumentation [(WMI)](https://learn.microsoft.com/en-us/windows/win32/wmisdk/about-wmi), a core management technology in the Windows Operating system.
16+
The `wmi` metricset of the Windows module reads metrics via [Windows Management Instrumentation](https://learn.microsoft.com/en-us/windows/win32/wmisdk/about-wmi) (WMI), a core management technology in the Windows Operating system.
1817

1918
By leveraging WMI Query Language (WQL), this metricset allows you to extract detailed system information and metrics to monitor the health and performance of Windows Systems.
2019

21-
This metricset leverages the [Microsoft WMI](https://github.com/microsoft/wmi), library a convenient wrapper around the [GO-OLE](https://github.com/go-ole) library which allows to invoke the WMI Api.
20+
This metricset leverages the [Microsoft WMI](https://github.com/microsoft/wmi) library, a convenient wrapper around the [GO-OLE](https://github.com/go-ole) library which allows to invoke the WMI API.
2221

2322
## WMI Query Language (WQL) Support
2423

@@ -30,11 +29,14 @@ namespaces.
3029
Currently, the metricset supports queries with `SELECT`, `FROM` and
3130
`WHERE` clauses.
3231

33-
When working with WMI queries, it is the user’s responsibility to ensure
32+
::::{warning}
33+
When working with WMI queries, it is the user's responsibility to ensure
3434
that queries are safe, efficient, and do not cause unintended side
3535
effects. A notorious example of a problematic WMI class is
36-
Win32\_Product. Read more in [Windows
37-
Documentation](https://support.microsoft.com/kb/974524).
36+
`Win32_Product`. Read more in the related [Windows
37+
documentation](https://learn.microsoft.com/en-us/troubleshoot/windows-server/admin-development/windows-installer-reconfigured-all-applications#more-information).
38+
::::
39+
3840

3941
## WMI Arbitrator and Query Execution
4042

@@ -54,30 +56,37 @@ fail, Metricbeat has a timeout mechanism that stops waiting for query
5456
results after a specified timeout. This is controlled by the
5557
`wmi.warning_threshold` setting.
5658

59+
::::{note}
5760
While Metricbeat stops waiting for the result, the underlying WMI query
5861
may continue running until the WMI Arbitrator decides to stop execution.
62+
::::
5963

6064
## WMI Type support
6165

6266
The `microsoft/wmi` library internally uses the WMI Scripting API. This API, as per the
6367
[official WMI Documentation](https://learn.microsoft.com/en-us/windows/win32/wmisdk/querying-wmi),
64-
does not provide direct type conversion for `uint64`, `sint64`, and `datetime` CIM types;
68+
does not provide direct type conversion for `uint64`, `sint64`, and `datetime`
69+
[Common Information Model](https://learn.microsoft.com/en-us/windows/win32/wmisdk/common-information-model) (CIM) types;
6570
instead, these values are returned as strings.
6671

6772
To ensure the correct data type is reported, Metricbeat dynamically fetches the
68-
CIM type definitions for the properties of the WMI instance classes involved in the query,
73+
CIM type definitions for the properties of the WMI instance classes returned by the query,
6974
and then performs the necessary data type conversions.
7075

7176
To optimize performance and avoid repeatedly fetching these schema definitions
7277
for every row and every request, an LRU cache is utilized. This cache stores
73-
the schema definition for each unique WMI class encountered. For queries involving
78+
the schema definition for each WMI class-property pair encountered. For queries involving
7479
superclasses, such as `CIM_LogicalDevice`, the cache will populate with individual entries
7580
for each specific derived class (leaf of the class hierarchy) whose instances are returned by the query (for example, `Win32_DiskDrive` or `Win32_NetworkAdapter`).
7681

7782
::::{note}
7883
The properties of type `CIM_Object` (embedded objects) are not yet supported and are ignored.
7984
::::
8085

86+
::::{note}
87+
Properties of type `CIM_Reference` (references), which are used in [WMI Association Classes](https://learn.microsoft.com/en-us/windows/win32/wmisdk/declaring-an-association-class), are currently returned as string values exactly as reported by the [Microsoft WMI](https://github.com/microsoft/wmi) library.
88+
::::
89+
8190
## Configuration
8291

8392
```yaml
@@ -107,7 +116,7 @@ The properties of type `CIM_Object` (embedded objects) are not yet supported and
107116
108117
**`wmi.namespace`**
109118
: The default WMI namespace used for queries. This can be overridden per
110-
query. The default is `root\cimv2`.
119+
query. The default is `"root\\cimv2"`.
111120

112121
**`wmi.warning_threshold`**
113122
: The time threshold after which Metricbeat will stop waiting for the
@@ -138,9 +147,8 @@ The default value is `0`, which is a special value indicating that all fetched
138147
results should be returned without a row limit.
139148

140149
**`wmi.schema_cache_size`**
141-
: The maximum number of WMI class definitions that can be cached per single query. Every query keeps its own separate cache. This cache helps improve performance when dealing with queries that involve inheritance hierarchies. Read more in [WMI Type Support](#wmi-type-support).
142-
For example, if a superclass is queried, the cache
143-
might store all its derived classes (leaves of the class hierarchy) to optimize subsequent operations.
150+
: The maximum number of WMI class-property pairs that can be cached per single query. Every query keeps its own separate cache.
151+
This cache helps improve performance when dealing with queries that involve inheritance hierarchies. Read more in [WMI Type Support](#wmi-type-support). For example, if a superclass is queried, the cache stores entries for each WMI concrete instance class (the leaves of the class hierarchy) and their associated properties. Therefore, querying a superclass that returns a result set containing instances of `10` different classes, each with `50` properties, will result in a cache size of `500` entries (`10×50`).
144152
The default value is `1000`.
145153

146154
**`wmi.queries`**
@@ -197,17 +205,19 @@ Equivalent YAML Configuration:
197205

198206
- When possible, try querying concrete (leaf) classes or classes closer to the leaves of the WMI inheritance hierarchy. Querying abstract superclasses may require fetching and caching the schema definitions for numerous derived classes, which can lead to increased memory usage and potential performance penalties due to cache misses.
199207

200-
- Set up alerts in Metricbeat for documents with the `error.message` field set.
208+
- Set up Kibana Alerts for documents generated by this metricset with the `error.message` field.
201209

202-
- [Advanced] Configure collection of WMI-Activity Operational Logs (found in Event Viewer under `Applications and Services Logs/Microsoft/Windows/WMI-Activity/Operational`). These logs can be invaluable for correlating issues with Metricbeat WMI warnings or documents containing `error.message`.
210+
- Configure collection of WMI-Activity Operational Logs (found in Event Viewer under `Applications and Services Logs/Microsoft/Windows/WMI-Activity/Operational`). These logs can be invaluable for correlating issues with Metricbeat WMI warnings or documents containing `error.message`.
203211

204212
## Compatibility
205213

206-
This module has been tested on the following platform:
214+
This module has been tested on the following platforms:
207215

208-
- Operating System: Microsoft Windows Server 2019 Datacenter
216+
| Operating System | Architecture |
217+
|---------------------------------------------|--------------|
218+
| Microsoft Windows Server 2019 Datacenter | x64 |
219+
| Microsoft Windows 11 Pro | x64 |
209220

210-
- Architecture: x64
211221

212222
Other Windows versions and architectures may also work but have not been
213223
explicitly tested.

metricbeat/module/windows/wmi/_meta/docs.md

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
This functionality is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.
33
::::
44

5-
6-
The `wmi` metricset of the Windows module reads metrics via Windows Management Instrumentation [(WMI)](https://learn.microsoft.com/en-us/windows/win32/wmisdk/about-wmi), a core management technology in the Windows Operating system.
5+
The `wmi` metricset of the Windows module reads metrics via [Windows Management Instrumentation](https://learn.microsoft.com/en-us/windows/win32/wmisdk/about-wmi) (WMI), a core management technology in the Windows Operating system.
76

87
By leveraging WMI Query Language (WQL), this metricset allows you to extract detailed system information and metrics to monitor the health and performance of Windows Systems.
98

10-
This metricset leverages the [Microsoft WMI](https://github.com/microsoft/wmi), library a convenient wrapper around the [GO-OLE](https://github.com/go-ole) library which allows to invoke the WMI Api.
9+
This metricset leverages the [Microsoft WMI](https://github.com/microsoft/wmi) library, a convenient wrapper around the [GO-OLE](https://github.com/go-ole) library which allows to invoke the WMI API.
1110

1211
## WMI Query Language (WQL) Support
1312

@@ -19,11 +18,14 @@ namespaces.
1918
Currently, the metricset supports queries with `SELECT`, `FROM` and
2019
`WHERE` clauses.
2120

22-
When working with WMI queries, it is the user’s responsibility to ensure
21+
::::{warning}
22+
When working with WMI queries, it is the user's responsibility to ensure
2323
that queries are safe, efficient, and do not cause unintended side
2424
effects. A notorious example of a problematic WMI class is
25-
Win32\_Product. Read more in [Windows
26-
Documentation](https://support.microsoft.com/kb/974524).
25+
`Win32_Product`. Read more in the related [Windows
26+
documentation](https://learn.microsoft.com/en-us/troubleshoot/windows-server/admin-development/windows-installer-reconfigured-all-applications#more-information).
27+
::::
28+
2729

2830
## WMI Arbitrator and Query Execution
2931

@@ -43,30 +45,37 @@ fail, Metricbeat has a timeout mechanism that stops waiting for query
4345
results after a specified timeout. This is controlled by the
4446
`wmi.warning_threshold` setting.
4547

48+
::::{note}
4649
While Metricbeat stops waiting for the result, the underlying WMI query
4750
may continue running until the WMI Arbitrator decides to stop execution.
51+
::::
4852

4953
## WMI Type support
5054

5155
The `microsoft/wmi` library internally uses the WMI Scripting API. This API, as per the
5256
[official WMI Documentation](https://learn.microsoft.com/en-us/windows/win32/wmisdk/querying-wmi),
53-
does not provide direct type conversion for `uint64`, `sint64`, and `datetime` CIM types;
57+
does not provide direct type conversion for `uint64`, `sint64`, and `datetime`
58+
[Common Information Model](https://learn.microsoft.com/en-us/windows/win32/wmisdk/common-information-model) (CIM) types;
5459
instead, these values are returned as strings.
5560

5661
To ensure the correct data type is reported, Metricbeat dynamically fetches the
57-
CIM type definitions for the properties of the WMI instance classes involved in the query,
62+
CIM type definitions for the properties of the WMI instance classes returned by the query,
5863
and then performs the necessary data type conversions.
5964

6065
To optimize performance and avoid repeatedly fetching these schema definitions
6166
for every row and every request, an LRU cache is utilized. This cache stores
62-
the schema definition for each unique WMI class encountered. For queries involving
67+
the schema definition for each WMI class-property pair encountered. For queries involving
6368
superclasses, such as `CIM_LogicalDevice`, the cache will populate with individual entries
6469
for each specific derived class (leaf of the class hierarchy) whose instances are returned by the query (for example, `Win32_DiskDrive` or `Win32_NetworkAdapter`).
6570

6671
::::{note}
6772
The properties of type `CIM_Object` (embedded objects) are not yet supported and are ignored.
6873
::::
6974

75+
::::{note}
76+
Properties of type `CIM_Reference` (references), which are used in [WMI Association Classes](https://learn.microsoft.com/en-us/windows/win32/wmisdk/declaring-an-association-class), are currently returned as string values exactly as reported by the [Microsoft WMI](https://github.com/microsoft/wmi) library.
77+
::::
78+
7079
## Configuration
7180

7281
```yaml
@@ -96,7 +105,7 @@ The properties of type `CIM_Object` (embedded objects) are not yet supported and
96105
97106
**`wmi.namespace`**
98107
: The default WMI namespace used for queries. This can be overridden per
99-
query. The default is `root\cimv2`.
108+
query. The default is `"root\\cimv2"`.
100109

101110
**`wmi.warning_threshold`**
102111
: The time threshold after which Metricbeat will stop waiting for the
@@ -127,9 +136,8 @@ The default value is `0`, which is a special value indicating that all fetched
127136
results should be returned without a row limit.
128137

129138
**`wmi.schema_cache_size`**
130-
: The maximum number of WMI class definitions that can be cached per single query. Every query keeps its own separate cache. This cache helps improve performance when dealing with queries that involve inheritance hierarchies. Read more in [WMI Type Support](#wmi-type-support).
131-
For example, if a superclass is queried, the cache
132-
might store all its derived classes (leaves of the class hierarchy) to optimize subsequent operations.
139+
: The maximum number of WMI class-property pairs that can be cached per single query. Every query keeps its own separate cache.
140+
This cache helps improve performance when dealing with queries that involve inheritance hierarchies. Read more in [WMI Type Support](#wmi-type-support). For example, if a superclass is queried, the cache stores entries for each WMI concrete instance class (the leaves of the class hierarchy) and their associated properties. Therefore, querying a superclass that returns a result set containing instances of `10` different classes, each with `50` properties, will result in a cache size of `500` entries (`10×50`).
133141
The default value is `1000`.
134142

135143
**`wmi.queries`**
@@ -186,17 +194,20 @@ Equivalent YAML Configuration:
186194

187195
- When possible, try querying concrete (leaf) classes or classes closer to the leaves of the WMI inheritance hierarchy. Querying abstract superclasses may require fetching and caching the schema definitions for numerous derived classes, which can lead to increased memory usage and potential performance penalties due to cache misses.
188196

189-
- Set up alerts in Metricbeat for documents with the `error.message` field set.
197+
- Set up Kibana Alerts for documents generated by this metricset with the `error.message` field.
190198

191-
- [Advanced] Configure collection of WMI-Activity Operational Logs (found in Event Viewer under `Applications and Services Logs/Microsoft/Windows/WMI-Activity/Operational`). These logs can be invaluable for correlating issues with Metricbeat WMI warnings or documents containing `error.message`.
199+
- Configure collection of WMI-Activity Operational Logs (found in Event Viewer under `Applications and Services Logs/Microsoft/Windows/WMI-Activity/Operational`). These logs can be invaluable for correlating issues with Metricbeat WMI warnings or documents containing `error.message`.
192200

193201
## Compatibility
194202

195-
This module has been tested on the following platform:
203+
This module has been tested on the following platforms:
196204

197-
- Operating System: Microsoft Windows Server 2019 Datacenter
205+
| Operating System | Architecture |
206+
|---------------------------------------------|--------------|
207+
| Microsoft Windows Server 2019 Datacenter | x64 |
208+
| Microsoft Windows 11 Pro | x64 |
198209

199-
- Architecture: x64
200210

201211
Other Windows versions and architectures may also work but have not been
202212
explicitly tested.
213+

0 commit comments

Comments
 (0)