First, starting from Howie's page on creating animations of Weathermaps here:
http://www.network-weathermap.com/conte ... eathermaps
I use a very similar script to grab a copy of the new map each time it is generated and store it with the date as part of the file name. I also use a cron entry to prune the saved maps to a number of days. I store the saved maps in cacti/plugins/weathermap/output/history/ for lack of a better location. Make sure that you name the saved map files in this format: map_201010132300.png as the PHP script will look for this format.
To illustrate, here is a bash script to save the map, which you would call from the poller as Howie suggests or from cron in your own fashion if you prefer:
Next, using the SuperLinks plugin, I create a tab that points to a simple PHP script located in that same output/history/ directory. This script looks at all of the map files that have been saved and builds a table of time links where the link opens the map from that time (see attached screen image and the PHP script). So, you see a big list of times ordered by day and hour (in my example, I capture the map every five minutes), and you can click a time to view that saved map. Of course, you could link to this file however you like - SuperLinks is not a requirement, but I like to have the history as a Cacti tab.
Code: Select all
#!/bin/sh SRC_MAP="/var/www/html/cacti/plugins/weathermap/output/your-map-here.png" HISTORY_DIR="/var/www/html/cacti/plugins/weathermap/output/history" DATE=`date '+%Y%m%d%H%M'` cp $SRC_MAP $HISTORY_DIR/map_$DATE.png
That's all there is to it. I thought about making this script its own plugin, especially after trying to include some of Cacti's CSS files in order to give it a similar look and feel. But I have been thinking about it for a while and decided to go ahead and post here - maybe there is someone that would like to bundle it up more cleanly.
Let me know if you like it or have any problems!