[rrd-users] Little trouble with rrd_create_r

Geoff Garside geoff.garside at openhosting.co.uk
Wed Jun 13 12:35:22 CEST 2007


Hello List,

I've written an application which collects bandwidth stats from a bunch of
switches and then takes those stats and is supposed to insert them into an
RRD for each switch port. I've been having some trouble both creating RRDs
and inserting data into them. 

 

The errors I am getting when creating the RRDs is "expected 2 data source
readings (got 1) from 0:". I've got my code printing out the equivalent
`rrdtool create` command from the same arguments passed to the
`rrd_create_r` function and it prints out the following

 

            rrdtool create /path/to/rrds/b4_switch_port_47.rrd --step 300
--start 1181726796 \

                        "DS:input:COUNTER:600:0:U"    \

                        "DS:output:COUNTER:600:U:U" \

                        "RRA:AVERAGE:0.5:1:600"                   \

                        "RRA:LAST:0.5:1:600"               \

                        "RRA:MAX:0.5:1:600"                \

                        "RRA:AVERAGE:0.5:6:700"                   \

                        "RRA:LAST:0.5:6:700"               \

                        "RRA:MAX:0.5:6:700"                \

                        "RRA:AVERAGE:0.5:24:775"      \

                        "RRA:LAST:0.5:24:775"              \

                        "RRA:MAX:0.5:24:775"              \

                        "RRA:AVERAGE:0.5:288:797"    \

                        "RRA:LAST:0.5:288:797"                        \

                        "RRA:MAX:0.5:288:797"

 

<line breaks added for readability>

 

The function which is used to create the RRD is as follows

 

            int

            sc_rrd_create(const char *filename)

            {

                time_t start = time(NULL) - 600;

                unsigned long step = 300;

 

                int argc = 14;

                char *argv[] = {

                    "DS:input:COUNTER:600:0:U",

                    "DS:output:COUNTER:600:U:U",

                    "RRA:AVERAGE:0.5:1:600",

                    "RRA:LAST:0.5:1:600",

                    "RRA:MAX:0.5:1:600",

                    "RRA:AVERAGE:0.5:6:700",

                    "RRA:LAST:0.5:6:700",

                    "RRA:MAX:0.5:6:700",

                    "RRA:AVERAGE:0.5:24:775",

                    "RRA:LAST:0.5:24:775",

                    "RRA:MAX:0.5:24:775",

                    "RRA:AVERAGE:0.5:288:797",

                    "RRA:LAST:0.5:288:797",

                    "RRA:MAX:0.5:288:797",

                    (char*)NULL

                };

 

                sc_replay_rrd_create(filename, step, start, argc, (const
char **)argv);

                return rrd_create_r(filename, step, start, argc, (const char
**)argv);

            }

 

The `sc_replay_rrd_create` function is what prints out the above `rrdtool
create` command. Out of all the switches I am working with and all their
ports, this function correctly creates the RRD for about 10 - 15% of them.
The rest have the "expected 2 data source readings (got 1) from 0:" error.

 

Am I missing something glaringly obvious in my RRD definition which is
causing this problem?

 

Linking against librrd and using `-O0 -g` when compiling. RRDtool version
1.2.23.

 

Regards,

Geoff Garside

 

Open Hosting Ltd

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/rrd-users/attachments/20070613/0d52e0f2/attachment-0001.html 


More information about the rrd-users mailing list