Skip to content

Commit e6ded3a

Browse files
author
Marius Burkard
committed
Merge branch 'master' into 'master'
Master See merge request !249
2 parents add7cc4 + 5e205c4 commit e6ded3a

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

server/lib/classes/cron.d/100-monitor_raid.inc.php

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,91 @@ public function onRunJob() {
229229
}
230230
}
231231

232+
/*
233+
* HP Proliant
234+
*/
235+
system('which hpacucli', $retval);
236+
if($retval === 0) {
237+
$state = 'ok';
238+
$data['output'] = shell_exec('/usr/sbin/hpacucli ctrl all show config');
239+
$tmp = explode("\n", $data['output']);
240+
if(is_array($tmp)) {
241+
foreach ($tmp as $item) {
242+
if (strpos($item, 'logicaldrive') !== false) {
243+
if (strpos($item, 'OK') !== false) {
244+
$this->_tools->_setState($state = 'ok');
245+
} elseif (strpos($item, 'Recovery Mode') !== false) {
246+
$this->_tools->_setState($state = 'critical');
247+
break;
248+
} elseif (strpos($item, 'Failed') !== false) {
249+
$this->_tools->_setState($state = 'error');
250+
break;
251+
} elseif (strpos($item, 'Recovering') !== false) {
252+
$this->_tools->_setState($state = 'info');
253+
break;
254+
} else {
255+
$this->_tools->_setState($state = 'critical');
256+
}
257+
}
258+
if (strpos($item, 'physicaldrive') !== false) {
259+
if (strpos($item, 'physicaldrive') !== false) {
260+
if (strpos($item, 'OK') !== false) {
261+
$this->_tools->_setState($state = 'ok');
262+
} elseif (strpos($item, 'Failed') !== false) {
263+
$this->_tools->_setState($state = 'critical');
264+
break;
265+
} elseif (strpos($item, 'Rebuilding') !== false) {
266+
$this->_tools->_setState($state = 'info');
267+
break;
268+
} else {
269+
$this->_tools->_setState($state = 'critical');
270+
break;
271+
}
272+
}
273+
}
274+
}
275+
}
276+
}
277+
278+
/*
279+
* LSI MegaRaid
280+
*/
281+
system('which megacli', $retval);
282+
system('which megacli64', $retval64);
283+
if($retval === 0 || $retval64 === 0) {
284+
$binary=@($retval === 0)?'megacli':'megacli64';
285+
$state = 'ok';
286+
$data['output'] = shell_exec($binary.' -LDInfo -Lall -aAll');
287+
if (strpos($data['output'], 'Optimal') !== false) {
288+
$this->_tools->_setState($state, 'ok');
289+
} else if (strpos($data['output'], 'Degraded') !== false) {
290+
$this->_tools->_setState($state, 'critical');
291+
} else if (strpos($data['output'], 'Offline') !== false) {
292+
$this->_tools->_setState($state, 'critical');
293+
} else {
294+
$this->_tools->_setState($state, 'critical');
295+
}
296+
}
297+
298+
/*
299+
* Adaptec-RAID
300+
*/
301+
system('which arcconf', $retval);
302+
if($retval === 0) {
303+
$state = 'ok';
304+
$data['output'] = shell_exec('arcconf GETCONFIG 1 LD');
305+
if(is_array($data['output'])) {
306+
foreach ($data['output'] as $item) {
307+
if (strpos($item, 'Logical device name : RAID') !== false) {
308+
if (strpos($item, 'Optimal') !== false) {
309+
$this->_tools->_setState($state, 'ok');
310+
} else {
311+
$this->_tools->_setState($state, 'critical');
312+
}
313+
}
314+
}
315+
}
316+
}
232317

233318
$res = array();
234319
$res['server_id'] = $server_id;

0 commit comments

Comments
 (0)