Maison >développement back-end >tutoriel php >关于rrdtool数据问题
每10秒写一个数据,但读出来的 却和写进去的不一样,求解
建立的库如下:
./bin/rrdtool create data/test.rrd --start 1365756520 --step 10 DS:myds:GAUGE:100:0:U RRA:LAST:0.5:1:100000
写数据
./bin/rrdtool updatev data/test.rrd -t myds N:1028
读数据
./bin/rrdtool fetch data/test.rrd LAST -s 1365756520
//返回 [1365766390]RRA[AVERAGE][1]DS[myds] = 1.0256558852e+03
这是什么情况,好像被求平均值了??
谁来解答一下啊
[1365766390]RRA[ AVERAGE][1]DS[myds] = 1.0256558852e+03
AVERAGE 平均
你要的不就是这个吗?
但我 /bin/rrdtool fetch data/test.rrd LAST -s 1365756520
fetch 的是 LAST
[root@localhost shm]# /usr/local/rrdtool/bin/rrdtool create test.rrd --step 10 DS:myds:GAUGE:100:0:U RRA:LAST:0.5:1:100000[root@localhost shm]# /usr/local/rrdtool/bin/rrdtool updatev test.rrd -t myds N:1028return_value = 0[1365991710]RRA[LAST][1]DS[myds] = 1.0280000000e+03[root@localhost shm]# /usr/local/rrdtool/bin/rrdtool fetch test.rrd LAST | grep -v nan myds1365991710: 1.0280000000e+03[root@localhost shm]# /usr/local/rrdtool/bin/rrdtool -VRRDtool 1.4.7 Copyright 1997-2012 by Tobias Oetiker <tobi@oetiker.ch> Compiled Jul 5 2012 15:34:45
而且很奇怪,按照你的create语句,是不应该存在AVERAGE这个CF的, 是不是你对这个test.rrd还有其他部分的操作?
[root@localhost shm]# /usr/local/rrdtool/bin/rrdtool create test.rrd --step 10 DS:myds:GAUGE:100:0:U RRA:LAST:0.5:1:100000[root@localhost shm]# /usr/local/rrdtool/bin/rrdtool info test.rrd filename = "test.rrd"rrd_version = "0003"step = 10last_update = 1365991934header_size = 584ds[myds].index = 0ds[myds].type = "GAUGE"ds[myds].minimal_heartbeat = 100ds[myds].min = 0.0000000000e+00ds[myds].max = NaNds[myds].last_ds = "U"ds[myds].value = 0.0000000000e+00ds[myds].unknown_sec = 4rra[0].cf = "LAST"rra[0].rows = 100000rra[0].cur_row = 82401rra[0].pdp_per_row = 1rra[0].xff = 5.0000000000e-01rra[0].cdp_prep[0].value = NaNrra[0].cdp_prep[0].unknown_datapoints = 0
这个,前面几个数据update是正常的,但后面几个就变乱了,
而且很奇怪,按照你的create语句,是不应该存在AVERAGE这个CF的, 是不是你对这个test.rrd还有其他部分的操作?
PHP code?12345678910111213141516171819202122[root@localhost shm]# /usr/local/rrdtool/bin/rrdtool create test.rrd --st……
其实我就想把它当数据库来使用 ,存入什么数据, 取出也就什么数据
[root@localhost rrdtool]# ./bin/rrdtool updatev data/test.rrd -t myds N:1028
return_value = 0
[ 1366011870]RRA[LAST][1]DS[myds] = 1.0011771028e+03
[ 1366011890]RRA[LAST][1]DS[myds] = 1.0011771028e+03
[root@localhost rrdtool]#
更郁闷的是,为啥返回两行 ,两个时间截?
重新再试,情况依旧
./bin/rrdtool create data/test.rrd --start 1365768603 --step 10 DS:myds:GAUGE:100:0:U RRA:LAST:0.5:1:100000
./bin/rrdtool updatev data/test.rrd -t myds N:1028
./bin/rrdtool updatev data/test.rrd -t myds N:102
[root@localhost rrdtool]# ./bin/rrdtool updatev data/test.rrd -t myds N:76
return_value = 0
[1366095920]RRA[LAST][1]DS[myds] = 7.3762737333e+01
[1366095940]RRA[LAST][1]DS[myds] = 7.3762737333e+01
------以下为info内容----
[root@localhost rrdtool]# ./bin/rrdtool info data/test.rrd
filename = "data/test.rrd"
rrd_version = "0003"
step = 10
last_update = 1366095930
header_size = 584
ds[myds].index = 0
ds[myds].type = "GAUGE"
ds[myds].minimal_heartbeat = 100
ds[myds].min = 0.0000000000e+00
ds[myds].max = NaN
ds[myds].last_ds = "76"
ds[myds].value = 5.9394532000e+01
ds[myds].unknown_sec = 0
rra[0].cf = "LAST"
rra[0].rows = 100000
rra[0].cur_row = 79575
rra[0].pdp_per_row = 1
rra[0].xff = 5.0000000000e-01
rra[0].cdp_prep[0].value = NaN
rra[0].cdp_prep[0].unknown_datapoints = 0
有人解答没...
求解........