Migrating Wview from a Nslu2 to a Sheevaplug

My Nslu2 which I had been running Wview on finally died and rather than replace it with another one I decided to buy a Sheevaplug instead.

Migrating archive data from wlk files to Sqlite

The version of Wview on the Nslu2 was quite old and used  .wlk files to store archived readings. The newer versions of Wview store the data in a Sqlite database. The Wview software comes with utilities to migrate the data in the wlk files into the Sqlite database.

Copy the old .wlk files from the Wview archive directory on the old server to /var/lib/wview/archive on the Sheevaplug. The utility to copy the data from the wlk files into the Sqlite database is wlk2sqlite

The first time I ran it I got an error :-

root@sheeva:/var/lib/wview/archive# wlk2sqlite /var/lib/wview/archive
Using default $prefix/var/wview/archive destination…
Converting…(this takes a while, longer on small devices)…
Conversion Stats:
Time      : 0:0
Floating point exception

It turns out the Nslu2 was a Big Endian machine and the Sheevaplug is Little Endian . Luckily the Wview software comes with a converter program. Make a new directory for the converted files then convert them and overwrite the original ones.

mkdir old

arc_be2le /var/lib/wview/archive /var/lib/wview/archive/old
mv old/*wlk  .

Run the conversion program and it should start converting the files and load them into the database. It took 20 mins to convert 2.5 years worth of archive data.

root@sheeva:/var/lib/wview/archive# wlk2sqlite /var/lib/wview/archive
Using default $prefix/var/wview/archive destination…
Converting…(this takes a while, longer on small devices)…
Conversion Stats:
Time      : 1:0 minutes
Recs/sec  : 200
Inserts   : 12050
Duplicates: 4
Errors    : 0

Now stop and start Wview

/etc/init.d/wview restart

Do a tail -f /var/log/wview.log and you should see Wview generating history htmls :-

Nov 24 17:03:16 sheeva htmlgend[16835]: <1322154196730> : htmlHistoryInit: storing day history for Sun Jan  2 00:05:00 2011
Nov 24 17:03:17 sheeva htmlgend[16835]: <1322154197158> : htmlHistoryInit: storing day history for Mon Jan  3 00:05:00 2011
Nov 24 17:03:17 sheeva htmlgend[16835]: <1322154197609> : htmlHistoryInit: storing day history for Tue Jan  4 00:05:00 2011

Now all your old data is in the database of the Wview on the Sheevaplug.

Leave a Reply

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