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?" }); }
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?" }); }