Homeโ€บ๐Ÿ“ก SNMP Extensionsโ€บModule 11 min read ยท 2/16

SNMP Fundamentals

Tutorial2 exercises

What is SNMP?

SNMP (Simple Network Management Protocol) is how you read data from network devices. Your extension asks a device for a value at a specific address โ€” called an OID โ€” and the device responds.

๐Ÿ’ก Think of OIDs like database column addresses. You ask for 1.3.6.1.2.1.1.5.0 and get back "SWITCH-01" (the hostname).

OIDs โ€” Object Identifiers

Every piece of data has a dotted-number address. Here are the ones you'll use most:

OIDNameReturnsType
1.3.6.1.2.1.1.5.0sysNameHostnameScalar
1.3.6.1.2.1.1.3.0sysUpTimeUptime in ticksScalar
1.3.6.1.2.1.1.1.0sysDescrDevice descriptionScalar
1.3.6.1.2.1.2.2.1.2ifDescrInterface namesTable
1.3.6.1.2.1.31.1.1.1.6ifHCInOctetsBytes in (64-bit)Table
1.3.6.1.2.1.31.1.1.1.15ifHighSpeedSpeed in MbpsTable

OIDs under 1.3.6.1.2.1 are standard (work on any device). OIDs under 1.3.6.1.4.1.{vendor} are vendor-specific (need MIB files).

Scalar vs Table โ€” The #1 Rule

This is the most important concept in SNMP extensions. Get it wrong and your extension breaks silently.

Scalar = one value per device. OID ends in .0:

1.3.6.1.2.1.1.5.0  โ†’  sysName = "SWITCH-01"  (one value)

Table = multiple rows (one per interface, CPU, sensor). OID does NOT end in .0:

1.3.6.1.2.1.2.2.1.2  โ†’  ifDescr
  .1 = "GigabitEthernet0/1"
  .2 = "GigabitEthernet0/2"
  .3 = "Vlan100"
table: true โ†’ OIDs must NOT end in .0 (GETBULK walk) table: false โ†’ OIDs MUST end in .0 (scalar GET) Mix them up = DED016 / DED017 error
๐Ÿ›  Try it

This extension has 1 bug. The sysUpTime OID is scalar (one value per device) but it's missing .0 at the end. Fix it.

extension.yamlYAML
Loading...

MIB Files

A MIB maps OID numbers to human-readable names. Standard MIBs ship with ActiveGate. Vendor MIBs go in your extension's snmp/ folder:

extension.zip/
โ”œโ”€โ”€ extension.yaml
โ””โ”€โ”€ snmp/
    โ””โ”€โ”€ CISCO-PROCESS-MIB.my   โ† vendor MIB

Standard vs Vendor MIBs

MIBOID PrefixWhat It CoversBundled?
IF-MIB1.3.6.1.2.1.2Interfaces (traffic, status)โœ“ Yes
SNMPv2-MIB1.3.6.1.2.1.1System info (name, uptime)โœ“ Yes
ENTITY-MIB1.3.6.1.2.1.47Physical componentsโœ“ Yes
CISCO-PROCESS-MIB1.3.6.1.4.1.9.9.109Cisco CPU/Memoryโœ— Bundle it
CISCO-ENVMON-MIB1.3.6.1.4.1.9.9.13Cisco temp/fans/PSUโœ— Bundle it
๐Ÿ›  Try itExercise 2

This interface metric has .0 at the end but it's in a table: true subgroup. Table OIDs should NOT end in .0. Remove it.

extension.yamlYAML
Loading...

What's Next

In Module 2, you'll turn these OIDs into real metrics with types and metadata.