我正在尝试使用 RRD4J,但它检索到奇怪的数据。也许我在做一些奇怪的事情。
我创建了一个具有以下功能的数据库:
// MAIN DATA SOURCES
rrdDef.addDatasource("create", DsType.COUNTER, 600, Double.NaN, Double.NaN);
rrdDef.addDatasource("copy", DsType.COUNTER, 600, Double.NaN, Double.NaN);
rrdDef.addDatasource("check", DsType.COUNTER, 600, Double.NaN, Double.NaN);
rrdDef.addDatasource("delete", DsType.COUNTER, 600, Double.NaN, Double.NaN);
// AVERAGE ARCHIVES
rrdDef.addArchive(ConsolFun.AVERAGE, 0.5, 1, 576);
rrdDef.addArchive(ConsolFun.AVERAGE, 0.5, 6, 336);
rrdDef.addArchive(ConsolFun.AVERAGE, 0.5, 24, 720);
rrdDef.addArchive(ConsolFun.AVERAGE, 0.5, 288, 540);
// MAX ARCHIVES
rrdDef.addArchive(ConsolFun.MAX, 0.5, 1, 576);
rrdDef.addArchive(ConsolFun.MAX, 0.5, 6, 336);
rrdDef.addArchive(ConsolFun.MAX, 0.5, 24, 720);
rrdDef.addArchive(ConsolFun.MAX, 0.5, 288, 540);
我更新如下:
Sample sample = rrdDb.createSample();
sample.setTime(now);
sample.setValue("create", (double)create);
sample.setValue("copy", (double)copy);
sample.setValue("check", (double)check);
sample.setValue("delete", (double)del);
sample.update();
并检索数据:
long endTime = Util.getTime();
long startTime = endTime - (12*60*60L);
FetchRequest fetchRequest = rrdDb.createFetchRequest(ConsolFun.MAX, startTime, endTime);
FetchData fetchData = fetchRequest.fetchData();
System.out.println(fetchData.dump());
但我尽可能检索到最奇怪的数据。我输入了 95、48、78 和 15 等数字,并收到了 +1.8046081071E07、+1.8046079370E07、+0.0000000000E00 和 +1.8046081013E07 等数据
我想取回值。难道我做错了什么?