Traps forwarded from OpenNMS toward northbound NMS has the SNMP community field as “public” at all time.
Description
I tried to forward SNMP Traps by using Scriptd event script. The script is relatively simple (pasted below) and I am using SnmpTrapHelper class method forwardTrap for this forwarding.
So the bug I am experiencing is the following: The SNMP trap received by OpenNMS has SNMP community value “space”, but the forwarded trap from OpenNMS toward northbound NMS has the SNMP community field “public”.
I tried to forward SNMP Traps by using Scriptd event script.
The script is relatively simple (pasted below) and I am using SnmpTrapHelper class method forwardTrap for this forwarding.
So the bug I am experiencing is the following:
The SNMP trap received by OpenNMS has SNMP community value “space”, but the forwarded trap from OpenNMS toward northbound NMS has the SNMP community field “public”.
<event-script language="beanshell">
import org.opennms.netmgt.xml.event.Event;
import org.opennms.netmgt.xml.event.Snmp;
import org.opennms.netmgt.scriptd.helper.SnmpTrapHelper;
event = bsf.lookupBean("event");
snmp_community = event.getSnmp().getCommunity();
NMS_IP = "10.102.242.16";
NMS_PORT = 162;
if (snmpInfo != null) {
log.info("Forwarding NATIVE trap for dpajin, host:" + event.host + ", snmphost:" + event.snmphost + ", comm:" + snmp_community + ", uei: " + event.uei);
snmpTrapHelper.forwardTrap(event, NMS_IP, NMS_PORT);
}
</event-script>