Search in sources :

Example 1 with SnmpTrapSession

use of org.opennms.protocols.snmp.SnmpTrapSession in project opennms by OpenNMS.

the class JoeSnmpStrategy method send.

public static void send(final String destAddr, final int destPort, final String community, final SnmpPduRequest pdu) throws Exception {
    SnmpTrapSession trapSession = getTrapSession();
    SnmpPeer peer = new SnmpPeer(InetAddress.getByName(destAddr), destPort);
    SnmpParameters parms = new SnmpParameters(community);
    parms.setVersion(SnmpSMI.SNMPV2);
    peer.setParameters(parms);
    trapSession.send(peer, pdu);
}
Also used : SnmpTrapSession(org.opennms.protocols.snmp.SnmpTrapSession) SnmpParameters(org.opennms.protocols.snmp.SnmpParameters) SnmpPeer(org.opennms.protocols.snmp.SnmpPeer)

Example 2 with SnmpTrapSession

use of org.opennms.protocols.snmp.SnmpTrapSession in project opennms by OpenNMS.

the class JoeSnmpStrategy method registerForTraps.

@Override
public void registerForTraps(final TrapNotificationListener listener, InetAddress address, int snmpTrapPort) throws IOException {
    final RegistrationInfo info = new RegistrationInfo(listener, address, snmpTrapPort);
    final JoeSnmpTrapNotifier m_trapHandler = new JoeSnmpTrapNotifier(listener);
    info.setHandler(m_trapHandler);
    SnmpTrapSession m_trapSession = new SnmpTrapSession(m_trapHandler, address, snmpTrapPort);
    info.setSession(m_trapSession);
    s_registrations.put(listener, info);
}
Also used : SnmpTrapSession(org.opennms.protocols.snmp.SnmpTrapSession)

Example 3 with SnmpTrapSession

use of org.opennms.protocols.snmp.SnmpTrapSession in project opennms by OpenNMS.

the class JoeSnmpStrategy method send.

public static void send(String destAddr, int destPort, String community, SnmpPduTrap trap) throws Exception {
    SnmpTrapSession trapSession = getTrapSession();
    SnmpPeer peer = new SnmpPeer(InetAddress.getByName(destAddr), destPort);
    SnmpParameters parms = new SnmpParameters(community);
    parms.setVersion(SnmpSMI.SNMPV1);
    peer.setParameters(parms);
    trapSession.send(peer, trap);
}
Also used : SnmpTrapSession(org.opennms.protocols.snmp.SnmpTrapSession) SnmpParameters(org.opennms.protocols.snmp.SnmpParameters) SnmpPeer(org.opennms.protocols.snmp.SnmpPeer)

Aggregations

SnmpTrapSession (org.opennms.protocols.snmp.SnmpTrapSession)3 SnmpParameters (org.opennms.protocols.snmp.SnmpParameters)2 SnmpPeer (org.opennms.protocols.snmp.SnmpPeer)2