Legacy switch · SNMP selection self-repair

miagent run report · workdir snmp-oldswitch2
PASS 9/9 expected metrics verified
http://127.0.0.1:9132/snmp?target=127.0.0.1%3A11162&module=if_mib&auth=public_v2
1
repair iterations
2
model calls
21.2K
tokens in
3.3K
tokens out
2
validation runs
17
series scraped
Every validation run above cost 0 tokens: correctness is decided by scraping the artifact and diffing against the IR, never by a model. Models are used only to read docs, generate the artifact, and repair it.

Pipeline

StageExecuted byModelCost
Parse MIBdeterministic code—
Compile artifactsdeterministic code—
Run + validatedeterministic code—2 run(s), 0 tokens
Per-stage attribution was added after this run; only totals are available here.

Validation diff · expected (IR) vs observed (scrape)

MetricTypeObservedSeriesSampleLabelsNote
✓network_interface_countgaugegauge12—
✓network_interface_admin_statusgaugegauge21ifIndex, interface
✓network_interface_oper_statusgaugegauge21ifIndex, interface
✓network_interface_last_change_secondsgaugegauge212ifIndex, interface
✓network_interface_speed_bitsgaugegauge2100,000,000ifIndex, interface
✓network_interface_receive_bytes_totalcountercounter2161,102ifIndex, interface
✓network_interface_transmit_bytes_totalcountercounter2165,696ifIndex, interface
✓network_interface_receive_errors_totalcountercounter212ifIndex, interface
✓network_interface_transmit_errors_totalcountercounter23ifIndex, interface

Repair history

iteration 0 · FAIL 6/19 metrics

failures: missing_metric ×13
evidence fed to repair: live device walk — 21 responding OID(s) (an object absent here is not implemented, so repair must substitute or drop it)

iteration 1 · PASS 9/9 metrics

Cost ledger

ModelCallsTokens inTokens out
sonnet221.2K3.3K
total221.2K3.3K
validation (2 run(s))000

Artifacts

snmp.yml — Compiled snmp_exporter config · 143 lines
auths:
  public_v2:
    community: oldswitch
    security_level: noAuthNoPriv
    auth_protocol: MD5
    priv_protocol: DES
    version: 2
modules:
  if_mib:
    walk:
    - 1.3.6.1.2.1.2.1
    - 1.3.6.1.2.1.2.2.1.2
    - 1.3.6.1.2.1.2.2.1.5
    - 1.3.6.1.2.1.2.2.1.7
    - 1.3.6.1.2.1.2.2.1.8
    - 1.3.6.1.2.1.2.2.1.9
    - 1.3.6.1.2.1.2.2.1.10
    - 1.3.6.1.2.1.2.2.1.14
    - 1.3.6.1.2.1.2.2.1.16
    - 1.3.6.1.2.1.2.2.1.20
    metrics:
    - name: network_interface_count
      oid: 1.3.6.1.2.1.2.1
      type: gauge
      help: Number of network interfaces present on the system. - ifNumber (1.3.6.1.2.1.2.1)
    - name: network_interface_admin_status
      oid: 1.3.6.1.2.1.2.2.1.7
      type: gauge
      help: Desired interface state (1=up, 2=down, 3=testing). - ifAdminStatus (1.3.6.1.2.1.2.2.1.7)
      indexes:
      - labelname: ifIndex
        type: gauge
      lookups:
      - labels:
        - ifIndex
        labelname: interface
        oid: 1.3.6.1.2.1.2.2.1.2
        type: DisplayString
      enum_values:
        1: up
        2: down
        3: testing
    - name: network_interface_oper_status
      oid: 1.3.6.1.2.1.2.2.1.8
      type: gauge
      help: Current operational state (1=up, 2=down, 3=testing, 4=unknown, 5=dormant, 6=notPresent, 7=lowerLayerDown). - ifOperStatus (1.3.6.1.2.1.2.2.1.8)
      indexes:
      - labelname: ifIndex
        type: gauge
      lookups:
      - labels:
        - ifIndex
        labelname: interface
        oid: 1.3.6.1.2.1.2.2.1.2
        type: DisplayString
      enum_values:
        1: up
        2: down
        3: testing
        4: unknown
        5: dormant
        6: notPresent
        7: lowerLayerDown
    - name: network_interface_last_change_seconds
      oid: 1.3.6.1.2.1.2.2.1.9
      type: gauge
      help: sysUpTime value (in timeticks) when the interface entered its current operational state. - ifLastChange (1.3.6.1.2.1.2.2.1.9)
      scale: 0.01
      indexes:
      - labelname: ifIndex
        type: gauge
      lookups:
      - labels:
        - ifIndex
        labelname: interface
        oid: 1.3.6.1.2.1.2.2.1.2
        type: DisplayString
    - name: network_interface_speed_bits
      oid: 1.3.6.1.2.1.2.2.1.5
      type: gauge
      help: Estimate of the interface's current bandwidth in bits per second (32-bit ifTable object; ifHighSpeed is not implemented on this device). - ifSpeed (1.3.6.1.2.1.2.2.1.5)
      indexes:
      - labelname: ifIndex
        type: gauge
      lookups:
      - labels:
        - ifIndex
        labelname: interface
        oid: 1.3.6.1.2.1.2.2.1.2
        type: DisplayString
    - name: network_interface_receive_bytes_total
      oid: 1.3.6.1.2.1.2.2.1.10
      type: counter
      help: Total octets received on the interface (32-bit counter; ifHCInOctets is not implemented on this device). - ifInOctets (1.3.6.1.2.1.2.2.1.10)
      indexes:
      - labelname: ifIndex
        type: gauge
      lookups:
      - labels:
        - ifIndex
        labelname: interface
        oid: 1.3.6.1.2.1.2.2.1.2
        type: DisplayString
    - name: network_interface_transmit_bytes_total
      oid: 1.3.6.1.2.1.2.2.1.16
      type: counter
      help: Total octets transmitted out of the interface (32-bit counter; ifHCOutOctets is not implemented on this device). - ifOutOctets (1.3.6.1.2.1.2.2.1.16)
      indexes:
      - labelname: ifIndex
        type: gauge
      lookups:
      - labels:
        - ifIndex
        labelname: interface
        oid: 1.3.6.1.2.1.2.2.1.2
        type: DisplayString
    - name: network_interface_receive_errors_total
      oid: 1.3.6.1.2.1.2.2.1.14
      type: counter
      help: Inbound packets that contained errors preventing delivery to a higher layer. - ifInErrors (1.3.6.1.2.1.2.2.1.14)
      indexes:
      - labelname: ifIndex
        type: gauge
      lookups:
      - labels:
        - ifIndex
        labelname: interface
        oid: 1.3.6.1.2.1.2.2.1.2
        type: DisplayString
    - name: network_interface_transmit_errors_total
      oid: 1.3.6.1.2.1.2.2.1.20
      type: counter
      help: Outbound packets that could not be transmitted because of errors. - ifOutErrors (1.3.6.1.2.1.2.2.1.20)
      indexes:
      - labelname: ifIndex
        type: gauge
      lookups:
      - labels:
        - ifIndex
        labelname: interface
        oid: 1.3.6.1.2.1.2.2.1.2
        type: DisplayString
generator.yml — generator.yml (human-maintained source) · 47 lines
# snmp_exporter generator config, produced by migen.
# MIB modules required: IF-MIB
# Run: generator generate -m <mib-dir> -g generator.yml -o snmp.yml
# NOTE: `rename_to` under overrides is a migen annotation recording the
# intended Prometheus metric name; the upstream generator ignores it.
auths:
  public_v2:
    community: public
    version: 2
modules:
  if_mib:
    walk:
    - ifAdminStatus
    - ifDescr
    - ifInErrors
    - ifInOctets
    - ifLastChange
    - ifNumber
    - ifOperStatus
    - ifOutErrors
    - ifOutOctets
    - ifSpeed
    lookups:
    - source_indexes:
      - ifIndex
      lookup: ifDescr
      drop_source_indexes: false
    overrides:
      ifNumber:
        rename_to: network_interface_count
      ifAdminStatus:
        rename_to: network_interface_admin_status
      ifOperStatus:
        rename_to: network_interface_oper_status
      ifLastChange:
        rename_to: network_interface_last_change_timeticks_seconds
      ifSpeed:
        rename_to: network_interface_speed_bits
      ifInOctets:
        rename_to: network_interface_receive_bytes_total
      ifOutOctets:
        rename_to: network_interface_transmit_bytes_total
      ifInErrors:
        rename_to: network_interface_receive_errors_total
      ifOutErrors:
        rename_to: network_interface_transmit_errors_total
spec.json — Metric IR (validation contract) · 238 lines
{
  "service": "oldswitch",
  "kind": "snmp_generator",
  "endpoints": [
    {
      "url": "127.0.0.1:11162",
      "method": "GET",
      "auth": "none",
      "auth_detail": "",
      "response_format": "snmp",
      "notes": "snmp_exporter module=if_mib, auth=public_v2"
    }
  ],
  "metrics": [
    {
      "name": "network_interface_count",
      "type": "gauge",
      "help": "Number of network interfaces present on the system.",
      "unit": "",
      "labels": [],
      "value": {
        "min": null,
        "max": null
      },
      "source": "SNMP ifNumber oid=1.3.6.1.2.1.2.1 module=IF-MIB",
      "required": true
    },
    {
      "name": "network_interface_admin_status",
      "type": "gauge",
      "help": "Desired interface state (1=up, 2=down, 3=testing).",
      "unit": "",
      "labels": [
        {
          "name": "ifIndex",
          "description": "table index ifIndex",
          "allowed_values": null,
          "required": true
        },
        {
          "name": "interface",
          "description": "lookup from ifDescr",
          "allowed_values": null,
          "required": true
        }
      ],
      "value": {
        "min": null,
        "max": null
      },
      "source": "SNMP ifAdminStatus oid=1.3.6.1.2.1.2.2.1.7 module=IF-MIB",
      "required": true
    },
    {
      "name": "network_interface_oper_status",
      "type": "gauge",
      "help": "Current operational state (1=up, 2=down, 3=testing, 4=unknown, 5=dormant, 6=notPresent, 7=lowerLayerDown).",
      "unit": "",
      "labels": [
        {
          "name": "ifIndex",
          "description": "table index ifIndex",
          "allowed_values": null,
          "required": true
        },
        {
          "name": "interface",
          "description": "lookup from ifDescr",
          "allowed_values": null,
          "required": true
        }
      ],
      "value": {
        "min": null,
        "max": null
      },
      "source": "SNMP ifOperStatus oid=1.3.6.1.2.1.2.2.1.8 module=IF-MIB",
      "required": true
    },
    {
      "name": "network_interface_last_change_seconds",
      "type": "gauge",
      "help": "sysUpTime value (in timeticks) when the interface entered its current operational state.",
      "unit": "",
      "labels": [
        {
          "name": "ifIndex",
          "description": "table index ifIndex",
          "allowed_values": null,
          "required": true
        },
        {
          "name": "interface",
          "description": "lookup from ifDescr",
          "allowed_values": null,
          "required": true
        }
      ],
      "value": {
        "min": null,
        "max": null
      },
      "source": "SNMP ifLastChange oid=1.3.6.1.2.1.2.2.1.9 module=IF-MIB",
      "required": true
    },
    {
      "name": "network_interface_speed_bits",
      "type": "gauge",
      "help": "Estimate of the interface's current bandwidth in bits per second (32-bit ifTable object; ifHighSpeed is not implemented on this device).",
      "unit": "",
      "labels": [
        {
          "name": "ifIndex",
          "description": "table index ifIndex",
          "allowed_values": null,
          "required": true
        },
        {
          "name": "interface",
          "description": "lookup from ifDescr",
          "allowed_values": null,
          "required": true
        }
      ],
      "value": {
        "min": null,
        "max": null
      },
      "source": "SNMP ifSpeed oid=1.3.6.1.2.1.2.2.1.5 module=IF-MIB",
      "required": true
    },
    {
      "name": "network_interface_receive_bytes_total",
      "type": "counter",
      "help": "Total octets received on the interface (32-bit counter; ifHCInOctets is not implemented on this device).",
      "unit": "",
      "labels": [
        {
          "name": "ifIndex",
          "description": "table index ifIndex",
          "allowed_values": null,
          "required": true
        },
        {
          "name": "interface",
          "description": "lookup from ifDescr",
          "allowed_values": null,
          "required": true
        }
      ],
      "value": {
        "min": 0.0,
        "max": null
      },
      "source": "SNMP ifInOctets oid=1.3.6.1.2.1.2.2.1.10 module=IF-MIB",
      "required": true
    },
    {
      "name": "network_interface_transmit_bytes_total",
      "type": "counter",
      "help": "Total octets transmitted out of the interface (32-bit counter; ifHCOutOctets is not implemented on this device).",
      "unit": "",
      "labels": [
        {
          "name": "ifIndex",
          "description": "table index ifIndex",
          "allowed_values": null,
          "required": true
        },
        {
          "name": "interface",
          "description": "lookup from ifDescr",
          "allowed_values": null,
          "required": true
        }
      ],
      "value": {
        "min": 0.0,
        "max": null
      },
      "source": "SNMP ifOutOctets oid=1.3.6.1.2.1.2.2.1.16 module=IF-MIB",
      "required": true
    },
    {
      "name": "network_interface_receive_errors_total",
      "type": "counter",
      "help": "Inbound packets that contained errors preventing delivery to a higher layer.",
      "unit": "",
      "labels": [
        {
          "name": "ifIndex",
          "description": "table index ifIndex",
          "allowed_values": null,
          "required": true
        },
        {
          "name": "interface",
          "description": "lookup from ifDescr",
          "allowed_values": null,
          "required": true
        }
      ],
      "value": {
        "min": 0.0,
        "max": null
      },
      "source": "SNMP ifInErrors oid=1.3.6.1.2.1.2.2.1.14 module=IF-MIB",
      "required": true
    },
    {
      "name": "network_interface_transmit_errors_total",
      "type": "counter",
      "help": "Outbound packets that could not be transmitted because of errors.",
      "unit": "",
      "labels": [
        {
          "name": "ifIndex",
          "description": "table index ifIndex",
          "allowed_values": null,
          "required": true
        },
        {
          "name": "interface",
          "description": "lookup from ifDescr",
          "allowed_values": null,
          "required": true
        }
      ],
      "value": {
        "min": 0.0,
        "max": null
      },
      "source": "SNMP ifOutErrors oid=1.3.6.1.2.1.2.2.1.20 module=IF-MIB",
      "required": true
    }
  ],
  "notes": "Device implements only ifNumber and a subset of ifTable; ifXTable (1.3.6.1.2.1.31.1.1) returned nothing, so all ifHC* counters and ifHighSpeed were replaced by 32-bit equivalents where present (ifInOctets, ifOutOctets, ifSpeed). ifSpeed is reported in bits per second, so the metric is named _bits rather than _megabits. Dropped with no working equivalent in the walk: unicast/multicast/broadcast packet counters (ifInUcastPkts, ifOutUcastPkts, ifHC*), ifInDiscards, ifOutDiscards, ifInUnknownProtos, ifOutQLen. Counters are 32-bit and may wrap on fast links; at 100 Mbps this is acceptable with rate() at typical scrape intervals. Lookup remains ifIndex -> ifDescr, which returned values."
}
selection.json — SNMP selection (the one model-produced artifact) · 60 lines
{
  "module_name": "if_mib",
  "metrics": [
    {
      "mib_object": "ifNumber",
      "metric_name": "network_interface_count",
      "help": "Number of network interfaces present on the system."
    },
    {
      "mib_object": "ifAdminStatus",
      "metric_name": "network_interface_admin_status",
      "help": "Desired interface state (1=up, 2=down, 3=testing)."
    },
    {
      "mib_object": "ifOperStatus",
      "metric_name": "network_interface_oper_status",
      "help": "Current operational state (1=up, 2=down, 3=testing, 4=unknown, 5=dormant, 6=notPresent, 7=lowerLayerDown)."
    },
    {
      "mib_object": "ifLastChange",
      "metric_name": "network_interface_last_change_timeticks",
      "help": "sysUpTime value (in timeticks) when the interface entered its current operational state."
    },
    {
      "mib_object": "ifSpeed",
      "metric_name": "network_interface_speed_bits",
      "help": "Estimate of the interface's current bandwidth in bits per second (32-bit ifTable object; ifHighSpeed is not implemented on this device)."
    },
    {
      "mib_object": "ifInOctets",
      "metric_name": "network_interface_receive_bytes_total",
      "help": "Total octets received on the interface (32-bit counter; ifHCInOctets is not implemented on this device)."
    },
    {
      "mib_object": "ifOutOctets",
      "metric_name": "network_interface_transmit_bytes_total",
      "help": "Total octets transmitted out of the interface (32-bit counter; ifHCOutOctets is not implemented on this device)."
    },
    {
      "mib_object": "ifInErrors",
      "metric_name": "network_interface_receive_errors_total",
      "help": "Inbound packets that contained errors preventing delivery to a higher layer."
    },
    {
      "mib_object": "ifOutErrors",
      "metric_name": "network_interface_transmit_errors_total",
      "help": "Outbound packets that could not be transmitted because of errors."
    }
  ],
  "lookups": [
    {
      "index_labels": [
        "ifIndex"
      ],
      "source_object": "ifDescr",
      "label_name": "interface"
    }
  ],
  "notes": "Device implements only ifNumber and a subset of ifTable; ifXTable (1.3.6.1.2.1.31.1.1) returned nothing, so all ifHC* counters and ifHighSpeed were replaced by 32-bit equivalents where present (ifInOctets, ifOutOctets, ifSpeed). ifSpeed is reported in bits per second, so the metric is named _bits rather than _megabits. Dropped with no working equivalent in the walk: unicast/multicast/broadcast packet counters (ifInUcastPkts, ifOutUcastPkts, ifHC*), ifInDiscards, ifOutDiscards, ifInUnknownProtos, ifOutQLen. Counters are 32-bit and may wrap on fast links; at 100 Mbps this is acceptable with rate() at typical scrape intervals. Lookup remains ifIndex -> ifDescr, which returned values."
}