本文整理汇总了Java中org.rrd4j.core.RrdDef.setStep方法的典型用法代码示例。如果您正苦于以下问题:Java RrdDef.setStep方法的具体用法?Java RrdDef.setStep怎么用?Java RrdDef.setStep使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.rrd4j.core.RrdDef
的用法示例。
在下文中一共展示了RrdDef.setStep方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createUnitDb
import org.rrd4j.core.RrdDef; //导入方法依赖的package包/类
public static RrdDb createUnitDb(int cores, int clusterId, int unitId) throws IOException {
Logger.getLogger(RrdDbFactory.class.getName()).info("Creating new RRD file: "
+ RrdHelper.getDbPath(clusterId, unitId));
RrdDef rrdDef = new RrdDef(RrdHelper.getDbPath(clusterId, unitId));
rrdDef.setStep(STEP);
rrdDef.addDatasource(new MonitoredEntity(MonitoredEntityType.CPU_SPEED).getStringId(),
DsType.GAUGE, TIMEOUT, Double.NaN, Double.NaN);
for (int i = 0; i < cores; i++) {
rrdDef.addDatasource(new MonitoredEntity(MonitoredEntityType.CPU_USAGE, i).getStringId(),
DsType.GAUGE, TIMEOUT, Double.NaN, Double.NaN);
}
rrdDef.addDatasource(new MonitoredEntity(MonitoredEntityType.MEMORY).getStringId(),
DsType.GAUGE, TIMEOUT, Double.NaN, Double.NaN);
rrdDef.addArchive(ConsolFun.AVERAGE, 0.5,
RrdHelper.getSampleSize(RrdDbResolution.EXACT),
RrdHelper.getSampleWindow(RrdDbResolution.EXACT));
rrdDef.addArchive(ConsolFun.AVERAGE, 0.5,
RrdHelper.getSampleSize(RrdDbResolution.LOW),
RrdHelper.getSampleWindow(RrdDbResolution.LOW));
RrdDb rrdDb = new RrdDb(rrdDef);
return rrdDb;
}
示例2: createGpuDb
import org.rrd4j.core.RrdDef; //导入方法依赖的package包/类
public static RrdDb createGpuDb(int clusterId, int unitId, int deviceId) throws IOException {
Logger.getLogger(RrdDbFactory.class.getName()).info("Creating new GPU RRD file: "
+ RrdHelper.getDbPath(clusterId, unitId, deviceId));
RrdDef rrdDef = new RrdDef(RrdHelper.getDbPath(clusterId, unitId, deviceId));
rrdDef.setStep(STEP);
rrdDef.addDatasource(new MonitoredEntity(MonitoredEntityType.GPU_USAGE).getStringId(),
DsType.GAUGE, TIMEOUT, Double.NaN, Double.NaN);
rrdDef.addDatasource(new MonitoredEntity(MonitoredEntityType.GPU_GLOBAL_MEMORY).getStringId(),
DsType.GAUGE, TIMEOUT, Double.NaN, Double.NaN);
rrdDef.addDatasource(new MonitoredEntity(MonitoredEntityType.FAN).getStringId(),
DsType.GAUGE, TIMEOUT, 0, 100);
rrdDef.addArchive(ConsolFun.AVERAGE, 0.5,
RrdHelper.getSampleSize(RrdDbResolution.EXACT),
RrdHelper.getSampleWindow(RrdDbResolution.EXACT));
rrdDef.addArchive(ConsolFun.AVERAGE, 0.5,
RrdHelper.getSampleSize(RrdDbResolution.LOW),
RrdHelper.getSampleWindow(RrdDbResolution.LOW));
RrdDb rrdDb = new RrdDb(rrdDef);
return rrdDb;
}
示例3: build
import org.rrd4j.core.RrdDef; //导入方法依赖的package包/类
@Override
public MetricsDatabase build() {
checkNotNull(metricName, METRIC_NAME_MSG);
checkNotNull(resourceName, RESOURCE_NAME_MSG);
checkArgument(!dsDefs.isEmpty(), METRIC_TYPE_MSG);
// define the resolution of monitored metrics
rrdDef = new RrdDef(DB_PATH + SPLITTER + metricName +
SPLITTER + resourceName, RESOLUTION_IN_SECOND);
try {
DsDef[] dsDefArray = new DsDef[dsDefs.size()];
IntStream.range(0, dsDefs.size()).forEach(i -> dsDefArray[i] = dsDefs.get(i));
rrdDef.addDatasource(dsDefArray);
rrdDef.setStep(RESOLUTION_IN_SECOND);
// raw archive, no aggregation is required
ArcDef rawArchive = new ArcDef(CONSOL_FUNCTION, XFF_VALUE,
STEP_VALUE, ROW_VALUE);
rrdDef.addArchive(rawArchive);
// always store the metric data in memory...
rrdDb = new RrdDb(rrdDef, RrdBackendFactory.getFactory(STORING_METHOD));
} catch (IOException e) {
log.warn("Failed to create a new round-robin database due to {}", e);
}
return new DefaultMetricsDatabase(metricName, resourceName, rrdDb);
}
示例4: getRrdDef
import org.rrd4j.core.RrdDef; //导入方法依赖的package包/类
private RrdDef getRrdDef(String itemName, File file) {
RrdDef rrdDef = new RrdDef(file.getAbsolutePath());
RrdDefConfig useRdc = getRrdDefConfig(itemName);
rrdDef.setStep(useRdc.step);
rrdDef.setStartTime(System.currentTimeMillis()/1000-1);
rrdDef.addDatasource(DATASOURCE_STATE, useRdc.dsType, useRdc.heartbeat, useRdc.min, useRdc.max);
for (RrdArchiveDef rad : useRdc.archives) {
rrdDef.addArchive(rad.fcn, rad.xff, rad.steps, rad.rows);
}
return rrdDef;
}
示例5: getRrdDef
import org.rrd4j.core.RrdDef; //导入方法依赖的package包/类
private RrdDef getRrdDef(String itemName, File file) {
RrdDef rrdDef = new RrdDef(file.getAbsolutePath());
RrdDefConfig useRdc = getRrdDefConfig(itemName);
rrdDef.setStep(useRdc.step);
rrdDef.setStartTime(System.currentTimeMillis() / 1000 - 1);
rrdDef.addDatasource(DATASOURCE_STATE, useRdc.dsType, useRdc.heartbeat, useRdc.min, useRdc.max);
for (RrdArchiveDef rad : useRdc.archives) {
rrdDef.addArchive(rad.fcn, rad.xff, rad.steps, rad.rows);
}
return rrdDef;
}