Skip to content
Ric Lister edited this page May 23, 2013 · 1 revision

The ganglia source allows graphing of data from ganglia cluster reports. Instead of target, use cluster, graph and/or metric. These can be extracted from the url parameters c, g and m in the desired ganglia view.

Example:

Dash.stats()
  .config({
    type:    'ganglia',
    source:  'http://ganglia01',
    cluster: 'Web Front End'
  })
  .add(
    {
      title: 'Web front-end load',
      graph: 'load_report'
    },
    {
      title: 'Web front-end CPU',
      graph: 'cpu_report'
    }
  );

Calculating ratios

Ganglia provides data about infrastructure, such as number of nodes, cpus, etc. It is possible to use this in a filter function to show data as a ratio, which can be more human-friendly. For example:

var convertLoadReportToRatio = function(data) {
  return [{
    metric_name: 'load_ratio',
    datapoints: data[0].datapoints.map(function(x, i) {
      var num_cpus = data[2].datapoints[i][0];
      // last cpu value can be zero, do not divide by this or the universe will end
      var ratio = (num_cpus === 0) ? 0 : x[0]/num_cpus;
      return [ ratio, x[1] ];
    })
  }];
};

Dash.stats()
  .add({
    title:   'Resque workers load ratio',
    type:    'ganglia',
    source:  'http://ganglia02',
    cluster: 'Resque Workers',
    graph:   'load_report',
    filter:  convertLoadReportToRatio,
    display: 'last',
    thresholds: [
      { class: 'green',  test: function(x) { return x < 1.0 } },
      { class: 'yellow', test: function(x) { return x >= 1.0 && x <= 2.0 } },
      { class: 'red',    test: function(x) { return x > 2.0 } }
    ]
  });
Clone this wiki locally