This repository has been archived by the owner on Dec 22, 2022. It is now read-only.
forked from pommi/CGP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
detail.php
79 lines (62 loc) · 1.66 KB
/
detail.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
require_once 'conf/common.inc.php';
require_once 'inc/functions.inc.php';
require_once 'inc/html.inc.php';
require_once 'inc/collectd.inc.php';
header("Content-Type: text/html");
# use width/height from config if nothing is given
if (empty($_GET['x']))
$_GET['x'] = $CONFIG['detail-width'];
if (empty($_GET['y']))
$_GET['y'] = $CONFIG['detail-height'];
# set graph_type to canvas if hybrid
if ($CONFIG['graph_type'] == 'hybrid')
$CONFIG['graph_type'] = 'canvas';
$host = GET('h');
$plugin = GET('p');
$pinstance = GET('pi');
$category = GET('c');
$type = GET('t');
$tinstance = GET('ti');
$seconds = GET('s');
$selected_plugins = !$plugin ? $CONFIG['overview'] : array($plugin);
html_start($host, $selected_plugins);
echo <<<EOT
<input type="checkbox" id="navicon" class="navicon" />
<label for="navicon"></label>
EOT;
if (!$plugins = collectd_plugins($host)) {
echo "Unknown host\n";
return false;
}
echo '<div class="graphs">';
plugin_header($host, $plugin);
$args = GET();
print '<div class="time-range btn-group" role="group">' . "\n";
foreach($CONFIG['term'] as $key => $s) {
$args['s'] = $s;
if ($seconds == $s) {
$selected = 'active';
}
else {
$selected = '';
}
printf('<a class="btn btn-default %s" href="%s%s">%s</a>'."\n",
$selected,
htmlentities($CONFIG['weburl']),
htmlentities(build_url('detail.php', $args)),
htmlentities($key));
}
print "<br /><br />\n";
if ($CONFIG['graph_type'] == 'canvas') {
chdir($CONFIG['webdir']);
include $CONFIG['webdir'].'/graph.php';
} else {
printf("<img src=\"%s%s\">\n",
htmlentities($CONFIG['weburl']),
htmlentities(build_url('graph.php', GET()))
);
}
echo '</div>';
echo "</fieldset>\n";
html_end();