1

Need to forward the snmp trap to multiple managers. Below is the snippet used to send trap to single target address and it is working as expected.

Address targetaddress = new UdpAddress(ConnectionPropertyUtil
    .getProperty("snmpAddress").toString()+ "/"+ConnectionPropertyUtil.getProperty("snmpPort").toString());

CommunityTarget target = new CommunityTarget();
target.setCommunity(new OctetString("public"));
target.setVersion(SnmpConstants.version2c);
target.setAddress(targetaddress);
Snmp snmp = new Snmp(new DefaultUdpTransportMapping());
snmp.send(trap, target, null, null);

Is there any way where I can set multiple targetAdresses and send trap at a single shot.

priyanka hj
  • 79
  • 1
  • 2
  • 11

1 Answers1

1

You need to define one CommunityTarget for each manager. If there is more than one, it probably should go in a for loop, fetching their addresses from a file or other source.

Jolta
  • 2,620
  • 1
  • 29
  • 42