rrdtool使用上次更新时间作为结束时间创建图表的命令行是什么?

时间:2016-01-29 04:33:22

标签: rrdtool rrd

离开这个问题:Print time of recording for LAST value

似乎可以让rrdtool计算rrd中最后一次更新的时间戳。如何在命令中使用它作为" end"时间?

即。我想做这样的事情:

rrdtool graph img.png -a PNG -s e-600 -e LASTUPDATETIME -v "CPU Usage" \
  --title "CPU Utilization" DEF:ds0a=node.rrd:ds0:AVERAGE \  
  DEF:ds1a=node.rrd:ds1:AVERAGE AREA:ds0a#35b73d:"User" \
  LINE1:ds1a#0400ff:"System"

我尝试了解DEF,CDEF和VDEF的事情无济于事:

rrdtool graph img.png -a PNG -v "CPU Usage" --title "CPU Utilization" \
  DEF:data=node.rrd:x:AVERAGE CDEF:count=data,UN,UNKN,COUNT,IF  \
  VDEF:last=count,MAXIMUM \
  DEF:ds0a=node.rrd:ds0:AVERAGE:start=end-600:end=last \
  DEF:ds1a=node.rrd:ds1:AVERAGE:start=end-600:end=last \
  AREA:ds0a#35b73d:"User" LINE1:ds1a#0400ff:"System" 

这导致:

ERROR: end time: unparsable time: last

有什么想法吗?

1 个答案:

答案 0 :(得分:2)

在命令行上

,你可以做

rrdtool graph img.png -a PNG -s e-600 -e `date +%s node.rrd` -v "CPU Usage" \
  --title "CPU Utilization" DEF:ds0a=node.rrd:ds0:AVERAGE \  
  DEF:ds1a=node.rrd:ds1:AVERAGE AREA:ds0a#35b73d:User \
  LINE1:ds1a#0400ff:System