# How can I assosiate some metrics collected by WMI extension with a process?

**URL:** <https://community.dynatrace.com/t/how-can-i-assosiate-some-metrics-collected-by-wmi-extension-with-a-process/36514>\
**Category:** Extensions\
**Tags:** dynatrace-managed, extensions\
**Created:** [September 13, 2022, 10:48am UTC](https://community.dynatrace.com/t/how-can-i-assosiate-some-metrics-collected-by-wmi-extension-with-a-process/36514 "2022-09-13T10:48:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rab](https://avatars.discourse-cdn.com/v4/letter/r/b38774/32.png) [@rab](https://community.dynatrace.com/u/rab)\
**Post date:** [September 13, 2022, 10:48am UTC](https://community.dynatrace.com/t/how-can-i-assosiate-some-metrics-collected-by-wmi-extension-with-a-process/36514/1 "2022-09-13T10:48:12Z")

</div>

We have a custom WMI extension working, just have a simple question:

Generally, metrics in Dynatrace can be associated with hosts, processes, or more by assigning values to _Dynatrace reserved dimensions_, as described in the doc of the metrics ingestion protocol: [Metric ingestion protocol — Dynatrace Docs](https://www.dynatrace.com/support/help/extend-dynatrace/extend-metrics/reference/metric-ingestion-protocol#dimension)

Now, metrics collected using the WMI extension seem to be associated with **the host** by default. We wish to associate some metrics with **a process**. This is not documented in the docs for WMI: [WMI data source tutorial — Dynatrace Docs](http://dynatrace.com/support/help/extend-dynatrace/extensions20/data-sources/wmi-extensions/wmi-tutorial).

How can we create this topology?

---

<div class="post-metadata">

**Author:** ![Mike\_L](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mike_l/32/11717_2.png) [@Mike\_L](https://community.dynatrace.com/u/Mike_L)\
**Post date:** [November 30, 2022, 10:25am UTC](https://community.dynatrace.com/t/how-can-i-assosiate-some-metrics-collected-by-wmi-extension-with-a-process/36514/2 "2022-11-30T10:25:16Z")

</div>

You’ve got a couple of options here. These are the two easiest ones as they are programmatic.

1: If you can get the process ID through a call, you can add that as a dimension. It’d then be translated to the process instance id and process group id.

For example, this metric line:

```auto
myMetric dt.process.id=12345 1

```

would become

```auto
myMetric dt.entity.process_group_instance=PROCESS_GROUP_INSTANCE-D337020E5CAE4F0F,dt.entity.process_group=PROCESS_GROUP-D337020E5CAE4F0D 1

```

Example yaml:

```c-mrkdwn__pre
wmi:
  - group: WMIClasses
    interval: 10~
    featureSet: basic
    subgroups:
      - subgroup: ZoomCamera
        wmiNamespace: root\cimv2
        query: SELECT Name, Status, PID FROM Win32_PnPEntity WHERE PNPClass='Camera'
        dimensions:
          - key: camera.name
            value: Name
          - key: camera.status
            value: Status
          - key: dt.process.id
            value: PID

```

2: If you can define the process detection rule in the same yaml, you can reference that in the wmi section to automatically add the process instance id and process group id.

For example:

```c-mrkdwn__pre
processes:
  - name: ZoomTech
    detection:
      - id: zoomtech
        processGroupName: Zoom
        rules:
        - property: executable
          condition: "$prefix(Zoom)"
wmi:
  - group: WMIClasses
    interval: 10~
    featureSet: basic
    subgroups:
      - subgroup: ZoomCamera
        wmiNamespace: root\cimv2
        query: SELECT Name, Status FROM Win32_PnPEntity WHERE PNPClass='Camera'
        dimensions:
          - key: camera.name
            value: Name
          - key: camera.status
            value: Status
          - key: dt.techrule.id
            value: const:zoomtech

```
