aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php23
1 files changed, 21 insertions, 2 deletions
diff --git a/index.php b/index.php
index b220241..71e09a0 100644
--- a/index.php
+++ b/index.php
@@ -13,11 +13,30 @@ $h = array();
13# show all categorized hosts 13# show all categorized hosts
14if (isset($CONFIG['cat']) && is_array($CONFIG['cat'])) { 14if (isset($CONFIG['cat']) && is_array($CONFIG['cat'])) {
15 foreach($CONFIG['cat'] as $cat => $hosts) { 15 foreach($CONFIG['cat'] as $cat => $hosts) {
16 host_summary($cat, $hosts); 16
17 $h = array_merge($h, $hosts); 17 if(is_array($hosts)) {
18 host_summary($cat, $hosts);
19 $h = array_merge($h, $hosts);
20 } else {
21 // Asume regexp
22 $regexp = $hosts;
23 $ahosts = collectd_hosts();
24 $rhosts = array();
25
26 foreach($ahosts as $host) {
27 if(preg_match($regexp, $host)) {
28 array_push($rhosts, $host);
29 }
30 }
31
32 host_summary($cat, $rhosts);
33 $h = array_merge($h, $rhosts);
34 }
35
18 } 36 }
19} 37}
20 38
39
21# search for uncategorized hosts 40# search for uncategorized hosts
22if(!$chosts = collectd_hosts()) 41if(!$chosts = collectd_hosts())
23 printf('<p class="warn">Error: No Collectd hosts found in <em>%s</em></p>', $CONFIG['datadir']); 42 printf('<p class="warn">Error: No Collectd hosts found in <em>%s</em></p>', $CONFIG['datadir']);