šŸ“” SNMP Extensions — Module 6

Screens & Dashboards

Hands-on

Extension Screens

Screens define how your entity data appears in the Dynatrace UI. Every entity type needs two views:

  • List view — shows all entities of this type in a table
  • Detail view — shows one entity's metrics, properties, and children

Screen Structure

screens:
  - entityType: my_device:device
    listSettings:
      staticContent:
        header:
          title: Network Devices
        breadcrumbs:
          - type: NOOP
            displayName: Infrastructure
          - type: NOOP
            displayName: Network Devices
      layout:
        autoGenerate: false
        cards:
          - key: device_list
            type: ENTITIES_LIST

    detailsSettings:
      staticContent:
        showProblems: true
        showProperties: true
        showTags: true
      layout:
        autoGenerate: false
        cards:
          - key: device_health
            type: CHART_GROUP
          - key: interface_list
            type: ENTITIES_LIST

Chart Cards

Define charts that appear on the detail page:

    chartsCards:
      - key: device_health
        displayName: Device Health
        numberOfVisibleCharts: 2
        charts:
          - displayName: CPU Usage
            visualizationType: GRAPH_CHART
            graphChartConfig:
              connectGaps: true
              metrics:
                - metricSelector: my_device.cpu_usage:splitBy("dt.entity.my_device:device")
              yAxes:
                - key: cpu
                  position: LEFT
                  visible: true
                  min: "0"
                  max: "100"

          - displayName: Uptime
            visualizationType: SINGLE_VALUE
            singleValueConfig:
              metric:
                metricSelector: func:my_device.uptime_hours:splitBy("dt.entity.my_device:device")

          - displayName: Memory Used
            visualizationType: GRAPH_CHART
            graphChartConfig:
              metrics:
                - metricSelector: my_device.memory_used:splitBy("dt.entity.my_device:device")

Visualization types:

  • GRAPH_CHART — Time series line chart
  • SINGLE_VALUE — Big number display (great for uptime, status)
  • TABLE — Tabular data

The metricSelector must include :splitBy("dt.entity.{type}") to scope data to the current entity.

Child Entity Lists

Show interfaces, PSUs, sensors on the parent device's detail page:

    entitiesListCards:
      - key: interface_list
        pageSize: 10
        displayName: Interfaces
        entitySelectorTemplate: type(my_device:interface),fromRelationships.isChildOf($(entityConditions))
        displayCharts: true
        charts:
          - displayName: Traffic In
            visualizationType: GRAPH_CHART
            graphChartConfig:
              metrics:
                - metricSelector: "((my_device.if.in.octets.count) * (8)):rate(1s):splitBy()"

          - displayName: Traffic Out
            visualizationType: GRAPH_CHART
            graphChartConfig:
              metrics:
                - metricSelector: "((my_device.if.out.octets.count) * (8)):rate(1s):splitBy()"

The entitySelectorTemplate uses fromRelationships.isChildOf($(entityConditions)) to find all children of the current parent entity.

Child Entity Screens

Each child type also needs its own screens:

  - entityType: my_device:interface
    listSettings:
      staticContent:
        header:
          title: Network Interfaces
      layout:
        autoGenerate: false
        cards:
          - key: if_list
            type: ENTITIES_LIST
    detailsSettings:
      staticContent:
        showProblems: true
        showProperties: true
      layout:
        autoGenerate: false
        cards:
          - key: if_charts
            type: CHART_GROUP
    chartsCards:
      - key: if_charts
        displayName: Interface Metrics
        charts:
          - displayName: Speed (Mbps)
            visualizationType: SINGLE_VALUE
            singleValueConfig:
              metric:
                metricSelector: my_device.if.speed:splitBy("dt.entity.my_device:interface")
          - displayName: Bytes In
            visualizationType: GRAPH_CHART
            graphChartConfig:
              metrics:
                - metricSelector: my_device.if.in.octets.count:splitBy("dt.entity.my_device:interface")

Dashboards

Dashboards are JSON files in the dashboards/ directory, referenced from extension.yaml:

dashboards:
  - path: dashboards/overview.json

Dashboard JSON follows the Dynatrace Dashboard API format. You can create one in the Dynatrace UI, export it, and include it in your extension.

Screen Rules

Rule                                                    Why
──────────────────────────────────────────────────────  ──────────────────────────
Every entity type needs listSettings + detailsSettings  Or the UI shows nothing
CHART_GROUP cards reference chartsCards by key           Keys must match exactly
ENTITIES_LIST cards reference entitiesListCards by key   Keys must match exactly
metricSelector must include :splitBy()                  Scopes to current entity
Child lists use fromRelationships.isChildOf()           Finds children of parent
autoGenerate: false for custom layouts                  true = Dynatrace guesses

What's Next

In Module 7, we'll add calculated metrics (func:) — server-side computed metrics like uptime in hours, memory percentage, and bandwidth utilization that don't exist as raw OIDs.

šŸ›  Hands-On Exercise

Edit the YAML in the editor, then click "Check My Work" to validate.

Build Entity Screens

Add screens to display your device and interface entities in the Dynatrace UI.

  • Create a screen for screen_lab:device with a chart card showing sysUpTime as SINGLE_VALUE
  • Add an ENTITIES_LIST card on the device detail page showing child interfaces
  • Create a screen for screen_lab:interface with a traffic chart (GRAPH_CHART)
  • Remember: metricSelector in charts must include :splitBy() with the entity dimension
extension.yamlYAML
Loading...