Examples of RrdGraphDef


Examples of org.jrobin.graph.RrdGraphDef

      _rrdPool.release(rrdDb);
      graphTemplate.setVariable("start", start);
      graphTemplate.setVariable("end", end);
      graphTemplate.setVariable("rrd", _rrdPath);
      // create graph finally
      RrdGraphDef gDef = graphTemplate.getRrdGraphDef();
      RrdGraph graph = new RrdGraph(gDef);
      return graph.getRrdGraphInfo().getBytes();
    }
    catch (Exception e)
    {
View Full Code Here

Examples of org.jrobin.graph.RrdGraphDef

        rrdDef = rrdDb.getRrdDef();
      }
      finally {
        rrdDb.close();
      }
      RrdGraphDef rrdGraphDef = new RrdGraphDef();
      rrdGraphDef.setTimeSpan(t1, t2);
      rrdGraphDef.setImageFormat("png");
      rrdGraphDef.setTitle(rrdDef.getDsDefs()[dsIndex].dump() + " " +
          rrdDef.getArcDefs()[arcIndex].dump());
      LinearInterpolator linearInterpolator = new LinearInterpolator(timestamps, values);
      linearInterpolator.setInterpolationMethod(LinearInterpolator.INTERPOLATE_RIGHT);
      rrdGraphDef.datasource(dsName, linearInterpolator);
      rrdGraphDef.area(dsName, color, dsName + "\\r");
      rrdGraphDef.comment("START: " + new Date(t1 * 1000L) + "\\r");
      rrdGraphDef.comment("END: " + new Date(t2 * 1000L) + "\\r");
      int width = graphPanel.getWidth(), height = graphPanel.getHeight();
      rrdGraphDef.setWidth(width + deltaWidth);
      rrdGraphDef.setHeight(height + deltaHeight);
      rrdGraph = new RrdGraph(rrdGraphDef);
      if (deltaWidth == 0 && deltaHeight == 0) {
        RrdGraphInfo info = rrdGraph.getRrdGraphInfo();
        deltaWidth = graphPanel.getWidth() - info.getWidth();
        deltaHeight = graphPanel.getHeight() - info.getHeight();
View Full Code Here

Examples of org.jrobin.graph.RrdGraphDef

    /**
     * @throws RrdException
     * @returns an RRD graph definition
     */
    public RrdGraphDef getGraphDef() throws RrdException {
        RrdGraphDef gdef = new RrdGraphDef();

    // OPTIONS

    // START, END
    String t1 = getOptionValue("s", "start", DEFAULT_START), t2 = getOptionValue("e", "end", DEFAULT_END);
    gdef.setTimeSpan(Util.getTimestamps(t1, t2));
    // X-GRID
    parseXGrid(gdef, getOptionValue("x", "x-grid"));
    // Y-GRID
    parseYGrid(gdef, getOptionValue("y", "y-grid"));
    // ALT-Y-GRID
    gdef.setAltYGrid(getBooleanOption("Y", "alt-y-grid"));
    // NO_MINOR
    gdef.setNoMinorGrid(getBooleanOption(null, "no-minor"));
    // ALT-Y-MRTG
    gdef.setAltYMrtg(getBooleanOption("R", "alt-y-mrtg"));
    // ALT-AUTOSCALE
    gdef.setAltAutoscale(getBooleanOption("A", "alt-autoscale"));
    // ALT-AUTOSCALE-MAX
    gdef.setAltAutoscaleMax(getBooleanOption("M", "alt-autoscale-max"));
    // UNITS-EXPONENT
    String opt = getOptionValue("X", "units-exponent");
    if (opt != null) {
      gdef.setUnitsExponent(parseInt(opt));
    }
    // UNITS-LENGTH
    opt = getOptionValue("L", "units-length");
    if (opt != null) {
      gdef.setUnitsLength(parseInt(opt));
    }
    // VERTICAL LABEL
    opt = getOptionValue("v", "vertical-label");
    if (opt != null) {
      gdef.setVerticalLabel(opt);
    }
    // WIDTH
    opt = getOptionValue("w", "width");
    if (opt != null) {
      gdef.setWidth(parseInt(opt));
    }
    // HEIGHT
    opt = getOptionValue("h", "height");
    if (opt != null) {
      gdef.setHeight(parseInt(opt));
    }
    // INTERLACED
    gdef.setInterlaced(getBooleanOption("i", "interlaced"));
    // IMGINFO
    opt = getOptionValue("f", "imginfo");
    if (opt != null) {
      gdef.setImageInfo(opt);
    }
    // IMGFORMAT
    opt = getOptionValue("a", "imgformat");
    if (opt != null) {
      gdef.setImageFormat(opt);
    }
    // BACKGROUND
    opt = getOptionValue("B", "background");
    if (opt != null) {
      gdef.setBackgroundImage(opt);
    }
    // OVERLAY
    opt = getOptionValue("O", "overlay");
    if (opt != null) {
      gdef.setOverlayImage(opt);
    }
    // UNIT
    opt = getOptionValue("U", "unit");
    if (opt != null) {
      gdef.setUnit(opt);
    }
    // LAZY
    gdef.setLazy(getBooleanOption("z", "lazy"));
    // UPPER-LIMIT
    opt = getOptionValue("u", "upper-limit");
    if (opt != null) {
      gdef.setMaxValue(parseDouble(opt));
    }
    // LOWER-LIMIT
    opt = getOptionValue("l", "lower-limit");
    if (opt != null) {
      gdef.setMinValue(parseDouble(opt));
    }
    // RIGID
    gdef.setRigid(getBooleanOption("r", "rigid"));
    // BASE
    opt = getOptionValue("b", "base");
    if (opt != null) {
      gdef.setBase(parseDouble(opt));
    }
    // LOGARITHMIC
    gdef.setLogarithmic(getBooleanOption("o", "logarithmic"));
    // COLORS
    parseColors(gdef, getMultipleOptionValues("c", "color"));
    // NO-LEGEND
    gdef.setNoLegend(getBooleanOption("g", "no-legend"));
    // ONLY_GRAPH
    gdef.setOnlyGraph(getBooleanOption("j", "only-graph"));
    // FORCE-RULES-LEGEND
    gdef.setForceRulesLegend(getBooleanOption("F", "force-rules-legend"));
    // TITLE
    opt = getOptionValue("t", "title");
    if (opt != null) {
      gdef.setTitle(opt);
    }
    // STEP
    opt = getOptionValue("S", "step");
    if (opt != null) {
      gdef.setStep(parseLong(opt));
    }

    // NON-OPTIONS

    String[] words = getRemainingWords();
    // the first word must be a filename
    if (words.length < 2) {
      throw new RrdException("Image filename must be specified");
    }
    gdef.setFilename(words[1]);
    // parse remaining words, in no particular order
    for (int i = 2; i < words.length; i++) {
      if (words[i].startsWith("DEF:")) {
        parseDef(gdef, words[i]);
      }
View Full Code Here

Examples of org.jrobin.graph.RrdGraphDef

    /**
     * @throws RrdException
     * @returns an RRD graph definition
     */
    public RrdGraphDef getGraphDef() throws RrdException {
        RrdGraphDef gdef = new RrdGraphDef();

    // OPTIONS

    // START, END
    String t1 = getOptionValue("s", "start", DEFAULT_START), t2 = getOptionValue("e", "end", DEFAULT_END);
    gdef.setTimeSpan(Util.getTimestamps(t1, t2));
    // X-GRID
    parseXGrid(getOptionValue("x", "x-grid"));
    // Y-GRID
    parseYGrid(getOptionValue("y", "y-grid"));
    // ALT-Y-GRID
    gdef.setAltYGrid(getBooleanOption("Y", "alt-y-grid"));
    // NO_MINOR
    gdef.setNoMinorGrid(getBooleanOption(null, "no-minor"));
    // ALT-Y-MRTG
    gdef.setAltYMrtg(getBooleanOption("R", "alt-y-mrtg"));
    // ALT-AUTOSCALE
    gdef.setAltAutoscale(getBooleanOption("A", "alt-autoscale"));
    // ALT-AUTOSCALE-MAX
    gdef.setAltAutoscaleMax(getBooleanOption("M", "alt-autoscale-max"));
    // UNITS-EXPONENT
    String opt = getOptionValue("X", "units-exponent");
    if (opt != null) {
      gdef.setUnitsExponent(parseInt(opt));
    }
    // UNITS-LENGTH
    opt = getOptionValue("L", "units-length");
    if (opt != null) {
      gdef.setUnitsLength(parseInt(opt));
    }
    // VERTICAL LABEL
    opt = getOptionValue("v", "vertical-label");
    if (opt != null) {
      gdef.setVerticalLabel(opt);
    }
    // WIDTH
    opt = getOptionValue("w", "width");
    if (opt != null) {
      gdef.setWidth(parseInt(opt));
    }
    // HEIGHT
    opt = getOptionValue("h", "height");
    if (opt != null) {
      gdef.setHeight(parseInt(opt));
    }
    // INTERLACED
    gdef.setInterlaced(getBooleanOption("i", "interlaced"));
    // IMGINFO
    opt = getOptionValue("f", "imginfo");
    if (opt != null) {
      gdef.setImageInfo(opt);
    }
    // IMGFORMAT
    opt = getOptionValue("a", "imgformat");
    if (opt != null) {
      gdef.setImageFormat(opt);
    }
    // BACKGROUND
    opt = getOptionValue("B", "background");
    if (opt != null) {
      gdef.setBackgroundImage(opt);
    }
    // OVERLAY
    opt = getOptionValue("O", "overlay");
    if (opt != null) {
      gdef.setOverlayImage(opt);
    }
    // UNIT
    opt = getOptionValue("U", "unit");
    if (opt != null) {
      gdef.setUnit(opt);
    }
    // LAZY
    gdef.setLazy(getBooleanOption("z", "lazy"));
    // UPPER-LIMIT
    opt = getOptionValue("u", "upper-limit");
    if (opt != null) {
      gdef.setMaxValue(parseDouble(opt));
    }
    // LOWER-LIMIT
    opt = getOptionValue("l", "lower-limit");
    if (opt != null) {
      gdef.setMinValue(parseDouble(opt));
    }
    // RIGID
    gdef.setRigid(getBooleanOption("r", "rigid"));
    // BASE
    opt = getOptionValue("b", "base");
    if (opt != null) {
      gdef.setBase(parseDouble(opt));
    }
    // LOGARITHMIC
    gdef.setLogarithmic(getBooleanOption("o", "logarithmic"));
    // COLORS
    parseColors(getMultipleOptionValues("c", "color"));
    // NO-LEGEND
    gdef.setNoLegend(getBooleanOption("g", "no-legend"));
    // ONLY_GRAPH
    gdef.setOnlyGraph(getBooleanOption("j", "only-graph"));
    // FORCE-RULES-LEGEND
    gdef.setForceRulesLegend(getBooleanOption("F", "force-rules-legend"));
    // TITLE
    opt = getOptionValue("t", "title");
    if (opt != null) {
      gdef.setTitle(opt);
    }
    // STEP
    opt = getOptionValue("S", "step");
    if (opt != null) {
      gdef.setStep(parseLong(opt));
    }

    // NON-OPTIONS

    String[] words = getRemainingWords();
    // the first word must be a filename
    if (words.length < 2) {
      throw new RrdException("Image filename must be specified");
    }
    gdef.setFilename(words[1]);
    // parse remaining words, in no particular order
    for (int i = 2; i < words.length; i++) {
      if (words[i].startsWith("DEF:")) {
        parseDef(words[i]);
      }
View Full Code Here

Examples of org.jrobin.graph.RrdGraphDef

        rrdDef = rrdDb.getRrdDef();
      }
      finally {
        rrdDb.close();
      }
      RrdGraphDef rrdGraphDef = new RrdGraphDef();
      rrdGraphDef.setTimeSpan(t1, t2);
      rrdGraphDef.setImageFormat("png");
      rrdGraphDef.setTitle(rrdDef.getDsDefs()[dsIndex].dump() + " " +
          rrdDef.getArcDefs()[arcIndex].dump());
      LinearInterpolator linearInterpolator = new LinearInterpolator(timestamps, values);
      linearInterpolator.setInterpolationMethod(LinearInterpolator.INTERPOLATE_RIGHT);
      rrdGraphDef.datasource(dsName, linearInterpolator);
      rrdGraphDef.area(dsName, color, dsName + "\\r");
      rrdGraphDef.comment("START: " + new Date(t1 * 1000L) + "\\r");
      rrdGraphDef.comment("END: " + new Date(t2 * 1000L) + "\\r");
      int width = graphPanel.getWidth(), height = graphPanel.getHeight();
      rrdGraphDef.setWidth(width + deltaWidth);
      rrdGraphDef.setHeight(height + deltaHeight);
      rrdGraph = new RrdGraph(rrdGraphDef);
      if (deltaWidth == 0 && deltaHeight == 0) {
        RrdGraphInfo info = rrdGraph.getRrdGraphInfo();
        deltaWidth = graphPanel.getWidth() - info.getWidth();
        deltaHeight = graphPanel.getHeight() - info.getHeight();
View Full Code Here

Examples of org.rrd4j.graph.RrdGraphDef

  public void generateGraph(long startTimestamp, long stopTimestamp, BufferedImage bufferedImage) throws Exception
  {
    File file = FileTools.newAkteraFile("/var/aktera/jvm-memory/" + name + ".rrd");
    String fileName = file.getAbsolutePath();

    RrdGraphDef gDef = new RrdGraphDef();

    gDef.setWidth(1024);
    gDef.setHeight(768);
    gDef.setFilename(fileName + ".png");
    gDef.setLazy(false);
    gDef.setStartTime(startTimestamp);
    gDef.setEndTime(stopTimestamp);
    gDef.setTitle(name);
    gDef.setVerticalLabel("Memory");
    gDef.datasource("Init", fileName, "Init", AVERAGE);
    gDef.datasource("Used", fileName, "Used", AVERAGE);
    gDef.datasource("Committed", fileName, "Committed", AVERAGE);
    gDef.datasource("Max", fileName, "Max", AVERAGE);

    gDef.line("Init", Color.GREEN, "Init memory");
    gDef.area("Max", Color.RED, "Max memory\n");
    gDef.area("Committed", Color.gray, "Committed memory");
    gDef.area("Used", Color.GREEN, "Used memory");

    gDef.gprint("Used", MAX, "used-max = %.3f%s");
    gDef.gprint("Committed", MAX, "committed-max = %.3f%S\\r");
    gDef.gprint("Max", MAX, "max = %.3f%S");
    gDef.gprint("Used", AVERAGE, "used-avg = %.3f%S\\r");
    gDef.setImageInfo("<img src='%s' width='%d' height = '%d'>");
    gDef.setPoolUsed(false);
    gDef.setImageFormat("png");
    gDef.setAltAutoscaleMax(true);
    gDef.setAntiAliasing(true);

    // create graph finally
    RrdGraph graph = new RrdGraph(gDef);

    graph.render(bufferedImage.getGraphics());
View Full Code Here

Examples of org.rrd4j.graph.RrdGraphDef

        @Override
        public void run() {
            try {
                // generate PNG diagram
                RrdGraphDef gDef = new RrdGraphDef();
                gDef.setFilename("-");
                gDef.setWidth(800);
                gDef.setHeight(600);
                gDef.setStartTime(start / 1000);
                gDef.setEndTime(System.currentTimeMillis() / 1000);
                gDef.setTitle("KiWiLoader Performance");
                gDef.setVerticalLabel("number/sec");
                gDef.setAntiAliasing(true);


                gDef.datasource("triples", statFile.toString(), "triples", ConsolFun.AVERAGE);

                gDef.line("triples", Color.BLUE, "Triples Written", 3F);


                gDef.setImageFormat("png");
                gDef.gprint("triples", ConsolFun.AVERAGE, "average triples/sec: %,.0f\\l");

                RrdGraph graph = new RrdGraph(gDef);
                BufferedImage img = new BufferedImage(900,750, BufferedImage.TYPE_INT_RGB);
                graph.render(img.getGraphics());
View Full Code Here

Examples of org.rrd4j.graph.RrdGraphDef

  }

  @Override
  public BufferedImage createChart(String service, String theme, Date startTime, Date endTime, int height, int width,
      String items, String groups) throws ItemNotFoundException {
    RrdGraphDef graphDef = new RrdGraphDef();

    long period = (startTime.getTime() - endTime.getTime()) / 1000;
   
    graphDef.setWidth(width);
    graphDef.setHeight(height);
    graphDef.setAntiAliasing(true);
    graphDef.setImageFormat("PNG");
    graphDef.setStartTime(period);
    graphDef.setTextAntiAliasing(true);
    graphDef.setLargeFont(new Font("SansSerif", Font.PLAIN, 15));
    graphDef.setSmallFont(new Font("SansSerif", Font.PLAIN, 11));
   
    int seriesCounter = 0;

    // Loop through all the items
    if (items != null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.