A very basic Weathermap history

Support questions about the Network Weather Map plugin

Moderators: Moderators, Developers

Post Reply
Posts: 17
Joined: Sat Sep 11, 2010 11:24 pm

A very basic Weathermap history

#1 Post by jwhitaker » Wed Oct 13, 2010 11:00 pm

Hi folks - I have managed to create a very simple Weathermap history using a little PHP and Howie's other fancy plugin - SuperLinks.

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:

Code: Select all



DATE=`date '+%Y%m%d%H%M'`
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.

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!
PHP script that generates a simple map history.
(1.08 KiB) Downloaded 205 times
Example history page generated by the script.
history.jpg (137.58 KiB) Viewed 3035 times

User avatar
Cacti Guru User
Posts: 5354
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom

Re: A very basic Weathermap history

#2 Post by Howie » Thu Oct 14, 2010 2:36 am

Nice :-)

I'm pretty sure I added the fields to the weathermap_maps table so that it would be possible to control this from the weathermap management screen, but then never did anything with it. I'll check that. I think that a rewrite of that management page to have a single 'map properties' page with the permissions, group, variables, debug, schedule and potentially history settings in one place would be a good thing.

Don't forget to add something to delete really old ones, or do it rrdtool style: strip out the :5,15,25,35,45,55, then the :10,20,.40,.50, then the .30, then every other hour... depending on how old the maps are. The find command will do it for you, but otherwise someday it'll fill your disk and kill your cacti.
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)

Posts: 1
Joined: Thu Sep 17, 2015 7:21 pm

Re: A very basic Weathermap history

#3 Post by Gostega » Tue Mar 01, 2016 9:48 pm

Hi, check out my answer on StackOverflow for a way to save the weathermap in Windows.
http://stackoverflow.com/questions/3399 ... 8#33992878

All my answer does is cover how to save the graphics at regular intervals using powershell. It doesn't do any of the amazing things like adding links.
You could potentially convert the graphic files to an AVI or something.

Post Reply