/** * Add a datastore that will not generate a graph * * @param name String */ public void add(String name) { add(name, name, null, GraphType.NONE, null, null, DEFAULTCF, false, null, null, null); }
public void add(String name, GraphType graphType) { add(name, name, null, graphType, Colors.resolveIndex(lastColor), name, DEFAULTCF, false, null, null, null); if(graphType.toPlot()) lastColor++; }
static public GraphDesc getGd() { GraphDesc gd = new GraphDesc(); gd.add("sun", null, GraphDesc.LINE.toString(), "green", null, null, null, null, null, null, null); gd.add("shade", null, GraphDesc.LINE.toString(), "blue", null, null, null, null, null, null, null); gd.add("median", "sun,shade,+,2,/", GraphDesc.LINE.toString(), "magenta", null, null, null, null, null, null, null); gd.add("diff", "sun,shade,-,ABS,-1,*", GraphDesc.AREA.toString(), "yellow", null, null, null, null, null, null, null); gd.setGraphTitle("Temperatures in May 2003"); gd.setVerticalLabel("temperature"); return gd; }
"Adding '%s': %s/'%s', %s, %s, '%s', %s, %s, %d, %s, %s", name, dsName, rpn, graphType, color, legend, consFunc, reversed, valPercentile, host, probe)); add(name, dsName, rpn, gt, c, legend, cf, reversed != null, valPercentile, host, probe);
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; }
dsName = elements.get("dsName"); gd.add(addName, addrpn, addgraphType, addColor, addLegend, consFunc, reversed, percentile, host, probe, dsName);
@Test public void test1() throws IOException, InvocationTargetException { RRDToolProbe p = new RRDToolProbe(); p.setHost(new HostStarter(new HostInfo("toto"))); ProbeDesc<String> pd = new ProbeDesc<String>(); pd.setName("Rrdtool"); pd.setProbeName("rrdtool"); p.setPd(pd); Map<String, String> empty = Collections.emptyMap(); p.setMainStore(new RrdDbStoreFactory(), empty); Assert.assertTrue("rrd native file can't be read", rrdfile.canRead()); Assert.assertTrue("Configuration of the probe failed", p.configure(rrdfile)); Assert.assertTrue("Check of the probe failed", p.checkStore()); GraphDesc gd = new GraphDesc(); gd.setGraphName("rrdtool"); gd.setName("rrdtool"); gd.add("speed", "speed", null, GraphDesc.LINE, Color.BLUE, "speed", GraphDesc.DEFAULTCF, false, null, null, null); gd.add("weight", "weight", null, GraphDesc.LINE, Color.GREEN, "weight", GraphDesc.DEFAULTCF, false, null, null, null); p.addGraph(gd); for(GraphNode gn: p.getGraphList()) { Graph g = gn.getGraph(); g.setEnd(new Date(end * 1000)); g.setStart(new Date(start * 1000)); File outputFile = new File(testFolder.getRoot(), "rrdtool.png"); OutputStream out = new FileOutputStream(outputFile); g.writePng(out); Assert.assertTrue("graph not created", outputFile.canRead()); } }
private Sum doSum(JrdsDocument d, HostsList hl) throws Exception { HostInfo host = new HostInfo("SumHost"); SumBuilder sm = new SumBuilder(); sm.setPm(Tools.makePm(testFolder, "security=yes")); Sum sp = sm.makeSum(d); try { sp.configure(hl); } catch (Exception e) { } sp.getProbe().setHost(new HostStarter(host)); hl.addHost(host); hl.addProbe(sp.getProbe()); jrds.GraphNode mg = new MockGraph(); mg.getGraphDesc().add("plot"); hl.addHost(mg.getProbe().getHost()); hl.addProbe(mg.getProbe()); return sp; }