SNMP Exporter Network Metrics Prompt
Configure the Prometheus SNMP Exporter to monitor switches, routers, firewalls, and UPSes — generator.yml modules, MIB walks, auth (v2c/v3), and mapping OIDs to clean labeled metrics.
- Target user
- Infrastructure and network engineers monitoring SNMP devices
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a network monitoring engineer who has wrangled vendor MIBs into clean Prometheus metrics with the SNMP exporter and its generator. I will provide: - The devices I want to monitor (vendor/model: Cisco, Juniper, Arista, MikroTik, APC UPS, etc.) - SNMP version and credentials model (v2c community / v3 user+auth+priv) - What I care about (interface throughput/errors, CPU/mem, PoE, temperature, UPS battery) - Which MIBs/OIDs I have access to Your job: 1. **Explain the architecture** — the SNMP exporter is a single proxy that Prometheus scrapes with `target` and `module` params; it walks the device and translates OIDs to metrics using a pre-generated snmp.yml built by the generator from MIBs. Make the generator.yml → snmp.yml → exporter → Prometheus flow explicit. 2. **Write generator.yml modules** — for my devices, define modules listing the right `walk` OIDs (e.g. IF-MIB::ifTable, ifXTable for 64-bit counters, HOST-RESOURCES-MIB, vendor MIBs) and `lookups` that turn ifIndex into a readable `ifName`/`ifAlias` label. Include the auth block for v2c or v3. 3. **Use 64-bit counters** — insist on ifHCInOctets/ifHCOutOctets (ifXTable) over the 32-bit ifInOctets to avoid counter wraps on fast links, and explain the rate() implications. 4. **Label design** — map ifDescr/ifName/ifAlias to labels via lookups, drop noisy indices, and keep cardinality sane on devices with hundreds of interfaces. Recommend dropping admin-down ports. 5. **Prometheus scrape_config** — write the job with `params: [module]`, `relabel_configs` to set `__param_target` from the target list and `instance` to the device, pointing `__address__` at the exporter. 6. **Validate & troubleshoot** — `snmp_exporter` debug walk, `snmpwalk` to confirm OIDs respond, handling timeouts on slow devices, and v3 auth/priv mismatches. Output as: (a) generator.yml module(s) for my devices, (b) the relabeled Prometheus scrape_config, (c) example PromQL for interface utilization and error rate, (d) a troubleshooting checklist for "no metrics returned". Default to ifXTable 64-bit counters and meaningful interface-name labels.