1<h2>Breakdown</h2>
2
3<?php
4
5if ( !isset($_REQUEST['hreg']) and !isset($_REQUEST['metric']) ) {
6  die("You need to supply host regex and metric");
7} else {
8  $host_reg = trim($_REQUEST['hreg']);
9  $metric = trim($_REQUEST['metric']);
10}
11
12require_once('./eval_conf.php');
13
14$context = "cluster";
15
16include_once "./functions.php";
17include_once "./ganglia.php";
18include_once "./get_ganglia.php";
19
20$results_array = array();
21
22foreach ($metrics as $hostname => $host_metrics ) {
23
24  if ( preg_match("/" . $host_reg  .  "/", $hostname) ) {
25    if ( isset($host_metrics[$metric]) ) {
26      $metric_value = $host_metrics[$metric]["VAL"];
27      $results_array[$metric_value][] = $hostname;
28    }
29  }
30
31}
32
33?>
34
35<table width="100%" border=1>
36<thead>
37  <tr>
38    <th>Value</th>
39    <th>#</th>
40    <th>Members</th>
41  </tr>
42</thead>
43<tbody>
44<?php
45
46foreach ( $results_array as $metric_value => $members ) {
47
48  print "<tr><td>" . $metric_value . "</td>" .
49    "<td align=\"center\">" . count($members) .
50    "</td><td>" . join(",", $members) . "</td></tr>";
51
52}
53
54?>
55</tbody>
56</table>
57