diff options
Diffstat (limited to 'host.php')
-rw-r--r-- | host.php | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/host.php b/host.php new file mode 100644 index 0000000..22112e6 --- /dev/null +++ b/host.php | |||
@@ -0,0 +1,43 @@ | |||
1 | <?php | ||
2 | |||
3 | require_once 'inc/html.inc.php'; | ||
4 | require_once 'inc/collectd.inc.php'; | ||
5 | |||
6 | $host = $_GET['h']; | ||
7 | $splugin = $_GET['p']; | ||
8 | |||
9 | html_start(); | ||
10 | |||
11 | printf('<h1><a href="%s">«</a> %s</h1>'."\n", $CONFIG['weburl'], $host); | ||
12 | |||
13 | $plugins = collectd_plugins($host); | ||
14 | |||
15 | if(!$plugins) { | ||
16 | echo "Unknown host\n"; | ||
17 | return false; | ||
18 | } | ||
19 | |||
20 | # first the ones defined in overview | ||
21 | foreach($CONFIG['overview'] as $plugin) { | ||
22 | if (in_array($plugin, $plugins)) { | ||
23 | printf("<h2>[-] %s</h2>\n", $plugin); | ||
24 | graphs_from_plugin($host, $plugin); | ||
25 | } | ||
26 | } | ||
27 | |||
28 | # other plugins | ||
29 | foreach($plugins as $plugin) { | ||
30 | if (!in_array($plugin, $CONFIG['overview'])) { | ||
31 | $url = sprintf('<a href="%s/host.php?h=%s&p=%s">%s</a>'."\n", $CONFIG['weburl'], $host, $plugin, $plugin); | ||
32 | if ($splugin == $plugin) { | ||
33 | printf("<h2>[-] %s</h2>\n", $url); | ||
34 | graphs_from_plugin($host, $plugin); | ||
35 | } else { | ||
36 | printf("<h2>[+] %s</h2>\n", $url); | ||
37 | } | ||
38 | } | ||
39 | } | ||
40 | |||
41 | html_end(); | ||
42 | |||
43 | ?> | ||