EOT; } function html_end() { global $CONFIG; $git = '/usr/bin/git'; $changelog = $CONFIG['webdir'].'/doc/CHANGELOG'; $version = 'v?'; if (file_exists($git) && is_dir($CONFIG['webdir'].'/.git')) { chdir($CONFIG['webdir']); $version = exec($git.' describe --tags'); } elseif (file_exists($changelog)) { $changelog = file($changelog); $version = explode(' ', $changelog[0]); $version = 'v'.$version[0]; } echo << EOT; } function plugin_header($host, $plugin, $status) { global $CONFIG; if ($status == 1) { $f = 'get'; $i = 'plus'; $a = '+'; } else { $f = 'rm'; $i = 'minus'; $a = '-'; } return printf("

\"[%s]\" %s

\n", $f, $host, $plugin, $CONFIG['weburl'], $i, $a, $plugin); } function host_summary($hosts) { global $CONFIG; $rrd = new RRDTool($CONFIG['rrdtool']); echo "\n"; $row_style = array(0 => "even", 1 => "odd"); $host_counter = 0; foreach($hosts as $host) { $host_counter++; printf('', $row_style[$host_counter % 2]); printf('', $CONFIG['weburl'],$host, $host); if ($CONFIG['showload']) { collectd_flush(sprintf('%s/load/load', $host)); $rrd_info = $rrd->rrd_info($CONFIG['datadir'].'/'.$host.'/load/load.rrd'); # ignore if file does not exist if (!$rrd_info) continue; if (isset($rrd_info['ds[shortterm].last_ds']) && isset($rrd_info['ds[midterm].last_ds']) && isset($rrd_info['ds[longterm].last_ds'])) { printf('', $rrd_info['ds[shortterm].last_ds'], $rrd_info['ds[midterm].last_ds'], $rrd_info['ds[longterm].last_ds']); } } print "\n"; } echo "
%s%.2f%.2f%.2f
\n"; } function breadcrumbs() { if (validate_get($_GET['h'], 'host')) $path = ' - '.ucfirst($_GET['h']); if (validate_get($_GET['p'], 'plugin')) $path .= ' - '.ucfirst($_GET['p']); if (validate_get($_GET['pi'], 'pinstance')) $path .= ' - '.$_GET['pi']; if (validate_get($_GET['t'], 'type') && validate_get($_GET['p'], 'plugin') && $_GET['t'] != $_GET['p']) $path .= ' - '.$_GET['t']; if (validate_get($_GET['ti'], 'tinstance')) $path .= ' - '.$_GET['ti']; return $path; } ?>