0

I found below snmpget command in bash script which is used to check the remote server status; is the remote server up or down. Command is

snmpget $1 tcpConnState.0.0.0.0.12000.0.0.0.0.0 | grep listen | wc -l

here $1 is the hostname of remote server. Whenever I try to execute the command its showing below error

No log handling enabled - turning on stderr logging
snmpget: No securityName specified (Sub-id not found: (top) -> tcpConnState)
0

Any changes required in the snmpd configuration ?

Esa Jokinen
  • 46,944
  • 3
  • 83
  • 129

1 Answers1

2

tcpConnState is part of the TCP-MIB and retrieves information on active tcp connections on the remote host (similar to the information available from netstat). The first five digits are the server's local address & port for the tcp connection, and the last five are the remote address and port.

For example an active ssh connection looks as follows, with a.b.c.d as the server and w.x.y.z as the client

TCP-MIB::tcpConnState.a.b.c.d.22.w.x.y.z.62612 = INTEGER: established(5)

In this case it is looking for a tcp socket from 0.0.0.0 (any local address) port 12000, to remote host 0.0.0.0 port 0 - which is what a listening socket would usually show up as (assuming it's not bound to a specific local IP address). So in short it's checking if there's something listening on port 12000 on the snmp target.

It's possible that the remote host doesn't support the tcpConnState operation, or it's not exposed.

I would try an snmpwalk on the remote host first to see if the tcpConnState tree appears. If it's something like a Linux box that's running the standard snmpd daemon it should support this so it may be disabled in configuration.

USD Matt
  • 5,381
  • 15
  • 23