telegraf: Timeout with inputs.snmp polling squid-cache

Relevant telegraf.conf:

[[inputs.snmp]]
  interval = "30s"
  agents = [ "udp://192.168.3.1:161" ]
  version = 2
  community = "public"
  name = "squid"

  [[inputs.snmp.field]]
    name = "cacheSoftware"
    oid = "1.3.6.1.4.1.3495.1.2.2.0"
    is_tag = true

  [[inputs.snmp.field]]
    name = "cacheVersionId"
    oid = "1.3.6.1.4.1.3495.1.2.3.0"
    is_tag = true

  [[inputs.snmp.field]]
    name = "cacheProtoClientHttpRequests"
    oid = "1.3.6.1.4.1.3495.1.3.2.1.1.0"

System info:

Running Ubuntu in telegraf:latest docker image:

I have no name!@TelegrafHost:/$ telegraf --version Telegraf 1.18.2 (git: HEAD a6143722)

Docker

version : "3"

services:
  telegraf:
    image: telegraf
    hostname: TelegrafHost
    user: 201:201
    command: --config /etc/telegraf/telegraf.conf --config-directory /etc/telegraf/telegraf.d
    ports:
      - 6514:6514/udp
      - 162:6162/udp
    volumes:
      - /home/docker/etc/telegraf:/etc/telegraf:ro
      - /proc:/host/proc:ro
      - /home/docker/.snmp/mibs:/usr/share/snmp/mibs:ro
    networks:
       influxdatanet:

Steps to reproduce:

  1. configure telegraf docker image to pull snmp statistics from squid-cache

Expected behavior:

From the CLI inside the docker container snmpget works as expected.

I have no name!@TelegrafHost:/$ snmpget -v2c -c public 192.168.3.1 1.3.6.1.4.1.3495.1.2.2.0 iso.3.6.1.4.1.3495.1.2.2.0 = STRING: “squid”

Actual behavior:

docker logs show timeout errors on this specific agent

2021-05-20T14:28:10Z E! [inputs.snmp] Error in plugin: agent udp://192.168.3.1:161: performing get on field cacheSoftware: request timeout (after 3 retries)

(lot’s of these)

Additional info:

Other input.snmp agents work, just this specific one time’s out.

a tcpdump gives this when telegraf polls:

16:31:35.005000 IP 172.18.0.5.35773 > 192.168.3.1.161: GetRequest(31) .1.3.6.1.4.1.3495.1.2.2.0 16:31:35.005274 IP 172.18.0.1.161 > 172.18.0.5.35773: GetResponse(40) .1.3.6.1.4.1.3495.1.2.2.0=“squid” 16:31:35.005313 IP 172.18.0.5 > 172.18.0.1: ICMP 172.18.0.5 udp port 35773 unreachable, length 95

but an snmpget from the CLI does not give the ICMP error. (telegraf stops listening at the port before the answer is received?)

test run output:

I have no name!@TelegrafHost:/$ telegraf --test --config /etc/telegraf/telegraf.conf --config-directory /etc/telegraf/telegraf.d <…> 2021-05-20T14:09:28Z E! [inputs.snmp] Error in plugin: agent udp://192.168.3.1:161: performing get on field cacheSoftware: request timeout (after 3 retries) I have no name!@TelegrafHost:/$

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 23 (5 by maintainers)

Most upvoted comments

With the latest official release (1.21.4) it did not work, then I tried the pr build (1.22.0) and there it worked.

This pr takes @Hipska idea of implementing UseUnconnectedUDPSocket. Can someone please test it to see if it fixes their issue?

@reimda WDYT?

I think PR#277 is the one.