Package org.rrd4j.core

Examples of org.rrd4j.core.RrdDef


   * @param path
   * @throws IOException
   */
  public RoundRobin(long heartbeat, File path) throws IOException {
    if (path == null ) path = MFile.createTempFile(MSystem.getPid(), "rrd");
    RrdDef rrdDef = new RrdDef(path.getAbsolutePath());
    rrdDef.setStartTime(System.currentTimeMillis());
    rrdDef.addDatasource("speed", DsType.COUNTER, heartbeat, Double.NaN, Double.NaN);
    rrdDef.addArchive(ConsolFun.AVERAGE, 0.5, 1, 24);
    rrdDef.addArchive(ConsolFun.AVERAGE, 0.5, 6, 10);
    // RrdBackendFactory factory = RrdBackendFactory.getFactory("MEMORY");
    rrdDb = new RrdDb(rrdDef);
    sample = rrdDb.createSample();
  }
View Full Code Here


    {
      rrdDb = new RrdDb(fileName);
    }
    else
    {
      RrdDef rrdDef = new RrdDef(fileName, startTimestamp - 1, AkteraJvmMemoryManager.DATA_CAPTURE_INTERVAL);

      rrdDef.addDatasource("Init", DsType.GAUGE, max, 0, Double.NaN);
      rrdDef.addDatasource("Used", DsType.GAUGE, max, 0, Double.NaN);
      rrdDef.addDatasource("Committed", DsType.GAUGE, max, 0, Double.NaN);
      rrdDef.addDatasource("Max", DsType.GAUGE, max, 0, Double.NaN);
      rrdDef.addArchive(AVERAGE, 0.5, 1, 1440);
      rrdDef.addArchive(AVERAGE, 0.5, 30, 336);
      rrdDef.addArchive(AVERAGE, 0.5, 60, 744);
      rrdDef.addArchive(AVERAGE, 0.5, 1440, 336);
      rrdDef.addArchive(MIN, 0.5, 1, 1440);
      rrdDef.addArchive(MIN, 0.5, 30, 336);
      rrdDef.addArchive(MIN, 0.5, 60, 744);
      rrdDef.addArchive(MIN, 0.5, 1440, 336);
      rrdDef.addArchive(MAX, 0.5, 1, 1440);
      rrdDef.addArchive(MAX, 0.5, 30, 336);
      rrdDef.addArchive(MAX, 0.5, 60, 744);
      rrdDef.addArchive(MAX, 0.5, 1440, 336);
      rrdDb = new RrdDb(rrdDef);
    }

    probe = rrdDb.createSample();
    rrdDb.close();
View Full Code Here

    }
    return db;
  }

  private RrdDef getRrdDef(ConsolFun function, File file) {
      RrdDef rrdDef = new RrdDef(file.getAbsolutePath());
      if(function==ConsolFun.AVERAGE) {
        // for measurement values, we define archives that are suitable for charts
        rrdDef.setStep(60);
          rrdDef.setStartTime(System.currentTimeMillis()/1000-1);
          rrdDef.addDatasource(DATASOURCE_STATE, DsType.GAUGE, 60, Double.NaN, Double.NaN);
          rrdDef.addArchive(function, 0.5, 1, 480); // 8 hours (granularity 1 min)
          rrdDef.addArchive(function, 0.5, 4, 360); // one day (granularity 4 min)
          rrdDef.addArchive(function, 0.5, 15, 644); // one week (granularity 15 min)
          rrdDef.addArchive(function, 0.5, 60, 720); // one month (granularity 1 hour)
          rrdDef.addArchive(function, 0.5, 720, 730); // one year (granularity 12 hours)
          rrdDef.addArchive(function, 0.5, 10080, 520); // ten years (granularity 7 days)
      } else {
        // for other things, we mainly provide a high level of detail for the last hour
        rrdDef.setStep(1);
          rrdDef.setStartTime(System.currentTimeMillis()/1000-1);
          rrdDef.addDatasource(DATASOURCE_STATE, DsType.GAUGE, 3600, Double.NaN, Double.NaN);
          rrdDef.addArchive(function, .999, 1, 3600); // 1 hour (granularity 1 sec)
          rrdDef.addArchive(function, .999, 10, 1440); // 4 hours (granularity 10 sec)
          rrdDef.addArchive(function, .999, 60, 1440); // one day (granularity 1 min)
          rrdDef.addArchive(function, .999, 900, 2880); // one month (granularity 15 min)
          rrdDef.addArchive(function, .999, 21600, 1460); // one year (granularity 6 hours)
          rrdDef.addArchive(function, .999, 86400, 3650); // ten years (granularity 1 day)
      }
    return rrdDef;
  }
View Full Code Here

            try
            {
                if ( !new File( getDbFilePath() ).exists() )
                {
                    // CREATE RRD DEFINITION
                    RrdDef rrdDef = new RrdDef( getDbFilePath(), STEP_SIZE );

                    rrdDef.setVersion( 2 );

                    // DEFINE DATA SOURCES

                    rrdDef.addDatasource( NODE_CACHE_SIZE, DsType.GAUGE,
                            STEP_SIZE, 0, Long.MAX_VALUE );

                    rrdDef.addDatasource( NODE_COUNT, DsType.GAUGE, STEP_SIZE,
                            0, Long.MAX_VALUE );

                    rrdDef.addDatasource( RELATIONSHIP_COUNT, DsType.GAUGE,
                            STEP_SIZE, 0, Long.MAX_VALUE );

                    rrdDef.addDatasource( PROPERTY_COUNT, DsType.GAUGE,
                            STEP_SIZE, 0, Long.MAX_VALUE );

                    rrdDef.addDatasource( MEMORY_PERCENT, DsType.GAUGE,
                            STEP_SIZE, 0, Long.MAX_VALUE );

                    // DEFINE ARCHIVES

                    // Last 35 minutes
                    rrdDef.addArchive( ConsolFun.AVERAGE, 0.5, 1,
                            STEPS_PER_ARCHIVE );

                    // Last 6 hours
                    rrdDef.addArchive( ConsolFun.AVERAGE, 0.2, 10,
                            STEPS_PER_ARCHIVE );

                    // Last day
                    rrdDef.addArchive( ConsolFun.AVERAGE, 0.2, 50,
                            STEPS_PER_ARCHIVE );

                    // Last week
                    rrdDef.addArchive( ConsolFun.AVERAGE, 0.2, 300,
                            STEPS_PER_ARCHIVE );

                    // Last month
                    rrdDef.addArchive( ConsolFun.AVERAGE, 0.2, 1300,
                            STEPS_PER_ARCHIVE );

                    // Last five years
                    rrdDef.addArchive( ConsolFun.AVERAGE, 0.2, 15000,
                            STEPS_PER_ARCHIVE * 5 );

                    // INSTANTIATE

                    INSTANCE = new RrdDb( rrdDef );
View Full Code Here

TOP

Related Classes of org.rrd4j.core.RrdDef

Copyright © 2018 www.massapicom. 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.