From OIDs to Metrics
Every metric needs three things: a key, a value (the OID), and a type.
metrics:
- key: my_device.cpu_usage
value: oid:1.3.6.1.4.1.9.9.109.1.1.1.1.8
type: gauge
Metric Types
| Type | Behavior | Examples | Key Suffix |
|---|---|---|---|
gauge | Point-in-time value, stored as-is | CPU %, temperature, memory | No .count |
count | Cumulative counter, Dynatrace calculates rate | Bytes, packets, errors | Must end in .count |
๐ก If the value only goes up (until reset) โ count. If it fluctuates โ gauge.
Metric Key Naming
Prefix with your extension name. The .count suffix rule is enforced by the validator:
# Correct
- key: cisco_aci.cpu_usage # gauge โ no .count
type: gauge
- key: cisco_aci.if.in.octets.count # count โ has .count
type: count
# Wrong โ triggers DED006/DED007 warnings
- key: cisco_aci.if.in.octets # count missing .count suffix
type: count
Add a CPU metric with the correct type. CPU usage is a point-in-time percentage โ is that gauge or count?
Metric Metadata
Define display names and units in the top-level metrics: section:
metrics:
- key: my_device.cpu_usage
metadata:
displayName: CPU Usage (5 min avg)
unit: Percent
Available units:
| Unit | Use For |
|---|---|
Percent | CPU, memory, bandwidth utilization |
Byte | Memory, disk, traffic volumes |
Count | Packets, errors, sessions |
MilliSecond | Latency, response time |
Celsius | Temperature sensors |
MegaBit | Interface speed |
Unspecified | Anything else |
Dimensions
Dimensions are labels attached to metrics. Three value sources:
dimensions:
- key: device.address
value: this:device.address # from monitoring config
- key: sys.name
value: oid:1.3.6.1.2.1.1.5.0 # from SNMP device
- key: device.type
value: const:Cisco Switch # hardcoded constant
๐ก oid: = read from device, this: = from monitoring config, const: = hardcoded value.
Add a const: dimension for device type and an oid: dimension for sysDescr (1.3.6.1.2.1.1.1.0).
What's Next
In Module 3, you'll organize metrics into groups and feature sets โ so users can toggle monitoring sections on/off.