/** {@inheritDoc} */ @Override public PrefabGraph[] findPrefabGraphsForResource(OnmsResource resource) { return m_graphDao.getPrefabGraphsForResource(resource); }
/** {@inheritDoc} */ @Override public PrefabGraph getPrefabGraph(String name) { return m_graphDao.getPrefabGraph(name); }
PrefabGraph[] queries = m_graphDao.getPrefabGraphsForResource(resource); List<String> queryNames = new ArrayList<String>(queries.length); for (PrefabGraph query : queries) { PrefabGraph prefabGraph = m_graphDao.getPrefabGraph(report); Graph graph = new Graph(prefabGraph, resource, graphResults.getStart(), graphResults.getEnd()); getAttributeFiles(graph, filesToPromote);
/** {@inheritDoc} */ @Override public InputStream getPrefabGraph(ResourceId resourceId, String report, long start, long end, Integer width, Integer height) { Assert.notNull(resourceId, "resourceId argument cannot be null"); Assert.notNull(report, "report argument cannot be null"); Assert.isTrue(end > start, "end time " + end + " must be after start time" + start); PrefabGraphType t = m_graphDao.findPrefabGraphTypeByName("performance"); if (t == null) { throw new IllegalArgumentException("graph type \"" + "performance" + "\" is not valid"); } OnmsResource r = m_resourceDao.getResourceById(resourceId); Assert.notNull(r, "resource could not be located"); PrefabGraph prefabGraph = m_graphDao.getPrefabGraph(report); Graph graph = new Graph(prefabGraph, r, new Date(start), new Date(end)); String command = createPrefabCommand(graph, t.getCommandPrefix(), report, width, height); return getInputStreamForCommand(command); }
/** {@inheritDoc} */ @Override public InputStream getAdhocGraph(ResourceId resourceId, String title, String[] dataSources, String[] aggregateFunctions, String[] colors, String[] dataSourceTitles, String[] styles, long start, long end) { Assert.notNull(resourceId, "resourceId argument cannot be null"); Assert.notNull(title, "title argument cannot be null"); Assert.notNull(dataSources, "dataSources argument cannot be null"); Assert.notNull(aggregateFunctions, "aggregateFunctions argument cannot be null"); Assert.notNull(colors, "colors argument cannot be null"); Assert.notNull(dataSourceTitles, "dataSourceTitles argument cannot be null"); Assert.notNull(styles, "styles argument cannot be null"); Assert.isTrue(end > start, "end time must be after start time"); AdhocGraphType t = m_graphDao.findAdhocGraphTypeByName("performance"); OnmsResource r = m_resourceDao.getResourceById(resourceId); Assert.notNull(r, "resource \"" + resourceId + "\" could not be located"); String command = createAdHocCommand(t, r, start, end, title, dataSources, aggregateFunctions, colors, dataSourceTitles, styles); return getInputStreamForCommand(command); }
PrefabGraph[] queries = m_graphDao.getPrefabGraphsForResource(resource); List<String> queryNames = new ArrayList<String>(queries.length); for (PrefabGraph query : queries) { PrefabGraph prefabGraph = m_graphDao.getPrefabGraph(report); Graph graph = new Graph(prefabGraph, resource, graphResults.getStart(), graphResults.getEnd()); getAttributeFiles(graph, filesToPromote);
/** {@inheritDoc} */ @Override public InputStream getPrefabGraph(ResourceId resourceId, String report, long start, long end, Integer width, Integer height) { Assert.notNull(resourceId, "resourceId argument cannot be null"); Assert.notNull(report, "report argument cannot be null"); Assert.isTrue(end > start, "end time " + end + " must be after start time" + start); PrefabGraphType t = m_graphDao.findPrefabGraphTypeByName("performance"); if (t == null) { throw new IllegalArgumentException("graph type \"" + "performance" + "\" is not valid"); } OnmsResource r = m_resourceDao.getResourceById(resourceId); Assert.notNull(r, "resource could not be located"); PrefabGraph prefabGraph = m_graphDao.getPrefabGraph(report); Graph graph = new Graph(prefabGraph, r, new Date(start), new Date(end)); String command = createPrefabCommand(graph, t.getCommandPrefix(), report, width, height); return getInputStreamForCommand(command); }
/** {@inheritDoc} */ @Override public InputStream getAdhocGraph(ResourceId resourceId, String title, String[] dataSources, String[] aggregateFunctions, String[] colors, String[] dataSourceTitles, String[] styles, long start, long end) { Assert.notNull(resourceId, "resourceId argument cannot be null"); Assert.notNull(title, "title argument cannot be null"); Assert.notNull(dataSources, "dataSources argument cannot be null"); Assert.notNull(aggregateFunctions, "aggregateFunctions argument cannot be null"); Assert.notNull(colors, "colors argument cannot be null"); Assert.notNull(dataSourceTitles, "dataSourceTitles argument cannot be null"); Assert.notNull(styles, "styles argument cannot be null"); Assert.isTrue(end > start, "end time must be after start time"); AdhocGraphType t = m_graphDao.findAdhocGraphTypeByName("performance"); OnmsResource r = m_resourceDao.getResourceById(resourceId); Assert.notNull(r, "resource \"" + resourceId + "\" could not be located"); String command = createAdHocCommand(t, r, start, end, title, dataSources, aggregateFunctions, colors, dataSourceTitles, styles); return getInputStreamForCommand(command); }
/** {@inheritDoc} */ @Override public PrefabGraph[] findPrefabGraphsForResource(OnmsResource resource) { return m_graphDao.getPrefabGraphsForResource(resource); }
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?" }); }
/** {@inheritDoc} */ @Override public PrefabGraph getPrefabGraph(String name) { return m_graphDao.getPrefabGraph(name); }
@Override public PrefabGraph[] getAllPrefabGraphs(ResourceId resourceId) { OnmsResource resource = m_resourceDao.getResourceById(resourceId); return m_graphDao.getPrefabGraphsForResource(resource); }
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?" }); }
public ModelAndView nrtStart(ResourceId resourceId, String report, HttpSession httpSession) { assert (resourceId != null); logger.debug("resourceId: '{}'", resourceId); assert (report != null); logger.debug("report: '{}'", report); OnmsResource reportResource = m_resourceDao.getResourceById(resourceId); PrefabGraph prefabGraph = m_graphDao.getPrefabGraph(report); String nrtCollectionTaskId = String.format("NrtCollectionTaskId_%d_%d", System.currentTimeMillis(), new Random().nextInt()); List<CollectionJob> collectionJobs = createCollectionJobs(reportResource, prefabGraph, nrtCollectionTaskId); for (CollectionJob collectionJob : collectionJobs) { m_nrtBroker.publishCollectionJob(collectionJob); getCollectionJobMap(httpSession, true).put(nrtCollectionTaskId, collectionJob); } ModelAndView modelAndView = new ModelAndView("nrt/realtime.json"); modelAndView.addObject("nrtCollectionTaskId", nrtCollectionTaskId); modelAndView.addObject("graphTitle", prefabGraph.getTitle()); modelAndView.addObject("graphName", prefabGraph.getName()); modelAndView.addObject("graphDescription", prefabGraph.getDescription()); NrtHelper nrtHelper = new NrtHelper(); modelAndView.addObject("rrdGraphString", nrtHelper.cleanUpRrdGraphStringForWebUi(prefabGraph, getRequiredExternalPropertyAttributes(reportResource, prefabGraph), getRequiredStringPropertyAttributes(reportResource, prefabGraph))); Set<RrdGraphAttribute> relevantRrdGraphAttributes = getRequiredRrdGraphAttributes(reportResource, prefabGraph); Map<String, String> rrdGraphAttributesMetaData = getMetaDataForReport(relevantRrdGraphAttributes); Map<String, String> rrdGraphAttributesToMetricIds = getRrdGraphAttributesToMetricIds(rrdGraphAttributesMetaData); modelAndView.addObject("metricsMapping", nrtHelper.generateJsMappingObject(prefabGraph.getCommand(), rrdGraphAttributesToMetricIds)); return modelAndView; }
@Override public PrefabGraph[] getAllPrefabGraphs(ResourceId resourceId) { OnmsResource resource = m_resourceDao.getResourceById(resourceId); return m_graphDao.getPrefabGraphsForResource(resource); }
@Override public Map<String, String> doInTransaction(TransactionStatus transactionStatus) { OnmsResource resource = m_resourceDao.getResourceById(resourceId); PrefabGraph[] queries = m_graphDao.getPrefabGraphsForResource(resource); Map<String, String> graphResults = new TreeMap<String, String>(); for (PrefabGraph query : queries) { graphResults.put(query.getName(), "resourceId=" + resourceId + "&report=" + query.getName()); } return graphResults; } });
@Override public Map<String, String> doInTransaction(TransactionStatus transactionStatus) { OnmsResource resource = m_resourceDao.getResourceById(resourceId); PrefabGraph[] queries = m_graphDao.getPrefabGraphsForResource(resource); Map<String, String> graphResults = new TreeMap<String, String>(); for (PrefabGraph query : queries) { graphResults.put(query.getName(), query.getName()); } return graphResults; } });
@Override public Map<String, String> doInTransaction(TransactionStatus transactionStatus) { OnmsResource resource = m_resourceDao.getResourceById(resourceId); PrefabGraph[] queries = m_graphDao.getPrefabGraphsForResource(resource); Map<String, String> graphResults = new TreeMap<String, String>(); for (PrefabGraph query : queries) { graphResults.put(query.getTitle(), query.getName()); } return graphResults; } });
@Override public Map<String, String> doInTransaction(TransactionStatus transactionStatus) { OnmsResource resource = m_resourceDao.getResourceById(resourceId); PrefabGraph[] queries = m_graphDao.getPrefabGraphsForResource(resource); Map<String, String> graphResults = new TreeMap<String, String>(); for (PrefabGraph query : queries) { graphResults.put(query.getName(), "resourceId=" + resourceId + "&report=" + query.getName()); } return graphResults; } });
@Override public Map<String, String> doInTransaction(TransactionStatus transactionStatus) { OnmsResource resource = m_resourceDao.getResourceById(resourceId); PrefabGraph[] queries = m_graphDao.getPrefabGraphsForResource(resource); Map<String, String> graphResults = new TreeMap<String, String>(); for (PrefabGraph query : queries) { graphResults.put(query.getName(), query.getTitle()); } return graphResults; } });