当前位置: 首页>>代码示例>>Java>>正文


Java RrdDef.setStep方法代码示例

本文整理汇总了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;
}
 
开发者ID:roscisz,项目名称:KernelHive,代码行数:25,代码来源:RrdDbFactory.java

示例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;
}
 
开发者ID:roscisz,项目名称:KernelHive,代码行数:22,代码来源:RrdDbFactory.java

示例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);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:31,代码来源:DefaultMetricsDatabase.java

示例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;
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:13,代码来源:RRD4jService.java

示例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;
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:13,代码来源:RRD4jService.java


注:本文中的org.rrd4j.core.RrdDef.setStep方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。