예제 #1
0
 private void percentile(String name, String dsName, int percentile) {
   if (graphDef != null) {
     graphDef.datasource(name, dsName, new Variable.PERCENTILE(percentile));
   } else {
     dp.addDatasource(name, dsName, new Variable.PERCENTILE(percentile));
   }
 }
예제 #2
0
 private void datasource(String name, Plottable plottable) {
   if (graphDef != null) {
     graphDef.datasource(name, plottable);
   } else {
     dp.addDatasource(name, plottable);
   }
 }
예제 #3
0
 private void datasource(String name, String rpn) {
   if (graphDef != null) {
     graphDef.datasource(name, rpn);
   } else {
     dp.addDatasource(name, rpn);
   }
 }
예제 #4
0
  /**
   * return the RrdGraphDef for this graph, used the indicated probe any data can be overridden of a
   * provided map of Plottable
   *
   * @param probe
   * @param ownData data used to override probe's own values
   * @return
   * @throws IOException
   * @throws RrdException
   */
  public DataProcessor getPlottedDatas(Probe<?, ?> probe, Map<?, ?> ownData, long start, long end)
      throws IOException {
    DataProcessor retValue = new DataProcessor(start, end);
    String rrdName = probe.getRrdName();

    String lastName = null;
    for (DsDesc ds : allds) {
      boolean stack = ds.graphType == GraphType.STACK;
      boolean plotted = stack || ds.graphType == GraphType.LINE || ds.graphType == GraphType.AREA;
      if (ds.rpn == null && ds.dsName != null) {
        // Does the datas existe in the provided values
        if (ownData != null && ownData.containsKey(ds.dsName) && ds.graphType == GraphType.LINE) {
          retValue.addDatasource(ds.name, (Plottable) ownData.get(ds.dsName));
        }
        // Or they might be on the associated rrd
        else if (probe.dsExist(ds.dsName)) {
          retValue.addDatasource(ds.name, rrdName, ds.dsName, ds.cf);
        }
      } else if (ds.rpn != null) {
        retValue.addDatasource(ds.name, ds.rpn);
      }
      if (plotted && stack) {
        retValue.addDatasource("Plotted" + ds.name, lastName + ", " + ds.name + ", +");
      } else if (plotted) {
        retValue.addDatasource("Plotted" + ds.name, ds.name);
      }
      lastName = ds.name;
    }
    if (logger.isTraceEnabled()) {
      logger.trace("Datastore for " + getName());
      for (String s : retValue.getSourceNames()) logger.trace("\t" + s);
    }
    return retValue;
  }