Multi-Vendor SNMP Support — Guia Tecnica
Fecha: 13-03-2026 Version: v1.0.37 Archivos clave:
network/migrations/0032-0035— VendorProfile enrichmentnetwork/migrations/0037— SNMPv3 fields en DeviceProfilenetwork/services/device_discovery/snmp_auth.py— Central SNMP auth abstraction (v2c/v3)network/services/mib_assistant.py— Level 2 MIB Assistantnetwork/services/device_discovery/auto_classifier.py— Level 3 Auto-Classifiernetwork/api/vendor.py— API endpointsDocumentation/archive/plans/MULTI_VENDOR_SUPPORT_PLAN.md— Plan completo
Resumen
Sistema de 3 niveles para soportar >90% de equipos de datacenter via SNMP sin intervencion manual del usuario:
| Nivel | Descripcion | Cobertura |
|---|---|---|
| 1. Pre-built Profiles | 1,605 VendorProfiles con OIDs estandar + vendor-specific | ~70-80% |
| 2. MIB Assistant | Gemini Flash analiza MIBs subidos y propone OID mappings | +15-20% |
| 3. Auto-Discovery | Pattern matching + heuristics para vendors desconocidos | +5-10% |
Nivel 1: Pre-built VendorProfiles
Migrations
| Migration | Descripcion |
|---|---|
0032_enrich_all_vendor_profiles | Standard MIBs (ENTITY-MIB, IF-MIB, LLDP-MIB) para TODOS + vendor-specific para 10 principales |
0033_infrastructure_vendor_profiles | Nuevos perfiles: APC, Eaton, CyberPower, Synology, QNAP, Aruba, Extreme, Vertiv, Raritan |
0034_generic_fallback_profile | Perfiles genericos: generic, generic-ups, generic-printer |
0035_fix_infra_vendor_oids | Fix OIDs para vendors que ya existian en DB |
Perfiles por Categoria
WiFi Access Points: Cisco, Aruba, Ruckus, Ubiquiti, Meraki, Fortinet, MikroTik, Cambium, Xirrus, Extreme, HP, TP-Link, Zyxel, D-Link, Netgear
Switches/Routers: Cisco, Juniper, Arista, Huawei, HP/ProCurve, Dell, MikroTik
Firewalls: Fortinet (FortiGate), Palo Alto, Cisco ASA
UPS: APC/Schneider, Eaton, CyberPower, Vertiv/Liebert + generic-ups (UPS-MIB RFC 1628)
PDU: APC, Raritan + generic
NAS/Storage: Synology, QNAP + generic
Impresoras: generic-printer (Printer-MIB RFC 3805)
Standard MIBs (todos los vendors)
Todas las 1,605 VendorProfiles incluyen deep_discovery_oids con:
| MIB | Categoria | OIDs |
|---|---|---|
| SNMPv2-MIB | system | sysDescr, sysObjectID, sysName, sysLocation, sysContact |
| ENTITY-MIB | hardware | modelName, serialNum, softwareRev, hardwareRev, physicalDescr |
| IF-MIB | interfaces | ifDescr, ifType, ifSpeed, ifOperStatus, ifName, ifAlias |
| LLDP-MIB | neighbors | lldpRemSysName, lldpRemPortId, lldpRemChassisId |
SNMPv3 Support (v1.0.37)
Todos los vendors se pueden consultar con SNMPv3 USM. Los OIDs son idénticos a v2c — SNMPv3 solo cambia la autenticación y el cifrado del transporte.
| Componente | Archivo | Función |
|---|---|---|
| Auth builder | network/services/device_discovery/snmp_auth.py | build_snmp_auth() → CommunityData o UsmUserData |
| Auth protocols | MD5, SHA, SHA-224, SHA-256, SHA-384, SHA-512 | |
| Priv protocols | DES, AES-128, AES-192, AES-256 | |
| DeviceProfile | 5 campos v3 (migration 0037) | snmp_v3_username, snmp_v3_auth_protocol, snmp_v3_auth_key, snmp_v3_priv_protocol, snmp_v3_priv_key |
| MonitoringTarget | Almacenados en config JSONField | Mismos 6 campos (snmp_version + 5 v3) |
Nota: SNMPv3 NO mejora la calidad de los datos de monitoreo — los OIDs retornan exactamente los mismos valores. Es una feature de seguridad (autenticación + cifrado en tránsito) para entornos que requieren/exigen v3 o que tienen v2c deshabilitado.
Vendor-specific monitoring_oids
| Vendor | Metricas | OIDs |
|---|---|---|
| Cisco | CPU, memory used/free | CISCO-PROCESS-MIB, CISCO-MEMORY-POOL-MIB |
| Juniper | CPU, memory, temperature | JUNIPER-MIB (jnxOperating) |
| Fortinet | CPU, memory, sessions | FORTINET-FORTIGATE-MIB |
| Palo Alto | active/max sessions | PAN-COMMON-MIB |
| MikroTik | CPU, memory, temperature | MIKROTIK-MIB (mtxrHl) |
| Ubiquiti | CPU, memory, clients | UBNT-UniFi-MIB |
| APC | UPS battery + PDU power | PowerNet-MIB + UPS-MIB |
| Synology | CPU, temp, disk, RAID | SYNOLOGY-SYSTEM-MIB |
| QNAP | CPU, temp, memory | NAS-MIB |
Bandwidth Monitoring OIDs (todos los vendors)
El Agent Sentinel pollea estos OIDs por target para calcular bandwidth (Mbps), errores y discards. El ifIndex concreto lo determina AutoConfigService._select_primary_interface() durante el auto-provisioning (ver AUTO_PROVISION_GUIDE.md §6.1).
| OID | Nombre | Tipo | Uso |
|---|---|---|---|
1.3.6.1.2.1.31.1.1.1.6.{ifIndex} | ifHCInOctets | Counter64 | Bandwidth IN (preferido) |
1.3.6.1.2.1.31.1.1.1.10.{ifIndex} | ifHCOutOctets | Counter64 | Bandwidth OUT (preferido) |
1.3.6.1.2.1.2.2.1.10.{ifIndex} | ifInOctets | Counter32 | Bandwidth IN (fallback legacy) |
1.3.6.1.2.1.2.2.1.16.{ifIndex} | ifOutOctets | Counter32 | Bandwidth OUT (fallback legacy) |
1.3.6.1.2.1.2.2.1.14.{ifIndex} | ifInErrors | Counter32 | Error rate (errors/min) |
1.3.6.1.2.1.2.2.1.20.{ifIndex} | ifOutErrors | Counter32 | Error rate (errors/min) |
1.3.6.1.2.1.2.2.1.13.{ifIndex} | ifInDiscards | Counter32 | Discard rate (discards/min) |
1.3.6.1.2.1.2.2.1.19.{ifIndex} | ifOutDiscards | Counter32 | Discard rate (discards/min) |
HC→Legacy Fallback (snmp_bandwidth.py): Si ifHCInOctets + ifHCOutOctets delta = 0 pero legacy delta > 0, usa contadores legacy 32-bit. Necesario para Xirrus donde HC counters devuelven 0 permanentemente en interfaces ethernet.
Cálculo: Mbps = delta_octets × 8 / dt_seconds / 1,000,000
Protecciones: Spike clamp > 10 Gbps (descarta y resetea baseline). Error/discard clamp > 100k/min.
Quirks por Vendor — Bandwidth SNMP
Xirrus (XR/XD series)
| Quirk | Detalle |
|---|---|
| ifHCInOctets = 0 permanente | Los HC counters (64-bit) de interfaces ethernet (gig1/gig2) siempre devuelven 0. Solo ifInOctets (32-bit) tiene datos reales |
| Interfaces virtuales sin tráfico | wds1, wds2, bridge — ifIndex 1-N devuelven 0 octets. El ifIndex correcto es el de gig1 (varía por modelo) |
| ifIndex varía por modelo | XR4847→28, XR4836/4830→33, XR630→24, XD4-240→25, XD2-240→9 |
| totalConnectedClients acumulativo | OID .7.0 es contador ACUMULATIVO, no clientes actuales. Usar clientsPerRadio walk_sum |
| associatedClients en ifStats | Solo contiene interfaces cableadas (gig1/gig2). Usar stationMac walk_count para clientes WiFi |
Cambium (XE series)
| Quirk | Detalle |
|---|---|
| HC counters funcionan | ifHCInOctets/ifHCOutOctets incrementan normalmente en interfaces ethernet |
| ifIndex varía | XE3-4 puede ser 5 u 8 según firmware |
Nivel 2: MIB Assistant
Servicio: network/services/mib_assistant.py
Flujo:
- Usuario sube un archivo .mib via
POST /api/vendor-profiles/{slug}/upload-mib - MibManager compila y extrae OIDs
- Usuario llama
POST /api/vendor-profiles/{slug}/mib-assistant/analyze - Gemini Flash (gemini-3-flash-preview) clasifica los OIDs en categorias
- Si Gemini no disponible, fallback a reglas por keywords
- Usuario confirma via
POST /api/vendor-profiles/{slug}/mib-assistant/apply - OIDs propuestos se fusionan en VendorProfile (no sobreescribe existentes)
API Endpoints
POST /api/vendor-profiles/{slug}/mib-assistant/analyze
-> Analiza OIDs de CustomMibs con Gemini Flash
<- { device_type, confidence, monitoring_oids, deep_discovery_oids }
POST /api/vendor-profiles/{slug}/mib-assistant/apply
Body: { monitoring_oids: {...}, deep_discovery_oids: {...} }
<- { vendor_slug, monitoring_added, deep_discovery_added, ... }
Funciones principales
| Funcion | Descripcion |
|---|---|
analyze_mib_oids() | Envia OIDs a Gemini Flash, retorna propuesta clasificada |
_fallback_classify() | Clasificacion por keywords cuando Gemini no disponible |
apply_proposal() | Fusiona propuesta confirmada en VendorProfile |
_call_gemini() | Wrapper para google-genai SDK |
Prompt de Gemini
El prompt pide a Gemini:
- Clasificar cada OID en categorias (monitoring, hardware, wireless, clients, etc.)
- Para monitoring: especificar type (gauge/walk_sum/walk_first) y unit
- Para deep_discovery: especificar get/walk
- Devolver JSON puro con confianza
Fallback (sin Gemini)
Cuando la API de Gemini no esta disponible, _fallback_classify() usa keyword matching:
- “cpu” → monitoring.cpu_usage (gauge, percent)
- “memory” → monitoring.memory_usage (gauge, percent)
- “temperature” → monitoring.temperature (gauge, celsius)
- “client/station” → monitoring.connected_clients (walk_sum, count)
- Y categoriza en deep_discovery por keywords: interface, disk, battery, etc.
Nivel 3: Auto-Classifier
Servicio: network/services/device_discovery/auto_classifier.py
Integrado en: DeviceDiscoveryService.provision_device() (service.py)
Punto de insercion: Despues de Stage 2 SNMP, cuando ni sysObjectID ni sysDescr matchean un VendorProfile.
Algoritmo de clasificacion
5 metodos combinados, cada uno asigna puntos:
| Metodo | Puntos max | Descripcion |
|---|---|---|
| Enterprise OID | +40 | ENTERPRISE_HINTS dict (318=UPS, 6574=NAS, 674=server, etc.) |
| sysDescr keywords | +30 | Busca “switch”, “ups”, “printer”, “nas”, etc. en sysDescr |
| Hostname hints | +15 | Prefijos: “sw-”=switch, “ups-”=ups, “ap-”=access_point |
| Interface count | +20 | >24 interfaces = switch, 4-12 = router |
| Interface type | +25 | ifType=71 (ieee80211) = access_point |
Confianza minima: 20% para activar (muy conservador — cualquier signal es suficiente)
Device Types reconocidos
| Type | Generic Profile | Keywords clave |
|---|---|---|
| access_point | generic | wireless, ap, 802.11, radio |
| switch | generic | switch, catalyst, nexus, poe |
| router | generic | router, gateway, bgp, ospf |
| firewall | generic | firewall, asa, fortigate, utm |
| ups | generic-ups | ups, smart-ups, battery backup |
| pdu | generic | pdu, power distribution |
| nas | generic | nas, diskstation, synology, qnap |
| server | generic | server, idrac, ilo, bmc |
| printer | generic-printer | printer, laserjet, mfp |
| sensor | generic | netbotz, environmental, temperature sensor |
Integracion en pipeline
Stage 2: SNMP
├── sysObjectID match? → VendorProfile found ✓
├── sysDescr match? → VendorProfile found ✓
└── Neither matched? → AUTO-CLASSIFIER
├── classify_from_all_data(snmp, http, nmap)
├── confidence >= 20%?
│ ├── Set generic profile (generic/generic-ups/generic-printer)
│ ├── Set detected_vendor from generic profile
│ └── snmp_data['auto_classified'] = True
└── confidence < 20%?
└── No vendor, continue as unknown
Enterprise OID Hints
Cuando el sysObjectID tiene un enterprise number conocido pero no hay VendorProfile con ese prefix:
ENTERPRISE_HINTS = {
318: "ups", # APC
534: "ups", # Eaton
476: "ups", # Vertiv
3808: "ups", # CyberPower
850: "ups", # Tripp Lite
6574: "nas", # Synology
24681: "nas", # QNAP
789: "nas", # NetApp
674: "server", # Dell iDRAC
232: "server", # HP iLO
13742: "pdu", # Raritan
1718: "pdu", # ServerTech
21239: "pdu", # Geist/Vertiv
}
Ejemplos de Clasificacion
Caso 1: UPS APC no reconocido
Input: sysDescr="APC Smart-UPS 3000", sysObjectID="1.3.6.1.4.1.318.1.3.17", hostname="ups-rack01"
Output: device_type=ups, confidence=85%, profile=generic-ups
Reason: enterprise OID 318, sysDescr 'ups', hostname 'ups-'
Caso 2: Switch con 48 puertos
Input: sysDescr="Generic L2 Switch", hostname="sw-core-01", 48 interfaces
Output: device_type=switch, confidence=35%, profile=generic
Reason: hostname 'sw-', 48 interfaces
Caso 3: NAS Synology
Input: sysDescr="Linux NAS 5.10.0-synology", sysObjectID="1.3.6.1.4.1.6574.1", hostname="nas-backup"
Output: device_type=nas, confidence=85%, profile=generic
Reason: enterprise OID 6574, sysDescr 'nas', hostname 'nas-'
Testing
Auto-Classifier
from network.services.device_discovery.auto_classifier import classify_from_snmp_data
result = classify_from_snmp_data({
'sys_descr': 'APC Smart-UPS 3000',
'sys_object_id': '1.3.6.1.4.1.318.1.3.17',
'hostname': 'ups-rack01',
'interfaces': {},
})
# → device_type=ups, confidence=85, profile=generic-ups
MIB Assistant (fallback sin Gemini)
from network.services.mib_assistant import _fallback_classify
oids = [
{'name': 'cpuUsage', 'oid': '1.3.6.1.4.1.99.1', 'type': 'get', 'access': 'readonly'},
{'name': 'memTotal', 'oid': '1.3.6.1.4.1.99.2', 'type': 'get', 'access': 'readonly'},
]
result = _fallback_classify(oids, 'switch')
# → monitoring_oids: {cpu_usage: {...}, memory_usage: {...}}
MIB Assistant (con Gemini)
# Requiere GEMINI_API_KEY en env
curl -X POST http://localhost:8000/api/vendor-profiles/cisco/mib-assistant/analyze
Archivos Modificados
| Archivo | Cambio |
|---|---|
network/migrations/0032_enrich_all_vendor_profiles.py | Nuevo: standard + vendor OIDs |
network/migrations/0033_infrastructure_vendor_profiles.py | Nuevo: APC, Eaton, etc. |
network/migrations/0034_generic_fallback_profile.py | Nuevo: generic profiles |
network/migrations/0035_fix_infra_vendor_oids.py | Nuevo: fix pre-existing vendors |
network/services/mib_assistant.py | Nuevo: Gemini + fallback OID classifier |
network/services/device_discovery/auto_classifier.py | Nuevo: heuristic device classifier |
network/services/device_discovery/service.py | Modificado: auto-classifier hook |
network/api/vendor.py | Modificado: +2 MIB Assistant endpoints |
network/migrations/0036_av_digital_signage_profiles.py | Nuevo: 11 AV/Digital Signage vendors |
network/services/device_discovery/auto_classifier.py | Modificado: +4 device types, +9 enterprise hints |
Mantenido por: Claude (Anthropic) + Equipo CreaRack
Nivel 1 Ampliacion: AV / Digital Signage (Migration 0036)
Perfiles por Categoria
Media Players: SpinetiX (PEN 29888), Crestron (PEN 3212), Extron (PEN 17049), BrightSign (PEN 44804)
Projectors: Barco (PEN 10103), Christie (PEN 19124), NEC/Sharp (PEN 119)
Audio DSP: QSC (PEN 30815), Shure (PEN 20918), Biamp (PEN 37890)
Displays: LG Display (PEN 2116)
Monitoring OIDs (vendor-specific)
| Vendor | Metricas | OIDs |
|---|---|---|
| SpinetiX | CPU, memory | HOST-RESOURCES-MIB (hrProcessorLoad, hrStorageUsed) |
| Crestron | CPU | HOST-RESOURCES-MIB (hrProcessorLoad) |
Deep Discovery (vendor-specific)
| Vendor | Categorias | OIDs |
|---|---|---|
| SpinetiX | storage, software | hrStorageDescr/Size/Used, hrSWInstalledName |
| Crestron | crestron | deviceModel, deviceSerial, firmwareVersion (enterprise OIDs) |
Nota: Vendors sin monitoring_oids (Extron, Barco, etc.) usan standard MIBs. Enriquecer via MIB Assistant (Level 2) subiendo MIBs vendor-specific.
Auto-Classifier: Nuevos Device Types
| Type | Generic Profile | Keywords clave |
|---|---|---|
| media_player | generic | digital signage, spinetix, brightsign, crestron, extron, streaming |
| projector | generic | projector, barco, christie, dlp, lcd projector |
| audio_dsp | generic | qsc, q-sys, shure, biamp, tesira, dante, audio dsp |
| display | generic | webos, lg signage, video wall, commercial display |
Enterprise OID Hints (auto-classifier)
29888: "media_player", # SpinetiX
3212: "media_player", # Crestron
17049: "media_player", # Extron
10103: "projector", # Barco
44804: "media_player", # BrightSign
19124: "projector", # Christie
30815: "audio_dsp", # QSC
20918: "audio_dsp", # Shure
37890: "audio_dsp", # Biamp
Véase también
- [[crearack-tech—backend—auto-provision-guide]] — guía técnica de Auto-Provision
- [[crearack-tech—backend—network-management-implementation]] — implementación de gestión de red
- [[crearack-tech—backend—network-observatory]] — Network Observatory en backend
- [[crearack-tech—architecture—wireless-monitor]] — plan de monitorización wireless
- [[entity—network—model—vendorprofile]] — modelo VendorProfile
- [[entity—network—model—custommib]] — modelo CustomMIB
- [[crearack—redes-infra—conceptos-snmp]] — conceptos básicos de SNMP
Referenciado desde
- Agente · dev-auto-provision
- Agente 2.30.1: el contador de 32 bits de los Xirrus daba la vuelta y "AP Bandwidth" pintaba un cero (v1.166.1)
- Auditoría #261 ciclo 1 — las gráficas de tráfico SNMP vuelven a tener quien las alimente
- Auto-Provision — Technical Guide
- Las gráficas de SAI, vivas de fábrica — walk_first, validación de tipos OID y guardia de frescura (task #255, v1.82.5)
- Network Management Implementation Guide
- Network Tools - Guía Completa
- Selector de interfaz en la gráfica de Bandwidth del Observatory (cierra #262)
- Wireless Monitor — Architecture & Technical Reference