Homeβ€ΊπŸ“‘ SNMP Extensionsβ€ΊModule 71 min read Β· 8/16

Calculated Metrics (func:)

Hands-on

What Are func: Metrics?

Extension metrics β€” including calculated func: metrics

Calculated metrics let you compute values server-side without writing code. Prefix the key with func::

- key: func:my_ext.uptime_hours
  value: metric:my_ext.uptime_ticks
  operand: 100
  operator: DIVIDE
  type: gauge

Available Operators

Operator   What It Does                Example
─────────  ──────────────────────────  ──────────────────────────
DIVIDE     metric / operand            Ticks β†’ hours (Γ· 360000)
MULTIPLY   metric Γ— operand            Bytes β†’ bits (Γ— 8)
ADD        metric + operand            Offset correction
SUBTRACT   metric - operand            Baseline subtraction
REMAINDER  metric % operand            Modulo

Common Patterns

# Convert SNMP ticks (1/100 sec) to hours
- key: func:my_ext.uptime_hours
  value: metric:my_ext.uptime_ticks
  operand: 360000
  operator: DIVIDE
  type: gauge

# Convert bytes to megabytes
- key: func:my_ext.memory_mb
  value: metric:my_ext.memory_bytes
  operand: 1048576
  operator: DIVIDE
  type: gauge

# Percentage from two counters
- key: func:my_ext.error_rate
  value: metric:my_ext.errors.count
  operand: metric:my_ext.total.count
  operator: DIVIDE
  type: gauge

⚠️ func: metrics are NOT stored in Grail β€” they only work in entity screens and classic dashboards. For Gen3 DQL dashboards, do the math in DQL instead.

πŸ’‘ Use func: metrics for unit conversions (ticksβ†’hours, bytesβ†’MB) and simple ratios. For complex calculations, use Python extensions instead.

πŸ›  Try it: Open Ctrl+K β†’ "Metrics" β†’ search for "func:" to find calculated metrics from extensions. These are computed at query time from raw metrics β€” they don't cost extra storage but give you derived insights like utilization percentages.