Skip to content

Commit a5fe274

Browse files
author
xaver
committed
Fixed #1390 - Added 3ware controller (was my script i use 3ware)
1 parent 0141fd3 commit a5fe274

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

server/lib/classes/monitor_tools.inc.php

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,61 @@ public function monitorRaid() {
10351035
}
10361036
}
10371037
}
1038+
1039+
/*
1040+
* 3ware Controller
1041+
*/
1042+
system('which tw_cli', $retval);
1043+
if($retval === 0) {
1044+
1045+
$data['output'] = shell_exec('tw_cli info c0');
1046+
1047+
$state = 'ok';
1048+
foreach ($data['output'] as $item) {
1049+
if (strpos($item, 'RAID') !== false) {
1050+
if (strpos($item, ' VERIFYING ') !== false) {
1051+
$this->_setState($state, 'info');
1052+
}
1053+
else if (strpos($item, ' MIGRATE-PAUSED ') !== false) {
1054+
$this->_setState($state, 'info');
1055+
}
1056+
else if (strpos($item, ' MIGRATING ') !== false) {
1057+
$this->_setState($state, 'ok');
1058+
}
1059+
else if (strpos($item, ' INITIALIZING ') !== false) {
1060+
$this->_setState($state, 'info');
1061+
}
1062+
else if (strpos($item, ' INIT-PAUSED ') !== false) {
1063+
$this->_setState($state, 'info');
1064+
}
1065+
else if (strpos($item, ' REBUILDING ') !== false) {
1066+
$this->_setState($state, 'info');
1067+
}
1068+
else if (strpos($item, ' REBUILD-PAUSED ') !== false) {
1069+
$this->_setState($state, 'warning');
1070+
}
1071+
else if (strpos($item, ' RECOVERY ') !== false) {
1072+
$this->_setState($state, 'warning');
1073+
}
1074+
else if (strpos($item, ' DEGRADED ') !== false) {
1075+
$this->_setState($state, 'critical');
1076+
}
1077+
else if (strpos($item, ' UNKNOWN ') !== false) {
1078+
$this->_setState($state, 'critical');
1079+
}
1080+
else if (strpos($item, ' OK ') !== false) {
1081+
$this->_setState($state, 'ok');
1082+
}
1083+
else if (strpos($item, ' OPTIMAL ') !== false) {
1084+
$this->_setState($state, 'ok');
1085+
}
1086+
else {
1087+
$this->_setState($state, 'critical');
1088+
}
1089+
}
1090+
}
1091+
}
1092+
10381093

10391094
/*
10401095
* Return the Result

0 commit comments

Comments
 (0)