Homeโ€บ๐Ÿ“ก SNMP Extensionsโ€บModule 21 min read ยท 3/16

Metrics & Dimensions

Hands-on2 exercises

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

TypeBehaviorExamplesKey Suffix
gaugePoint-in-time value, stored as-isCPU %, temperature, memoryNo .count
countCumulative counter, Dynatrace calculates rateBytes, packets, errorsMust 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
๐Ÿ›  Try it

Add a CPU metric with the correct type. CPU usage is a point-in-time percentage โ€” is that gauge or count?

extension.yamlYAML
Loading...

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:

UnitUse For
PercentCPU, memory, bandwidth utilization
ByteMemory, disk, traffic volumes
CountPackets, errors, sessions
MilliSecondLatency, response time
CelsiusTemperature sensors
MegaBitInterface speed
UnspecifiedAnything 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.

๐Ÿ›  Try itExercise 2

Add a const: dimension for device type and an oid: dimension for sysDescr (1.3.6.1.2.1.1.1.0).

extension.yamlYAML
Loading...

What's Next

In Module 3, you'll organize metrics into groups and feature sets โ€” so users can toggle monitoring sections on/off.