telegraf: SNMP - Cannot find module

Relevant telegraf.conf:

# # Retrieves SNMP values from remote agents
 [[inputs.snmp]]
#   agents = [ "127.0.0.1:161" ]
     agents = ["ipdadrres_switch:161"]	
#   ## Timeout for each SNMP query.
   timeout = "5s"
#   ## Number of retries to attempt within timeout.
   retries = 3
#   ## SNMP version, values can be 1, 2, or 3
   version = 3
#
#   ## SNMP community string.
   community = "public"
#
#   ## The GETBULK max-repetitions parameter
   max_repetitions = 10
#
#   ## SNMPv3 auth parameters
   sec_name = "snmpuser"
   auth_protocol = "SHA"      # Values: "MD5", "SHA", ""
   auth_password = "somethingsecret"
   sec_level = "authNoPriv"   # Values: "noAuthNoPriv", "authNoPriv", "authPriv"
##   #context_name = ""
   priv_protocol = "AES"         # Values: "DES", "AES", ""
   priv_password = "somethingsecret"

[inputs.snmp.field]]
    name = "hostname"
    oid = "RFC1213-MIB::sysName.0"
    is_tag = true

  [[inputs.snmp.field]]
    name = "uptime"
    oid = "DISMAN-EXPRESSION-MIB::sysUpTimeInstance"

  # IF-MIB::ifTable contains counters on input and output traffic as well as errors and discards.
  [[inputs.snmp.table]]
    name = "interface"
    inherit_tags = [ "hostname" ]
    oid = "IF-MIB::ifTable"

    # Interface tag - used to identify interface in metrics database
    [[inputs.snmp.table.field]]
      name = "ifDescr"
      oid = "IF-MIB::ifDescr"
      is_tag = true

  # IF-MIB::ifXTable contains newer High Capacity (HC) counters that do not overflow as fast for a few of the ifTable counters
  [[inputs.snmp.table]]
    name = "interface"
    inherit_tags = [ "hostname" ]
    oid = "IF-MIB::ifXTable"

    # Interface tag - used to identify interface in metrics database
    [[inputs.snmp.table.field]]
      name = "ifDescr"
      oid = "IF-MIB::ifDescr"
      is_tag = true

  # EtherLike-MIB::dot3StatsTable contains detailed ethernet-level information about what kind of errors have been logged on an interface (such as FCS error, frame too long, etc)
  [[inputs.snmp.table]]
    name = "interface"
    inherit_tags = [ "hostname" ]
    oid = "EtherLike-MIB::dot3StatsTable"

    # Interface tag - used to identify interface in metrics database
    [[inputs.snmp.table.field]]
      name = "ifDescr"
      oid = "IF-MIB::ifDescr"
      is_tag = true

System info:

Telegraf : 1.8.1 OS: Centos 7 Activated plugins - vsphere, snmp, system

Steps to reproduce:

Expected behavior:

To be able to get SNMP metrics and pushed to Influx output

Actual behavior:

When running the telegraf test for config, fetches other metrics for System but no SNMP metrics $telegraf --config /etc/telegraf/telegraf.conf --test Also when checking the status

$systemctl status telegraf.service -l
: Cannot find module (IPV6-UDP-MIB):At line 0 in (none)
: Cannot find module (IPV6-FORWARD-MIB):At line 0 in (none)
: Cannot find module (NET-SNMP-PASS-MIB):At line 0 in (none)
: Cannot find module (NET-SNMP-EXTEND-MIB):At line 0 in (none)
: Cannot find module (UCD-DLMOD-MIB):At line 0 in (none)
: Cannot find module (SNMP-NOTIFICATION-MIB):At line 0 in (none)
: Cannot find module (IF-MIB):At line 0 in (none)
: IF-MIB::ifTable:Unknown Object Identifier

Additional info:

I also tried doing a snmpwalk, which works perfectly fine for the ip address. [Include gist of relevant config, logs, etc.]

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (5 by maintainers)

Most upvoted comments

I had to install this:

apt install snmp snmp-mibs-downloader

After setting the router’s IP, all errors went away and everything started working. Don’t forget to entire the router IP in the Dashboard

The 1.14.5-alpine now works fine the 1.14.5 does not work and still suffers from this problem

You can reload Telegraf by sending it a SIGHUP, it will reread the configuration and restart the plugins without exiting.

Hi @danielnelson, sure, see below, please:

  1. test snmpwalk from Linux host:
$ snmpwalk -v 3 -u Collector -l authPriv -a SHA -A SUPER_AUTH -x AES -X SUPER_PASS EOS2 IF-MIB::ifXTable
IF-MIB::ifName.1 = STRING: Ethernet1
IF-MIB::ifName.2 = STRING: Ethernet2
IF-MIB::ifName.3 = STRING: Ethernet3
IF-MIB::ifName.4 = STRING: Ethernet4
IF-MIB::ifName.999001 = STRING: Management1
...
  1. launch container:
$ sudo docker run -d -p 8125:8125 -p 8092:8092 -p 8094:8094 \
      -v $PWD/data:/var/lib/snmp \
      -v $PWD/telegraf.conf:/etc/telegraf/telegraf.conf:ro \
      --add-host="EOS2:192.168.141.72" \
      telegraf -config /etc/telegraf/telegraf.conf
  1. look for conainer id:
$ sudo docker container ls
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                                                                        NAMES
86c3a0c60a7c        telegraf            "/entrypoint.sh -con…"   2 minutes ago       Up 2 minutes        0.0.0.0:8092->8092/tcp, 8092/udp, 0.0.0.0:8094->8094/tcp, 8125/udp, 0.0.0.0:8125->8125/tcp   adoring_montalcini
  1. check logs within Telegraf container (reports problem):
$ sudo docker logs 86c3a0c60a7c 
2019-02-21T08:04:20Z E! [inputs.snmp]: Error in plugin: initializing table interface: translating: exit status 2: /usr/share/snmp/mibs/IF-MIB.txt: No such file or directory
MIB search path: /root/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf:/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)
IF-MIB::ifXTable: Unknown Object Identifier
  1. check MIBs within container and find that IF-MIB is missing:
$ sudo docker exec -it 86c3a0c60a7c ls /usr/share/snmp/mibs/
GNOME-SMI.txt			     NET-SNMP-TC.txt
IANA-ADDRESS-FAMILY-NUMBERS-MIB.txt  NET-SNMP-VACM-MIB.txt
IANA-LANGUAGE-MIB.txt		     RFC-1215.txt
IANA-RTPROTO-MIB.txt		     SNMP-TLS-TM-MIB.txt
IANAifType-MIB.txt		     SNMP-TSM-MIB.txt
LM-SENSORS-MIB.txt		     UCD-DEMO-MIB.txt
NET-SNMP-AGENT-MIB.txt		     UCD-DISKIO-MIB.txt
NET-SNMP-EXAMPLES-MIB.txt	     UCD-DLMOD-MIB.txt
NET-SNMP-EXTEND-MIB.txt		     UCD-IPFILTER-MIB.txt
NET-SNMP-MIB.txt		     UCD-IPFWACC-MIB.txt
NET-SNMP-MONITOR-MIB.txt	     UCD-SNMP-MIB-OLD.txt
NET-SNMP-PASS-MIB.txt		     UCD-SNMP-MIB.txt
NET-SNMP-PERIODIC-NOTIFY-MIB.txt     miblist.txt
NET-SNMP-SYSTEM-MIB.txt
  1. upload all MIBs from local host to container: $ sudo docker cp /usr/share/snmp/mibs/. 86c3a0c60a7c:/usr/share/snmp/mibs/

  2. check that MIBs are really uploaded:

$ sudo docker exec -it 86c3a0c60a7c ls /usr/share/snmp/mibs/
AGENTX-MIB.txt			     NET-SNMP-VACM-MIB.txt
BRIDGE-MIB.txt			     NETWORK-SERVICES-MIB.txt
DISMAN-EVENT-MIB.txt		     NOTIFICATION-LOG-MIB.txt
DISMAN-SCHEDULE-MIB.txt		     RFC-1215.txt
DISMAN-SCRIPT-MIB.txt		     RFC1155-SMI.txt
EtherLike-MIB.txt		     RFC1213-MIB.txt
GNOME-SMI.txt			     RMON-MIB.txt
HCNUM-TC.txt			     SCTP-MIB.txt
HOST-RESOURCES-MIB.txt		     SMUX-MIB.txt
HOST-RESOURCES-TYPES.txt	     SNMP-COMMUNITY-MIB.txt
IANA-ADDRESS-FAMILY-NUMBERS-MIB.txt  SNMP-FRAMEWORK-MIB.txt
IANA-LANGUAGE-MIB.txt		     SNMP-MPD-MIB.txt
IANA-RTPROTO-MIB.txt		     SNMP-NOTIFICATION-MIB.txt
IANAifType-MIB.txt		     SNMP-PROXY-MIB.txt
IF-INVERTED-STACK-MIB.txt	     SNMP-TARGET-MIB.txt
IF-MIB				     SNMP-TLS-TM-MIB.txt
IF-MIB.txt			     SNMP-TSM-MIB.txt
INET-ADDRESS-MIB.txt		     SNMP-USER-BASED-SM-MIB.txt
IP-FORWARD-MIB.txt		     SNMP-USM-AES-MIB.txt
IP-MIB				     SNMP-USM-DH-OBJECTS-MIB.txt
IP-MIB.txt			     SNMP-VIEW-BASED-ACM-MIB.txt
IPV6-FLOW-LABEL-MIB.txt		     SNMPv2-CONF.txt
IPV6-ICMP-MIB.txt		     SNMPv2-MIB.txt
IPV6-MIB.txt			     SNMPv2-SMI.txt
IPV6-TC.txt			     SNMPv2-TC.txt
IPV6-TCP-MIB.txt		     SNMPv2-TM.txt
IPV6-UDP-MIB.txt		     TCP-MIB.txt
LM-SENSORS-MIB.txt		     TRANSPORT-ADDRESS-MIB.txt
MTA-MIB.txt			     TUNNEL-MIB.txt
NET-SNMP-AGENT-MIB.txt		     UCD-DEMO-MIB.txt
NET-SNMP-EXAMPLES-MIB.txt	     UCD-DISKIO-MIB.txt
NET-SNMP-EXTEND-MIB.txt		     UCD-DLMOD-MIB.txt
NET-SNMP-MIB.txt		     UCD-IPFILTER-MIB.txt
NET-SNMP-MONITOR-MIB.txt	     UCD-IPFWACC-MIB.txt
NET-SNMP-PASS-MIB.txt		     UCD-SNMP-MIB-OLD.txt
NET-SNMP-PERIODIC-NOTIFY-MIB.txt     UCD-SNMP-MIB.txt
NET-SNMP-SYSTEM-MIB.txt		     UDP-MIB.txt
NET-SNMP-TC.txt			     miblist.txt
  1. test snmwalk from container:
$ sudo docker exec -it 86c3a0c60a7c snmpwalk -v 3 -u Collector -l authPriv -a SHA -A SUPER_AUTH -x AES -X SUPER_PASS EOS2 IF-MIB::ifXTable
IF-MIB::ifName.1 = STRING: Ethernet1
IF-MIB::ifName.2 = STRING: Ethernet2
IF-MIB::ifName.3 = STRING: Ethernet3
IF-MIB::ifName.4 = STRING: Ethernet4
...
  1. check logs for Telegraf container again:
$ sudo docker logs 86c3a0c60a7c 
2019-02-21T08:11:10Z E! [inputs.snmp]: Error in plugin: initializing table interface: translating: exit status 2: /usr/share/snmp/mibs/IF-MIB.txt: No such file or directory
MIB search path: /root/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf:/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)
IF-MIB::ifXTable: Unknown Object Identifier

Any ideas?

Thanks and BR, Anton