forked from pommi/CGP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
group.php
50 lines (35 loc) · 1.06 KB
/
group.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
<?php
require_once 'conf/common.inc.php';
require_once 'inc/html.inc.php';
require_once 'inc/collectd.inc.php';
header("Content-Type: text/html");
$category = GET('h');
$plugin = GET('p');
$selected_plugins = !$plugin ? $CONFIG['overview'] : array($plugin);
html_start();
echo "<h1>$category</h1>";
$host = $CONFIG['cat'][$category][0];
printf("<fieldset id=\"%s\">", htmlentities($host));
printf("<legend>%s</legend>", htmlentities($host));
echo <<<EOT
<input type="checkbox" id="navicon" class="navicon" />
<label for="navicon"></label>
EOT;
if (!strlen($host) || !$plugins = collectd_plugins($host)) {
echo "Unknown host\n";
return false;
}
plugins_list_group($category, $selected_plugins);
echo $CONFIG['cat'][$category];
echo '<div class="graphs">';
foreach ($selected_plugins as $selected_plugin) {
plugin_header($host, $selected_plugin);
if (in_array($selected_plugin, $plugins)) {
foreach ($CONFIG['cat'][$category] as $host) {
graphs_from_plugin($host, $selected_plugin, empty($plugin));
}
}
}
echo '</div>';
printf("</fieldset>");
html_end();