Old MRTG log files to Cacti

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Moderators, Developers

Post Reply
Posts: 2
Joined: Tue Nov 30, 2004 9:16 am

Old MRTG log files to Cacti

#1 Post by poweredge_netone » Tue Nov 30, 2004 9:18 am


Is het possible to convert the old MRTG log files that i use to the cacti RRA files. It are plain files with those enourmos numbers in it. Well known to everyone i suppose. Im currently monitoring my switch for a year so its nice when ik can port the data so ive got an actual yearly average :)

has anyone done it ?

Basilio Cat
Posts: 25
Joined: Sun Sep 12, 2004 1:13 pm

#2 Post by Basilio Cat » Tue Nov 30, 2004 10:00 am

I've been looked forward to do that.
You can dump rra files as XML, insert missing data from logs, and import XML back to rra

BUT. I've for about 1300 interfaces being graphed in MRTG, and there's no way to link log files with rra's without writing complex script - it would be parsing mrtg configs, getting info from MySQL db, e.t.c.

I've decided to leave MRTG running for one year =)

Posts: 14
Joined: Sat Oct 23, 2004 4:03 am

#3 Post by fangel » Wed Dec 22, 2004 5:48 pm


I have found a way to convert MRTG's .log (rateup) files into .rrd (Round Robin)... It's a bit of a hack, but it works... I'm working on a better way (mergeing files, and gui for importing files)

1) Create device and graphs in Cacti so .rrd files will get created...

2) Use MRTG-RRD, actually what you do is add 3 lines to you .cfg file for MRTG (you could do this on a backup of mrtg, mrtg will stop logging to .log files afterwards)
The next time MRTG runs it will convert all .log files to .rrd (.log files stays in place)

3) Patch the MRTG RRD files (open in a hexeditor, change ds1, ds0 to traffic_in, traffic_out - not sure which one was which - not currently at work)

4) Overwrite Cacti's rrd files (in /rra) with MRTG's rrd files (be carefull which one goes where - nameing scheme are no were like eachother)

That should do the trick - all the old data are imported into Cacti, and Cacti wil continue logging in the imported .rrd files... (there might be a gap though - and not sure about daylight savings might cause probs - I seem to be getting a gap of approx one hour)


As said, I'm currently working on a add-on for graphs.php to add a GUI to do the changing in the files, and the overwriting off files...

If anyone knows how to merge two RRD files, I'm all ears...

I might look into figuring out how to figure out which MRTG files goes where... But that will require some massive parsing of the .cfg file for MRTG...

Morten Fangel
- [email protected]

Post Reply