wview-rrd - Interactive RRDTool graphs for wview weather stations
wview-rrd updates Round Robin Database files from a local wview SQLite database file. cgi-bin/weather then generates interactive graphs of the weather data from these RRD files to a web browser.
See EXAMPLES below for an example web site.
Features of the CGI web interface include:
* show all weather variables in high resolution time series graphs
* change displayed units, with configurable defaults
* zoom the displayed time frame: year, month, week, day, hour, custom
* scroll the displayed time frame of the graphs left/right
* change graph plot size (width x height)
* change data resolution - detailed, hourly, daily and so on
* at wider resolutions, show average line in min/max area
* add graphs of extra sensor data
* show (min < avg < max) last, of plotted data in the legend
* show many times of a graph at once (just click a graph)
* export the data of any graph to csv, xml, json or see RRD code
* all widgets / links have mouse balloon tooltip cluesInstall the data collector and data presentation code:
cp -p or ln -s bin/* to /usr/bin/ or the location of other wv* code
cp -p or ln -s cgi-bin/* to your web server's cgi-bin/ directory
edit cgi-bin/weather.pl config file as needed - make sure
$where is the directory that holds your weather .sdb files.http://localhost/cgi-bin/weather should now show an interface, but with broken graphs since the RRD files don't yet exist. Click y and << a couple times to zoom out to a 4 year view. You can refresh this in a moment to see the data coming in as you run the data collector.
These graphs track accumulated rain per year, automatically resetting to 0 at the beginning of each year. So, you can optionally find out how many inches of rain you had in the year up to the start date of your station. This needs passed to wview-rrd when it first generates the RRD files. If you don't know, the default value is 0.
Run as root, passing starting inches of rain as the only argument:
umask 022
cd /var/lib/wview/archive # location of wview-archive.sdb
wview-rrd 6.17 # where "6.17" is inches of rain to start, or 0Be patient - this first run will take a while as all your station data is stored in the RRD files. Refresh the weather URL above to see the data coming in. Confirm 3 RRD files are created in the current directory, along side the wview-archive.sdb source database file. After finished, run wview-rrd again and it should complete much faster as it just adds any new data.
Set up automated updates of the RRD files after generating the HTML files. Do this by adding a few lines to /etc/wview/post-generate.sh:
umask 022
cd /var/lib/wview/archive # location of wview-archive.sdb
wview-rrd > /tmp/wview-rrd.log 2>&1 &Add your initial YTD inches of rain as above if known. This allows a simple rm *.rrd to recreate them at any time with correct initial rain amount. Sometimes remove and regenerate is needed if you have edited data in the source database.
http://twitham.homelinux.org/cgi-bin/weather
rrdtool(1), http://www.wviewweather.com/
Timothy D Witham <twitham@sbcglobal.net>
Copyright 2012-2018 Timothy D Witham.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.