A very basic Weathermap history

Support questions about the Network Weather Map plugin

Moderators: Developers, Moderators

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

A very basic Weathermap history

Post by jwhitaker »

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

#!/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
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!
Attachments
history.zip
PHP script that generates a simple map history.
(1.08 KiB) Downloaded 312 times
Example history page generated by the script.
Example history page generated by the script.
history.jpg (137.58 KiB) Viewed 14184 times
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: A very basic Weathermap history

Post by Howie »

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!)
Gostega
Posts: 1
Joined: Thu Sep 17, 2015 7:21 pm

Re: A very basic Weathermap history

Post by Gostega »

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.
cmege
Posts: 1
Joined: Sun Jun 11, 2023 1:09 am

Re: A very basic Weathermap history

Post by cmege »

Hi,

it's an old thread, but I didn't find anything more recent about this functionnality.

Here is a an enhanced script that generate a (almost) pretty html page with history of weathermaps, and even animate them so we see evolution of trafic ;-)

https://github.com/c-mege/phpweathermap-history

I'll post some pictures if I found a easy way to do so ;-)
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: A very basic Weathermap history

Post by TheWitness »

It's basically a form of a 'Link' in Cacti 1.x that basically injects text into the page. It's still supported in Cacti, you simply need to create that form of 'Link'.
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest