Search in sources :

Example 6 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 7 with StatusDetails

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

the class DefaultLocationDataService method getInfoForAllLocations.

/**
 * <p>getInfoForAllLocations</p>
 *
 * @return a {@link java.util.List} object.
 */
@Transactional
@Override
public List<LocationInfo> getInfoForAllLocations() {
    waitForGeocoding("getInfoForAllLocations");
    Map<String, StatusDetails> statusDetails = getStatusDetailsForAllLocations();
    List<LocationInfo> locations = new ArrayList<LocationInfo>();
    for (Map.Entry<String, StatusDetails> entry : statusDetails.entrySet()) {
        OnmsMonitoringLocation def = m_monitoringLocationDao.get(entry.getKey());
        LocationInfo locationInfo = this.getLocationInfo(def, entry.getValue());
        locations.add(locationInfo);
    }
    return locations;
}
Also used : StatusDetails(org.opennms.features.poller.remote.gwt.client.StatusDetails) ArrayList(java.util.ArrayList) Map(java.util.Map) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) LocationInfo(org.opennms.features.poller.remote.gwt.client.location.LocationInfo) OnmsMonitoringLocation(org.opennms.netmgt.model.monitoringLocations.OnmsMonitoringLocation) Transactional(org.springframework.transaction.annotation.Transactional)

Example 8 with StatusDetails

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

the class DefaultLocationDataService method getInfoForAllApplications.

/**
 * <p>getInfoForAllApplications</p>
 *
 * @return a {@link java.util.List} object.
 */
@Transactional
@Override
public List<ApplicationInfo> getInfoForAllApplications() {
    waitForGeocoding("handleAllApplications");
    Map<OnmsApplication, StatusDetails> statusDetails = getStatusDetailsForAllApplications();
    final List<ApplicationInfo> appInfos = new ArrayList<ApplicationInfo>();
    for (Map.Entry<OnmsApplication, StatusDetails> entry : statusDetails.entrySet()) {
        final ApplicationInfo appInfo = getApplicationInfo(entry.getKey(), entry.getValue());
        appInfos.add(appInfo);
    }
    return appInfos;
}
Also used : StatusDetails(org.opennms.features.poller.remote.gwt.client.StatusDetails) ApplicationInfo(org.opennms.features.poller.remote.gwt.client.ApplicationInfo) ArrayList(java.util.ArrayList) OnmsApplication(org.opennms.netmgt.model.OnmsApplication) Map(java.util.Map) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Transactional(org.springframework.transaction.annotation.Transactional)

Example 9 with StatusDetails

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

the class DefaultLocationDataService method getLocationInfo.

/**
 * <p>getLocationInfo</p>
 *
 * @param def a {@link org.opennms.netmgt.model.OnmsMonitoringLocationDefinition} object.
 * @return a {@link org.opennms.features.poller.remote.gwt.client.location.LocationInfo} object.
 */
@Transactional
@Override
public LocationInfo getLocationInfo(final OnmsMonitoringLocation def) {
    waitForGeocoding("getLocationInfo");
    if (def == null) {
        LOG.warn("no location definition specified");
        return null;
    }
    final StatusDetails monitorStatus = getStatusDetailsForLocation(def);
    return getLocationInfo(def, monitorStatus);
}
Also used : StatusDetails(org.opennms.features.poller.remote.gwt.client.StatusDetails) Transactional(org.springframework.transaction.annotation.Transactional)

Example 10 with StatusDetails

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

the class DefaultLocationDataService method getStatusDetailsForApplicationOld.

/**
 * <p>getStatusDetailsForApplicationOld</p>
 *
 * @param app a {@link org.opennms.netmgt.model.OnmsApplication} object.
 * @return a {@link org.opennms.features.poller.remote.gwt.client.StatusDetails} object.
 */
@Transactional
public StatusDetails getStatusDetailsForApplicationOld(final OnmsApplication app) {
    waitForGeocoding("getStatusDetailsForApplication");
    List<GWTLocationSpecificStatus> statuses = new ArrayList<GWTLocationSpecificStatus>();
    final Date to = new Date();
    final Date from = new Date(to.getTime() - AVAILABILITY_MS);
    final Collection<OnmsMonitoredService> services = m_monitoredServiceDao.findByApplication(app);
    final List<GWTLocationMonitor> monitors = new ArrayList<GWTLocationMonitor>();
    final Set<GWTMonitoredService> gwtServices = new LinkedHashSet<GWTMonitoredService>(services.size());
    for (final OnmsMonitoredService service : services) {
        gwtServices.add(transformMonitoredService(service));
    }
    for (final OnmsLocationMonitor monitor : m_locationDao.findByApplication(app)) {
        monitors.add(transformLocationMonitor(monitor));
        for (final OnmsLocationSpecificStatus locationSpecificStatus : m_locationDao.getStatusChangesForLocationBetween(from, to, monitor.getLocation())) {
            if (services.contains(locationSpecificStatus.getMonitoredService())) {
                statuses.add(transformLocationSpecificStatus(locationSpecificStatus));
            }
        }
    }
    StatusDetails statusDetails = new AppStatusDetailsComputer(from, to, monitors, gwtServices, statuses).compute();
    LOG.warn("getStatusDetailsForApplication({}) returning {}", app.getName(), statusDetails);
    return statusDetails;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) OnmsLocationSpecificStatus(org.opennms.netmgt.model.OnmsLocationSpecificStatus) ArrayList(java.util.ArrayList) GWTLocationMonitor(org.opennms.features.poller.remote.gwt.client.GWTLocationMonitor) GWTMonitoredService(org.opennms.features.poller.remote.gwt.client.GWTMonitoredService) Date(java.util.Date) OnmsMonitoredService(org.opennms.netmgt.model.OnmsMonitoredService) AppStatusDetailsComputer(org.opennms.features.poller.remote.gwt.client.AppStatusDetailsComputer) GWTLocationSpecificStatus(org.opennms.features.poller.remote.gwt.client.GWTLocationSpecificStatus) StatusDetails(org.opennms.features.poller.remote.gwt.client.StatusDetails) OnmsLocationMonitor(org.opennms.netmgt.model.OnmsLocationMonitor) Transactional(org.springframework.transaction.annotation.Transactional)

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