2

I'm getting all NaN's in my rrdb. Why?

rrdtool create temps.rrd --step 120 \
  DS:temp:GAUGE:250:-10:212 \
  DS:rate:DERIVE:250:-10:212 \
  DS:setpoint:GAUGE:250:-10:212 \
  RRA:AVERAGE:0.3:1:43200

After a night of collecting data & updating every 2 minutes something like this:

 /usr/bin/rrdupdate temps.rrd N:30.8:30.8:9.6

The DS is changing, but the RRA doesn't have any entries.

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE rrd SYSTEM "http://oss.oetiker.ch/rrdtool/rrdtool.dtd">
<!-- Round Robin Database Dump -->
<rrd>
        <version>0003</version>
        <step>120</step> <!-- Seconds -->
        <lastupdate>1375360140</lastupdate> <!-- 2013-08-01 07:29:00 CDT -->

        <ds>
                <name> temp </name>
                <type> GAUGE </type>
                <minimal_heartbeat>250</minimal_heartbeat>
                <min>-1.0000000000e+01</min>
                <max>2.1200000000e+02</max>

                <!-- PDP Status -->
                <last_ds>60.1</last_ds>
                <value>NaN</value>
                <unknown_sec> 60 </unknown_sec>
        </ds>

        <ds>
                <name> rate </name>
                <type> DERIVE </type>
                <minimal_heartbeat>250</minimal_heartbeat>
                <min>-1.0000000000e+01</min>
                <max>2.1200000000e+02</max>

                <!-- PDP Status -->
                <last_ds>59.9</last_ds>
                <value>NaN</value>
                <unknown_sec> 60 </unknown_sec>
        </ds>

        <ds>
                <name> setpoint </name>
                <type> GAUGE </type>
                <minimal_heartbeat>250</minimal_heartbeat>
                <min>-1.0000000000e+01</min>
                <max>2.1200000000e+02</max>

                <!-- PDP Status -->
                <last_ds>60.0</last_ds>
                <value>NaN</value>
                <unknown_sec> 60 </unknown_sec>
        </ds>
        <!-- Round Robin Archives -->
        <rra>
                <cf>AVERAGE</cf>
                <pdp_per_row>1</pdp_per_row> <!-- 120 seconds -->

                <params>
                <xff>3.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>
                        <ds>
                        <primary_value>NaN</primary_value>
                        <secondary_value>NaN</secondary_value>
                        <value>NaN</value>
                        <unknown_datapoints>0</unknown_datapoints>
                        </ds>
                        <ds>
                        <primary_value>NaN</primary_value>
                        <secondary_value>NaN</secondary_value>
                        <value>NaN</value>
                        <unknown_datapoints>0</unknown_datapoints>
                        </ds>
                </cdp_prep>
                <database>
                        <!-- 2013-06-02 07:30:00 CDT / 1370176200 --> <row><v>NaN</v><v>NaN</v><v>NaN</v></row>
                        <!-- 2013-06-02 07:32:00 CDT / 1370176320 --> <row><v>NaN</v><v>NaN</v><v>NaN</v></row>
                        <!-- 2013-06-02 07:34:00 CDT / 1370176440 --> <row><v>NaN</v><v>NaN</v><v>NaN</v></row>

many lines, all NaN

                        <!-- 2013-08-01 07:26:00 CDT / 1375359960 --> <row><v>NaN</v><v>NaN</v><v>NaN</v></row>
                        <!-- 2013-08-01 07:28:00 CDT / 1375360080 --> <row><v>NaN</v><v>NaN</v><v>NaN</v></row>
                </database>
        </rra>
</rrd>
Dean Brundage
  • 2,038
  • 18
  • 31

1 Answers1

1

Your problem is that you are not actually storing any data; your rrdupdate calls are failing.

If you run the rrdupdate command from the commandline, you will immediately see the error:

$ rrdtool update temps.rrd N:30.8:31.2:9.1
ERROR: temps.rrd: not a simple signed integer: '31.2'

The reason for this is that, while the first and third DS are of type GAUGE, the second is of type DERIVE. It is a (poorly documented) fact that you can only use a non-integer value when the data type is GAUGE.

So, you have four options -

  • Make sure your second value (for 'rate') is always an integer
  • Change it to type GAUGE and pass the rate rather than the value
  • Remove the second DS entirely, and calculate this on the fly when displaying the data
  • Replace the rate DS with a COMPUTE DS type to calculate at storage time

The last may be the best option but would need some work.

Steve Shipway
  • 3,754
  • 3
  • 22
  • 39