Tag: Hosting

Munin: This RRD was created on another architecture – migrating between 32 and 64bit systems

When I was moving Senpuu.net to a new location, I've wanted to preserve my Munin stats (since my new server have almost identical configuration they will be very useful to me). Unfortunately moving RRD files between different architectures is not possible. To copy Munin data to a new server with a different architecture, we need to use rrdtool (dump and restore).

# Error example from /var/log/munin/munin-node.log
This RRD was created on another architecture

rrd dump and restore

Lets quote a man for rrdtool:

Dump:

Dump the contents of an RRD in plain ASCII. In connection with restore you can use this to move an RRD from one computer architecture to another.

Restore:

Restore an RRD in XML format to a binary RRD.

Now everything looks better. We can easily dump RRD files to XML, move them to the other server and then easily restore them to RRD format.

To dump all RRD files for given node, you need to get (as root) to RRD files dir (by default it should be somewhere near /var/lib/munin) and execute following code:

cd /var/lib/munin/senpuu
# Create a dir for RRD dumps
mkdir ./../rrd_dump
 for i in ./*.rrd;do rrdtool dump $i ./../rrd_dump/$i.xml;done

The above code will create XML dumps in appropriate directory. When this is finished, you need to download all the files and upload them to your new server. Then execute:

# Execute this on a new server
cd /var/lib/munin/rrd_dump
for i in ./*.xml; do rrdtool restore "$i" "../senpuu/${i%.xml}"; done

after this you might reset munin-node just to be sure that everything will work fine:

/etc/init.d/munin-node restart

Now you should have your old charts up and running.

Recursive converting multiple files from PNG to JPG

Quick tip on how to convert recursively multiply PNG files to JPG format. What do we need:

  • Linux
  • Bash
  • RMagick
  • Recursively stored PNG files
  • A bit of patience ;)

First lets convert all the PNG files:

 find ./ -name "*.png" -exec mogrify -format jpg {} \;

And after this, if everything went fine, we can remove all PNG "leftovers":

find ./ -name "*.png" -exec rm {} \;

Of course remember to change the ./ directory into your PNG files directory.

Copyright © 2024 Closer to Code

Theme by Anders NorenUp ↑