3ware Controller

Discussion in 'Developers' Forum' started by xaver, Jul 29, 2010.

  1. xaver

    xaver New Member

    3ware controller in ISPConfig3 monitor

    Hi,

    first test of 3ware controller status:
    Added in /usr/local/ispconfig/server/mods-available/monitor_core_module.inc.php (ispconfig v. 3.0.3 beta @ line 1114) v. 3.0.2 line 737
    Code:
    		system('which tw_cli', $retval);
    		if($retval === 0) {
    
    			$data['output'] = shell_exec('tw_cli info c0');
    
    			$state = 'ok';
    			foreach ($data['output'] as $item) {
    				if (strpos($item, 'RAID') !== false) {
    					if (strpos($item, ' VERIFYING ') !== false) {
    						$this->_setState($state, 'info');
    					}
    					else if (strpos($item, ' MIGRATE-PAUSED ') !== false) {
    						$this->_setState($state, 'info');
    					}
    					else if (strpos($item, ' MIGRATING ') !== false) {
    						$this->_setState($state, 'ok');
    					}
    					else if (strpos($item, ' INITIALIZING ') !== false) {
    						$this->_setState($state, 'info');
    					}
    					else if (strpos($item, ' INIT-PAUSED ') !== false) {
    						$this->_setState($state, 'info');
    					}
    					else if (strpos($item, ' REBUILDING ') !== false) {
    						$this->_setState($state, 'info');
    					}
    					else if (strpos($item, ' REBUILD-PAUSED ') !== false) {
    						$this->_setState($state, 'warning');
    					}
    					else if (strpos($item, ' RECOVERY ') !== false) {
    						$this->_setState($state, 'warning');
    					}
    					else if (strpos($item, ' DEGRADED ') !== false) {
    						$this->_setState($state, 'critical');
    					}
    					else if (strpos($item, ' UNKNOWN ') !== false) {
    						$this->_setState($state, 'critical');
    					}
    					else if (strpos($item, ' OK ') !== false) {
    						$this->_setState($state, 'ok');
    					}
    					else if (strpos($item, ' OPTIMAL ') !== false) {
    						$this->_setState($state, 'ok');
    					}
    					else {
    						$this->_setState($state, 'critical');
    					}
    				}
    			}
    		}
    (Maybe some _setStates not perfect)
    If you have a Problem type tw_cli info and replace c0 with your controller.

    If you have 2 cards:

    $data['output'][] = shell_exec('tw_cli info c0');
    $data['output'][] = shell_exec('tw_cli info c1');

    and replace last lines with

    Code:
    				else {
    						$this->_setState($state, 'critical');
    					}
    				$pack .= $item."\n";
    				}
    			}
    		$data['output'] = $pack;
    		}
    bye
     
    Last edited: Jul 29, 2010
  2. edge

    edge Active Member Moderator

    I have 3ware controller's in my serves and will give your code a test later today.

    I'll report back when done.
     
  3. edge

    edge Active Member Moderator

    Sorry.. I can not test it as I'm not using the beta version on a server with 3ware controller's. I only have the 3ware controller's in my production servers.
     
  4. xaver

    xaver New Member

    On a Productive System its line 737.
    No Problem at all. I hope 3.0.3 will stabel in next weeks.
     
  5. edge

    edge Active Member Moderator

    Okay. Insalled it, and looks like it's working great
    Thank you
     
    Last edited: Aug 1, 2010
  6. xaver

    xaver New Member

    Code:
                $state = 'no_state';
                $data['output']= '';
            }
    
            /*
             * Insert the data into the database
             */
            $sql = "INS
    not in /* part, but between } and $sql
     
  7. xaver

    xaver New Member

    Hi again :)

    Sry for the doublepost...

    Anybody had trouble with the code?
    If everything is fine i will open a ticket for implementation into ISPConfig.

    I had no trouble, i implemented it for tests into 2 servers.

    xaver
     
  8. edge

    edge Active Member Moderator

    For me it's working great.
    Debian 5.

    Thank you.
     
  9. till

    till Super Moderator Staff Member ISPConfig Developer

Share This Page