[CentOS] OT: forwarding SNMP traps

Fri Sep 28 18:36:47 UTC 2012
James Pifer <jep at obrien-pifer.com>

Can anyone here give me a hand with forwarding snmp traps? I'm looking at Zenoss and I 
want to see how it handles snmp traps. We currently have snmp traps getting sent to two 
servers. One of them is basically ignoring the traps, but I can't just change the ip address (to 
give to Zenoss) because of other things the host is doing.

So instead I'd like to simply forward the snmp traps to the new zenoss system. I've tried a 
couple different forwarding programs, like jredirect and a python script I found while 
searching. I use jredirect to forward some other things, but I'm guessing it doesn't like udp.

I've also tried figuring out snmptrapd and snmpd without any success at all. 

Last, I tried simply using iptables with something like:
# iptables -t nat -A PREROUTING -i eth0 -p udp -m udp --dport 162 -j DNAT --to-destination
# iptables -A INPUT -i eth0 -p udp -m udp --dport 162 -j ACCEPT

But that doesn't seem to work either. 

I can see running wireshark on both systems that the old server is receiving traps, but they 
are never getting forwarded to the zenoss system. 

Anyone here know how to do it? Any assistance is appreciated.