Skip to content

Commit 2c6df1b

Browse files
update wmi doc to be useful
1 parent 2fe9260 commit 2c6df1b

File tree

3 files changed

+121
-2
lines changed

3 files changed

+121
-2
lines changed

content/integrations/wmi.md

Lines changed: 121 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,134 @@
11
---
2-
title: Datadog-Windows Management Instrumentation Integration
2+
title: Datadog-WMI Integration
33
integration_title: WMI
44
kind: integration
5-
doclevel: basic
5+
newhlevel: true
6+
git_integration_title: wmi
67
---
78

9+
# Overview
810

11+
![WMI Metric](/static/images/wmimetric.png)
912

1013
Get metrics from your Windows applications/servers with Windows Management Instrumentation (WMI) in real time to
1114

1215
* Visualize their performance.
1316
* Correlate their activity with the rest of your applications.
1417

1518
<%= insert_example_links(conf:"wmi_check", check:"wmi_check")%>
19+
20+
# Installation
21+
22+
If you are only collecting standard metrics from Microsoft Windows and other packaged applications, there are no installation steps. If you need to define new metrics to collect from your application, then you have a few options:
23+
24+
1. Submit perfomance counters using System.Diagnostics in .NET, then access them via WMI.
25+
2. Implement a COM-based WMI provider for your application. You would typically only do this if you are using a non-.NET language.
26+
27+
To learn more about using System.Diagnostics, refer to [the MSDN documentation here](https://msdn.microsoft.com/en-us/library/system.diagnostics.performancecounter(v=vs.110).aspx). After adding your metric you should be able to find it in WMI. To browse the WMI namespaces you may find this tool useful: [WMI Explorer](https://wmie.codeplex.com/). You can find the same information with Powershell [here](https://msdn.microsoft.com/en-us/powershell/scripting/getting-started/cookbooks/getting-wmi-objects--get-wmiobject-). Also review the information in the [Datadog Knowledge Base article](https://help.datadoghq.com/hc/en-us/articles/205016075-How-to-retrieve-WMI-metrics).
28+
29+
If you assign the new metric a category of My_New_Metric, the WMI path will be
30+
`\\<ComputerName>\ROOT\CIMV2:Win32_PerfFormattedData_My_New_Metric`
31+
32+
If the metric isn't showing up in WMI, try running `winmgmt /resyncperf` to force the computer to reregister the performance libraries with WMI.
33+
34+
35+
# Configuration
36+
37+
1. Click the **Install Integration** button on the WMI Integration Tile.
38+
2. Open the Datadog Agent Manager on the Windows server.
39+
3. Edit the `Wmi Check` configuration.
40+
41+
init_config:
42+
43+
instances:
44+
- class: Win32_OperatingSystem
45+
metrics:
46+
- [NumberOfProcesses, system.proc.count, gauge]
47+
- [NumberOfUsers, system.users.count, gauge]
48+
49+
- class: Win32_PerfFormattedData_PerfProc_Process
50+
metrics:
51+
- [ThreadCount, proc.threads.count, gauge]
52+
- [VirtualBytes, proc.mem.virtual, gauge]
53+
- [PercentProcessorTime, proc.cpu_pct, gauge]
54+
tag_by: Name
55+
56+
- class: Win32_PerfFormattedData_PerfProc_Process
57+
metrics:
58+
- [IOReadBytesPerSec, proc.io.bytes_read, gauge]
59+
tag_by: Name
60+
tag_queries:
61+
- [IDProcess, Win32_Process, Handle, CommandLine]
62+
63+
Note that the default configuration uses the filter clause to limit the metrics pulled. Either set the filters to valid values or remove them as shown above to collect the metrics.
64+
65+
The metrics definitions include three components: class property in WMI, metric name as it appears in Datadog, and the metric type.
66+
67+
4. Restart the agent.
68+
69+
## Configuration Options
70+
71+
Each WMI query has 2 required options, `class` and `metrics` and six optional options, `host`, `namespace`, `filters`, `tag_by`, `constant_tags` and `tag_queries`.
72+
73+
`host` is the optional target of the WMI query, `localhost` is assumed by default if you set this option, make sure that Remote Management is enabled on the target host [see here](https://technet.microsoft.com/en-us/library/Hh921475.aspx) for more information.
74+
75+
`class` is the name of the WMI class, for example `Win32_OperatingSystem` or `Win32_PerfFormattedData_PerfProc_Process`. You can find many of the standard class names on the [MSDN docs](http://msdn.microsoft.com/en-us/library/windows/desktop/aa394084.aspx).
76+
77+
The `Win32_FormattedData_*` classes provide many useful performance counters by default.
78+
79+
`namespace` is the optionnal WMI namespace to connect to (default to `cimv2`).
80+
81+
`provider` is the optional WMI provider (default to `32` on Datadog Agent 32-bit or `64`). It is used to request WMI data from the non-default provider. Available options are: `32` or `64`.
82+
For more information: [https://msdn.microsoft.com/en-us/library/aa393067.aspx](https://msdn.microsoft.com/en-us/library/aa393067.aspx)
83+
84+
`metrics` is a list of metrics you want to capture, with each item in the
85+
list being a set of [WMI property name, metric name, metric type].
86+
87+
- The property name is something like `NumberOfUsers` or `ThreadCount`.
88+
The standard properties are also available on the MSDN docs for each
89+
class.
90+
91+
- The metric name is the name you want to show up in Datadog.
92+
93+
- The metric type is from the standard choices for all agent checks, such as gauge, rate, histogram or counter.
94+
95+
`filters` is a list of filters on the WMI query you may want. For example, for a process-based WMI class you may want metrics for only certain processes running on your machine, so you could add a filter for each process name. You can also use the '%' character as a wildcard.
96+
97+
See below for examples.
98+
99+
`tag_by` optionally lets you tag each metric with a property from the WMI class you're using. This is only useful when you will have multiple values for your WMI query. The examples below show how you can tag your process metrics with the process name (giving a tag of "name:app_name").
100+
101+
`constant_tags` optionally lets you tag each metric with a set of fixed values.
102+
103+
`tag_queries` optionally lets you specify a list of queries, to tag metrics with a target class property. Each item in the list is a set of \[link source property, target class, link target class property, target property] where:
104+
105+
- 'link source property' contains the link value
106+
107+
- 'target class' is the class to link to
108+
109+
- 'link target class property' is the target class property to link to
110+
111+
- 'target property' contains the value to tag with
112+
113+
It translates to a WMI query:
114+
115+
SELECT 'target property' FROM 'target class' WHERE 'link target class property' = 'link source property'
116+
117+
Note: setting this will cause any instance number to be removed from tag_by values
118+
i.e. name:process#1 => name:process
119+
120+
This feature is available starting with version 5.3 of the agent
121+
122+
123+
124+
125+
# Validation
126+
127+
To validate your installation and configuration, click the Agent Status menu from the Logs and Status button. The output should contain a section similar to the following:
128+
129+
![wmivalidate](/static/images/wmivalidate.png)
130+
{: style="width:400px;"}
131+
132+
133+
134+

content/static/images/wmimetric.png

13.6 KB
Loading

content/static/images/wmivalidate.png

10.1 KB
Loading

0 commit comments

Comments
 (0)