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

function html_start() {
	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="layout/style.css" type="text/css">
</head>
<body>

EOT;
}

function html_end() {
	echo <<<EOT
</body>
</html>
EOT;
}

require_once 'conf/common.inc.php';
require_once 'inc/rrdtool.class.php';
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";
}

?>