diff options
| -rw-r--r-- | inc/collectd.inc.php | 6 | ||||
| -rw-r--r-- | type/Base.class.php | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/inc/collectd.inc.php b/inc/collectd.inc.php index fda685d..761f7c4 100644 --- a/inc/collectd.inc.php +++ b/inc/collectd.inc.php | |||
| @@ -9,7 +9,7 @@ function collectd_hosts() { | |||
| 9 | global $CONFIG; | 9 | global $CONFIG; |
| 10 | 10 | ||
| 11 | if (!is_dir($CONFIG['datadir'])) | 11 | if (!is_dir($CONFIG['datadir'])) |
| 12 | return false; | 12 | return array(); |
| 13 | 13 | ||
| 14 | $dir = array_diff(scandir($CONFIG['datadir']), array('.', '..')); | 14 | $dir = array_diff(scandir($CONFIG['datadir']), array('.', '..')); |
| 15 | foreach($dir as $k => $v) { | 15 | foreach($dir as $k => $v) { |
| @@ -17,7 +17,7 @@ function collectd_hosts() { | |||
| 17 | unset($dir[$k]); | 17 | unset($dir[$k]); |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | return $dir ? $dir : false; | 20 | return $dir; |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | 23 | ||
| @@ -36,7 +36,7 @@ function get_host_rrd_files($dir) { | |||
| 36 | $files[] = str_replace($dir.'/', '', $object->getPathname()); | 36 | $files[] = str_replace($dir.'/', '', $object->getPathname()); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | return $files ? $files : false; | 39 | return $files; |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | 42 | ||
diff --git a/type/Base.class.php b/type/Base.class.php index ff9a235..1f42f4f 100644 --- a/type/Base.class.php +++ b/type/Base.class.php | |||
| @@ -155,6 +155,10 @@ class Type_Base { | |||
| 155 | function rrd_files() { | 155 | function rrd_files() { |
| 156 | $files = $this->get_filenames(); | 156 | $files = $this->get_filenames(); |
| 157 | 157 | ||
| 158 | $this->tinstances = array(); | ||
| 159 | $this->files = array(); | ||
| 160 | $this->identifiers = array(); | ||
| 161 | |||
| 158 | foreach($files as $filename) { | 162 | foreach($files as $filename) { |
| 159 | $basename=basename($filename,'.rrd'); | 163 | $basename=basename($filename,'.rrd'); |
| 160 | $instance = strpos($basename,'-') | 164 | $instance = strpos($basename,'-') |
| @@ -186,7 +190,7 @@ class Type_Base { | |||
| 186 | 190 | ||
| 187 | $files = glob($this->datadir .'/'. $identifier . $wildcard . 'rrd'); | 191 | $files = glob($this->datadir .'/'. $identifier . $wildcard . 'rrd'); |
| 188 | 192 | ||
| 189 | return $files; | 193 | return $files ? $files : array(); |
| 190 | } | 194 | } |
| 191 | 195 | ||
| 192 | function rrd_graph($debug = false) { | 196 | function rrd_graph($debug = false) { |
