Installing Meteo

Thanks to Walter Poxon and colleagues who provided these instructions for meteo versions before 0.8.0. Some things have changed in 0.8.0, most notably the replacement of the meteograph program by meteodraw. (Update 0.9.0: while the requirements have not changed, some of the details for running have, see below.)

Davis trivia for the day

The Davis Vantage Pro unit spits out wind direction in 1/100ths of a degree azimuth! ;)

Jeff writes: The other day when I was twiddling with the rain collector it proudly announced, "It's raining cats and dogs!!"

Installing meteo

Stuff you need on your system before compiling meteo:

Meteo installs fairly easily if you have the right pre-requisite packages installed on your system.

Here's a list of what I had to install (in roughly the order I needed to install them) in order for meteo to install/build properly:

drwxr-xr-x wdp user 1536 Feb 17 17:25 mysql-3.23.54a
drwxr-xr-x wdp user 5120 Feb 17 15:04 perl-5.8.0
-rw-r--r-- 1 wdp user 24729600 Apr 1 12:27 httpd-2.0.44.tar
-rw-r--r-- 1 wdp user 17141760 Jan 21 14:09 libxml2-2.5.1.tar
-rw-r--r-- 1 wdp user 2160640 Jan 21 14:25 gd-2.0.11.tar
-rw-r--r-- 1 wdp user 962560 Feb 17 06:56 DBI-1.32.tar
-rw-r--r-- 1 wdp user 409600 Feb 17 15:20 DBD-mysql-2.1025.tar
-rw-r--r-- 1 wdp user 768000 Feb 23 21:59 libwww-perl-5.69.tar
-rw-r--r-- 1 wdp user 286720 Feb 23 22:05 HTML-Parser-3.27.tar
-rw-r--r-- 1 wdp user 368640 Feb 23 22:09 URI-1.23.tar
-rw-r--r-- 1 wdp user 2048000 Mar 30 20:47 pm.tar
-rw-r--r-- 1 wdp user 24104960 Mar 30 21:10 php.tar


Install mysql, perl, and the latest apache first.

These are all independent of one another, but will be tied together by the subsequent pieces. All the version numbers above should be treated as minimums. If something newer is out there, I'd use it. Note that there are also some version constraints between some of the packages above, e.g. some libxslt version usually requires a minimum libxml2 version.

PHP in particular requires minimum versions >= those above of all the above pieces.

Then install the DBI, DBD, libwww-perl, the pm/php stuff, and everything else. Note that the perl stuff is needed only for the weatherunderground portion.

It goes without saying to do a "make test" on each of these pieces (if available) to make sure all the individual pieces work.
The last piece (which will use all of them) is meteo. Meteo will build properly with just the above installed. It will not run or look right, however, unless you follow the docs in the db directory of the meteo distribution on setting up additional users (first as unix users and then again separately in the database user admin stuff) for the two functions of meteo. Meteo uses a separate unix user + database user for data collection (read+write perms to the database tables) and the graphing stuff (read-only perms) to the database.

Configuring meteo:

Info on configuring meteo:

You need to set up the users and tables in your mysql database.

Make sure the mysql daemon is running, then check out the README in the db directory.

You'll need to first set up two unix accounts (named mtp and meteo - see below). Do these first, then create the necessary database users and tables in mysql according to the README in the db directory.

If you want to see a working example, log in to
Files you'll want to snarf:
/usr/local/etc/meteo.xml (the main config file for the whole thing)

Set up mtp user account

Meteo can run as any user, so you may choose to run it as root, or as some other user already defined on your system. It is, however, good system administration practice to use a dedicated user. The mtp user used for reading data from the station and writing it to the database needs access to the station (a serial interface like /dev/ttyS0, give this device to mtp, or via TCP to a device server), and needs insert and upate rights in the database.

Another user meteo can be set up who will generate the images, this user only needs read access to the database (select).

  1. Create a user named mtp
  2. Create this crontab for user mtp (runs davis_collect_data every 2 mins)
    */2 * * * * /usr/home/mtp/davis_collect_data

    Here's what the davis_collect_data script looks like:

        ps -ax | grep -v grep | grep meteopoll > /dev/null 2>&1
        if [ $? -eq 1 ] ; then
        /usr/local/bin/meteopoll -f /usr/local/etc/meteo.xml \
            -d -F -sOakwood > /dev/null 2>&1 &
        # echo "meteopoll already running"
    (Update 0.8.0: add the option -b msgqueue, or meteopoll will use the default destination for database updates, which is standard output. Also it is best to run meteopoll without -d -F in production, since the debug flag causes lots of debug messages to be generated, which takes quite some time. Also -F stops meteopoll from forking, which also disables meteopoll's ability to recover from a crash of the connection.)
  3. Set up meteo user: this is for running the meteograph program which reads info from the database and generates the graphs for you)
  4. Create this crontab for user meteo:

    WEATHER_GRAPH="/usr/local/bin/meteograph -f /usr/local/etc/meteo.xml -s Oakwood" */2 * * * * /usr/home/meteo/davis_average_data # every 5 mins, graph daily graphs for weather */5 * * * * $WEATHER_GRAPH -c $WWW 300 # at 5 mins after the hour, do weekly graphs 5 * * * * $WEATHER_GRAPH -c $WWW -a 1800 # at 15 mins after the hour, do monthly graphs 15 * * * * $WEATHER_GRAPH -c $WWW -a 7200 # at 25 mins after the hour, do yearly graphs 25 * * * * $WEATHER_GRAPH -c $WWW -a 86400
    Note the -a options to the graph program, it ensures that the precomputed averages in the meteoaverage table are used, which is essential for performance. While during the first few weeks you can easily live without the -a option, after about half a year you will start to wonder why your database server behaves so sluggish. (Update 0.8.0: the -a flag is no longer necessary, meteograph is no longer capable of reading from the stationdata table, it always uses the averages table. This also means that you must run meteoavg.)

Stuff for uploading data to Weather Underground

see wunderground directory.

  • re-work scripts for keeping meteopoll and meteoavg running (since they're supposed to run forever anyway). Instead of cron job which runs every 2 mins, switch to using a loop in /etc/rc.local to only re-invoke them if they exit (using a subshell).