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