use of org.opennms.web.svclayer.model.DistributedStatusHistoryModel.ServiceGraph in project opennms by OpenNMS.
the class DefaultDistributedStatusService method getServiceGraphForService.
private ServiceGraph getServiceGraphForService(OnmsLocationMonitor locMon, OnmsMonitoredService service, long[] times) {
OnmsResource resource;
try {
resource = m_resourceDao.getResourceForIpInterface(service.getIpInterface(), locMon);
} catch (ObjectRetrievalFailureException e) {
resource = null;
}
if (resource == null) {
return new ServiceGraph(service, new String[] { "Resource could not be found. Has any response time data been collected for this service from this remote poller?" });
}
String graphName = service.getServiceName().toLowerCase();
try {
m_graphDao.getPrefabGraph(graphName);
} catch (ObjectRetrievalFailureException e) {
return new ServiceGraph(service, new String[] { "Graph definition could not be found for '" + graphName + "'. A graph definition needs to be created for this service." });
}
PrefabGraph[] prefabGraphs = m_graphDao.getPrefabGraphsForResource(resource);
for (PrefabGraph graph : prefabGraphs) {
if (graph.getName().equals(graphName)) {
String url = "graph/graph.png" + "?report=" + Util.encode(graph.getName()) + "&resourceId=" + Util.encode(resource.getId().toString()) + "&start=" + times[0] + "&end=" + times[1];
return new ServiceGraph(service, url);
}
}
return new ServiceGraph(service, new String[] { "Graph could not be found for '" + graphName + "' on this resource. Has any response time data been collected for this service from this remote poller and is the graph definition correct?" });
}
use of org.opennms.web.svclayer.model.DistributedStatusHistoryModel.ServiceGraph in project opennms by OpenNMS.
the class DefaultDistributedStatusService method initializeGraphUrls.
private void initializeGraphUrls(DistributedStatusHistoryModel model) {
if (model.getChosenMonitor() != null) {
Collection<OnmsMonitoredService> services = model.getChosenApplicationMemberServices();
long[] times = model.getChosenPeriod().getStartAndEndTimes();
SortedSet<ServiceGraph> serviceGraphs = new TreeSet<ServiceGraph>(SERVICE_GRAPH_COMPARATOR);
for (OnmsMonitoredService service : services) {
serviceGraphs.add(getServiceGraphForService(model.getChosenMonitor(), service, times));
}
model.setServiceGraphs(serviceGraphs);
}
}
Aggregations