Skip to content

Translate MIB files to YAML files to use them with Logstash SNMP trap plugin

License

Notifications You must be signed in to change notification settings

erlfos/mib2yaml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

mib2yaml

Translate MIB files to YAML files to use them with Logstash SNMP trap plugin. The script requires snmptranslate, part of snmp package and snmp-mibs-downloader package for common MIBS.

Usage

Declare the MIBs as arguments to the script, with space in between each MIB:

./mib2yaml.sh GNOME-SMI SNMP-TARGET-MIB IANA-MALLOC-MIB

The MIB files must exist in a directory you have assigned for MIBs, usually /usr/share/snmp/mibs. The output files are stored in the current dir as yaml files, for example NSN-SNMP-NBI-COMMONFUNCTIONS-MIB.yaml.

To use the yaml files with Logstash, copy the files to /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/snmp-1.3.1/data/ruby/snmp/mibs/ (this directory name may vary according to your Logstash version. This is for Logstash 6.8), or use a custom directory if you don't want to use the default MIBs shipped with Logstash. Example Logstash config with custom MIB dir:

 snmptrap {
    id => 'snmptrap'
    port => 5062
    type => 'snmptrap'
    community => ["public", "test"]
    yamlmibdir => "/usr/share/logstash/yamlfiles/"
  }

The script will translate a MIB and all it's dependencies, so you might get duplicate OID errors from Logstash. I solved this by manually removing the OID lines that were duplicated in other MIBs. Usually it is enough to have everything from the root of the MIB and up. The dependencies are usually covered in a MIB that is already present in Logstash (SNMPv2-SMI for example).

About

Translate MIB files to YAML files to use them with Logstash SNMP trap plugin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages