use of org.opennms.netmgt.model.events.EventBuilder in project opennms by OpenNMS.
the class DeleteNodesServlet method sendDeleteNodeEvent.
private void sendDeleteNodeEvent(int node) throws ServletException {
EventBuilder bldr = new EventBuilder(EventConstants.DELETE_NODE_EVENT_UEI, "web ui");
bldr.setNodeid(node);
bldr.addParam(EventConstants.PARM_TRANSACTION_NO, "webUI");
sendEvent(bldr.getEvent());
}
use of org.opennms.netmgt.model.events.EventBuilder in project opennms by OpenNMS.
the class TrapdIT method testSnmpV2cTrapSend.
@Test
public void testSnmpV2cTrapSend() throws Exception {
String localhost = "127.0.0.1";
InetAddress localAddr = InetAddressUtils.addr(localhost);
SnmpObjId enterpriseId = SnmpObjId.get(".1.3.6.1.4.1.5813");
SnmpObjId trapOID = SnmpObjId.get(enterpriseId, new SnmpInstId(1));
SnmpTrapBuilder pdu = SnmpUtils.getV2TrapBuilder();
pdu.addVarBind(SnmpObjId.get(".1.3.6.1.2.1.1.3.0"), SnmpUtils.getValueFactory().getTimeTicks(0));
pdu.addVarBind(SnmpObjId.get(".1.3.6.1.6.3.1.1.4.1.0"), SnmpUtils.getValueFactory().getObjectId(trapOID));
pdu.addVarBind(SnmpObjId.get(".1.3.6.1.6.3.1.1.4.3.0"), SnmpUtils.getValueFactory().getObjectId(enterpriseId));
EventBuilder defaultTrapBuilder = new EventBuilder("uei.opennms.org/default/trap", "trapd");
defaultTrapBuilder.setInterface(localAddr);
defaultTrapBuilder.setSnmpVersion("v2c");
m_mockEventIpcManager.getEventAnticipator().anticipateEvent(defaultTrapBuilder.getEvent());
EventBuilder newSuspectBuilder = new EventBuilder(EventConstants.NEW_SUSPECT_INTERFACE_EVENT_UEI, "trapd");
newSuspectBuilder.setInterface(localAddr);
m_mockEventIpcManager.getEventAnticipator().anticipateEvent(newSuspectBuilder.getEvent());
pdu.send(localhost, m_trapdConfig.getSnmpTrapPort(), "public");
// Allow time for Trapd and Eventd to do their magic
Thread.sleep(5000);
}
use of org.opennms.netmgt.model.events.EventBuilder in project opennms by OpenNMS.
the class TrapdIT method testSnmpV1TrapSend.
@Test
public void testSnmpV1TrapSend() throws Exception {
String localhost = "127.0.0.1";
InetAddress localAddr = InetAddressUtils.addr(localhost);
SnmpV1TrapBuilder pdu = SnmpUtils.getV1TrapBuilder();
pdu.setEnterprise(SnmpObjId.get(".1.3.6.1.4.1.5813"));
pdu.setGeneric(1);
pdu.setSpecific(0);
pdu.setTimeStamp(666L);
pdu.setAgentAddress(localAddr);
EventBuilder defaultTrapBuilder = new EventBuilder("uei.opennms.org/default/trap", "trapd");
defaultTrapBuilder.setInterface(localAddr);
defaultTrapBuilder.setSnmpVersion("v1");
m_mockEventIpcManager.getEventAnticipator().anticipateEvent(defaultTrapBuilder.getEvent());
EventBuilder newSuspectBuilder = new EventBuilder(EventConstants.NEW_SUSPECT_INTERFACE_EVENT_UEI, "trapd");
newSuspectBuilder.setInterface(localAddr);
m_mockEventIpcManager.getEventAnticipator().anticipateEvent(newSuspectBuilder.getEvent());
pdu.send(localhost, m_trapdConfig.getSnmpTrapPort(), "public");
// Allow time for Trapd and Eventd to do their magic
Thread.sleep(5000);
}
use of org.opennms.netmgt.model.events.EventBuilder in project opennms by OpenNMS.
the class DefaultPollerBackEnd method sendRegainedOrLostServiceEvent.
private void sendRegainedOrLostServiceEvent(final OnmsLocationSpecificStatus newStatus, final PollStatus pollResult) {
final String uei = pollResult.isAvailable() ? EventConstants.REMOTE_NODE_REGAINED_SERVICE_UEI : EventConstants.REMOTE_NODE_LOST_SERVICE_UEI;
final EventBuilder builder = createEventBuilder(newStatus.getLocationMonitor(), uei).setMonitoredService(newStatus.getMonitoredService());
if (!pollResult.isAvailable() && pollResult.getReason() != null) {
builder.addParam(EventConstants.PARM_LOSTSERVICE_REASON, pollResult.getReason());
}
m_eventIpcManager.sendNow(builder.getEvent());
}
use of org.opennms.netmgt.model.events.EventBuilder in project opennms by OpenNMS.
the class PollerBackEndTest method createReconnectedEvent.
private static Event createReconnectedEvent() {
EventBuilder eventBuilder = new EventBuilder(EventConstants.LOCATION_MONITOR_RECONNECTED_UEI, "PollerBackEnd");
eventBuilder.addParam(EventConstants.PARM_LOCATION_MONITOR_ID, LOCATION_MONITOR_ID);
return eventBuilder.getEvent();
}
Aggregations