Search in sources :

Example 6 with SnmpV2TrapBuilder

use of org.opennms.netmgt.snmp.SnmpV2TrapBuilder in project opennms by OpenNMS.

the class SnmpTrapForwarderHelper method sendV2EventInform.

public void sendV2EventInform(Event event) throws UnknownHostException, SnmpTrapHelperException {
    long trapTimeStamp = 0;
    SnmpTrapBuilder trap = snmpTrapHelper.createV2Inform(".1.3.6.1.4.1.5813.1.1", Long.toString(trapTimeStamp));
    trap = buildEventTrap(event, trap, null);
    SnmpV2TrapBuilder inform = (SnmpV2TrapBuilder) trap;
    try {
        inform.sendInform(getIp(), getPort(), getTimeout(), getRetries(), getCommunity());
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : SnmpV2TrapBuilder(org.opennms.netmgt.snmp.SnmpV2TrapBuilder) UnknownHostException(java.net.UnknownHostException) SnmpTrapBuilder(org.opennms.netmgt.snmp.SnmpTrapBuilder)

Aggregations

SnmpV2TrapBuilder (org.opennms.netmgt.snmp.SnmpV2TrapBuilder)6 UnknownHostException (java.net.UnknownHostException)4 SnmpTrapBuilder (org.opennms.netmgt.snmp.SnmpTrapBuilder)2 SnmpAgentConfig (org.opennms.netmgt.snmp.SnmpAgentConfig)1