public GraphTree getGraphTree() { GraphTree gt = GraphTree.makeGraph(name); for(Map.Entry<String, List<String>> e: paths.entrySet()) { String id = e.getKey(); List<String> path = e.getValue(); GraphNode gn = hostlist.getGraphById(id.hashCode()); if(gn == null) { logger.warn(jrds.Util.delayedFormatString("Graph not found for %s: %s", name, id)); continue; } gt.addGraphByPath(path, gn); } return gt; } }
public Probe<?, ?> getProbe() { Probe<?, ?> p = hostlist.getProbeById(pid); if(p == null) { jrds.GraphNode node = hostlist.getGraphById(pid); if(node != null) p = node.getProbe(); } return p; }
/** * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, * javax.servlet.http.HttpServletResponse) */ public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { boolean found = false; res.setContentType("text/plain"); res.addHeader("Cache-Control", "no-cache"); ServletOutputStream out = res.getOutputStream(); String rrdId = req.getParameter("id"); HostsList hl = getHostsList(); GraphNode g = hl.getGraphById(Integer.parseInt(rrdId)); if(g != null) { Probe<?, ?> p = g.getProbe(); if(p != null) { found = true; out.println("Last update:" + p.getLastUpdate()); Map<String, Number> lastValues = p.getLastValues(); for(Map.Entry<String, Number> e: lastValues.entrySet()) { String dsName = e.getKey(); out.println(dsName + ": " + e.getValue()); } } if(!found) { out.println("values not available"); } } }
if(hostlist.getGraphById(g.getNode().hashCode()) != null) { args.put("id", g.getNode().hashCode());
public void configure(HostsList hl) { super.configure(hl); this.hl = hl; GraphNode g = null; // Check the sum consistency for(String graphname: graphList) { g = hl.getGraphById(graphname.hashCode()); if(g == null) { logger.warn(Util.delayedFormatString("graph %s not found for sum '%s'", graphname, getName())); } } // The last graph found is used to clone the graphdesc and use it if(g != null) { try { GraphDesc oldgd = g.getGraphDesc(); GraphDesc newgd = (GraphDesc) oldgd.clone(); newgd.setGraphTitle(getName()); setGraphDesc(newgd); logger.debug(Util.delayedFormatString("Adding sum called %s", getQualifiedName())); } catch (CloneNotSupportedException e) { throw new RuntimeException(String.format("GraphDesc is supposed to be clonnable, what happened with %s ?", getName())); } } else { throw new RuntimeException(String.format("Not graph found in %s definition, unusable sum", getName())); } }
jrds.GraphNode node = hl.getGraphById(p.getId()); int wh = graph.getDimension().height; int rh = graph.getRrdGraph().getRrdGraphInfo().getHeight();
GraphNode g = hl.getGraphById(name.hashCode()); logger.trace("Looking for " + name + " in graph base, and found " + g); if(g == null) {
public GraphNode getGraphNode(JrdsServlet caller) { GraphNode gn = null; if(id != null) gn = hostlist.getGraphById(id); if(gn != null) { logger.debug(jrds.Util.delayedFormatString("Graph found: %s", gn)); } else if(pid != null && pid != 0 && dsName != null) { if(!caller.allowed(this, hostlist.getDefaultRoles())) return null; Probe<?, ?> p = getProbe(); if(p == null) { logger.error("Looking for unknown probe"); return null; } logger.debug(jrds.Util.delayedFormatString("Probe found: %s", p)); Graphics2D g2d = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB).createGraphics(); String graphDescName = p.getName() + "." + dsName; GraphDesc gd = new GraphDesc(); gd.setName(graphDescName); gd.setGraphName(p.getHost().getName() + "." + p.getName() + "." + dsName); gd.setGraphTitle(p.getName() + "." + dsName + " on ${host}"); gd.add(dsName, GraphDesc.LINE); gd.initializeLimits(g2d); gn = new GraphNode(p, gd); gn.addACL(Configuration.get().getPropertiesManager().defaultACL); } return gn; }