0

I'm trying to update an rrd file with new data every 10 minutes. I've got a cronjob set to run every 10 minutes that should run the update command, but when I dump the contents of the rrd file afterwards, all values show up as NaN.

I've looked at a lot of different sites that indicate it's probably a problem with timing/step/heartbeat. I've fiddled with these and still can't get any values to show up.

Right now my step size is 600 and the heartbeat is 900 and the wrapper script runs every 10 minutes (600). This code is part of a function that will be called a couple times to create a couple of databases, hence the DSBOGO to keep it general.

$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";

Below is the rrdtool info output

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

And here is a sample of the rrdtool dump output sample

<!-- 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>

It seems like all of my timing parameters are set up correctly, but I cannot get this to work. I've let it run for over an hour now, and no data has shown up. Not sure what else to try at this point.

I went through the whole script again printing out all of the outputs and discovered the data was not updating as often as I expected. I increased the heartbeat size and started getting data.

fcr91
  • 23
  • 1
  • 7
  • you may want to log the values and timestamps of your updates – Tobi Oetiker Aug 05 '16 at 08:52
  • As Tobi says. The problem is not the DS max/min, nor is it the amount of data or data collection frequency. Check that you are definitely starting with a fresh RRD (and not somehow one set with future timestamps) and log the values as they are updated; possibly your update script is not running, or has an error and is attempting to update with invalid values. – Steve Shipway Aug 07 '16 at 22:17
  • So I know the rrd update is running. When I do an `ls -ltr` on in the directory where the rrd files are they do show updates every 10 minutes. I guess it's possible there's an error with the way I'm updating but I haven't been able to find one – fcr91 Aug 10 '16 at 19:58
  • My update statement looks like this `rrdtool update rrdfile.rrd 1468143600:0 1468150200:172693.27984 1468156800:135192.20432` with many more values being input after these first 3. I believe that is all formatted correctly? – fcr91 Aug 10 '16 at 20:04
  • @SteveShipway it turns out the data that I'm trying to put into the RRD has timestamps in the future (by about 3 hours) relative to the time on the server where the RRDs are. I assume this is why my update is not working correctly? – fcr91 Sep 21 '16 at 18:16
  • Timestamps in the future is not necessarily a problem, but they MUST be always increasing. You can't log data for 12:00 if you previously logged data for 13:00. Are you certain that the timestamps never go backwards in time? – Steve Shipway Sep 21 '16 at 23:13
  • @SteveShipway So this is a temporary rrd that will get deleted and recreated every time the script runs. I just need to temporarily store the data so I can operate on it and put it into a permanent rrd for actual data plotting. The data that I'm trying to input does go from the end of August through today, but since the file gets recreated each time, shouldn't that not be a problem? – fcr91 Sep 28 '16 at 21:25
  • @fcr91as long as the timestamps are always increasing as you enter them, should be OK – Steve Shipway Sep 29 '16 at 23:47

0 Answers0