Skip to content

Commit 794082b

Browse files
committed
Fixed a Bug in the monitor is the LSI software raid software is installed but no LSI raid is configured.
1 parent 59a4682 commit 794082b

File tree

1 file changed

+27
-25
lines changed

1 file changed

+27
-25
lines changed

server/lib/classes/monitor_tools.inc.php

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -993,32 +993,34 @@ public function monitorRaid() {
993993
* Then calc the state.
994994
*/
995995
$state = 'ok';
996-
foreach ($data['output'] as $item) {
997-
/*
998-
* The output contains information for every RAID and every HDD.
999-
* We only need the state of the RAID
1000-
*/
1001-
if (strpos($item, 'raidlevel:') !== false) {
996+
if(is_array($data['output'])) {
997+
foreach ($data['output'] as $item) {
1002998
/*
1003-
* We found a raid, process the state of it
1004-
*/
1005-
if (strpos($item, ' ONLINE ') !== false) {
1006-
$this->_setState($state, 'ok');
1007-
} elseif (strpos($item, ' OPTIMAL ') !== false) {
1008-
$this->_setState($state, 'ok');
1009-
} elseif (strpos($item, ' INITIAL ') !== false) {
1010-
$this->_setState($state, 'info');
1011-
} elseif (strpos($item, ' INACTIVE ') !== false) {
1012-
$this->_setState($state, 'critical');
1013-
} elseif (strpos($item, ' RESYNC ') !== false) {
1014-
$this->_setState($state, 'info');
1015-
} elseif (strpos($item, ' DEGRADED ') !== false) {
1016-
$this->_setState($state, 'critical');
1017-
} else {
1018-
/* we don't know the state. so we set the state to critical, that the
1019-
* admin is warned, that something is wrong
1020-
*/
1021-
$this->_setState($state, 'critical');
999+
* The output contains information for every RAID and every HDD.
1000+
* We only need the state of the RAID
1001+
*/
1002+
if (strpos($item, 'raidlevel:') !== false) {
1003+
/*
1004+
* We found a raid, process the state of it
1005+
*/
1006+
if (strpos($item, ' ONLINE ') !== false) {
1007+
$this->_setState($state, 'ok');
1008+
} elseif (strpos($item, ' OPTIMAL ') !== false) {
1009+
$this->_setState($state, 'ok');
1010+
} elseif (strpos($item, ' INITIAL ') !== false) {
1011+
$this->_setState($state, 'info');
1012+
} elseif (strpos($item, ' INACTIVE ') !== false) {
1013+
$this->_setState($state, 'critical');
1014+
} elseif (strpos($item, ' RESYNC ') !== false) {
1015+
$this->_setState($state, 'info');
1016+
} elseif (strpos($item, ' DEGRADED ') !== false) {
1017+
$this->_setState($state, 'critical');
1018+
} else {
1019+
/* we don't know the state. so we set the state to critical, that the
1020+
* admin is warned, that something is wrong
1021+
*/
1022+
$this->_setState($state, 'critical');
1023+
}
10221024
}
10231025
}
10241026
}

0 commit comments

Comments
 (0)