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) { return printf("

%s

\n", $CONFIG['weburl'], $host, $plugin, $plugin); } function plugins_list($host, $overview_plugins, $other_plugins, $selected_plugins = array()) { echo '
'; echo '

Plugins

'; echo '
    '; $selected = selected_overview($selected_plugins); printf("
  • %s
  • \n", $selected, $CONFIG['weburl'], $host, 'overview'); # first the ones defined as ordered foreach($overview_plugins as $plugin) { $selected = selected_plugin($plugin, $selected_plugins); printf("
  • %s
  • \n", $selected, $CONFIG['weburl'], $host, $plugin, $plugin); } # other plugins foreach($other_plugins as $plugin) { if (!in_array($plugin, $overview_plugins)) { $selected = selected_plugin($plugin, $selected_plugins); printf("
  • %s
  • \n", $selected, $CONFIG['weburl'], $host, $plugin, $plugin); } } echo '
'; echo '
'; } function selected_overview($selected_plugins) { if (count($selected_plugins) > 1) { return 'class="selected"'; } return ''; } function selected_plugin($plugin, $selected_plugins) { if (in_array($plugin, $selected_plugins)) { return 'class="selected"'; } return ''; } function selected_timerange($value1, $value2) { if ($value1 == $value2) { return 'class="selected"'; } return ''; } 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; } ?>