如何配置collectd-snmp来轮询路由器?

问题描述 投票:0回答:1

我正在尝试使用 Raspberry Pi 轮询 TP-LINK 路由器的接口 MIB (IF:MIB),然后将指标发送到 Librato。 设置collectd并将其与Librato集成完全没有问题——我成功地跟踪了其他指标(CPU、内存等)。我面临的挑战是collectd-snmp 插件配置。

我安装了 net-snmp 并且可以“看到”路由器:

pi@raspberrypi ~ $ snmpwalk -v 1 -c public 192.168.0.1 IF-MIB::ifInOctets
IF-MIB::ifInOctets.2 = Counter32: 1206812646
IF-MIB::ifInOctets.3 = Counter32: 1548296842
IF-MIB::ifInOctets.5 = Counter32: 19701783
IF-MIB::ifInOctets.10 = Counter32: 0
IF-MIB::ifInOctets.11 = Counter32: 0
IF-MIB::ifInOctets.15 = Counter32: 0
IF-MIB::ifInOctets.16 = Counter32: 0
IF-MIB::ifInOctets.22 = Counter32: 0
IF-MIB::ifInOctets.23 = Counter32: 0

Pi 位于 192.168.0.20,路由器位于 192.168.0.1。 我的collectd.conf如下:

<Plugin snmp>
  <Data "ifmib_if_octets32">
    Type "if_octets"
    Table true
    Instance "IF-MIB::ifDescr"
    Values "IF-MIB::ifInOctets" "IF-MIB::ifOutOctets"
  </Data>
  <Host "localhost">
    Address "192.168.0.1"
    Version 1
    Community "public"
    Collect "ifmib_if_octets32"
    Interval 60
  </Host>
</Plugin>

当我重新启动collectd时,出现以下错误:

pi@raspberrypi ~ $ sudo service collectd restart
[....] Restarting statistics collection and monitoring daemon: collectdNo log handling enabled - turning on stderr logging
MIB search path: $HOME/.snmp/mibs:/usr/share/mibs/site:/usr/share/snmp/mibs:/usr/share/mibs/iana:/usr/share/mibs/ietf:/usr/share/mibs/netsnmp
Cannot find module (IF-MIB): At line 0 in (none)
[2015-01-24 23:01:31] snmp plugin: read_objid (IF-MIB::ifDescr) failed.
[2015-01-24 23:01:31] snmp plugin: No such data configured: `ifmib_if_octets32'
No log handling enabled - turning on stderr logging
MIB search path: $HOME/.snmp/mibs:/usr/share/mibs/site:/usr/share/snmp/mibs:/usr/share/mibs/iana:/usr/share/mibs/ietf:/usr/share/mibs/netsnmp
Cannot find module (IF-MIB): At line 0 in (none)
[2015-01-24 23:01:33] snmp plugin: read_objid (IF-MIB::ifDescr) failed.
[2015-01-24 23:01:33] snmp plugin: No such data configured: `ifmib_if_octets32'
. ok

它显然找不到MIB,它甚至似乎没有查看路由器的IP。有关如何正确配置的任何建议吗?

snmp net-snmp collectd librato
1个回答
0
投票

我明白了:

<Plugin snmp>
  <Data "if_Octets">
    Type "if_octets"
    Table true
    Values "IF-MIB::ifInOctets" "IF-MIB::ifOutOctets"
  </Data>
  <Host "tp-link">
    Address "192.168.0.1"
    Version 1
    Community "public"
    Collect "if_Octets"
    Interval 60
  </Host>
</Plugin>
© www.soinside.com 2019 - 2024. All rights reserved.