use of org.opennms.netmgt.model.OnmsLocationMonitor.MonitorStatus in project opennms by OpenNMS.
the class ServerUnreachableAdaptor method pollerCheckingIn.
/** {@inheritDoc} */
@Override
public MonitorStatus pollerCheckingIn(final String locationMonitorId, final Date currentConfigurationVersion) {
// if we check in and get a remote exception then we switch to the EmptyConfiguration
try {
final MonitorStatus result = m_remoteBackEnd.pollerCheckingIn(locationMonitorId, currentConfigurationVersion);
m_serverUnresponsive = false;
return result;
} catch (final RemoteAccessException e) {
// we have failed to check in properly with the server
m_serverUnresponsive = true;
LOG.warn("Server is unable to respond due to the following exception.", e);
return MonitorStatus.DISCONNECTED;
}
}
use of org.opennms.netmgt.model.OnmsLocationMonitor.MonitorStatus in project opennms by OpenNMS.
the class DefaultLocationDataService method getUpdatedLocationsBetween.
/** {@inheritDoc} */
@Transactional
@Override
public Collection<LocationInfo> getUpdatedLocationsBetween(final Date startDate, final Date endDate) {
waitForGeocoding("getApplicationDetails");
final Collection<LocationInfo> locations = new ArrayList<LocationInfo>();
final Map<String, OnmsMonitoringLocation> definitions = new HashMap<String, OnmsMonitoringLocation>();
// check for any monitors that have changed status
for (OnmsMonitoringLocation def : m_monitoringLocationDao.findAll()) {
for (OnmsLocationMonitor mon : m_locationDao.findByLocationDefinition(def)) {
final MonitorStatus status = m_monitorStatuses.get(mon.getLocation());
if (status == null || !status.equals(mon.getStatus())) {
definitions.put(def.getLocationName(), def);
m_monitorStatuses.put(def.getLocationName(), mon.getStatus());
}
}
}
// check for any definitions that have status updates
for (final OnmsLocationSpecificStatus status : m_locationDao.getStatusChangesBetween(startDate, endDate)) {
final String definitionName = status.getLocationMonitor().getLocation();
if (!definitions.containsKey(definitionName)) {
definitions.put(definitionName, m_monitoringLocationDao.get(definitionName));
}
}
for (final OnmsMonitoringLocation def : definitions.values()) {
final LocationInfo location = getLocationInfo(def);
locations.add(location);
}
return locations;
}
Aggregations