Linux – Migrating Cacti from Windows to Linux

cactilinuxwindows

I'm migrating Cacti from Windows to Linux and I've come across a bit of a problem.

The Windows server is running an older version of Cacti so I'm migrating it to version 0.8.

I've managed to port the database across to the new server, the installer ran successfully and the tables have been migrated to the new version. I've copied over the RRA folder (containing the old RRD files) from the Windows server to the new version on the Linux server but graphs are not displaying.

Manually running poll.php from the command line reveals this error when Cacti tries to update the RRD files:

ERROR: reached EOF while loading header rrd->ds_def

Any ideas what might be causing this?

Thanks in advance!

Chris

Best Answer

You've got Windows line endings in your RRD files, so cacti/rrdtool on Linux can't read them.

The accepted method is to use rrddump to convert the RRD files to XML, and then use rrdrestore on the target machine to bring them back to RRDs. It's possible that running dos2unix on your RRDs would solve this, but I've never tried it.

--Edit by original poster--

Just in case they're needed, here are some specifics:

Windows Machine

Covert the rrd files to xml.

for /F "usebackq" %i in (`dir /s /b d:\Old_Cacti\rra_working_copy\*.rrd`) do rrdtool dump %i > %i.xml

Copy the converted files elsewhere for tarring/zipping up before moving to the Linux box

copy d:\Old_Cacti\rra_working_copy\*.xml d:\Old_Cacti\converted_rra_files\

Linux Machine

Change to the directory containing the converted (xml) files and convert them back into .rrd files.

find . -exec rrdtool restore {} {}.rrd \;

Copy the newly converted files into the rra directory.

cp *.rrd.xml.rrd /var/www/html/rra/

Change into the rra directory and rename the files back to *.rrd

rename .rrd.xml.rrd .rrd *.rrd.xml.rrd