Homeโ€บ๐Ÿ Python Extensionsโ€บModule 111 min read ยท 12/16

Python Topology & Screens

Hands-on2 exercises

Python Topology

Topology works the same as SNMP โ€” define entity types in extension.yaml. The difference: dimensions come from your report_metric() calls, not OIDs.

topology:
  types:
    - name: my_api:server
      displayName: API Server
      enabled: true
      rules:
        - idPattern: my_api_server_{device.address}
          instanceNamePattern: "{node.name} ({device.address})"
          sources:
            - sourceType: Metrics
              condition: $prefix(my_ext)
          requiredDimensions:
            - key: device.address
          role: default

๐Ÿ’ก The dimension keys in report_metric() must match requiredDimensions and idPattern placeholders exactly.

๐Ÿ›  Try it

Add a parent entity lb_topo:device with role: default. Use device.address in the idPattern.

extension.yamlYAML
Loading...

Screens for Python Extensions

Identical to SNMP screens โ€” same chartsCards, entitiesListCards, same metricSelector syntax:

screens:
  - entityType: my_api:server
    detailsSettings:
      staticContent:
        showProblems: true
        showProperties: true
      layout:
        autoGenerate: false
        cards:
          - key: overview
            type: CHART_GROUP
    chartsCards:
      - key: overview
        displayName: Overview
        charts:
          - displayName: CPU
            visualizationType: GRAPH_CHART
            graphChartConfig:
              metrics:
                - metricSelector: my_ext.cpu:splitBy("dt.entity.my_api:server")

Multiple Entity Types

Report metrics with different dimension sets to create parent and child entities:

# Parent entity (device-level dims only)
self.report_metric("my_ext.uptime", uptime, {"device.address": host})

# Child entity (device + child dims)
self.report_metric("my_ext.port.status", status, {
    "device.address": host,
    "port.name": port["name"]
})
๐Ÿ›  Try itExercise 2

Add a CHILD_OF relationship from lb_topo:pool to lb_topo:device.

extension.yamlYAML
Loading...

What's Next

Module 12 โ€” Testing and debugging your Python extension.