aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/inc/html.inc.php
diff options
context:
space:
mode:
authorPim van den Berg2009-09-20 13:36:25 +0200
committerPim van den Berg2009-09-20 13:45:26 +0200
commitcd94ef34134d8f06af83ec97119018b4e80346a0 (patch)
treeb01a57617cb5528554b1909583bdf110d8acb631 /inc/html.inc.php
downloadapt-panopticon_cgp-cd94ef34134d8f06af83ec97119018b4e80346a0.zip
apt-panopticon_cgp-cd94ef34134d8f06af83ec97119018b4e80346a0.tar.gz
apt-panopticon_cgp-cd94ef34134d8f06af83ec97119018b4e80346a0.tar.bz2
apt-panopticon_cgp-cd94ef34134d8f06af83ec97119018b4e80346a0.tar.xz
initial import of cgp
Collectd Graph Panel is a frontend for Collectd written in PHP. The goal of CGP is to provide an easy-to-use frontend for Collectd, starting with page that shows an overview of all the hosts you are managing with Collectd. In this initial import there is support for the plugins that are default enabled in Collectd. The supported plugins are located in the plugin directory.
Diffstat (limited to 'inc/html.inc.php')
-rw-r--r--inc/html.inc.php45
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
3function 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
14EOT;
15}
16
17function html_end() {
18 echo <<<EOT
19</body>
20</html>
21EOT;
22}
23
24require_once 'conf/common.inc.php';
25require_once 'inc/rrdtool.class.php';
26function 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?>