2.3 KiB
SNMP MIB Files
This directory contains SNMP MIB (Management Information Base) files used by Towerops for network device monitoring.
Directory Structure
standard/- Standard IETF/IANA MIBs (IF-MIB, ENTITY-MIB, etc.)cisco/- Cisco vendor-specific MIBsmikrotik/- MikroTik vendor-specific MIBsnet-snmp/- Net-SNMP specific MIBs (LM-SENSORS, UCD-SNMP)
Source
MIB files are sourced from the LibreNMS project, which maintains a comprehensive collection of vendor MIBs.
Purpose
These MIB files serve as:
- Reference Documentation - Authoritative source for OID definitions
- Validation - Tests verify that hardcoded OIDs in profile modules match MIB definitions
- Discovery - Can be browsed to understand available SNMP objects
Usage in Code
Profile modules (e.g., Towerops.Snmp.Profiles.Cisco) contain hardcoded OID strings for performance. These are validated against MIB files during testing to ensure accuracy.
Example from Towerops.Snmp.Profiles.Base:
@interface_oids %{
if_index: "1.3.6.1.2.1.2.2.1.1", # Validated against IF-MIB
if_descr: "1.3.6.1.2.1.2.2.1.2" # Validated against IF-MIB
}
Importing MIBs (Development)
MIB files are not tracked in git (gitignored) to avoid bloating the repository. Import them locally using the Mix task:
# Import all MIBs from LibreNMS
mix copy_mibs --source-path ~/librenms/mibs
# Import specific vendors only
mix copy_mibs --source-path ~/librenms/mibs --vendors mikrotik,cisco,ubiquiti
This copies MIB files to priv/mibs/ in development. The directory structure (with .gitkeep files) is tracked in git, but the MIB file contents are ignored.
Adding New MIBs
To add support for a new vendor:
- Import MIBs using
mix copy_mibs(development) ormix upload_mibs(production) - Create a new profile module in
lib/towerops/snmp/profiles/ - Add OID references in the profile module
- Tests will automatically validate against the imported MIBs
MIB File Format
MIB files use ASN.1 (Abstract Syntax Notation One) format, which defines:
- Object identifiers (OIDs)
- Data types
- Access levels
- Descriptions
Testing
See test/towerops/snmp/mib_validation_test.exs for OID validation tests.