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 94ecf80..9069152 100644
--- a/index.php
+++ b/index.php
@@ -11,11 +11,30 @@ $h = array();
11# show all categorized hosts 11# show all categorized hosts
12if (isset($CONFIG['cat']) && is_array($CONFIG['cat'])) { 12if (isset($CONFIG['cat']) && is_array($CONFIG['cat'])) {
13 foreach($CONFIG['cat'] as $cat => $hosts) { 13 foreach($CONFIG['cat'] as $cat => $hosts) {
14 host_summary($cat, $hosts); 14
15 $h = array_merge($h, $hosts); 15 if(is_array($hosts)) {
16 host_summary($cat, $hosts);
17 $h = array_merge($h, $hosts);
18 } else {
19 // Asume regexp
20 $regexp = $hosts;
21 $ahosts = collectd_hosts();
22 $rhosts = array();
23
24 foreach($ahosts as $host) {
25 if(preg_match($regexp, $host)) {
26 array_push($rhosts, $host);
27 }
28 }
29
30 host_summary($cat, $rhosts);
31 $h = array_merge($h, $rhosts);
32 }
33
16 } 34 }
17} 35}
18 36
37
19# search for uncategorized hosts 38# search for uncategorized hosts
20if(!$chosts = collectd_hosts()) 39if(!$chosts = collectd_hosts())
21 printf('<p class="warn">Error: No Collectd hosts found in <em>%s</em></p>', $CONFIG['datadir']); 40 printf('<p class="warn">Error: No Collectd hosts found in <em>%s</em></p>', $CONFIG['datadir']);