Monitoring the Currentcost Envir part 2 (on the Raspberry Pi)

It seems that when I created my first post onĀ Monitoring the Currentcost Envir I omitted some details.
This discovery came when trying to move the Currentcost monitoring over to a Raspberry Pi, and led to me looking everything up again and bashing my brains out on the desk for leaving it all out in the first place.

Firstly, there are a number of prerequisites:

sudo apt-get install perl rrdtool libdevice-serialport-perl

Secondly, I could not remember for the life of me how I had set up the autorunning of the Perl script and the graph creation script.
Turns out I’d left 2 entries tucked away in /etc/rc.local:

/usr/local/bin/cc_watchkeeper &
/usr/local/bin/cc_graphmaker &

These simply had for cc_watchkeeper:

#!/bin/bash
while :
do
/path/to/file/currentcost.pl
done

and for cc_graphmaker:

#!/bin/bash
while :
do
/path/to/file/ccgraphnew.sh
done

So if the processes themselves died, then these simple watchdogs would restart them.

The other problem I faced was RRDtool’s RRD files. These are platform-dependent, meaning if you create one on an x86 system, you can’t then just copy over and append the same file using an ARM system such as the Pi.
So, I got this:

ERROR: This RRD was created on another architecture

There is a way round, which involves dumping the RRD data into another file, and then using that data to recreate the RRD file on the new architecture:
So on the old x86 system:

rrdtool dump powertemp.rrd > powertemp.xml

Then after moving the .xml file to the Pi, we then run this on there:

rrdtool restore -f powertemp.xml powertemp.rrd

Your Pi should then be able to append this new RRD file.

Hopefully, this should save some headscratching, at least for me, if I move the monitoring system again!

Share This!

Leave a Reply

Your email address will not be published. Required fields are marked *