# 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 MIBs - `mikrotik/` - MikroTik vendor-specific MIBs - `net-snmp/` - Net-SNMP specific MIBs (LM-SENSORS, UCD-SNMP) ## Source MIB files are sourced from the [LibreNMS project](https://github.com/librenms/librenms/tree/master/mibs), which maintains a comprehensive collection of vendor MIBs. ## Purpose These MIB files serve as: 1. **Reference Documentation** - Authoritative source for OID definitions 2. **Validation** - Tests verify that hardcoded OIDs in profile modules match MIB definitions 3. **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`: ```elixir @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: ```bash # 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: 1. Import MIBs using `mix copy_mibs` (development) or `mix upload_mibs` (production) 2. Create a new profile module in `lib/towerops/snmp/profiles/` 3. Add OID references in the profile module 4. 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.