influxdata / telegraf

Agent for collecting, processing, aggregating, and writing metrics, logs, and other arbitrary data.
https://influxdata.com/telegraf
MIT License
14.71k stars 5.59k forks source link

SNMP: failed to parse mibs #10346

Closed beparmentier closed 2 years ago

beparmentier commented 2 years ago

Relevent telegraf.conf

[[inputs.snmp]]
  ## Agent addresses to retrieve values from.
  ##   example: agents = ["udp://127.0.0.1:161"]
  ##            agents = ["tcp://127.0.0.1:161"]
  agents = ["udp://192.168.1.1:161"]

  interval = "60s"

  ## Timeout for each request.
  timeout = "5s"

  ## SNMP version; can be 1, 2, or 3.
  version = 2

  ## SNMP community string.
  community = "public"

  ## Number of retries to attempt.
  retries = 3

  ## The GETBULK max-repetitions parameter.
  max_repetitions = 10

  ## SNMPv3 authentication and encryption options.
  ##
  ## Security Name.
  # sec_name = "myuser"
  ## Authentication protocol; one of "MD5", "SHA", or "".
  # auth_protocol = "MD5"
  ## Authentication password.
  # auth_password = "pass"
  ## Security Level; one of "noAuthNoPriv", "authNoPriv", or "authPriv".
  # sec_level = "authNoPriv"
  ## Context Name.
  # context_name = ""
  ## Privacy protocol used for encrypted messages; one of "DES", "AES" or "".
  # priv_protocol = ""
  ## Privacy password used for encrypted messages.
  # priv_password = ""

  ## Add fields and tables defining the variables you wish to collect.  This
  ## example collects the system uptime and interface variables.  Reference the
  ## full plugin documentation for configuration details.

  # Measurement name
  name = "snmp.edgeos"
  ##
  ## Exclusions
  ##
  # Don't want these columns from UCD-SNMP-MIB::laTable
  fielddrop = [ "laErrorFlag", "laErrMessage" ]
  # Don't want these rows from UCD-DISKIO-MIB::diskIOTable
  [inputs.snmp.tagdrop]
    diskIODevice = [ "loop*", "ram*" ]
  ## 
  ## System details
  ##
  #  System name (hostname)
  [[inputs.snmp.field]]
    name = "sysName"
    oid = "SNMPv2-MIB::sysName.0"
    is_tag = true
  #  System vendor OID
  [[inputs.snmp.field]]
    name = "sysObjectID"
    oid = "SNMPv2-MIB::sysObjectID.0"
  #  System description
  [[inputs.snmp.field]]
    name = "sysDescr"
    oid = "SNMPv2-MIB::sysDescr.0"
  #  System contact
  [[inputs.snmp.field]]
    name = "sysContact"
    oid = "SNMPv2-MIB::sysContact.0"
  #  System location
  [[inputs.snmp.field]]
    name = "sysLocation"
    oid = "SNMPv2-MIB::sysLocation.0"
  ##
  ## Host/System Resources
  ##
  #  System uptime
  [[inputs.snmp.field]]
    name = "sysUpTime"
    oid = "HOST-RESOURCES-MIB::hrSystemUptime.0"
  #  Number of user sessions
  [[inputs.snmp.field]]
    name = "hrSystemNumUsers"
    oid = "HOST-RESOURCES-MIB::hrSystemNumUsers.0"
  #  Number of process contexts
  [[inputs.snmp.field]]
    name = "hrSystemProcesses"
    oid = "HOST-RESOURCES-MIB::hrSystemProcesses.0"
  #  Device Listing
  [[inputs.snmp.table]]
    oid = "HOST-RESOURCES-MIB::hrDeviceTable"
    [[inputs.snmp.table.field]]
      oid = "HOST-RESOURCES-MIB::hrDeviceIndex"
      is_tag = true
  ##
  ## Context Switches & Interrupts
  ##
  #  Number of interrupts processed
  [[inputs.snmp.field]]
    name = "ssRawInterrupts"
    oid = "UCD-SNMP-MIB::ssRawInterrupts.0"
  #  Number of context switches
  [[inputs.snmp.field]]
    name = "ssRawContexts"
    oid = "UCD-SNMP-MIB::ssRawContexts.0"
  ##
  ## Host performance metrics
  ##
  #  System Load Average 
  [[inputs.snmp.table]]
    oid = "UCD-SNMP-MIB::laTable"
    [[inputs.snmp.table.field]]
      oid = "UCD-SNMP-MIB::laNames"
      is_tag = true
  ##
  ## CPU inventory
  ##
  #  Processor listing
  [[inputs.snmp.table]]
    index_as_tag = true
    oid = "HOST-RESOURCES-MIB::hrProcessorTable"
  ##
  ## CPU utilization
  ##
  #  Number of 'ticks' spent on user-level
  [[inputs.snmp.field]]
    name = "ssCpuRawUser"
    oid = "UCD-SNMP-MIB::ssCpuRawUser.0"
  #  Number of 'ticks' spent on reduced-priority
  [[inputs.snmp.field]]
    name = "ssCpuRawNice"
    oid = "UCD-SNMP-MIB::ssCpuRawNice.0"
  #  Number of 'ticks' spent on system-level
  [[inputs.snmp.field]]
    name = "ssCpuRawSystem"
    oid = "UCD-SNMP-MIB::ssCpuRawSystem.0"
  #  Number of 'ticks' spent idle
  [[inputs.snmp.field]]
    name = "ssCpuRawIdle"
    oid = "UCD-SNMP-MIB::ssCpuRawIdle.0"
  #  Number of 'ticks' spent waiting on I/O
  [[inputs.snmp.field]]
    name = "ssCpuRawWait"
    oid = "UCD-SNMP-MIB::ssCpuRawWait.0"
  #  Number of 'ticks' spent in kernel
  [[inputs.snmp.field]]
    name = "ssCpuRawKernel"
    oid = "UCD-SNMP-MIB::ssCpuRawKernel.0"
  #  Number of 'ticks' spent on hardware interrupts
  [[inputs.snmp.field]]
    name = "ssCpuRawInterrupt"
    oid = "UCD-SNMP-MIB::ssCpuRawInterrupt.0"
  #  Number of 'ticks' spent on software interrupts
  [[inputs.snmp.field]]
    name = "ssCpuRawSoftIRQ"
    oid = "UCD-SNMP-MIB::ssCpuRawSoftIRQ.0"
  ##
  ## System Memory (physical/virtual)
  ##
  #  Size of phsyical memory (RAM)
  [[inputs.snmp.field]]
    name = "hrMemorySize"
    oid = "HOST-RESOURCES-MIB::hrMemorySize.0"
  #  Size of real/phys mem installed
  [[inputs.snmp.field]]
    name = "memTotalReal"
    oid = "UCD-SNMP-MIB::memTotalReal.0"
  #  Size of real/phys mem unused/avail
  [[inputs.snmp.field]]
    name = "memAvailReal"
    oid = "UCD-SNMP-MIB::memAvailReal.0"
  #  Total amount of mem unused/avail
  [[inputs.snmp.field]]
    name = "memTotalFree"
    oid = "UCD-SNMP-MIB::memTotalFree.0"
  #  Size of mem used as shared memory
  [[inputs.snmp.field]]
    name = "memShared"
    oid = "UCD-SNMP-MIB::memShared.0"
  #  Size of mem used for buffers
  [[inputs.snmp.field]]
    name = "memBuffer"
    oid = "UCD-SNMP-MIB::memBuffer.0"
  #  Size of mem used for cache
  [[inputs.snmp.field]]
    name = "memCached"
    oid = "UCD-SNMP-MIB::memCached.0"
  ##
  ## Block (Disk) performance
  ##
  #  System-wide blocks written
  [[inputs.snmp.field]]
    name = "ssIORawSent"
    oid = "UCD-SNMP-MIB::ssIORawSent.0"
  #  Number of blocks read
  [[inputs.snmp.field]]
    name = "ssIORawReceived"
    oid = "UCD-SNMP-MIB::ssIORawReceived.0"
  #  Per-device (disk) performance
  [[inputs.snmp.table]]
    oid = "UCD-DISKIO-MIB::diskIOTable"
    [[inputs.snmp.table.field]]
      oid = "UCD-DISKIO-MIB::diskIODevice"
      is_tag = true
  ##
  ## Disk/Partition/Filesystem inventory & usage
  ##
  #  Storage listing
  [[inputs.snmp.table]]
    oid = "HOST-RESOURCES-MIB::hrStorageTable"
    [[inputs.snmp.table.field]]
      oid = "HOST-RESOURCES-MIB::hrStorageDescr"
      is_tag = true
  ##
  ## Interface metrics
  ##
  #  Per-interface traffic, errors, drops
  [[inputs.snmp.table]]
    oid = "IF-MIB::ifTable"
    [[inputs.snmp.table.field]]
      oid = "IF-MIB::ifName"
      is_tag = true
  #  Per-interface high-capacity (HC) counters
  [[inputs.snmp.table]]
    oid = "IF-MIB::ifXTable"
    [[inputs.snmp.table.field]]
      oid = "IF-MIB::ifName"
      is_tag = true
  ##
  ## IP metrics
  ##
  #  System-wide IP metrics
  [[inputs.snmp.table]]
    index_as_tag = true
    oid = "IP-MIB::ipSystemStatsTable"
  ## 
  ## ICMP Metrics
  ##
  #  ICMP statistics
  [[inputs.snmp.table]]
    index_as_tag = true
    oid = "IP-MIB::icmpStatsTable"
  #  ICMP per-type statistics
  [[inputs.snmp.table]]
    index_as_tag = true
    oid = "IP-MIB::icmpMsgStatsTable"
  ##
  ## UDP statistics
  ##
  #  Datagrams delivered to app
  [[inputs.snmp.field]]
    name = "udpInDatagrams"
    oid = "UDP-MIB::udpInDatagrams.0"
  #  Datagrams received with no app
  [[inputs.snmp.field]]
    name = "udpNoPorts"
    oid = "UDP-MIB::udpNoPorts.0"
  #  Datagrams received with error
  [[inputs.snmp.field]]
    name = "udpInErrors"
    oid = "UDP-MIB::udpInErrors.0"
  #  Datagrams sent
  [[inputs.snmp.field]]
    name = "udpOutDatagrams"
    oid = "UDP-MIB::udpOutDatagrams.0"
  ##
  ## TCP statistics
  ##
  #  Number of CLOSED -> SYN-SENT transitions
  [[inputs.snmp.field]]
    name = "tcpActiveOpens"
    oid = "TCP-MIB::tcpActiveOpens.0"
  #  Number of SYN-RCVD -> LISTEN transitions
  [[inputs.snmp.field]]
    name = "tcpPassiveOpens"
    oid = "TCP-MIB::tcpPassiveOpens.0"
  #  Number of SYN-SENT/RCVD -> CLOSED transitions
  [[inputs.snmp.field]]
    name = "tcpAttemptFails"
    oid = "TCP-MIB::tcpAttemptFails.0"
  #  Number of ESTABLISHED/CLOSE-WAIT -> CLOSED transitions
  [[inputs.snmp.field]]
    name = "tcpEstabResets"
    oid = "TCP-MIB::tcpEstabResets.0"
  #  Number of ESTABLISHED or CLOSE-WAIT
  [[inputs.snmp.field]]
    name = "tcpCurrEstab"
    oid = "TCP-MIB::tcpCurrEstab.0"
  #  Number of segments received
  [[inputs.snmp.field]]
    name = "tcpInSegs"
    oid = "TCP-MIB::tcpInSegs.0"
  #  Number of segments sent
  [[inputs.snmp.field]]
    name = "tcpOutSegs"
    oid = "TCP-MIB::tcpOutSegs.0"
  #  Number of segments retransmitted
  [[inputs.snmp.field]]
    name = "tcpRetransSegs"
    oid = "TCP-MIB::tcpRetransSegs.0"
  #  Number of segments received with error
  [[inputs.snmp.field]]
    name = "tcpInErrs"
    oid = "TCP-MIB::tcpInErrs.0"
  #  Number of segments sent w/RST
  [[inputs.snmp.field]]
    name = "tcpOutRsts"
    oid = "TCP-MIB::tcpOutRsts.0"
  ##
  ## IP routing statistics
  ##
  #  Number of valid routing entries
  [[inputs.snmp.field]]
    name = "inetCidrRouteNumber"
    oid = "IP-FORWARD-MIB::inetCidrRouteNumber.0"
  #  Number of valid entries discarded
  [[inputs.snmp.field]]
    name = "inetCidrRouteDiscards"
    oid = "IP-FORWARD-MIB::inetCidrRouteDiscards.0"
  #  Number of valid forwarding entries
  [[inputs.snmp.field]]
    name = "ipForwardNumber"
    oid = "IP-FORWARD-MIB::ipForwardNumber.0"
  ##
  ## IP routing statistics
  ##
  # Number of valid routes discarded
  [[inputs.snmp.field]]
    name = "ipRoutingDiscards"
    oid = "RFC1213-MIB::ipRoutingDiscards.0"
  ##
  ## SNMP metrics
  ##
  #  Number of SNMP messages received
  [[inputs.snmp.field]]
    name = "snmpInPkts"
    oid = "SNMPv2-MIB::snmpInPkts.0"
  #  Number of SNMP Get-Request received
  [[inputs.snmp.field]]
    name = "snmpInGetRequests"
    oid = "SNMPv2-MIB::snmpInGetRequests.0"
  #  Number of SNMP Get-Next received
  [[inputs.snmp.field]]
    name = "snmpInGetNexts"
    oid = "SNMPv2-MIB::snmpInGetNexts.0"
  #  Number of SNMP objects requested
  [[inputs.snmp.field]]
    name = "snmpInTotalReqVars"
    oid = "SNMPv2-MIB::snmpInTotalReqVars.0"
  #  Number of SNMP Get-Response received
  [[inputs.snmp.field]]
    name = "snmpInGetResponses"
    oid = "SNMPv2-MIB::snmpInGetResponses.0"
  #  Number of SNMP messages sent
  [[inputs.snmp.field]]
    name = "snmpOutPkts"
    oid = "SNMPv2-MIB::snmpOutPkts.0"
  #  Number of SNMP Get-Request sent
  [[inputs.snmp.field]]
    name = "snmpOutGetRequests"
    oid = "SNMPv2-MIB::snmpOutGetRequests.0"
  #  Number of SNMP Get-Next sent
  [[inputs.snmp.field]]
    name = "snmpOutGetNexts"
    oid = "SNMPv2-MIB::snmpOutGetNexts.0"
  #  Number of SNMP Get-Response sent
  [[inputs.snmp.field]]
    name = "snmpOutGetResponses"
    oid = "SNMPv2-MIB::snmpOutGetResponses.0"

Logs from Telegraf

Dec 24 11:56:37 odin telegraf[85513]: 2021-12-24T10:56:37Z I! Starting Telegraf 1.21.1 Dec 24 11:56:44 odin systemd[1]: Stopping The plugin-driven server agent for reporting metrics into InfluxDB... Dec 24 11:56:45 odin telegraf[85513]: Parse module: /var/lib/snmp/mibs/ietf/DPI20-MIB:9:4: unexpected "ibm" (expected ";") Dec 24 11:56:48 odin telegraf[85513]: Parse module: /var/lib/snmp/mibs/ietf/HPR-MIB:494:30: unexpected "HprRtpCounter" (expected "}") Dec 24 11:56:56 odin telegraf[85513]: Parse module: /var/lib/snmp/mibs/ietf/SNMPv2-PDU:73:1: unexpected "max-bindings" (expected "END") Dec 24 11:56:58 odin telegraf[85513]: Parse module: /var/lib/snmp/mibs/ietf/TCPIPX-MIB:63:12: unexpected "tcpIpxConnLocalPort" (expected "}") Dec 24 11:56:59 odin telegraf[85513]: panic: strconv.ParseUint: parsing "": invalid syntax Dec 24 11:56:59 odin telegraf[85513]: goroutine 1 [running]: Dec 24 11:56:59 odin telegraf[85513]: github.com/sleepinggenius2/gosmi/types.OidMustFromString(...) Dec 24 11:56:59 odin telegraf[85513]: #011/go/pkg/mod/github.com/sleepinggenius2/gosmi@v0.4.3/types/oid.go:91 Dec 24 11:56:59 odin telegraf[85513]: github.com/influxdata/telegraf/internal/snmp.GetIndex({0x4fab394, 0x1}, {0x40046ad128, 0xe}) Dec 24 11:56:59 odin telegraf[85513]: #011/go/src/github.com/influxdata/telegraf/internal/snmp/translate.go:126 +0x348 Dec 24 11:56:59 odin telegraf[85513]: github.com/influxdata/telegraf/plugins/inputs/snmp.snmpTableCall({0x4000bdd821, 0x15}) Dec 24 11:56:59 odin telegraf[85513]: #011/go/src/github.com/influxdata/telegraf/plugins/inputs/snmp/snmp.go:837 +0xcc Dec 24 11:56:59 odin telegraf[85513]: github.com/influxdata/telegraf/plugins/inputs/snmp.snmpTable({0x4000bdd821, 0x15}) Dec 24 11:56:59 odin telegraf[85513]: #011/go/src/github.com/influxdata/telegraf/plugins/inputs/snmp/snmp.go:820 +0x1b0 Dec 24 11:56:59 odin telegraf[85513]: github.com/influxdata/telegraf/plugins/inputs/snmp.(Table).initBuild(0x4000592860) Dec 24 11:56:59 odin telegraf[85513]: #011/go/src/github.com/influxdata/telegraf/plugins/inputs/snmp/snmp.go:192 +0x40 Dec 24 11:56:59 odin telegraf[85513]: github.com/influxdata/telegraf/plugins/inputs/snmp.(Table).Init(0x4000592860) Dec 24 11:56:59 odin telegraf[85513]: #011/go/src/github.com/influxdata/telegraf/plugins/inputs/snmp/snmp.go:162 +0x7c Dec 24 11:56:59 odin telegraf[85513]: github.com/influxdata/telegraf/plugins/inputs/snmp.(Snmp).Init(0x4000023600) Dec 24 11:56:59 odin telegraf[85513]: #011/go/src/github.com/influxdata/telegraf/plugins/inputs/snmp/snmp.go:110 +0x118 Dec 24 11:56:59 odin telegraf[85513]: github.com/influxdata/telegraf/models.(RunningInput).Init(0x4000bf3090) Dec 24 11:56:59 odin telegraf[85513]: #011/go/src/github.com/influxdata/telegraf/models/running_input.go:82 +0x58 Dec 24 11:56:59 odin telegraf[85513]: github.com/influxdata/telegraf/agent.(Agent).initPlugins(0x400000e608) Dec 24 11:56:59 odin telegraf[85513]: #011/go/src/github.com/influxdata/telegraf/agent/agent.go:189 +0x74 Dec 24 11:56:59 odin telegraf[85513]: github.com/influxdata/telegraf/agent.(Agent).Run(0x400000e608, {0x50f04e8, 0x400078e040}) Dec 24 11:56:59 odin telegraf[85513]: #011/go/src/github.com/influxdata/telegraf/agent/agent.go:105 +0x140 Dec 24 11:56:59 odin telegraf[85513]: main.runAgent({0x50f04e8, 0x400078e040}, {0x7b610f8, 0x0, 0x0}, {0x7b610f8, 0x0, 0x0}) Dec 24 11:56:59 odin telegraf[85513]: #011/go/src/github.com/influxdata/telegraf/cmd/telegraf/telegraf.go:312 +0xcf0 Dec 24 11:56:59 odin telegraf[85513]: main.reloadLoop({0x7b610f8, 0x0, 0x0}, {0x7b610f8, 0x0, 0x0}) Dec 24 11:56:59 odin telegraf[85513]: #011/go/src/github.com/influxdata/telegraf/cmd/telegraf/telegraf.go:147 +0x220 Dec 24 11:56:59 odin telegraf[85513]: main.run(...) Dec 24 11:56:59 odin telegraf[85513]: #011/go/src/github.com/influxdata/telegraf/cmd/telegraf/telegraf_posix.go:8 Dec 24 11:56:59 odin telegraf[85513]: main.main() Dec 24 11:56:59 odin telegraf[85513]: #011/go/src/github.com/influxdata/telegraf/cmd/telegraf/telegraf.go:485 +0xcb8 Dec 24 11:56:59 odin systemd[1]: telegraf.service: Main process exited, code=exited, status=2/INVALIDARGUMENT Dec 24 11:56:59 odin systemd[1]: telegraf.service: Failed with result 'exit-code'.

System info

Telegraf 1.21.1, Ubuntu 20.04

Docker

No response

Steps to reproduce

Just use the configuration I provide.

Expected behavior

Collect snmp metrics

Actual behavior

Telegraf panic

Additional info

I use this configuration for few months without any problem. Problem started when I updated telegraf from version 1.20.4 to version 1.21.1

I tried to update MIBs file using download-mibs from snmp-mibs-downloader package but without any success.

jostrasser commented 2 years ago

Hi, I am getting also issues with SNMP parsing after updating Telegraf to 1.21.1 on Ubuntu 20.04:

Dec 24 16:59:03 snmpdb telegraf[173]: 2021-12-24T15:59:03Z I! [agent] Config: Interval:1m0s, Quiet:false, Hostname:"snmpdb", Flush Interval:10s
Dec 24 16:59:03 snmpdb telegraf[173]: panic: runtime error: invalid memory address or nil pointer dereference
Dec 24 16:59:03 snmpdb telegraf[173]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x2c0a113]
Dec 24 16:59:03 snmpdb telegraf[173]: goroutine 1 [running]:
Dec 24 16:59:03 snmpdb telegraf[173]: github.com/influxdata/telegraf/internal/snmp.LoadMibsFromPath.func1({0x4deff4e, 0x14}, {0x0, 0x0}, {0x0, 0x2c09920})
Dec 24 16:59:03 snmpdb telegraf[173]: #011/go/src/github.com/influxdata/telegraf/internal/snmp/translate.go:60 +0x53
Dec 24 16:59:03 snmpdb telegraf[173]: path/filepath.Walk({0x4deff4e, 0x14}, 0xc000bed640)
Dec 24 16:59:03 snmpdb telegraf[173]: #011/usr/local/go/src/path/filepath/path.go:503 +0x50
Dec 24 16:59:03 snmpdb telegraf[173]: github.com/influxdata/telegraf/internal/snmp.LoadMibsFromPath({0xc000d34260, 0x1, 0xc000bed6c8}, {0x584e030, 0xc000d416e0})
Dec 24 16:59:03 snmpdb telegraf[173]: #011/go/src/github.com/influxdata/telegraf/internal/snmp/translate.go:57 +0x29a
Dec 24 16:59:03 snmpdb telegraf[173]: github.com/influxdata/telegraf/plugins/inputs/snmp.(*Snmp).Init(0xc00033edc0)
Dec 24 16:59:03 snmpdb telegraf[173]: #011/go/src/github.com/influxdata/telegraf/plugins/inputs/snmp/snmp.go:102 +0x50
Dec 24 16:59:03 snmpdb telegraf[173]: github.com/influxdata/telegraf/models.(*RunningInput).Init(0xc000bed758)
Dec 24 16:59:03 snmpdb telegraf[173]: #011/go/src/github.com/influxdata/telegraf/models/running_input.go:82 +0x35
Dec 24 16:59:03 snmpdb telegraf[173]: github.com/influxdata/telegraf/agent.(*Agent).initPlugins(0xc0001113a0)
Dec 24 16:59:03 snmpdb telegraf[173]: #011/go/src/github.com/influxdata/telegraf/agent/agent.go:189 +0x96
Dec 24 16:59:03 snmpdb telegraf[173]: github.com/influxdata/telegraf/agent.(*Agent).Run(0xc0001113a0, {0x57e5688, 0xc0002ca680})
Dec 24 16:59:03 snmpdb telegraf[173]: #011/go/src/github.com/influxdata/telegraf/agent/agent.go:105 +0x185
Dec 24 16:59:03 snmpdb systemd[1]: telegraf.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Dec 24 16:59:03 snmpdb systemd[1]: telegraf.service: Failed to kill control group /system.slice/telegraf.service, ignoring: Input/output error
Dec 24 16:59:03 snmpdb systemd[1]: message repeated 3 times: [ telegraf.service: Failed to kill control group /system.slice/telegraf.service, ignoring: Input/output error]
Dec 24 16:59:03 snmpdb systemd[1]: telegraf.service: Failed with result 'exit-code'.
Dec 24 16:59:03 snmpdb systemd[1]: telegraf.service: Scheduled restart job, restart counter is at 4.
Dec 24 16:59:03 snmpdb systemd[1]: Stopped The plugin-driven server agent for reporting metrics into InfluxDB.
Dec 24 16:59:03 snmpdb systemd[1]: Failed to attach 184 to compat systemd cgroup /system.slice/telegraf.service: No such file or directory
Dec 24 16:59:03 snmpdb systemd[1]: Started The plugin-driven server agent for reporting metrics into InfluxDB.
Dec 24 16:59:03 snmpdb systemd[184]: Failed to attach 184 to compat systemd cgroup /system.slice/telegraf.service: No such file or directory
Dec 24 16:59:03 snmpdb influxd-systemd-start.sh[80]: InfluxDB API unavailable after 2 attempts...
dlundh1 commented 2 years ago

It would be great if Telegraf could parse the mibs you get when you download the operating systems SNMP package.

jostrasser commented 2 years ago

Downgrading to Telegraf 1.20.4 (git: HEAD 34ad5aa1) solves the issue for me.

beparmentier commented 2 years ago

I also downgraded telegraf to version 1.20.4 and it solves the issue.

jnguiot commented 2 years ago

Same here. Downgrade temporarily fixes the problem. However, the issue seems to come from the fact that on Ubuntu, default path is set to ["/usr/share/snmp/mibs"], which does not exists. It causes the application to crash. However, to fix it:

To me, the real bug is this one:

Steps to reproduce:

Expected behavior

Observed behaviour:

sajoupa commented 2 years ago

Since https://github.com/influxdata/telegraf/commit/e00147ded38af30f945935ad626aa8be71700b6d, telegraf doesn't panic if the default path doesn't exist, but it will exit with an error.

https://github.com/influxdata/telegraf/pull/10354 makes it log a warning and continue. It also adds a test which would have caught the issue.

dlundh1 commented 2 years ago

I haven't had a panic. I just wish telegraf parsed MIBs it used to parse back on 1.20.

sajoupa commented 2 years ago

I haven't had a panic. I just wish telegraf parsed MIBs it used to parse back on 1.20.

That's right, I was mislead by a comment showing the panic. I created a new issue for the panic (now just an error, since https://github.com/influxdata/telegraf/commit/e00147ded38af30f945935ad626aa8be71700b6d): https://github.com/influxdata/telegraf/issues/10355. And linked the PR to the new issue instead of this one.

jostrasser commented 2 years ago

telegraf 1.21.2 released which should fix this issue... testing it asap... https://github.com/influxdata/telegraf/releases/tag/v1.21.2

jostrasser commented 2 years ago

...after updating to 1.21.2 I am getting another error: 2022-01-05T21:02:06Z E! [telegraf] Error running agent: could not initialize input inputs.snmp: Filepath could not be walked: no mibs found and telegraf is crashing.

Downgrading to 1.20.4 solves the issue again.

powersj commented 2 years ago

@jostrasser can you please file a new bug with all the required information and I'm sure someone can look at it.

jostrasser commented 2 years ago

@jostrasser can you please file a new bug with all the required information and I'm sure someone can look at it.

sure, I'll open a new one. Thanks for your support.

jostrasser commented 2 years ago

Hi @powersj opened this new issue: https://github.com/influxdata/telegraf/issues/10387

Thanks!

beparmentier commented 2 years ago

Hello,

Just having some warnings after updating to version 1.21.2 :

Jan  7 10:18:48 odin telegraf[256859]: 2022-01-07T09:18:48Z I! Starting Telegraf 1.21.2
Jan  7 10:18:56 odin telegraf[256859]: Parse module: /var/lib/snmp/mibs/ietf/DPI20-MIB:9:4: unexpected "ibm" (expected ";")
Jan  7 10:18:59 odin telegraf[256859]: Parse module: /var/lib/snmp/mibs/ietf/HPR-MIB:494:30: unexpected "HprRtpCounter" (expected "}")
Jan  7 10:19:07 odin telegraf[256859]: Parse module: /var/lib/snmp/mibs/ietf/SNMPv2-PDU:73:1: unexpected "max-bindings" (expected "END")
Jan  7 10:19:08 odin telegraf[256859]: Parse module: /var/lib/snmp/mibs/ietf/TCPIPX-MIB:63:12: unexpected "tcpIpxConnLocalPort" (expected "}")
2022-01-07T09:18:56Z W! [inputs.snmp] module DPI20-MIB could not be loaded
2022-01-07T09:18:59Z W! [inputs.snmp] module HPR-MIB could not be loaded
2022-01-07T09:19:07Z W! [inputs.snmp] module SNMPv2-PDU could not be loaded
2022-01-07T09:19:08Z W! [inputs.snmp] module TCPIPX-MIB could not be loaded

But without panic and my snmp inputs now work fine with the latest version.

Thanks

MyaLongmire commented 2 years ago

Thank you for the update! This is an issue with the syntax of these mibs. It is talked about with the maintainer of gosmi in this issue. Hope this clears up any confusion :)

dlundh1 commented 2 years ago

Thank you for the update! This is an issue with the syntax of these mibs. It is talked about with the maintainer of gosmi in this issue. Hope this clears up any confusion :)

Do you really expect everyone to start debugging MIB files? If so, the barrier to entry for InfluxDB and Telegraf just got way higher.

MyaLongmire commented 2 years ago

@beparmentier can you please try the nightly build to see if your problem still exists?

beparmentier commented 2 years ago

@MyaLongmire hello, I installed the nighly build and I don't get Parse module errors anymore

root@odin:~# telegraf --version
Telegraf 1.22.0-0a379a5c (git: master 0a379a5c)

I still get warnings in telegraf log about mibs

2022-01-12T08:15:39Z W! [inputs.snmp] module DPI20-MIB could not be loaded
2022-01-12T08:15:42Z W! [inputs.snmp] module HPR-MIB could not be loaded
2022-01-12T08:15:51Z W! [inputs.snmp] module SNMPv2-PDU could not be loaded
2022-01-12T08:15:53Z W! [inputs.snmp] module TCPIPX-MIB could not be loaded

But its not a problem for me because I don't use them. ietf/rfc still provide bugged mibs files but now telegraf properly handle them so all we can do is to try to ask them to fix their files.

To me the telegraf issue is now solved.

Thanks !

MyaLongmire commented 2 years ago

@beparmentier thank you for your response! Since you filed the issue and it is now fixed I am going to close this. if anyone else is still having problems open another ticket and someone on the team with assist you :)