Misc. Ganglia scripts, add-ons
PHP Perl JavaScript Other
Pull request Compare This branch is 164 commits behind vvuksan:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


This is an attempt to make the Ganglia UI more usable. You should be able to drop this into
your $HTTPD_ROOT/ganglia then run make to generate conf.php.

Please modify Makefile to point the directory where you installed the code. Also note
that Makefile will create directories /var/lib/ganglia/rrds and /var/lib/ganglia/dwoo
which are required for UI to function.


Make file will create a file called conf_default.php. These are default settings. If you 
would like to override any of the $conf settings put them in conf.php file ie. my conf.php
looks like this


$conf['graphreport_stats'] = false;


That way upgrades are much simpler and we can add/change configuration options with as 
little impact as possible.

New features


Views are an arbitrary collection of hostname/metric graphs. They are defined using JSON files and stored in the
/conf directory. View file names have to start with view ie.


There are two types of views, standard (default) and regex views. 

Standard views are defined as follows

  "items": [
    { "hostname":"web1", "metric":"disk_free"},
    { "hostname":"web2", "graph":"cpu_report"}

Regex views allow using regex to match hostnames (need to specify view_type regex) e.g.

  "items": [
    { "hostname":"web-wiki.*", "metric":"disk_free"},
    { "hostname":".*wiki", "graph":"cpu_report"}

Obviously you can write a regex that matches a single host. 

Easy Graph Aggregation

You can also define add graphs created through easy graph aggregation by specifying
"aggregate_graph": true then specifying all the regex rules to match host_regexes.
For example this is one example. Save it as view_myview.json and put in the conf 

  { "hostname":"web01.domain.com","graph":"cpu_report"},
  { "aggregate_graph":"true",
      "description":"Prod Web Servers load1"

Auto Rotation

Automatically rotate view graphs every 30 seconds with hour, day, week and month overview for each metric
on a single page. It will rotate until page closed. 

Optional Graphs

Ability to define optional graphs that are show at the top of the page for any host.
Those are defined using overrides stored in $GANGLIA_DIR/conf directory. You need
to make sure that directory is writeable by the Apache/Web user.

This should work like the normal Ganglia web UI. The difference is that
you need to make the conf/ directory writeable by the Apache user.


You can search for a metric or a host in a live manner. You should be able to click on the
host or metric in the search and 

Installation notes

You should install the PHP JSON extension. It comes with PHP 5.2+. If you are on 5.1 use 

pecl install json

pecl is part of php-pear package on RHEL/CentOS. Make sure you have 

# cat /etc/php.d/json.ini 

On RHEL/CentOS 4, you will also need phpize which comes with the php-devel package.

In recent versions, a native version of JSON encoding/decoding is used, but using the
PECL extension is recommended for performance reasons.


In the search window when you click on a metric it should actually jump to the metric once the
page is opened. That doesn't work. If you just press enter in the Location bar it does jump.