Search in sources :

Example 41 with EventBuilder

use of org.opennms.netmgt.model.events.EventBuilder in project opennms by OpenNMS.

the class DefaultPollerBackEnd method sendUnsuccessfulScanReportEvent.

private void sendUnsuccessfulScanReportEvent(final String reportId, final String locationName, final String failureMessage) {
    final EventBuilder eventBuilder = new EventBuilder(EventConstants.REMOTE_UNSUCCESSFUL_SCAN_REPORT_UEI, "PollerBackEnd");
    eventBuilder.addParam(PARM_SCAN_REPORT_ID, reportId);
    eventBuilder.addParam(PARM_SCAN_REPORT_LOCATION, locationName);
    eventBuilder.addParam(PARM_SCAN_REPORT_FAILURE_MESSAGE, failureMessage);
    m_eventIpcManager.sendNow(eventBuilder.getEvent());
}
Also used : EventBuilder(org.opennms.netmgt.model.events.EventBuilder)

Example 42 with EventBuilder

use of org.opennms.netmgt.model.events.EventBuilder in project opennms by OpenNMS.

the class DnsProvisioningAdapter method buildEvent.

private EventBuilder buildEvent(String uei, int nodeId) {
    EventBuilder builder = new EventBuilder(uei, "Provisioner", new Date());
    builder.setNodeid(nodeId);
    return builder;
}
Also used : EventBuilder(org.opennms.netmgt.model.events.EventBuilder) Date(java.util.Date)

Example 43 with EventBuilder

use of org.opennms.netmgt.model.events.EventBuilder in project opennms by OpenNMS.

the class UpdateNotifdStatusServlet method sendEvent.

protected void sendEvent(String uei, HttpServletRequest request) {
    EventBuilder bldr = new EventBuilder(uei, "NotifdConfigFactory");
    bldr.addParam("remoteUser", request.getRemoteUser());
    bldr.addParam("remoteHost", request.getRemoteHost());
    bldr.addParam("remoteAddr", request.getRemoteAddr());
    try {
        EventIpcManagerFactory.getIpcManager().sendNow(bldr.getEvent());
    } catch (Throwable t) {
    }
}
Also used : EventBuilder(org.opennms.netmgt.model.events.EventBuilder)

Example 44 with EventBuilder

use of org.opennms.netmgt.model.events.EventBuilder in project opennms by OpenNMS.

the class SnmpManageNodesServlet method sendSNMPRestartEvent.

private void sendSNMPRestartEvent(int nodeid, String primeInt) throws ServletException {
    EventBuilder bldr = new EventBuilder(EventConstants.REINITIALIZE_PRIMARY_SNMP_INTERFACE_EVENT_UEI, "web ui");
    bldr.setNodeid(nodeid);
    bldr.setInterface(addr(primeInt));
    sendEvent(bldr.getEvent());
}
Also used : EventBuilder(org.opennms.netmgt.model.events.EventBuilder)

Example 45 with EventBuilder

use of org.opennms.netmgt.model.events.EventBuilder in project opennms by OpenNMS.

the class PollerBackEndTest method testStatusChangeFromDownToUp.

public void testStatusChangeFromDownToUp() {
    expect(m_locMonDao.get(LOCATION_MONITOR_ID)).andReturn(m_locationMonitor);
    expect(m_monSvcDao.get(2)).andReturn(m_dnsService);
    expect(m_locMonDao.getMostRecentStatusChange(m_locationMonitor, m_dnsService)).andReturn(m_dnsCurrentStatus);
    // called when saving performance data
    expect(m_monitoringLocationDao.get(m_locationDefinition.getLocationName())).andReturn(m_locationDefinition);
    expect(m_pollerConfig.getPackage(m_package.getName())).andReturn(m_package);
    expect(m_pollerConfig.getServiceInPackage("DNS", m_package)).andReturn(m_dnsSvcConfig).times(3);
    expect(m_pollerConfig.parameters(m_dnsSvcConfig)).andReturn(m_dnsSvcConfig.getParameters()).times(6);
    final PollStatus newStatus = PollStatus.available(1234.0);
    OnmsLocationSpecificStatus expectedStatus = new OnmsLocationSpecificStatus(m_locationMonitor, m_dnsService, newStatus);
    // TODO: make anticipate method
    EventBuilder eventBuilder = new EventBuilder(EventConstants.REMOTE_NODE_REGAINED_SERVICE_UEI, "PollerBackEnd").setMonitoredService(m_dnsService).addParam(EventConstants.PARM_LOCATION_MONITOR_ID, LOCATION_MONITOR_ID);
    m_eventIpcManager.getEventAnticipator().anticipateEvent(eventBuilder.getEvent());
    m_locMonDao.saveStatusChange(isA(OnmsLocationSpecificStatus.class));
    expectLastCall().andAnswer(new StatusChecker(expectedStatus));
    m_mocks.replayAll();
    m_backEnd.saveResponseTimeData(m_locationMonitor.getId(), m_dnsService, 1234, m_package);
    m_backEnd.reportResult(LOCATION_MONITOR_ID, 2, newStatus);
}
Also used : PollStatus(org.opennms.netmgt.poller.PollStatus) EventBuilder(org.opennms.netmgt.model.events.EventBuilder) OnmsLocationSpecificStatus(org.opennms.netmgt.model.OnmsLocationSpecificStatus)

Aggregations

EventBuilder (org.opennms.netmgt.model.events.EventBuilder)305 Test (org.junit.Test)88 Event (org.opennms.netmgt.xml.event.Event)84 Date (java.util.Date)22 OnmsNode (org.opennms.netmgt.model.OnmsNode)17 InetAddress (java.net.InetAddress)16 EventProxyException (org.opennms.netmgt.events.api.EventProxyException)15 AlarmData (org.opennms.netmgt.xml.event.AlarmData)14 EventAnticipator (org.opennms.netmgt.dao.mock.EventAnticipator)12 ServletException (javax.servlet.ServletException)9 EventHandler (org.opennms.netmgt.events.api.annotations.EventHandler)9 Parm (org.opennms.netmgt.xml.event.Parm)9 Event (org.opennms.netmgt.xml.eventconf.Event)9 File (java.io.File)8 ArrayList (java.util.ArrayList)8 JUnitTemporaryDatabase (org.opennms.core.test.db.annotations.JUnitTemporaryDatabase)7 OnmsAlarm (org.opennms.netmgt.model.OnmsAlarm)7 OnmsIpInterface (org.opennms.netmgt.model.OnmsIpInterface)7 SyntaxToEvent (org.opennms.netmgt.model.events.snmp.SyntaxToEvent)7 Transactional (org.springframework.transaction.annotation.Transactional)6