From cd94ef34134d8f06af83ec97119018b4e80346a0 Mon Sep 17 00:00:00 2001 From: Pim van den Berg Date: Sun, 20 Sep 2009 13:36:25 +0200 Subject: 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. --- inc/html.inc.php | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 inc/html.inc.php (limited to 'inc/html.inc.php') 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 @@ + + + + + Collectd Graph Panel + + + + +EOT; +} + +function html_end() { + echo << + +EOT; +} + +require_once 'conf/common.inc.php'; +require_once 'inc/rrdtool.class.php'; +function host_summary($hosts) { + global $CONFIG; + + $rrd = new RRDTool; + + echo "\n"; + + foreach($hosts as $host) { + $rrd_info = $rrd->rrd_info($CONFIG['datadir'].'/'.$host.'/load/load.rrd'); + if (!$rrd_info) + continue; + printf(''."\n", + $CONFIG['weburl'],$host, $host, + $rrd_info["ds[shortterm].last_ds"], $rrd_info["ds[midterm].last_ds"], $rrd_info["ds[longterm].last_ds"]); + } + + echo "
%s%.2f%.2f%.2f
\n"; +} + +?> -- cgit v1.1