aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/inc/html.inc.php
blob: 0a5b3423928e0805bddfd7ba35db4d18c5f1eb00 (plain)
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
<?php

require_once 'conf/common.inc.php';
require_once 'inc/rrdtool.class.php';

function html_start() {
	global $CONFIG;
	echo <<<EOT
<!DOCTYPE HTML>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>Collectd Graph Panel</title>
	<link rel="stylesheet" href="{$CONFIG['weburl']}/layout/style.css" type="text/css">
</head>
<body>

EOT;
}

function html_end() {
	echo <<<EOT
<hr><span class="small">Collectd Graph Panel is distributed under the GNU General Public License (GPL)</span>
</body>
</html>
EOT;
}

function host_summary($hosts) {
	global $CONFIG;

	$rrd = new RRDTool;

	echo "<table class=\"summary\">\n";

	foreach($hosts as $host) {
		$rrd_info = $rrd->rrd_info($CONFIG['datadir'].'/'.$host.'/load/load.rrd');
		if (!$rrd_info)
			continue;
		printf('<tr><th><a href="%s/host.php?h=%s">%s</a></th><td>%.2f</td><td>%.2f</td><td>%.2f</td></tr>'."\n",
		$CONFIG['weburl'],$host, $host,
		$rrd_info["ds[shortterm].last_ds"], $rrd_info["ds[midterm].last_ds"], $rrd_info["ds[longterm].last_ds"]);
	}

	echo "</table>\n";
}

?>