[rrd-users] rrdtool-php fetch from multi-dimensional rrd

Big Wave Dave bigwavedave at gmail.com
Wed Apr 30 06:06:23 CEST 2008

I am trying to fetch a single value from an rrd which looks like:

root[]# rrdtool fetch ns3_everyone_net_loss_8.rrd AVERAGE -r 300 --start -1h
                           loss                 avg
max                 dev                 min

1209524400: 0.0000000000e+00 6.3632673333e+01 6.3914106667e+01
2.9694000000e-01 6.3377886667e+01
1209524700: 0.0000000000e+00 6.3609073333e+01 6.3764490000e+01
2.2424000000e-01 6.3343113333e+01
1209525000: 0.0000000000e+00 6.3925940000e+01 6.4463660000e+01
5.1203666667e-01 6.3272236667e+01
1209525300: 0.0000000000e+00 6.3800846667e+01 6.4178926667e+01
4.3552000000e-01 6.3319680000e+01
1209525600: 0.0000000000e+00 6.3664453333e+01 6.3935806667e+01
3.6324000000e-01 6.3310033333e+01
1209525900: 0.0000000000e+00 6.3633103333e+01 6.3983836667e+01
3.8791666667e-01 6.3341893333e+01
1209526200: 0.0000000000e+00 6.3832333333e+01 6.4199280000e+01
3.8102333333e-01 6.3422730000e+01
1209526500: 0.0000000000e+00 6.5081620000e+01 6.7784940000e+01
1.5541266667e+00 6.3637560000e+01
1209526800: nan nan nan nan nan
1209527100: nan nan nan nan nan
1209527400: nan nan nan nan nan
1209527700: nan nan nan nan nan
1209528000: nan nan nan nan nan

I am trying to grab the value from the 1st line of the "avg" column,
in php code such as:
$opts = array ( "AVERAGE", "--start", "-1h" );
$ret3 = rrd_fetch("/path/to/server1.rrd", $opts, count($opts));
$tmp3 = $ret3[data][1][2]; echo "<td> $tmp3 \n</td>";

I have this basicly working identically for a one-dimensional rrd, so
I must be pretty close.  Am I not calling the column aspect properly?
Reviewing the rrd-beginners seems to hint that the above is the proper

Any help would be greatly appreciated!


More information about the rrd-users mailing list