Search in sources :

Example 26 with SnmpTrapBuilder

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

the class SnmpTrapForwarderHelper method sendV2AlarmTrap.

public void sendV2AlarmTrap(Event event, boolean sync) throws UnknownHostException, SnmpTrapHelperException {
    long trapTimeStamp = 0;
    SnmpTrapBuilder trap = snmpTrapHelper.createV2Trap(".1.3.6.1.4.1.5813.1.3", Long.toString(trapTimeStamp));
    trap = buildAlarmTrap(event, sync, trap);
    try {
        trap.send(getIp(), getPort(), getCommunity());
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : UnknownHostException(java.net.UnknownHostException) SnmpTrapBuilder(org.opennms.netmgt.snmp.SnmpTrapBuilder)

Aggregations

SnmpTrapBuilder (org.opennms.netmgt.snmp.SnmpTrapBuilder)26 UnknownHostException (java.net.UnknownHostException)15 SnmpInstId (org.opennms.netmgt.snmp.SnmpInstId)5 SnmpObjId (org.opennms.netmgt.snmp.SnmpObjId)5 SnmpV3TrapBuilder (org.opennms.netmgt.snmp.SnmpV3TrapBuilder)5 Test (org.junit.Test)2 SnmpV2TrapBuilder (org.opennms.netmgt.snmp.SnmpV2TrapBuilder)2 InetAddress (java.net.InetAddress)1 SQLException (java.sql.SQLException)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 CamelBlueprintTest (org.opennms.core.test.camel.CamelBlueprintTest)1 EventBuilder (org.opennms.netmgt.model.events.EventBuilder)1 SnmpAgentConfig (org.opennms.netmgt.snmp.SnmpAgentConfig)1 SnmpValue (org.opennms.netmgt.snmp.SnmpValue)1 Parm (org.opennms.netmgt.xml.event.Parm)1 Snmp (org.opennms.netmgt.xml.event.Snmp)1 Value (org.opennms.netmgt.xml.event.Value)1 OctetString (org.snmp4j.smi.OctetString)1