- Add MIB files from LibreNMS in priv/mibs/ for reference - Create MibParser module to validate OIDs against official MIB definitions - Add MIB validation tests to ensure hardcoded OIDs match MIB specs - Refactor SNMP tests to be generic/behavior-focused instead of vendor-specific - Remove vendor-specific test files (cisco_test, net_snmp_test) - All 104 tests passing with automated OID validation |
||
|---|---|---|
| .. | ||
| cisco | ||
| mikrotik | ||
| net-snmp | ||
| standard | ||
| README.md | ||
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
}
Adding New MIBs
To add support for a new vendor:
- Create a directory:
priv/mibs/vendor_name/ - Download MIB files from LibreNMS or vendor
- Add OID references in the appropriate profile module
- Tests will automatically validate against the new 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.