An automatic rotation system for Cacti graphs to be display on a fixed monitor
JavaScript
Switch branches/tags
Nothing to show
Pull request Compare This branch is 13 commits ahead, 2 commits behind lozzd:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
README
ajax-loader.gif
cactiview.css
cactiview.js
config.json
index.html

README

#########################################################################
#
#       CactiView v2.0 - Brian Flad
#       http://fladpad.com - bflad417@gmail.com
#       
#       Forked and updated from the excellent:
#       CactiView v0.2 - Laurie Denness
#       http://laurie.denness.net - laurie@denness.net
#
#       Displays a rotation selection of graphs from Cacti/Ganglia
#
#       Configuration is available in config.php
#
#########################################################################

DISCLAIMER: This code is probably not 100% glamorous, but it works.
If you have any problems, I'm sure they won't be hard to solve; and I cannot be
held responsible if you lose data, time, your girlfriend, your house, or anything else from 
using this code. 

0. Requirements

- Cacti/Ganglia
- A decent web browser with Javascript/AJAX support

1. Limitations

Flat config file must be edited to change rotation items/speed. 

2. What it does 

CactiView gives you a clean and simple view of one data source from Cacti at a time. You can
name the data sources, and set the automatic rotation duration.

When you first load CactiView, it will automatically determine the size of your browser
and size everything (hopefully) appropriately. If you need to force a specific size, just add
height= and width= parameters in the URL.

You can see how this looks here: http://www.flickr.com/photos/hiddenspark42/4447965060/
Original v0.1 by Laurie: http://www.flickr.com/photos/lozzd/3210562508/

One main large graph for the last 24 hours, 3 smaller graphs with longer time periods and a 
couple of other bits and bobs of information. 

3. Configuration

To get the most of CactiView, you should make a couple of simple changes to your Cacti/Ganglia
installation. These are optional, but will improve the output of CactiView. More details later.

The actual configuration of CactiView is very simple. You do not even have to run CactiView on
the same server as Cacti. Each configuration option is detailed in the config file, config.json. 
At the very least, you should set a sensible timeout, the web path to Cacti (to display the 
actual graphs) and of course the graphs. All that is required for this is the internal ID of
the graph in Cacti, and a name for the graph. 

4. Using CactiView

After configuration, open a browser (I suggest Google Chrome, more here:
http://laurie.denness.net/blog/2009/05/finding-a-web-browser-for-constant-page-reloading/ )
and point it to where you installed CactiView. e.g. http://host/cactiview

You should land at your first graph, and after the timeout, it will rotate to the next graph
in the array until it hits the last at which point it will start again at the being. This repeats
forever. 

5. Hints and tips

If displaying this unattended constantly, it is a good idea to use a method to turn off the 
display when no one will be looking at it (if possible!). On Windows, I provide a couple of
small .exe files, one which sleeps the displays, and one to wake them. You can then use 
Task Scheduler to have the monitors be controlled automatically. Using Linux, you can use
dpms to sleep and wake the monitors using cron. 

6. Modifying Cacti

(Currently not implemented!)

To remove the graph title from the CactiView graphs to make the display cleaner, you need 
to add a small amount of code to Cacti itself. This is optional, but recommended. 

--- cacti-0.8.7d/lib/rrd.php       2009-02-12 02:55:50.000000000 +0000
+++ cacti/lib/rrd.php   2009-04-01 16:41:08.961126012 +0000
@@ -830,6 +830,16 @@
                }
        }

+        /* Last.fm modification, allow us to get a basic graph for CactiView */
+
+    if (isset($_GET['notitle'])) {
+        $graph["title_cache"] = '';
+        $graph["vertical_label"] = '';
+        $graph_opts .= "-c MGRID#888888" . RRD_NL;
+        $graph_opts .= "--slope-mode" . RRD_NL;
+    }
+
+

7. Modifying Ganglia

To allow for custom sizes posted into the URL of the graph.php graph creation script
in Ganglia, you need to add the following: (put the lines anywhere as long as Ganglia does
not overwrite the width variable again! Near the bottom is best.)

diff graph.php.20100330 graph.php
178a179,186
> if (isset($_GET['width'])) {
>    $rrdtool_graph['width'] = $_GET['width'];
> }
> 
> if (isset($_GET['height'])) {
>    $rrdtool_graph['height'] = $_GET['height'];
> }
> 
206a215,218
> if (isset($_GET['nolegend']) && $_GET['nolegend'] == 1){
>     $command .= " --no-legend";
> }
> 

8. Help me!

No! Well maybe. Send me an email, and I can probably offer some advice. I apologize if not!