RRDtool (Round Robin Database) stores time-series performance metrics (such as Nagios / PNP4Nagios / Cacti / Zabbix / Ganglia graphs) in a binary file format that depends on the underlying CPU architecture (i386 32-bit vs. x86_64 64-bit) and byte order (endianness).
When you migrate a Nagios server from a 32-bit OS to a 64-bit OS by copying /usr/local/nagios/share/perfdata directly, RRDtool refuses to read or update the copied .rrd files and logs:
ERROR: This RRD was created on another architecture
To migrate .rrd files across architectures without losing historical graphs, export each .rrd file to platform-independent XML on the 32-bit source server (rrdtool dump), transfer the .xml files to the 64-bit destination server, and rebuild native 64-bit .rrd files (rrdtool restore).
Step 1: Convert a Single .rrd File (dump and restore)
On a Nagios / PNP4Nagios server, performance data files are stored under /usr/local/nagios/share/perfdata/<hostname>/:
cd /usr/local/nagios/share/perfdata
- On the 32-bit source server, dump the binary
.rrdfile to XML:rrdtool dump stats.rrd > stats.xml - Copy
stats.xmlto the 64-bit destination server (for example, viascporrsync). - On the 64-bit destination server, restore the XML file into a native 64-bit
.rrdfile (-foverwrites an existing.rrdfile if present):rrdtool restore -f stats.xml stats.rrd sudo chown nagios:nagios stats.rrd - Verify the restored RRD header and data sources:
rrdtool info stats.rrd | head -n 20
Step 2: Batch-Convert All Nagios perfdata RRD Files
If you have hundreds of hosts and services under /usr/local/nagios/share/perfdata, use a loop to convert all .rrd files at once.
1. Export All .rrd Files to .xml on the 32-Bit Source Server
cd /usr/local/nagios/share/perfdata
find . -type f -name "*.rrd" -exec sh -c '
for rrd; do
rrdtool dump "$rrd" > "${rrd%.rrd}.xml"
done
' sh {} +
2. Copy the Directory Tree to the 64-Bit Server
Transfer the exported .xml (and companion PNP4Nagios metadata) files to the new 64-bit server, or run the restore in place after copying:
rsync -avz /usr/local/nagios/share/perfdata/ root@new-nagios-64bit:/usr/local/nagios/share/perfdata/
3. Restore All .xml Dumps to 64-Bit .rrd Files on the Destination Server
Important (PNP4Nagios Note): PNP4Nagios stores a small companion metadata
.xmlfile alongside every<service>.rrdfile (also named<service>.xml). If you use PNP4Nagios, dump to<service>.rrd.xmlin Step 1 so you do not overwrite PNP4Nagios’s metadata XML files!
# Safe batch dump/restore naming (*.rrd.xml) that preserves PNP4Nagios metadata XMLs:
# On 32-bit source server:
cd /usr/local/nagios/share/perfdata
find . -type f -name "*.rrd" -exec sh -c '
for rrd; do
rrdtool dump "$rrd" > "${rrd}.xml"
done
' sh {} +
# On 64-bit destination server:
cd /usr/local/nagios/share/perfdata
find . -type f -name "*.rrd.xml" -exec sh -c '
for xml; do
rrd="${xml%.xml}"
rm -f "$rrd"
rrdtool restore -f "$xml" "$rrd" && rm -f "$xml"
done
' sh {} +
sudo chown -R nagios:nagios /usr/local/nagios/share/perfdata
Restart npcd and nagios on the destination server and verify that historical performance graphs load cleanly in the web UI.