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() { $path = ''; 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; } ?>