Search in sources :

Example 1 with StatusDetails

use of org.opennms.features.poller.remote.gwt.client.StatusDetails in project opennms by OpenNMS.

the class LocationDataManagerTest method testGetApplicationInfo.

@Test
public void testGetApplicationInfo() {
    String appName = "Domain Controllers";
    OnmsApplication app = m_applicationDao.findByName(appName);
    System.err.println("TEST testGetApplicationInfo: calling getApplicationInfo");
    m_locationDataService.getApplicationInfo(app, new StatusDetails());
}
Also used : StatusDetails(org.opennms.features.poller.remote.gwt.client.StatusDetails) OnmsApplication(org.opennms.netmgt.model.OnmsApplication) Test(org.junit.Test)

Example 2 with StatusDetails

use of org.opennms.features.poller.remote.gwt.client.StatusDetails in project opennms by OpenNMS.

the class LocationDataManagerTest method testGetStatusDetailsForApplication.

@Test
public void testGetStatusDetailsForApplication() {
    String appName = "Domain Controllers";
    int count = 100;
    long start = System.currentTimeMillis();
    for (int i = 0; i < count; i++) {
        OnmsApplication app = m_applicationDao.findByName(appName);
        //System.err.println("TEST testGetSatusDetailsForApplication: calling getStatusDetailsForApplication");
        StatusDetails details = m_locationDataService.getStatusDetailsForApplication(app);
        assertEquals(Status.UP, details.getStatus());
    }
    System.err.println(String.format("Avg getStatusDetailsForApplication: %d\n", (System.currentTimeMillis() - start) / count));
}
Also used : StatusDetails(org.opennms.features.poller.remote.gwt.client.StatusDetails) OnmsApplication(org.opennms.netmgt.model.OnmsApplication) Test(org.junit.Test)

Example 3 with StatusDetails

use of org.opennms.features.poller.remote.gwt.client.StatusDetails in project opennms by OpenNMS.

the class DefaultLocationDataService method getStatusDetailsForLocation.

/** {@inheritDoc} */
@Transactional
@Override
public StatusDetails getStatusDetailsForLocation(final OnmsMonitoringLocation def) {
    waitForGeocoding("getStatusDetails");
    final DefaultLocationDataService.MonitorStatusTracker mst = new DefaultLocationDataService.MonitorStatusTracker(def.getLocationName());
    final List<GWTLocationMonitor> monitors = new ArrayList<GWTLocationMonitor>();
    for (OnmsLocationMonitor mon : m_locationDao.findByLocationDefinition(def)) {
        monitors.add(transformLocationMonitor(mon));
    }
    for (OnmsLocationSpecificStatus status : m_locationDao.getMostRecentStatusChangesForLocation(def.getLocationName())) {
        mst.onStatus(status);
    }
    LocationMonitorState monitorState = new LocationMonitorState(monitors, mst.drain());
    StatusDetails statusDetails = monitorState.getStatusDetails();
    LOG.debug("getStatusDetails({}) returning {}", def.getLocationName(), statusDetails);
    return statusDetails;
}
Also used : OnmsLocationSpecificStatus(org.opennms.netmgt.model.OnmsLocationSpecificStatus) ArrayList(java.util.ArrayList) StatusDetails(org.opennms.features.poller.remote.gwt.client.StatusDetails) LocationMonitorState(org.opennms.features.poller.remote.gwt.client.LocationMonitorState) GWTLocationMonitor(org.opennms.features.poller.remote.gwt.client.GWTLocationMonitor) OnmsLocationMonitor(org.opennms.netmgt.model.OnmsLocationMonitor) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with StatusDetails

use of org.opennms.features.poller.remote.gwt.client.StatusDetails in project opennms by OpenNMS.

the class DefaultLocationDataService method getStatusDetailsForAllLocations.

@Override
public Map<String, StatusDetails> getStatusDetailsForAllLocations() {
    final Collection<OnmsMonitoringLocation> definitions = m_monitoringLocationDao.findAll();
    AllMonitorStatusTracker tracker = new AllMonitorStatusTracker();
    MonitorTracker monTracker = new MonitorTracker();
    for (OnmsLocationSpecificStatus status : m_locationDao.getAllMostRecentStatusChanges()) {
        tracker.onStatus(status);
    }
    for (OnmsLocationMonitor monitor : m_locationDao.findAll()) {
        monTracker.onMonitor(monitor);
    }
    Map<String, StatusDetails> statusDetails = new LinkedHashMap<String, StatusDetails>();
    for (final OnmsMonitoringLocation def : definitions) {
        LocationMonitorState monitorState = new LocationMonitorState(monTracker.drain(def.getLocationName()), tracker.drain(def.getLocationName()));
        final StatusDetails monitorStatus = monitorState.getStatusDetails();
        statusDetails.put(def.getLocationName(), monitorStatus);
    }
    return statusDetails;
}
Also used : OnmsLocationSpecificStatus(org.opennms.netmgt.model.OnmsLocationSpecificStatus) StatusDetails(org.opennms.features.poller.remote.gwt.client.StatusDetails) LocationMonitorState(org.opennms.features.poller.remote.gwt.client.LocationMonitorState) OnmsLocationMonitor(org.opennms.netmgt.model.OnmsLocationMonitor) OnmsMonitoringLocation(org.opennms.netmgt.model.monitoringLocations.OnmsMonitoringLocation) LinkedHashMap(java.util.LinkedHashMap)

Example 5 with StatusDetails

use of org.opennms.features.poller.remote.gwt.client.StatusDetails in project opennms by OpenNMS.

the class DefaultLocationDataService method getStatusDetailsForAllApplications.

private Map<OnmsApplication, StatusDetails> getStatusDetailsForAllApplications() {
    final Collection<OnmsApplication> apps = m_applicationDao.findAll();
    Map<OnmsApplication, StatusDetails> statusDetails = new LinkedHashMap<OnmsApplication, StatusDetails>();
    for (final OnmsApplication app : apps) {
        StatusDetails appStatusDetails = getStatusDetailsForApplication(app);
        statusDetails.put(app, appStatusDetails);
    }
    return statusDetails;
}
Also used : StatusDetails(org.opennms.features.poller.remote.gwt.client.StatusDetails) OnmsApplication(org.opennms.netmgt.model.OnmsApplication) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

StatusDetails (org.opennms.features.poller.remote.gwt.client.StatusDetails)10 Transactional (org.springframework.transaction.annotation.Transactional)6 ArrayList (java.util.ArrayList)5 LinkedHashMap (java.util.LinkedHashMap)4 OnmsApplication (org.opennms.netmgt.model.OnmsApplication)4 OnmsLocationSpecificStatus (org.opennms.netmgt.model.OnmsLocationSpecificStatus)4 GWTLocationMonitor (org.opennms.features.poller.remote.gwt.client.GWTLocationMonitor)3 OnmsLocationMonitor (org.opennms.netmgt.model.OnmsLocationMonitor)3 Date (java.util.Date)2 HashMap (java.util.HashMap)2 LinkedHashSet (java.util.LinkedHashSet)2 Map (java.util.Map)2 Test (org.junit.Test)2 AppStatusDetailsComputer (org.opennms.features.poller.remote.gwt.client.AppStatusDetailsComputer)2 GWTLocationSpecificStatus (org.opennms.features.poller.remote.gwt.client.GWTLocationSpecificStatus)2 GWTMonitoredService (org.opennms.features.poller.remote.gwt.client.GWTMonitoredService)2 LocationMonitorState (org.opennms.features.poller.remote.gwt.client.LocationMonitorState)2 OnmsMonitoredService (org.opennms.netmgt.model.OnmsMonitoredService)2 OnmsMonitoringLocation (org.opennms.netmgt.model.monitoringLocations.OnmsMonitoringLocation)2 ApplicationInfo (org.opennms.features.poller.remote.gwt.client.ApplicationInfo)1