Monitoring multiple SNMP agents behind a single IP address (without Minion)

snmp
#1

Scenario

We have multiple SNMP agents bound to different ports on a single IP address
and we want to monitor these as separate nodes in OpenNMS.

Problem

The SNMP configuration is currently bound to the IP address and location, so we cannot reliably use different ports on the same IP address.

Workaround

Configure the nodes in OpenNMS using different IP addresses and route the traffic from these
IP address to the actualy SNMP agents.

On the OpenNMS system, create a new tap interface, and add the IP addresses that we will associate with the nodes:

ip tuntap add dev tap0 mode tap
ip addr add 10.255.1.1 dev tap0

Now, use socat to bind to port 161 on that address, and forward the SNMP traffic to the real agent:

socat udp-listen:161,fork,bind=10.255.1.1 udp:demo.snmplabs.com:161

Test:

snmpwalk -On -c public -v 2c 10.255.1.1 .1.3.6.1.2.1.1

Configure the SNMP settings in OpenNMS for 10.255.1.1 and provision a node with this IP as it’s primary SNMP address.

3 Likes