24 Jun 2025
02:31 PM
- last edited on
25 Jun 2025
07:19 AM
by
MaciejNeumann
A lot of WMI state and status values are reported as numbers and there is no value that has the enumerated description of those state values.
So, how can we display those states as the actual text description found in the WMI Class documentation?
An example is PowerState found in the Win32_ComputerSystem class.
0 = Unknown
1 = Full Power
2 = Low Power Mode
etc...
I know how to setup an enumeration in the extensions.yaml for a variable, but how do you use an enum to convert the number that the WMI query returns into a text value that I can use as a dimension for my metrics?
Are there any examples of this in any WMI extensions? I've looked in several (SQL, Exchange, and Remote Host) and not seen it done anywhere.
24 Jun 2025 05:27 PM
Hi @36Krazyfists ,
I seriously doubt that it’s possible using the WMI extension, as extensions usually return metrics. Can we use DQL to convert those values into meaningful text? Will that work here ?
25 Jun 2025 02:58 PM - edited 25 Jun 2025 02:58 PM
Well, extensions do a LOT more than just return metrics. Plus, SNMP extensions can enumerate values when the MIB file for the corresponding OID's are loaded on the ActiveGates running the extension.
And yes, it could be done via DQL, but that would mean you'd have to write that query every time you want to dashboard or alert on that data. That would be a huge pain.
25 Jun 2025 03:45 PM
I think it makes more sense to do it in OpenPipeline than in DQL. It is currently not possible to do it in the WMI data source. You can raise a product idea for it.
25 Jun 2025 07:30 PM
These are dimensions I'd like to enumerate on metrics. OpenPipeline doesn't apply here. At least not at this time (although I did here that metrics were going to be added to OpenPipeline parsing eventually).
Regardless, I would argue that it makes much more sense to do that in the extension.yaml file, as there is already an ability to declare enum objects for variables and it would be much more convenient to declare that as a package deal bundled in with the extension config.
They just need to add the ability to declare enums for dimensions so that any numeric value in a dimension can be converted to the matching string using the mapping of a corresponding enum object.