SNMP input plugin - all available ports taken and not released

Hi!

Running telegraf with 11000 inputs.snmp raises an error.
After many debugging days I found that my OS has this setting:

net.ipv4.ip_local_port_range = 60000 65000

that allows 5001 simultaneous connections.

Running netstat to check, I found that after starting telegraf all ports are taken and never released until telegraf is stoped.

I checked plugin documentation and did not find a way to force the port released.
Found this:

  ## Unconnected UDP socket
  ## When true, SNMP responses are accepted from any address not just
  ## the requested address. This can be useful when gathering from
  ## redundant/failover systems.
  # unconnected_udp_socket = false

but don’t seem to apply.

I know the simpler solution would be increase net.ipv4.ip_local_port_range values, but to me is not the proper way.

Most of my plugins have an interval of 24h, so the connection would be iddle most of the time.

Is there any way to make the plugin use a port and release it until next interval?

Regards;
Pablo

@PabloFraire,
I don’t think that there is but I could be mistaken.
@srebhan would know more though.

The option you mentioned is exactly what applies @PabloFraire! :wink: It will make the plugin to not hold a connection but just send/receive the required packages.

Ok.
I tried it and worked.
This morning all the plugins with

unconnected_udp_socket = true

were not connected.

Thanks.

1 Like