我正在尝试每10分钟使用新数据更新一个rrd文件。我有一个cronjob设置为每10分钟运行一次应运行update命令,但是当我之后转储rrd文件的内容时,所有值都显示为NaN。
我看了很多不同的网站,表明它可能是计时/步/心跳的问题。我已经摆弄了这些,仍然无法获得任何值。
现在我的步长为600,心跳为900,包装脚本每10分钟运行一次(600)。这段代码是一个函数的一部分,它将被调用几次来创建几个数据库,因此DSBOGO可以保持它的通用性。
$cmdCommand .= "DS:DSBOGO:GAUGE:900:U:U \\";
$cmdCommand .= "RRA:AVERAGE:0.5:1:720000 \\";
$cmdCommand .= "RRA:AVERAGE:0.5:5:144000 \\";
$cmdCommand .= "RRA:AVERAGE:0.5:60:12000 \\";
$cmdCommand .= "RRA:AVERAGE:0.5:240:3000";
以下是rrdtool信息输出
filename = "TEMPNAMERcvd.rrd"
rrd_version = "0003"
step = 600
last_update = 631200000
ds[DSBOGO].type = "GAUGE"
ds[DSBOGO].minimal_heartbeat = 900
ds[DSBOGO].min = NaN
ds[DSBOGO].max = NaN
ds[DSBOGO].last_ds = "UNKN"
ds[DSBOGO].value = 0.0000000000e+00
ds[DSBOGO].unknown_sec = 0
rra[0].cf = "AVERAGE"
rra[0].rows = 720000
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
rra[1].cf = "AVERAGE"
rra[1].rows = 144000
rra[1].pdp_per_row = 5
rra[1].xff = 5.0000000000e-01
rra[1].cdp_prep[0].value = NaN
rra[1].cdp_prep[0].unknown_datapoints = 0
rra[2].cf = "AVERAGE"
rra[2].rows = 12000
rra[2].pdp_per_row = 60
rra[2].xff = 5.0000000000e-01
rra[2].cdp_prep[0].value = NaN
rra[2].cdp_prep[0].unknown_datapoints = 20
rra[3].cf = "AVERAGE"
rra[3].rows = 3000
rra[3].pdp_per_row = 240
rra[3].xff = 5.0000000000e-01
rra[3].cdp_prep[0].value = NaN
rra[3].cdp_prep[0].unknown_datapoints = 80
以下是rrdtool转储输出示例的示例
<!-- Round Robin Database Dump --><rrd> <version> 0003 </version>
<step> 600 </step> <!-- Seconds -->
<lastupdate> 1470334800 </lastupdate> <!-- 2016-08-04 14:20:00 EDT -->
<ds>
<name> DSBOGO </name>
<type> GAUGE </type>
<minimal_heartbeat> 900 </minimal_heartbeat>
<min> NaN </min>
<max> NaN </max>
<!-- PDP Status -->
<last_ds> 0 </last_ds>
<value> NaN </value>
<unknown_sec> 0 </unknown_sec>
</ds>
<!-- Round Robin Archives --> <rra>
<cf> AVERAGE </cf>
<pdp_per_row> 1 </pdp_per_row> <!-- 600 seconds -->
<params>
<xff> 5.0000000000e-01 </xff>
</params>
<cdp_prep>
<ds>
<primary_value> NaN </primary_value>
<secondary_value> NaN </secondary_value>
<value> NaN </value>
<unknown_datapoints> 0 </unknown_datapoints>
</ds>
</cdp_prep>
<database>
<!-- 2016-05-01 00:00:00 EDT / 1462075200 --> <row><v> NaN </v></row>
<!-- 2016-05-01 00:10:00 EDT / 1462075800 --> <row><v> NaN </v></row>
<!-- 2016-05-01 00:20:00 EDT / 1462076400 --> <row><v> NaN </v></row>
<!-- 2016-05-01 00:30:00 EDT / 1462077000 --> <row><v> NaN </v></row>
<!-- 2016-05-01 00:40:00 EDT / 1462077600 --> <row><v> NaN </v></row>
<!-- 2016-05-01 00:50:00 EDT / 1462078200 --> <row><v> NaN </v></row>
<!-- 2016-05-01 01:00:00 EDT / 1462078800 --> <row><v> NaN </v></row>
<!-- 2016-05-01 01:10:00 EDT / 1462079400 --> <row><v> NaN </v></row>
<!-- 2016-05-01 01:20:00 EDT / 1462080000 --> <row><v> NaN </v></row>
<!-- 2016-05-01 01:30:00 EDT / 1462080600 --> <row><v> NaN </v></row>
<!-- 2016-05-01 01:40:00 EDT / 1462081200 --> <row><v> NaN </v></row>
<!-- 2016-05-01 01:50:00 EDT / 1462081800 --> <row><v> NaN </v></row>
<!-- 2016-05-01 02:00:00 EDT / 1462082400 --> <row><v> NaN </v></row>
似乎我的所有时序参数都设置正确,但我无法使其工作。我现在让它运行了一个多小时,没有数据显示出来。不知道还有什么可以尝试。
我再次浏览整个脚本,打印出所有输出,发现数据没有像我预期的那样经常更新。我增加了心跳大小并开始获取数据。