![Collectd SNMP 插件无法找到 MIB](https://linux22.com/image/693266/Collectd%20SNMP%20%E6%8F%92%E4%BB%B6%E6%97%A0%E6%B3%95%E6%89%BE%E5%88%B0%20MIB.png)
使用 Collectd 通过 snmp 插件轮询 Cisco 设备。我已将所需的 Cisco mib(CISCO-MEMORY-POOL-MIB 和 CISCO-PROCESS-MIB)加载到 net-snmp 中,snmpwalk 可以正常查看它们。
但是当我尝试将它们添加到 collectd 中时,重新启动 collectd 服务时出现以下错误:
Cannot find module (CISCO-MEMORY-POOL-MIB): At line 0 in (none)
Cannot find module (CISCO-PROCESS-MIB): At line 0 in (none)
日志文件显示:
[2016-11-09 14:13:56] Exiting normally.
[2016-11-09 14:13:56] collectd: Stopping 5 read threads.
[2016-11-09 14:13:56] snmp plugin: read_objid (CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolName) failed.
[2016-11-09 14:13:56] snmp plugin: read_objid (CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolName) failed.
[2016-11-09 14:13:56] snmp plugin: snmp_parse_oid (CISCO-PROCESS-MIB::cpmCPUTotal5secRev) failed.
[2016-11-09 14:13:56] snmp plugin: No such data configured: `memory_free'
[2016-11-09 14:13:56] snmp plugin: No such data configured: `memory_used'
[2016-11-09 14:13:56] snmp plugin: No such data configured: `cisco_cpu'
[2016-11-09 14:13:56] snmp plugin: No such data configured: `memory_free'
[2016-11-09 14:13:56] snmp plugin: No such data configured: `memory_used'
[2016-11-09 14:13:56] snmp plugin: No such data configured: `cisco_cpu'
[2016-11-09 14:13:56] snmp plugin: No such data configured: `memory_free'
[2016-11-09 14:13:56] snmp plugin: No such data configured: `memory_used'
[2016-11-09 14:13:56] snmp plugin: No such data configured: `cisco_cpu'
[2016-11-09 14:13:56] Initialization complete, entering read-loop.
这是我的 collectd.conf 的 snmp 部分
<Plugin snmp>
<Data "SysInfo">
Type "counter"
Table false
Instance "sysName"
Values "SNMPv2-MIB::sysName"
</Data>
<Data "uptime">
Type "uptime"
Table false
Instance "Uptime"
scale 0.01
Values "DISMAN-EVENT-MIB::sysUpTimeInstance"
</Data>
<Data "if_octets">
Type "if_octets"
Table true
Instance "IF-MIB::ifAlias"
Values "IF-MIB::ifHCInOctets" "IF-MIB::ifHCOutOctets"
</Data>
<Data "if_errors">
Type "if_errors"
Table true
Instance "IF-MIB::ifAlias"
Values "IF-MIB::ifInErrors" "IF-MIB::ifOutErrors"
</Data>
<Data "memory_free">
Type "memory_free"
Table true
Instance "CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolName"
Values "CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolFree"
</Data>
<Data "memory_used">
Type "memory_used"
Table true
Instance "CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolName"
Values "CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolUsed"
</Data>
<Data "cisco_cpu">
Type "cisco_cpu"
Table true
Values "CISCO-PROCESS-MIB::cpmCPUTotal5secRev" "CISCO-PROCESS-MIB::cpmCPUTotal1minRev" "CISCO-PROCESS-MIB::cpmCPUTotal5minRev"
</Data>
我这里遗漏了什么?我也尝试过使用 OID 地址代替名称,但也没有得到任何结果。
答案1
尝试一些设置并取得一些成功。
如果我将类型更改为“gauge”并将表更改为“false”,CISCO-MEMORY-POOL PoolFree/Used 就会起作用。这很合理。但 CISCO-PROCESS-MIB cpu 返回的似乎是百分比。仍然无法获得那个。
snmpwalk 返回 OID 的方式如下:
[root@NMS-srv2 ~]# snmpwalk -v 2c -c rbhome spine1 CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolFree
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolFree.1 = Gauge32: 564215448 bytes
[root@NMS-srv2 ~]# snmpwalk -v 2c -c rbhome spine1 CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolUsed
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolUsed.1 = Gauge32: 249119560 bytes
[root@NMS-srv2 ~]# snmpwalk -v 2c -c rbhome spine1 CISCO-PROCESS-MIB::cpmCPUTotal1minRev
CISCO-PROCESS-MIB::cpmCPUTotal1minRev.7 = Gauge32: 1 percent
这是当前的配置。
<Data "memory_used">
Type "gauge"
Table false
Instance "memory_used"
Values "1.3.6.1.4.1.9.9.48.1.1.1.5.1"
</Data>
<Data "cisco_cpu">
Type "gauge"
Table false
Instance "cpu_used_min"
Values "1.3.6.1.4.1.9.9.109.1.1.1.1.7.7" "1.3.6.1.4.1.9.9.109.1.1.1.1.8.7"
</Data>
仍然无法弄清楚 MIB / OID 名称问题。