Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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
share|improve this answer
    
I did wonder if something like that would be the case, but I'm not familiar with MRTG/Cacti etc so didn't know what the solution was. I'll give it a go and come back and mark your response as the answer. –  leftcase Apr 23 '12 at 18:50
    
Thanks for your help NathanG, dos2unix doesn't work but rrdtool does. I'll add the specifics to your answer just in case anyone else needs them. –  leftcase Apr 23 '12 at 21:30
2  
Line endings have nothing to do with it. dos2unix won't work because RRD files aren't text, they're binary. The conversion to/from XML with rrdtool is necessary to account for architectural differences between platforms. The generated XML is portable by design; the binary data is not. –  James Sneeringer Apr 24 '12 at 4:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.