diff options
Diffstat (limited to '')
-rw-r--r-- | inc/html.inc.php | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/inc/html.inc.php b/inc/html.inc.php new file mode 100644 index 0000000..d1d2a65 --- /dev/null +++ b/inc/html.inc.php | |||
@@ -0,0 +1,45 @@ | |||
1 | <?php | ||
2 | |||
3 | function html_start() { | ||
4 | echo <<<EOT | ||
5 | <!DOCTYPE HTML> | ||
6 | <html> | ||
7 | <head> | ||
8 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | ||
9 | <title>Collectd Graph Panel</title> | ||
10 | <link rel="stylesheet" href="layout/style.css" type="text/css"> | ||
11 | </head> | ||
12 | <body> | ||
13 | |||
14 | EOT; | ||
15 | } | ||
16 | |||
17 | function html_end() { | ||
18 | echo <<<EOT | ||
19 | </body> | ||
20 | </html> | ||
21 | EOT; | ||
22 | } | ||
23 | |||
24 | require_once 'conf/common.inc.php'; | ||
25 | require_once 'inc/rrdtool.class.php'; | ||
26 | function host_summary($hosts) { | ||
27 | global $CONFIG; | ||
28 | |||
29 | $rrd = new RRDTool; | ||
30 | |||
31 | echo "<table class=\"summary\">\n"; | ||
32 | |||
33 | foreach($hosts as $host) { | ||
34 | $rrd_info = $rrd->rrd_info($CONFIG['datadir'].'/'.$host.'/load/load.rrd'); | ||
35 | if (!$rrd_info) | ||
36 | continue; | ||
37 | printf('<tr><th><a href="%s/host.php?h=%s">%s</a></th><td>%.2f</td><td>%.2f</td><td>%.2f</td></tr>'."\n", | ||
38 | $CONFIG['weburl'],$host, $host, | ||
39 | $rrd_info["ds[shortterm].last_ds"], $rrd_info["ds[midterm].last_ds"], $rrd_info["ds[longterm].last_ds"]); | ||
40 | } | ||
41 | |||
42 | echo "</table>\n"; | ||
43 | } | ||
44 | |||
45 | ?> | ||