Skip to content

Tutorial: Writing a custom yaml file for SNMP

Ian edited this page Jul 20, 2021 · 10 revisions

Tutorial: Write a custom yaml file describing a MIB.

This page will walk through creating a yaml file used for polling a custom set of oids. Ktranslate ships with a built in set of these at https://github.com/kentik/ktranslate/tree/main/config/profiles/kentik_snmp.

As a base, we will be using Palo Alto Network's PAN-COMMON-MIB.

Each yaml file has three top level sections: extends, sysobjectid, and metrics.

Extends

extends lists the other yaml files which this file inherits. List only the file name. A runtime error will occur if a listed file is not found. For example:

extends:
  - system-mib.yml
  - if-mib.yml

Will add in all mibs found in system-mib.yml and if-mib.yml

Sysobjectid

sysobjectid lists which system object ids will be matched to this profile. They can be specified either exactly:

sysobjectid: 1.3.6.1.4.1.9.1.111

As a list:

sysobjectid:
  - 1.3.6.1.4.1.9.1.111
  - 1.3.6.1.4.1.9.1.170

Or using a wildcard:

sysobjectid: 1.3.6.1.4.1.25461.*

Wildcards will match all oids with the value before the * as a prefix.

Metrics

metrics define the actual oids to poll. The simplest section here lists oids one by one with a name:

metrics:
  - MIB: PAN-COMMON-MIB
    symbol:
      OID: 1.3.6.1.4.1.25461.2.1.2.3.1.0
      name: panSessionUtilization
  - MIB: PAN-COMMON-MIB
    symbol:
      OID: 1.3.6.1.4.1.25461.2.1.2.3.2.0
      name: panSessionMax

Ktranslate will poll each of these oids and create metrics called kentik.snmp.panSessionUtilization and kentik.snmp.panSessionMax