Importing old mrtg data (howto)

BryanRagon

10-06-2004 11:27:08

Greetings all,

Thanks to the help on this board, I have found a way to import our old mrtg rrd data into netmrg. I believe the standard mrtg can only have two values for each rrd file that it is recording. If you track both of those values in netmrg, it will store them in two separate rrd's. Here's how to extract them. Note that you need to install xmlstartlet, available at http//xmlstar.sf.net/.

[code1d224e468a0]
rrdtool dump old_mrtg.rrd | xml ed -d /rrd/ds[2] | xml ed -d /rrd/rra/cdp_prep/ds[2] |xml ed -d /rrd/rra/database/row/v[2] | xml ed -u '/rrd/ds/name' -v ' mon_19 ' |sed 1d > netmrg_value1.xml
rm /var/lib/netmrg/rrd/mon_19.rrd
rrdtool restore netmrg_value1.xml /var/lib/netmrg/rrd/mon_19.rrd
[/code1d224e468a0]

and for value 2
[code1d224e468a0]
rrdtool dump old_mrtg.rrd | xml ed -d /rrd/ds[1] | xml ed -d /rrd/rra/cdp_prep/ds[1] |xml ed -d /rrd/rra/database/row/v[1] | xml ed -u '/rrd/ds/name' -v ' mon_20 ' |sed 1d > netmrg_value1.xml
rm /var/lib/netmrg/rrd/mon_20.rrd
rrdtool restore netmrg_value1.xml /var/lib/netmrg/rrd/mon_20.rrd
[/code1d224e468a0]

The only thing this doesn't do is this In 'natively' generated netmrg rrd's, there are 12 <rra> sections. 4 each for AVERAGE, LAST, and MAX. There are four each for the different "ppd_per_row" levels. mrtg created rrd's only have AVERAGE and MAX. when following this guide the four LAST rra sections are not added. And they are not automatically added the next time netmrg_gatherer is run. However I have not been able to find any decresed functionality or bugs from this section not being in the new rrd's.