include_once 'inc/collectd.inc.php'; require_once 'inc/html.inc.php'; html_start(); $h = array(); # show all categorized hosts if (isset($CONFIG['cat']) && is_array($CONFIG['cat'])) { foreach ($CONFIG['cat'] as $cat => $hosts) { host_summary($cat, $hosts); $h = array_merge($h, $hosts); } } # search for uncategorized hosts if (!($chosts = collectd_hosts())) { printf('<p class="warn">Error: No Collectd hosts found in <em>%s</em></p>', $CONFIG['datadir']); } $uhosts = array_diff($chosts, $h); # show all uncategorized hosts if ($uhosts) { host_summary('uncategorized', $uhosts); } if ($CONFIG['showtime']) { echo <<<EOT <script> jQuery(document).ready(function() { jQuery("time.timeago").timeago(); }); </script> EOT; } html_end(true);
<?php include_once 'conf/common.inc.php'; include_once 'inc/collectd.inc.php'; require_once 'inc/html.inc.php'; html_start(); $h = array(); # show all categorized hosts if (is_array($CONFIG['cat'])) { foreach ($CONFIG['cat'] as $cat => $hosts) { printf("<h2>%s</h2>\n", $cat); host_summary($hosts); $h = array_merge($h, $hosts); } } # search for uncategorized hosts if (!($chosts = collectd_hosts())) { printf('<p class="warn">Error: No Collectd hosts found in <em>%s</em></p>', $CONFIG['datadir']); } $uhosts = array_diff($chosts, $h); # show all uncategorized hosts if ($uhosts) { echo "<h2>uncategorized</h2>\n"; host_summary($uhosts); } html_end();
{ $this->pattern = $pattern; } function ereg($string) { return preg_match($this->pattern, $string); } } $h = array(); if (is_array($CONFIG['regexp'])) { echo "<ul class=\"regexp\">\n"; foreach ($CONFIG['regexp'] as $name => $regexp) { printf("\t<li><a href=\"#%s\">%s</a></li>\n", $regexp, $name); } echo "</ul>\n"; } # show all hosts by regexp if (is_array($CONFIG['regexp'])) { foreach ($CONFIG['regexp'] as $name => $regexp) { $h[$regexp] = array_filter($chosts, array(new array_ereg("/{$regexp}/"), 'ereg')); printf("<h2 id=\"%s\">%s</a></h2>\n", $regexp, $name); host_summary($h[$regexp]); $chosts = array_diff($chosts, $h[$regexp]); } } # show all uncategorized hosts if ($chosts) { echo "<h2>uncategorized</h2>\n"; host_summary($chosts); } html_end();
$rhosts = array(); foreach ($ahosts as $host) { if (preg_match($regexp, $host)) { array_push($rhosts, $host); } } host_summary($cat, $rhosts); $h = array_merge($h, $rhosts); } } } # search for uncategorized hosts if (!($chosts = collectd_hosts())) { printf('<p class="warn">Error: No Collectd hosts found in <em>%s</em></p>', $CONFIG['datadir']); } $uhosts = array_diff($chosts, $h); # show all uncategorized hosts if ($uhosts) { host_summary('', $uhosts); } if ($CONFIG['showtime']) { echo <<<EOT <script> jQuery(document).ready(function() { jQuery("time.timeago").timeago(); }); </script> EOT; } html_end(true);