/web/acc/phpsysinfo/plugins/pingtest/class.pingtest.inc.php |
---|
0,0 → 1,144 |
<?php |
/** |
* PingTime Plugin |
* |
* PHP version 5 |
* |
* @category PHP |
* @package PSI_Plugin_PingTest |
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net> |
* @copyright 2017 phpSysInfo |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version |
* @version SVN: $Id: class.pingtest.inc.php 1 2017-09-01 09:01:15Z namiltd $ |
* @link http://phpsysinfo.sourceforge.net |
*/ |
class PingTest extends PSI_Plugin |
{ |
/** |
* variable, which holds the content of the command |
* @var array |
*/ |
private $_filecontent = array(); |
/** |
* variable, which holds the result before the xml is generated out of this array |
* @var array |
*/ |
private $_result = array(); |
/** |
* read the data into an internal array and also call the parent constructor |
* |
* @param String $enc target encoding |
*/ |
public function __construct($enc) |
{ |
parent::__construct(__CLASS__, $enc); |
if (defined('PSI_PLUGIN_PINGTEST_ADDRESSES') && is_string(PSI_PLUGIN_PINGTEST_ADDRESSES)) { |
if (preg_match(ARRAY_EXP, PSI_PLUGIN_PINGTEST_ADDRESSES)) { |
$addresses = eval(PSI_PLUGIN_PINGTEST_ADDRESSES); |
} else { |
$addresses = array(PSI_PLUGIN_PINGTEST_ADDRESSES); |
} |
switch (strtolower(PSI_PLUGIN_PINGTEST_ACCESS)) { |
case 'command': |
if (PSI_OS == 'WINNT') { |
$params = "-n 1"; |
if (defined('PSI_PLUGIN_PINGTEST_TIMEOUT')) { |
if (($tout = max(intval(PSI_PLUGIN_PINGTEST_TIMEOUT), 0)) > 0) { |
$params .= " -w ".(1000*$tout); |
} |
} else { |
$params .= " -w 2000"; |
} |
} else { |
$params = "-c 1"; |
if (defined('PSI_PLUGIN_PINGTEST_TIMEOUT')) { |
if (($tout = max(intval(PSI_PLUGIN_PINGTEST_TIMEOUT), 0)) > 0) { |
$params .= " -W ".$tout; |
} |
} else { |
$params .= " -W 2"; |
} |
} |
foreach ($addresses as $address) { |
CommonFunctions::executeProgram("ping".((strpos($address, ':') === false)?'':((PSI_OS !== 'WINNT')?'6':'')), $params." ".$address, $buffer, PSI_DEBUG); |
if ((strlen($buffer) > 0) && preg_match("/[=<]([\d\.]+)\s*ms/", $buffer, $tmpout)) { |
$this->_filecontent[] = array($address, $tmpout[1]); |
} |
} |
break; |
case 'data': |
CommonFunctions::rfts(PSI_APP_ROOT."/data/pingtest.txt", $buffer); |
$addresses = preg_split("/\n/", $buffer, -1, PREG_SPLIT_NO_EMPTY); |
foreach ($addresses as $address) { |
$pt = preg_split("/[\s]?\|[\s]?/", $address, -1, PREG_SPLIT_NO_EMPTY); |
if (count($pt) == 2) { |
$this->_filecontent[] = array(trim($pt[0]), trim($pt[1])); |
} |
} |
break; |
default: |
$this->global_error->addConfigError("__construct()", "[pingtest] ACCESS"); |
break; |
} |
} |
} |
/** |
* doing all tasks to get the required informations that the plugin needs |
* result is stored in an internal array |
* |
* @return void |
*/ |
public function execute() |
{ |
if (defined('PSI_PLUGIN_PINGTEST_ADDRESSES') && is_string(PSI_PLUGIN_PINGTEST_ADDRESSES)) { |
if (preg_match(ARRAY_EXP, PSI_PLUGIN_PINGTEST_ADDRESSES)) { |
$addresses = eval(PSI_PLUGIN_PINGTEST_ADDRESSES); |
} else { |
$addresses = array(PSI_PLUGIN_PINGTEST_ADDRESSES); |
} |
foreach ($addresses as $address) { |
$this->_result[] = array($address, $this->address_inarray($address, $this->_filecontent)); |
} |
} |
} |
/** |
* generates the XML content for the plugin |
* |
* @return SimpleXMLElement entire XML content for the plugin |
*/ |
public function xml() |
{ |
foreach ($this->_result as $pt) { |
$xmlps = $this->xml->addChild("Ping"); |
$xmlps->addAttribute("Address", $pt[0]); |
$xmlps->addAttribute("PingTime", $pt[1]); |
} |
return $this->xml->getSimpleXmlElement(); |
} |
/** |
* checks an array if pingtest address is in |
* |
* @param mixed $needle what to find |
* @param array $haystack where to find |
* |
* @return pingtime - found<br>"lost" - not found |
*/ |
private function address_inarray($needle, $haystack) |
{ |
foreach ($haystack as $stalk) { |
if ($needle === $stalk[0]) { |
return $stalk[1]; |
} |
} |
return "lost"; |
} |
} |
/web/acc/phpsysinfo/plugins/pingtest/pingtest_bootstrap.html |
---|
0,0 → 1,25 |
<div class="col-lg-6" id="block_pingtest" style="display:none;"> |
<div class="card" id="panel_pingtest" style="display:none;"> |
<div class="card-header"><span class="lang_plugin_pingtest_001">Ping Test</span> |
<div id="reload_pingtest" class="reload" title="reload"></div> |
</div> |
<div class="card-body"> |
<div class="table-responsive"> |
<table id="pingtest" class="table table-hover table-sm sortable"> |
<thead> |
<tr> |
<th class="sorttable_ip" id="pingtest_Address"><span class="lang_plugin_pingtest_002">Address</span></th> |
<th class="rightCell"><span class="lang_plugin_pingtest_003">Ping Time</span></th> |
</tr> |
</thead> |
<tbody id="pingtest-data"> |
<tr> |
<th><span data-bind="Address"></span></th> |
<td class="rightCell"><span data-bind="PingTime"></span></td> |
</tr> |
</tbody> |
</table> |
</div> |
</div> |
</div> |
</div> |
/web/acc/phpsysinfo/plugins/ps/class.ps.inc.php |
---|
0,0 → 1,259 |
<?php |
/** |
* PS Plugin, which displays all running processes |
* a simple tree view which is filled with the running processes which are determined by |
* calling the "ps" command line utility, another way is to provide |
* a file with the output of the ps utility, so there is no need to run a execute by the |
* webserver, the format of the command is written down in the phpsysinfo.ini file, where also |
* the method of getting the information is configured |
* |
* @category PHP |
* @package PSI_Plugin_PS |
* @author Michael Cramer <BigMichi1@users.sourceforge.net> |
* @copyright 2009 phpSysInfo |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version |
* @version Release: 3.0 |
* @link http://phpsysinfo.sourceforge.net |
*/ |
class PS extends PSI_Plugin |
{ |
/** |
* variable, which holds the content of the command |
* @var array |
*/ |
private $_filecontent = array(); |
/** |
* variable, which holds the result before the xml is generated out of this array |
* @var array |
*/ |
private $_result = array(); |
/** |
* read the data into an internal array and also call the parent constructor |
* |
* @param string $enc encoding |
*/ |
public function __construct($enc) |
{ |
parent::__construct(__CLASS__, $enc); |
switch (strtolower(PSI_PLUGIN_PS_ACCESS)) { |
case 'command': |
if (PSI_OS == 'WINNT') { |
try { |
$objLocator = new COM('WbemScripting.SWbemLocator'); |
$wmi = $objLocator->ConnectServer('', 'root\CIMv2'); |
$os_wmi = CommonFunctions::getWMI($wmi, 'Win32_OperatingSystem', array('TotalVisibleMemorySize')); |
$memtotal = 0; |
foreach ($os_wmi as $os) { |
$memtotal = $os['TotalVisibleMemorySize'] * 1024; |
break; |
} |
$perf_wmi = CommonFunctions::getWMI($wmi, 'Win32_PerfFormattedData_PerfProc_Process', array('IDProcess', 'CreatingProcessID', 'PercentProcessorTime')); |
$proccpu = array(); |
foreach ($perf_wmi as $perf) { |
$proccpu[trim($perf['IDProcess'])] = array('ParentProcessId'=>trim($perf['CreatingProcessID']), 'PercentProcessorTime'=>trim($perf['PercentProcessorTime'])); |
} |
$process_wmi = CommonFunctions::getWMI($wmi, 'Win32_Process', array('Caption', 'CommandLine', 'ProcessId', 'ParentProcessId', 'WorkingSetSize')); |
foreach ($process_wmi as $process) { |
if (strlen(trim($process['CommandLine'])) > 0) { |
$ps = trim($process['CommandLine']); |
} else { |
$ps = trim($process['Caption']); |
} |
if (($procid = trim($process['ProcessId'])) != 0) { |
$memusage = round(trim($process['WorkingSetSize']) * 100 / $memtotal, 1); |
$parentid = trim($process['ParentProcessId']); |
$cpu = 0; |
if (isset($proccpu[$procid]) && ($proccpu[$procid]['ParentProcessId'] == $parentid)) { |
$cpu = $proccpu[$procid]['PercentProcessorTime']; |
} |
//ParentProcessId |
//Unique identifier of the process that creates a process. Process identifier numbers are reused, so they |
//only identify a process for the lifetime of that process. It is possible that the process identified by |
//ParentProcessId is terminated, so ParentProcessId may not refer to a running process. It is also |
//possible that ParentProcessId incorrectly refers to a process that reuses a process identifier. You can |
//use the CreationDate property to determine whether the specified parent was created after the process |
//represented by this Win32_Process instance was created. |
//=> subtrees of processes may be missing (WHAT TODO?!?) |
$this->_filecontent[] = $procid." ".$parentid." ".$memusage." ".$cpu." ".$ps; |
} |
} |
} catch (Exception $e) { |
} |
} else { |
CommonFunctions::executeProgram("ps", "axo pid,ppid,pmem,pcpu,args", $buffer, PSI_DEBUG); |
if (((PSI_OS == 'Linux') || (PSI_OS == 'Android')) && (!preg_match("/^[^\n]+\n\s*\d+\s+\d+\s+[\d\.]+\s+[\d\.]+\s+.+/", $buffer))) { //alternative method if no data |
if (CommonFunctions::rfts('/proc/meminfo', $mbuf)) { |
$bufe = preg_split("/\n/", $mbuf, -1, PREG_SPLIT_NO_EMPTY); |
$totalmem = 0; |
foreach ($bufe as $buf) { |
if (preg_match('/^MemTotal:\s+(\d+)\s*kB/i', $buf, $ar_buf)) { |
$totalmem = $ar_buf[1]; |
break; |
} |
} |
$buffer = " PID PPID %MEM %CPU COMMAND\n"; |
$processlist = glob('/proc/*/status', GLOB_NOSORT); |
if (is_array($processlist) && (($total = count($processlist)) > 0)) { |
natsort($processlist); //first sort |
$process = array(); |
foreach ($processlist as $processitem) { //second sort |
$process[] = $processitem; |
} |
$buf = ""; |
for ($i = 0; $i < $total; $i++) { |
if (CommonFunctions::rfts($process[$i], $buf, 0, 4096, false)) { |
if (($totalmem != 0) && (preg_match('/^VmRSS:\s+(\d+)\s+kB/m', $buf, $tmppmem))) { |
$pmem = round(100 * $tmppmem[1] / $totalmem, 1); |
} else { |
$pmem = 0; |
} |
$name = null; |
if (CommonFunctions::rfts(substr($process[$i], 0, strlen($process[$i])-6)."cmdline", $namebuf, 0, 4096, false)) { |
$name = str_replace(chr(0), ' ', trim($namebuf)); |
} |
if (preg_match('/^Pid:\s+(\d+)/m', $buf, $tmppid) && |
preg_match('/^PPid:\s+(\d+)/m', $buf, $tmpppid) && |
preg_match('/^Name:\s+(.+)/m', $buf, $tmpargs)) { |
$pid = $tmppid[1]; |
$ppid = $tmpppid[1]; |
$args = $tmpargs[1]; |
if ($name !== null) { |
if ($name !== "") { |
$args = $name; |
} else { |
$args = "[".$args."]"; |
} |
} |
$buffer .= $pid." ".$ppid." ".$pmem." 0.0 ".$args."\n"; |
} |
} |
} |
} |
} |
} |
} |
break; |
case 'data': |
CommonFunctions::rfts(PSI_APP_ROOT."/data/ps.txt", $buffer); |
break; |
default: |
$this->global_error->addConfigError("__construct()", "[ps] ACCESS"); |
break; |
} |
if (PSI_OS != 'WINNT') { |
if (trim($buffer) != "") { |
$this->_filecontent = preg_split("/\n/", $buffer, -1, PREG_SPLIT_NO_EMPTY); |
unset($this->_filecontent[0]); |
} else { |
$this->_filecontent = array(); |
} |
} |
} |
/** |
* doing all tasks to get the required informations that the plugin needs |
* result is stored in an internal array<br>the array is build like a tree, |
* so that it is possible to get only a specific process with the childs |
* |
* @return void |
*/ |
public function execute() |
{ |
if (empty($this->_filecontent)) { |
return; |
} |
$items = array(); |
foreach ($this->_filecontent as $roworig) { |
$row = preg_split("/[\s]+/", trim($roworig), 5); |
if (count($row) != 5) { |
break; |
} |
foreach ($row as $key=>$val) { |
$items[$row[0]][$key] = $val; |
} |
if ($row[1] !== $row[0]) { |
$items[$row[1]]['childs'][$row[0]] = &$items[$row[0]]; |
} |
} |
foreach ($items as $item) { //find zombie |
if (!isset($item[0])) { |
foreach ($item["childs"] as $subitem) { |
$zombie = $subitem[1]; |
if ($zombie != 0) { |
$items[$zombie]["0"] = $zombie; |
$items[$zombie]["1"] = "0"; |
$items[$zombie]["2"] = "0"; |
$items[$zombie]["3"] = "0"; |
$items[$zombie]["4"] = "unknown"; |
$items[0]['childs'][$zombie] = &$items[$zombie]; |
} |
break; //first is sufficient |
} |
} |
} |
if (isset($items[0])) { |
$this->_result = $items[0]; |
} else { |
$this->_result = array(); |
} |
} |
/** |
* generates the XML content for the plugin |
* |
* @return SimpleXMLElement entire XML content for the plugin |
*/ |
public function xml() |
{ |
if ($this->_result) { |
$positions = array(0=>0); |
$this->_addchild($this->_result['childs'], $this->xml, $positions); |
} |
return $this->xml->getSimpleXmlElement(); |
} |
/** |
* recursive function to allow appending child processes to a parent process |
* |
* @param array $child part of the array which should be appended to the XML |
* @param SimpleXMLExtended $xml XML-Object to which the array content is appended |
* @param array &$positions array with parent positions in xml structure |
* |
* @return SimpleXMLExtended Object with the appended array content |
*/ |
private function _addchild($child, SimpleXMLExtended $xml, &$positions) |
{ |
foreach ($child as $key=>$value) { |
$xmlnode = $xml->addChild("Process"); |
if (isset($value[0])) { |
array_push($positions, $value[0]); |
$xmlnode->addAttribute('PID', $value[0]); |
$parentid = array_search($value[1], $positions); |
$xmlnode->addAttribute('ParentID', $parentid); |
$xmlnode->addAttribute('PPID', $value[1]); |
if (!defined('PSI_PLUGIN_PS_MEMORY_USAGE') || (PSI_PLUGIN_PS_MEMORY_USAGE !== false)) { |
$xmlnode->addAttribute('MemoryUsage', $value[2]); |
} |
if (!defined('PSI_PLUGIN_PS_CPU_USAGE') || (PSI_PLUGIN_PS_CPU_USAGE !== false)) { |
$xmlnode->addAttribute('CPUUsage', $value[3]); |
} |
$xmlnode->addAttribute('Name', $value[4]); |
if ((PSI_OS !== 'WINNT') && |
((($parentid === 1) && (!defined('PSI_PLUGIN_PS_SHOW_PID1CHILD_EXPANDED') || (PSI_PLUGIN_PS_SHOW_PID1CHILD_EXPANDED === false))) |
|| ((!defined('PSI_PLUGIN_PS_SHOW_KTHREADD_EXPANDED') || (PSI_PLUGIN_PS_SHOW_KTHREADD_EXPANDED === false)) && ($value[4] === "[kthreadd]")))) { |
$xmlnode->addAttribute('Expanded', 0); |
} |
} |
if (isset($value['childs'])) { |
$this->_addChild($value['childs'], $xml, $positions); |
} |
} |
return $xml; |
} |
} |
/web/acc/phpsysinfo/plugins/ps/ps_bootstrap.html |
---|
0,0 → 1,24 |
<div class="col-lg-12" id="block_ps" style="display:none;"> |
<div class="card" id="panel_ps" style="display:none;"> |
<div class="card-header"><span class="lang_plugin_ps_001">Processes Status</span> |
<div id="reload_ps" class="reload" title="reload"></div> |
</div> |
<div class="card-body"> |
<div class="table-responsive"> |
<table id="ps" class="table table-hover table-sm"> |
<thead> |
<tr> |
<th><span class="lang_plugin_ps_002">Command</span></th> |
<th><span class="lang_plugin_ps_003">Process ID</span></th> |
<th><span class="lang_plugin_ps_004">Parent ID</span></th> |
<th><span class="lang_plugin_ps_005">Memory Usage</span></th> |
<th><span class="lang_plugin_ps_006">CPU Usage</span></th> |
</tr> |
</thead> |
<tbody id="ps-data"> |
</tbody> |
</table> |
</div> |
</div> |
</div> |
</div> |
/web/acc/phpsysinfo/plugins/psstatus/class.psstatus.inc.php |
---|
0,0 → 1,155 |
<?php |
/** |
* PSStatus Plugin, which displays the status of configured processes |
* a simple view which shows a process name and the status |
* status determined by calling the "pidof" command line utility, another way is to provide |
* a file with the output of the pidof utility, so there is no need to run a executeable by the |
* webserver, the format of the command is written down in the phpsysinfo.ini file, where also |
* the method of getting the information is configured |
* processes that should be checked are also defined in phpsysinfo.ini |
* |
* @category PHP |
* @package PSI_Plugin_PSStatus |
* @author Michael Cramer <BigMichi1@users.sourceforge.net> |
* @copyright 2009 phpSysInfo |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version |
* @version Release: 3.0 |
* @link http://phpsysinfo.sourceforge.net |
*/ |
class PSStatus extends PSI_Plugin |
{ |
/** |
* variable, which holds the content of the command |
* @var array |
*/ |
private $_filecontent = array(); |
/** |
* variable, which holds the result before the xml is generated out of this array |
* @var array |
*/ |
private $_result = array(); |
/** |
* read the data into an internal array and also call the parent constructor |
* |
* @param String $enc target encoding |
*/ |
public function __construct($enc) |
{ |
parent::__construct(__CLASS__, $enc); |
if (defined('PSI_PLUGIN_PSSTATUS_PROCESSES') && is_string(PSI_PLUGIN_PSSTATUS_PROCESSES)) { |
switch (strtolower(PSI_PLUGIN_PSSTATUS_ACCESS)) { |
case 'command': |
if (PSI_OS == 'WINNT') { |
try { |
$objLocator = new COM('WbemScripting.SWbemLocator'); |
$wmi = $objLocator->ConnectServer('', 'root\CIMv2'); |
$process_wmi = CommonFunctions::getWMI($wmi, 'Win32_Process', array('Caption', 'ProcessId')); |
foreach ($process_wmi as $process) { |
$this->_filecontent[] = array(strtolower(trim($process['Caption'])), trim($process['ProcessId'])); |
} |
} catch (Exception $e) { |
} |
} else { |
if (preg_match(ARRAY_EXP, PSI_PLUGIN_PSSTATUS_PROCESSES)) { |
$processes = eval(PSI_PLUGIN_PSSTATUS_PROCESSES); |
} else { |
$processes = array(PSI_PLUGIN_PSSTATUS_PROCESSES); |
} |
if (defined('PSI_PLUGIN_PSSTATUS_USE_REGEX') && PSI_PLUGIN_PSSTATUS_USE_REGEX === true) { |
foreach ($processes as $process) { |
CommonFunctions::executeProgram("pgrep", "-n -x \"".$process."\"", $buffer, PSI_DEBUG); |
if (strlen($buffer) > 0) { |
$this->_filecontent[] = array($process, $buffer); |
} |
} |
} else { |
foreach ($processes as $process) { |
CommonFunctions::executeProgram("pidof", "-s -x \"".$process."\"", $buffer, PSI_DEBUG); |
if (strlen($buffer) > 0) { |
$this->_filecontent[] = array($process, $buffer); |
} |
} |
} |
} |
break; |
case 'data': |
CommonFunctions::rfts(PSI_APP_ROOT."/data/psstatus.txt", $buffer); |
$processes = preg_split("/\n/", $buffer, -1, PREG_SPLIT_NO_EMPTY); |
foreach ($processes as $process) { |
$ps = preg_split("/[\s]?\|[\s]?/", $process, -1, PREG_SPLIT_NO_EMPTY); |
if (count($ps) == 2) { |
$this->_filecontent[] = array(trim($ps[0]), trim($ps[1])); |
} |
} |
break; |
default: |
$this->global_error->addConfigError("__construct()", "[psstatus] ACCESS"); |
break; |
} |
} |
} |
/** |
* doing all tasks to get the required informations that the plugin needs |
* result is stored in an internal array<br>the array is build like a tree, |
* so that it is possible to get only a specific process with the childs |
* |
* @return void |
*/ |
public function execute() |
{ |
if (defined('PSI_PLUGIN_PSSTATUS_PROCESSES') && is_string(PSI_PLUGIN_PSSTATUS_PROCESSES)) { |
if (preg_match(ARRAY_EXP, PSI_PLUGIN_PSSTATUS_PROCESSES)) { |
$processes = eval(PSI_PLUGIN_PSSTATUS_PROCESSES); |
} else { |
$processes = array(PSI_PLUGIN_PSSTATUS_PROCESSES); |
} |
if ((PSI_OS == 'WINNT') && (strtolower(PSI_PLUGIN_PSSTATUS_ACCESS) == 'command')) { |
foreach ($processes as $process) { |
$this->_result[] = array($process, $this->process_inarray(strtolower($process), $this->_filecontent)); |
} |
} else { |
foreach ($processes as $process) { |
$this->_result[] = array($process, $this->process_inarray($process, $this->_filecontent)); |
} |
} |
} |
} |
/** |
* generates the XML content for the plugin |
* |
* @return SimpleXMLElement entire XML content for the plugin |
*/ |
public function xml() |
{ |
foreach ($this->_result as $ps) { |
$xmlps = $this->xml->addChild("Process"); |
$xmlps->addAttribute("Name", $ps[0]); |
$xmlps->addAttribute("Status", $ps[1] ? 1 : 0); |
} |
return $this->xml->getSimpleXmlElement(); |
} |
/** |
* checks an array if process name is in |
* |
* @param mixed $needle what to find |
* @param array $haystack where to find |
* |
* @return boolean true - found<br>false - not found |
*/ |
private function process_inarray($needle, $haystack) |
{ |
foreach ($haystack as $stalk) { |
if ($needle === $stalk[0]) { |
return true; |
} |
} |
return false; |
} |
} |
/web/acc/phpsysinfo/plugins/psstatus/psstatus_bootstrap.html |
---|
0,0 → 1,25 |
<div class="col-lg-6" id="block_psstatus" style="display:none;"> |
<div class="card" id="panel_psstatus" style="display:none;"> |
<div class="card-header"><span class="lang_plugin_psstatus_001">Processes Status</span> |
<div id="reload_psstatus" class="reload" title="reload"></div> |
</div> |
<div class="card-body"> |
<div class="table-responsive"> |
<table id="psstatus" class="table table-hover table-sm sortable"> |
<thead> |
<tr> |
<th id="psstatus_Name"><span class="lang_plugin_psstatus_002">Name</span></th> |
<th class="rightCell"><span class="lang_plugin_psstatus_003">Status</span></th> |
</tr> |
</thead> |
<tbody id="psstatus-data"> |
<tr> |
<th><span data-bind="Name"></span></th> |
<td class="rightCell"><span class="badge badge-success" data-bind="Status1"></span><span class="badge badge-danger" data-bind="Status0"></span></td> |
</tr> |
</tbody> |
</table> |
</div> |
</div> |
</div> |
</div> |
/web/acc/phpsysinfo/plugins/quotas/class.quotas.inc.php |
---|
0,0 → 1,119 |
<?php |
/** |
* Quotas Plugin, which displays all quotas on the machine |
* display all quotas in a sortable table with the current values which are determined by |
* calling the "repquota" command line utility, another way is to provide |
* a file with the output of the repquota utility, so there is no need to run a execute by the |
* webserver, the format of the command is written down in the phpsysinfo.ini file, where also |
* the method of getting the information is configured |
* |
* @category PHP |
* @package PSI_Plugin_Quotas |
* @author Michael Cramer <BigMichi1@users.sourceforge.net> |
* @copyright 2009 phpSysInfo |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version |
* @version Release: 3.0 |
* @link http://phpsysinfo.sourceforge.net |
*/ |
class Quotas extends PSI_Plugin |
{ |
/** |
* variable, which holds the content of the command |
* @var array |
*/ |
private $_filecontent = array(); |
/** |
* variable, which holds the result before the xml is generated out of this array |
* @var array |
*/ |
private $_result = array(); |
/** |
* read the data into an internal array and also call the parent constructor |
* |
* @param String $enc target encoding |
*/ |
public function __construct($enc) |
{ |
parent::__construct(__CLASS__, $enc); |
switch (strtolower(PSI_PLUGIN_QUOTAS_ACCESS)) { |
case 'command': |
CommonFunctions::executeProgram("repquota", "-au", $buffer, PSI_DEBUG); |
break; |
case 'data': |
CommonFunctions::rfts(PSI_APP_ROOT."/data/quotas.txt", $buffer); |
break; |
default: |
$this->global_error->addConfigError("__construct()", "[quotas] ACCESS"); |
break; |
} |
if (trim($buffer) != "") { |
$this->_filecontent = preg_split("/\n/", $buffer, -1, PREG_SPLIT_NO_EMPTY); |
unset($this->_filecontent[0]); |
} else { |
$this->_filecontent = array(); |
} |
} |
/** |
* doing all tasks to get the required informations that the plugin needs |
* result is stored in an internal array<br>the array is build like a tree, |
* so that it is possible to get only a specific process with the childs |
* |
* @return void |
*/ |
public function execute() |
{ |
$i = 0; |
$quotas = array(); |
foreach ($this->_filecontent as $thisline) { |
$thisline = preg_replace("/([\s]--)/", "", $thisline); |
$thisline = preg_split("/(\s)/", $thisline, -1, PREG_SPLIT_NO_EMPTY); |
if (count($thisline) == 7) { |
$quotas[$i]['user'] = str_replace("--", "", $thisline[0]); |
$quotas[$i]['byte_used'] = $thisline[1] * 1024; |
$quotas[$i]['byte_soft'] = $thisline[2] * 1024; |
$quotas[$i]['byte_hard'] = $thisline[3] * 1024; |
if ($thisline[3] != 0) { |
$quotas[$i]['byte_percent_used'] = round((($quotas[$i]['byte_used'] / $quotas[$i]['byte_hard']) * 100), 1); |
} else { |
$quotas[$i]['byte_percent_used'] = 0; |
} |
$quotas[$i]['file_used'] = $thisline[4]; |
$quotas[$i]['file_soft'] = $thisline[5]; |
$quotas[$i]['file_hard'] = $thisline[6]; |
if ($thisline[6] != 0) { |
$quotas[$i]['file_percent_used'] = round((($quotas[$i]['file_used'] / $quotas[$i]['file_hard']) * 100), 1); |
} else { |
$quotas[$i]['file_percent_used'] = 0; |
} |
$i++; |
} |
} |
$this->_result = $quotas; |
} |
/** |
* generates the XML content for the plugin |
* |
* @return SimpleXMLElement entire XML content for the plugin |
*/ |
public function xml() |
{ |
foreach ($this->_result as $quota) { |
$quotaChild = $this->xml->addChild("Quota"); |
$quotaChild->addAttribute("User", $quota['user']); |
$quotaChild->addAttribute("ByteUsed", $quota['byte_used']); |
$quotaChild->addAttribute("ByteSoft", $quota['byte_soft']); |
$quotaChild->addAttribute("ByteHard", $quota['byte_hard']); |
$quotaChild->addAttribute("BytePercentUsed", $quota['byte_percent_used']); |
$quotaChild->addAttribute("FileUsed", $quota['file_used']); |
$quotaChild->addAttribute("FileSoft", $quota['file_soft']); |
$quotaChild->addAttribute("FileHard", $quota['file_hard']); |
$quotaChild->addAttribute("FilePercentUsed", $quota['file_percent_used']); |
} |
return $this->xml->getSimpleXmlElement(); |
} |
} |
/web/acc/phpsysinfo/plugins/quotas/quotas_bootstrap.html |
---|
0,0 → 1,39 |
<div class="col-lg-12" id="block_quotas" style="display:none;"> |
<div class="card" id="panel_quotas" style="display:none;"> |
<div class="card-header"><span class="lang_plugin_quotas_001">Quota Status</span> |
<div id="reload_quotas" class="reload" title="reload"></div> |
</div> |
<div class="card-body"> |
<div class="table-responsive"> |
<table id="quotas" class="table table-hover table-sm sortable"> |
<thead> |
<tr> |
<th id="quotas_User"><span class="lang_plugin_quotas_002">User</span></th> |
<th class="rightCell sorttable_numeric"><span class="lang_plugin_quotas_003">Bytes Used</span></th> |
<th class="rightCell sorttable_numeric"><span class="lang_plugin_quotas_004">Bytes Soft</span></th> |
<th class="rightCell sorttable_numeric"><span class="lang_plugin_quotas_005">Bytes Hard</span></th> |
<th class="rightCell sorttable_numeric"><span class="lang_plugin_quotas_006">Bytes Used Percent</span></th> |
<th class="rightCell sorttable_numeric"><span class="lang_plugin_quotas_007">Files Used</span></th> |
<th class="rightCell sorttable_numeric"><span class="lang_plugin_quotas_008">Files Soft</span></th> |
<th class="rightCell sorttable_numeric"><span class="lang_plugin_quotas_009">Files Hard</span></th> |
<th class="rightCell sorttable_numeric"><span class="lang_plugin_quotas_010">Files Used Percent</span></th> |
</tr> |
</thead> |
<tbody id="quotas-data"> |
<tr> |
<th><span data-bind="User"></span></th> |
<td class="rightCell"><span data-bind="ByteUsed"></span></td> |
<td class="rightCell"><span data-bind="ByteSoft"></span></td> |
<td class="rightCell"><span data-bind="ByteHard"></span></td> |
<td class="rightCell"><span data-bind="BytePercentUsed"></span></td> |
<td class="rightCell"><span data-bind="FileUsed"></span></td> |
<td class="rightCell"><span data-bind="FileSoft"></span></td> |
<td class="rightCell"><span data-bind="FileHard"></span></td> |
<td class="rightCell"><span data-bind="FilePercentUsed"></span></td> |
</tr> |
</tbody> |
</table> |
</div> |
</div> |
</div> |
</div> |
/web/acc/phpsysinfo/plugins/raid/class.raid.inc.php |
---|
0,0 → 1,1407 |
<?php |
/** |
* Raid Plugin, which displays RAID status |
* |
* @category PHP |
* @package PSI_Plugin_Raid |
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net> |
* @copyright 2009 phpSysInfo |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version |
* @version Release: 3.0 |
* @link http://phpsysinfo.sourceforge.net |
*/ |
class Raid extends PSI_Plugin |
{ |
/** |
* variable, which holds the content of the command |
* @var array |
*/ |
private $_filecontent = array(); |
/** |
* variable, which holds the result before the xml is generated out of this array |
* @var array |
*/ |
private $_result = array(); |
private $prog_items = array('mdstat','dmraid','megactl','megasasctl','graid','zpool','idrac'); |
/** |
* read the data into an internal array and also call the parent constructor |
* |
* @param String $enc encoding |
*/ |
public function __construct($enc) |
{ |
parent::__construct(__CLASS__, $enc); |
$RaidProgs = array(); |
if (defined('PSI_PLUGIN_RAID_PROGRAM') && is_string(PSI_PLUGIN_RAID_PROGRAM)) { |
if (is_string(PSI_PLUGIN_RAID_PROGRAM)) { |
if (preg_match(ARRAY_EXP, PSI_PLUGIN_RAID_PROGRAM)) { |
$RaidProgs = eval(strtolower(PSI_PLUGIN_RAID_PROGRAM)); |
} else { |
$RaidProgs = array(strtolower(PSI_PLUGIN_RAID_PROGRAM)); |
} |
} else { |
$this->global_error->addConfigError("__construct()", "[raid] PROGRAM"); |
exit; |
} |
} else { |
$RaidProgs = $this->prog_items; |
} |
$notwas = true; |
switch (strtolower(PSI_PLUGIN_RAID_ACCESS)) { |
case 'command': |
case 'php-snmp': |
if ((PSI_OS == 'Linux') && in_array('mdstat', $RaidProgs)) { |
CommonFunctions::rfts("/proc/mdstat", $this->_filecontent['mdstat'], 0, 4096, PSI_DEBUG); |
$notwas = false; |
} |
if ((PSI_OS == 'Linux') && in_array('dmraid', $RaidProgs)) { |
CommonFunctions::executeProgram("dmraid", "-s -vv 2>&1", $this->_filecontent['dmraid'], PSI_DEBUG); |
$notwas = false; |
} |
if ((PSI_OS == 'Linux') && in_array('megactl', $RaidProgs)) { |
CommonFunctions::executeProgram("megactl", "", $this->_filecontent['megactl'], PSI_DEBUG); |
$notwas = false; |
} |
if ((PSI_OS == 'Linux') && in_array('megasasctl', $RaidProgs)) { |
CommonFunctions::executeProgram("megasasctl", "", $this->_filecontent['megasasctl'], PSI_DEBUG); |
$notwas = false; |
} |
if ((PSI_OS == 'FreeBSD') && in_array('graid', $RaidProgs)) { |
CommonFunctions::executeProgram("graid", "list", $this->_filecontent['graid'], PSI_DEBUG); |
$notwas = false; |
} |
if (in_array('zpool', $RaidProgs)) { |
CommonFunctions::executeProgram("zpool", "status", $this->_filecontent['zpool'], PSI_DEBUG); |
$notwas = false; |
} |
if (in_array('idrac', $RaidProgs)) { |
if (defined('PSI_PLUGIN_RAID_IDRAC_DEVICES') && is_string(PSI_PLUGIN_RAID_IDRAC_DEVICES)) { |
if (preg_match(ARRAY_EXP, PSI_PLUGIN_RAID_IDRAC_DEVICES)) { |
$devices = eval(PSI_PLUGIN_RAID_IDRAC_DEVICES); |
} else { |
$devices = array(PSI_PLUGIN_RAID_IDRAC_DEVICES); |
} |
if (strtolower(PSI_PLUGIN_RAID_ACCESS)=="command") { |
foreach ($devices as $device) { |
CommonFunctions::executeProgram("snmpwalk", "-Ona -c public -v 1 -t ".PSI_SNMP_TIMEOUT_INT." -r ".PSI_SNMP_RETRY_INT." ".$device." .1.3.6.1.4.1.674.10892.5.5.1.20", $buffer, PSI_DEBUG); |
if (strlen($buffer) > 0) { |
$this->_filecontent['idrac'][$device] = $buffer; |
} |
} |
} else { |
snmp_set_valueretrieval(SNMP_VALUE_LIBRARY); |
snmp_set_oid_output_format(SNMP_OID_OUTPUT_NUMERIC); |
foreach ($devices as $device) { |
if (! PSI_DEBUG) { |
restore_error_handler(); /* default error handler */ |
$old_err_rep = error_reporting(); |
error_reporting(E_ERROR); /* fatal errors only */ |
} |
$bufferarr=snmprealwalk($device, "public", ".1.3.6.1.4.1.674.10892.5.5.1.20", 1000000 * PSI_SNMP_TIMEOUT_INT, PSI_SNMP_RETRY_INT); |
if (! PSI_DEBUG) { |
error_reporting($old_err_rep); /* restore error level */ |
set_error_handler('errorHandlerPsi'); /* restore error handler */ |
} |
if (! empty($bufferarr)) { |
$buffer=""; |
foreach ($bufferarr as $id=>$string) { |
$buffer .= $id." = ".$string."\n"; |
} |
if (strlen($buffer) > 0) { |
$this->_filecontent['idrac'][$device] = $buffer; |
} |
} |
} |
} |
} |
$notwas = false; |
} |
if ($notwas) { |
$this->global_error->addConfigError("__construct()", "[raid] PROGRAM"); |
} |
break; |
case 'data': |
foreach ($this->prog_items as $item) { |
if (in_array($item, $RaidProgs)) { |
if ($item !== 'idrac') { |
CommonFunctions::rfts(PSI_APP_ROOT."/data/raid".$item.".txt", $this->_filecontent[$item], 0, 4096, false); |
} elseif (defined('PSI_PLUGIN_RAID_IDRAC_DEVICES') && is_string(PSI_PLUGIN_RAID_IDRAC_DEVICES)) { |
if (preg_match(ARRAY_EXP, PSI_PLUGIN_RAID_IDRAC_DEVICES)) { |
$devices = eval(PSI_PLUGIN_RAID_IDRAC_DEVICES); |
} else { |
$devices = array(PSI_PLUGIN_RAID_IDRAC_DEVICES); |
} |
$pn=0; |
foreach ($devices as $device) { |
$buffer=""; |
if (CommonFunctions::rfts(PSI_APP_ROOT."/data/raid".$item.$pn.".txt", $buffer) && !empty($buffer)) { |
$this->_filecontent['idrac'][$device] = $buffer; |
} |
$pn++; |
} |
} |
$notwas = false; |
} |
} |
if ($notwas) { |
$this->global_error->addConfigError("__construct()", "[raid] PROGRAM"); |
} |
break; |
default: |
$this->global_error->addConfigError("__construct()", "[raid] ACCESS"); |
break; |
} |
} |
private function execute_mdstat($buffer) |
{ |
$raiddata = preg_split("/\r?\n/", $buffer, -1, PREG_SPLIT_NO_EMPTY); |
if (!empty($raiddata)) { |
// get the supported types |
$supported = ''; |
if (preg_match('/^[a-zA-Z]+ :( \[[a-z0-9]+\])+/', $raiddata[0], $res)) { |
$parts = preg_split("/ : /", $res[0]); |
if (isset($parts[1]) && (trim($parts[1]) !== '')) { |
$supported = preg_replace('/[\[\]]/', '', trim($parts[1])); |
} |
} |
// get disks |
if (preg_match("/^read_ahead/", $raiddata[1])) { |
$count = 2; |
} else { |
$count = 1; |
} |
$cnt_filecontent = count($raiddata); |
do { |
$parts = preg_split("/ : /", $raiddata[$count]); |
$dev = trim($parts[0]); |
if (count($parts) == 2) { |
$this->_result['devices'][$dev]['prog'] = "mdstat"; |
if ($supported !== '') $this->_result['devices'][$dev]['supported'] = $supported; |
$this->_result['devices'][$dev]['items'][0]['raid_index'] = -1; //must by first |
$details = preg_split('/ /', $parts[1]); |
if (!strstr($details[0], 'inactive')) { |
if (isset($details[2]) && strstr($details[1], '(auto-read-only)')) { |
$this->_result['devices'][$dev]['level'] = $details[2]; |
$this->_result['devices'][$dev]['status'] = $details[0]." ".$details[1]; |
//$this->_result['devices'][$dev]['items'][0]['name'] = $dev." ".$details[2]; |
$this->_result['devices'][$dev]['items'][0]['name'] = $details[2]; |
$this->_result['devices'][$dev]['items'][0]['status'] = "W"; |
$i = 3; |
} else { |
$this->_result['devices'][$dev]['level'] = $details[1]; |
$this->_result['devices'][$dev]['status'] = $details[0]; |
//$this->_result['devices'][$dev]['items'][0]['name'] = $dev." ".$details[1]; |
$this->_result['devices'][$dev]['items'][0]['name'] = $details[1]; |
$this->_result['devices'][$dev]['items'][0]['status'] = "ok"; |
$i = 2; |
} |
} else { |
$this->_result['devices'][$dev]['level'] = "none"; |
$this->_result['devices'][$dev]['status'] = $details[0]; |
$this->_result['devices'][$dev]['items'][0]['name'] = $dev; |
$this->_result['devices'][$dev]['items'][0]['status'] = "F"; |
$i = 1; |
} |
$this->_result['devices'][$dev]['items'][0]['parentid'] = 0; |
for ($cnt_details = count($details); $i < $cnt_details; $i++) { |
preg_match('/(([a-z0-9])+)(\[([0-9]+)\])(\([SF ]\))?/', trim($details[$i]), $partition); |
if (count($partition) == 5 || count($partition) == 6) { |
$this->_result['devices'][$dev]['items'][$partition[1]]['raid_index'] = 0+substr(trim($partition[3]), 1, -1); |
if (isset($partition[5])) { |
$search = array("(", ")"); |
$replace = array("", ""); |
$this->_result['devices'][$dev]['items'][$partition[1]]['status'] = str_replace($search, $replace, trim($partition[5])); |
} else { |
$this->_result['devices'][$dev]['items'][$partition[1]]['status'] = "ok"; |
} |
$this->_result['devices'][$dev]['items'][$partition[1]]['name'] = $partition[1]; |
$this->_result['devices'][$dev]['items'][$partition[1]]['parentid'] = 1; |
$this->_result['devices'][$dev]['items'][$partition[1]]['type'] = "disk"; |
} |
} |
$optionline = $raiddata[$count].$raiddata[$count+1]; |
$count++; |
if (preg_match('/([^\sk]*)k chunk/', $optionline, $chunksize)) { |
$this->_result['devices'][$dev]['chunk_size'] = $chunksize[1]; |
} |
if ($pos = strpos($optionline, "super non-persistent")) { |
$this->_result['devices'][$dev]['pers_superblock'] = 0; |
} else { |
$this->_result['devices'][$dev]['pers_superblock'] = 1; |
} |
if ($pos = strpos($optionline, "algorithm")) { |
$this->_result['devices'][$dev]['algorithm'] = trim(substr($optionline, $pos + 9, 2)); |
} |
if (preg_match('/\[([0-9]+)\/([0-9]+)\]/', $optionline, $res)) { |
$this->_result['devices'][$dev]['registered'] = $res[1]; |
$this->_result['devices'][$dev]['active'] = $res[2]; |
} |
if (isset($this->_result['devices'][$dev]['items'])) { |
asort($this->_result['devices'][$dev]['items']); |
} |
if ((!isset($this->_result['devices'][$dev]['registered']) || ($this->_result['devices'][$dev]['registered']<24)) && preg_match('/\[([_U]+)\]/', $optionline, $res) && (($reslen=strlen($res[1])) > 0)) { |
$notsparecount = 0; |
foreach ($this->_result['devices'][$dev]['items'] as $diskkey=>$disk) { |
if (($diskkey!==0) && ($this->_result['devices'][$dev]['items'][$diskkey]['status']!=="S")) { |
$notsparecount++; |
} |
} |
if ($notsparecount == $reslen) { |
$partnr = 0; |
foreach ($this->_result['devices'][$dev]['items'] as $diskkey=>$disk) { |
if (($diskkey!==0) && ($this->_result['devices'][$dev]['items'][$diskkey]['status']!=="S")) { |
if (($res[1][$partnr]=='_') && ($this->_result['devices'][$dev]['items'][$diskkey]['status']=="ok")) { |
$this->_result['devices'][$dev]['items'][$diskkey]['status']="W"; |
} |
$partnr++; |
} |
} |
} elseif ($reslen-$notsparecount == 1) { |
$partnr = 0; |
foreach ($this->_result['devices'][$dev]['items'] as $diskkey=>$disk) { |
if (($diskkey!==0) && ($this->_result['devices'][$dev]['items'][$diskkey]['status']!=="S")) { |
if ($res[1][$partnr]=='_') { |
$this->_result['devices'][$dev]['items']['none']['raid_index']=$this->_result['devices'][$dev]['items'][$diskkey]['raid_index']-1; |
$this->_result['devices'][$dev]['items']['none']['status']="E"; |
$this->_result['devices'][$dev]['items']['none']['name']="none"; |
$this->_result['devices'][$dev]['items']['none']['parentid'] = 1; |
$this->_result['devices'][$dev]['items']['none']['type'] = "disk"; |
} |
$partnr++; |
} |
} |
if ($res[1][$partnr]=='_') { |
$this->_result['devices'][$dev]['items']['none']['raid_index']=$this->_result['devices'][$dev]['items'][$diskkey]['raid_index']+1; |
$this->_result['devices'][$dev]['items']['none']['status']="E"; |
$this->_result['devices'][$dev]['items']['none']['name']="none"; |
$this->_result['devices'][$dev]['items']['none']['parentid'] = 1; |
$this->_result['devices'][$dev]['items']['none']['type']="disk"; |
} |
asort($this->_result['devices'][$dev]['items']); |
foreach ($this->_result['devices'][$dev]['items'] as $diskkey=>$disk) { |
if ($diskkey=="none") { |
$this->_result['devices'][$dev]['items'][$diskkey]['raid_index']="unknown"; |
} |
} |
} else { |
foreach ($this->_result['devices'][$dev]['items'] as $diskkey=>$disk) { |
if ($this->_result['devices'][$dev]['items'][$diskkey]['status']=="ok") { |
$this->_result['devices'][$dev]['items'][$diskkey]['status']="W"; |
} |
} |
for ($partnr=0; $partnr<$reslen-$notsparecount; $partnr++) { |
$this->_result['devices'][$dev]['items']['none'.$partnr]['raid_index']="unknown"; |
$this->_result['devices'][$dev]['items']['none'.$partnr]['status']="E"; |
$this->_result['devices'][$dev]['items']['none'.$partnr]['name'] = "none".$partnr; |
$this->_result['devices'][$dev]['items']['none'.$partnr]['parentid'] = 1; |
$this->_result['devices'][$dev]['items']['none'.$partnr]['type'] = "disk"; |
} |
} |
} |
if (preg_match(('/([a-z]+)( *)=( *)([0-9\.]+)%/'), $raiddata[$count + 1], $res) || (preg_match(('/([a-z]+)( *)=( *)([0-9\.]+)/'), $optionline, $res))) { |
list($this->_result['devices'][$dev]['action']['name'], $this->_result['devices'][$dev]['action']['percent']) = preg_split("/=/", str_replace("%", "", $res[0])); |
if (preg_match(('/([a-z]*=[0-9\.]+[a-z]+)/'), $raiddata[$count + 1], $res)) { |
$time = preg_split("/=/", $res[0]); |
list($this->_result['devices'][$dev]['action']['finish_time'], $this->_result['devices'][$dev]['action']['finish_unit']) = sscanf($time[1], '%f%s'); |
} |
} elseif (preg_match(('/^( *)([a-z]+)( *)=( *)([A-Z]+)$/'), $raiddata[$count + 1], $res)) { |
$this->_result['devices'][$dev]['status'] .= " ".trim($raiddata[$count + 1]); |
} |
} else { |
$count++; |
} |
} while ($cnt_filecontent > $count); |
$lastline = $raiddata[$cnt_filecontent - 1]; |
if (strpos($lastline, "unused devices") !== false) { |
$parts = preg_split("/:/", $lastline); |
$unused = trim($parts[1]); |
if ($unused !== "<none>") { |
$details = preg_split('/ /', $parts[1], -1, PREG_SPLIT_NO_EMPTY); |
$this->_result['devices']['spare']['prog'] = "mdstat"; |
$this->_result['devices']['spare']['status'] = "spare"; |
$this->_result['devices']['spare']['items'][0]['name'] = "spare"; |
$this->_result['devices']['spare']['items'][0]['parentid'] = 0; |
$this->_result['devices']['spare']['items'][0]['status'] = "S"; |
foreach ($details as $id=>$disk) { |
$this->_result['devices']['spare']['items'][$id+1]['name'] = $disk; |
$this->_result['devices']['spare']['items'][$id+1]['parentid'] = 1; |
$this->_result['devices']['spare']['items'][$id+1]['status'] = "S"; |
$this->_result['devices']['spare']['items'][$id+1]['type'] = "disk"; |
} |
} |
} |
} |
} |
private function execute_dmraid($buffer) |
{ |
$raiddata = preg_split("/(\r?\n\*\*\* )|(\r?\n--> )/", $buffer, -1, PREG_SPLIT_NO_EMPTY); |
if (!empty($raiddata)) { |
$group = ""; |
foreach ($raiddata as $block) { |
if (preg_match('/^(NOTICE: )|(ERROR: )/m', $block)) { |
$group = ""; |
$lines = preg_split("/\r?\n/", $block, -1, PREG_SPLIT_NO_EMPTY); |
foreach ($lines as $line) { |
if (preg_match('/^NOTICE: added\s+\/dev\/(.+)\s+to RAID set\s+\"(.+)\"/', $line, $partition)) { |
if (!isset($this->_result['devices'][$partition[2]]['items'][0]['parentid'])) { |
$this->_result['devices'][$partition[2]]['items'][0]['parentid'] = 0; |
$this->_result['devices'][$partition[2]]['items'][0]['name'] = $partition[2]; |
} |
$this->_result['devices'][$partition[2]]['items'][$partition[1]]['status'] = "ok"; |
$this->_result['devices'][$partition[2]]['items'][$partition[1]]['type'] = "disk"; |
$this->_result['devices'][$partition[2]]['items'][$partition[1]]['parentid'] = 1; |
$this->_result['devices'][$partition[2]]['items'][$partition[1]]['name'] = $partition[1]; |
$this->_result['devices'][$partition[2]]['prog'] = "dmraid"; |
$this->_result['devices'][$partition[2]]['status'] = "ok"; |
$this->_result['devices'][$partition[2]]['level'] = "unknown"; |
} elseif (preg_match('/^ERROR: .* device\s+\/dev\/(.+)\s+(.+)\s+in RAID set\s+\"(.+)\"/', $line, $partition)) { |
if (!isset($this->_result['devices'][$partition[3]]['items'][0]['parentid'])) { |
$this->_result['devices'][$partition[3]]['items'][0]['parentid'] = 0; |
$this->_result['devices'][$partition[3]]['items'][0]['name'] = $partition[3]; |
} |
$this->_result['devices'][$partition[3]]['prog'] = "dmraid"; |
$this->_result['devices'][$partition[3]]['level'] = "unknown"; |
$this->_result['devices'][$partition[3]]['items'][$partition[1]]['type'] = "disk"; |
$this->_result['devices'][$partition[3]]['items'][$partition[1]]['parentid'] = 1; |
if ($partition[2]=="broken") { |
$this->_result['devices'][$partition[3]]['items'][$partition[1]]['status'] = "F"; |
$this->_result['devices'][$partition[3]]['status'] = "F"; |
} else { |
$this->_result['devices'][$partition[3]]['items'][$partition[1]]['status'] = "W"; |
$this->_result['devices'][$partition[3]]['status'] = "W"; |
} |
$this->_result['devices'][$partition[3]]['items'][$partition[1]]['name'] = $partition[1]; |
} |
} |
} else { |
if (preg_match('/^Group superset\s+(.+)/m', $block, $arrname)) { |
$group = trim($arrname[1]); |
} |
if (preg_match('/^name\s*:\s*(.*)/m', $block, $arrname)) { |
if ($group=="") { |
$group = trim($arrname[1]); |
} |
$this->_result['devices'][$group]['prog'] = "dmraid"; |
$this->_result['devices'][$group]['name'] = trim($arrname[1]); |
$this->_result['devices'][$group]['items'][0]['name'] = trim($arrname[1]); |
if (preg_match('/^size\s*:\s*(.*)/m', $block, $size)) { |
$this->_result['devices'][$group]['size'] = trim($size[1]); |
} |
if (preg_match('/^stride\s*:\s*(.*)/m', $block, $stride)) { |
$this->_result['devices'][$group]['stride'] = trim($stride[1]); |
} |
if (preg_match('/^type\s*:\s*(.*)/m', $block, $type)) { |
$this->_result['devices'][$group]['level'] = trim($type[1]); |
//$this->_result['devices'][$group]['items'][0]['name'] .= " ".trim($type[1]); |
$this->_result['devices'][$group]['items'][0]['name'] = trim($type[1]); |
} |
if (preg_match('/^status\s*:\s*(.*)/m', $block, $status)) { |
$this->_result['devices'][$group]['status'] = trim($status[1]); |
switch (trim($status[1])) { |
case "broken": |
$this->_result['devices'][$group]['items'][0]['status'] = "F"; |
break; |
case "inconsistent": |
$this->_result['devices'][$group]['items'][0]['status'] = "W"; |
break; |
default: |
$this->_result['devices'][$group]['items'][0]['status'] = trim($status[1]); |
} |
} |
if (preg_match('/^subsets\s*:\s*(.*)/m', $block, $subsets)) { |
$this->_result['devices'][$group]['subsets'] = trim($subsets[1]); |
} |
if (preg_match('/^devs\s*:\s*(.*)/m', $block, $devs)) { |
$this->_result['devices'][$group]['devs'] = trim($devs[1]); |
} |
if (preg_match('/^spares\s*:\s*(.*)/m', $block, $spares)) { |
$this->_result['devices'][$group]['spares'] = trim($spares[1]); |
} |
if (!isset($this->_result['devices'][$group]['items'][0]['parentid'])) { |
$this->_result['devices'][$group]['items'][0]['parentid'] = 0; |
} |
$group = ""; |
} |
} |
} |
if (isset($this->_result['devices'])) { |
foreach ($this->_result['devices'] as $gid=>$group) if ($group['prog'] === "dmraid") { |
$id = 1; |
if (isset($group['devs']) && ($group['devs']>0) && |
(!isset($group['items']) || (count($group['items'])<$group['devs'])) && |
isset($group['subsets']) && ($group['subsets']>0)) for ($i = 0; $i < $group['subsets']; $i++) { |
if (isset($this->_result['devices'][$gid."-".$i]['items'][0]['parentid'])) { |
foreach ($this->_result['devices'][$gid."-".$i]['items'] as $fid=>$from) { |
if ($fid===0) { |
$this->_result['devices'][$gid]['items'][$gid."-".$i]['parentid'] = 1; |
$this->_result['devices'][$gid]['items'][$gid."-".$i]['status'] = $from['status']; |
$this->_result['devices'][$gid]['items'][$gid."-".$i]['name'] = $gid."-".$i." ".$from['name']; |
if (isset($from['type'])) $this->_result['devices'][$gid]['items'][$gid."-".$i]['type'] = $from['type']; |
} else { |
$this->_result['devices'][$gid]['items'][$from['name']]['parentid'] = 1+$id; |
$this->_result['devices'][$gid]['items'][$from['name']]['status'] = $from['status']; |
$this->_result['devices'][$gid]['items'][$from['name']]['name'] = $from['name']; |
if (isset($from['type'])) $this->_result['devices'][$gid]['items'][$from['name']]['type'] = $from['type']; |
} |
} |
$id+=count($this->_result['devices'][$gid."-".$i]['items']); |
unset($this->_result['devices'][$gid."-".$i]); |
} else { |
$this->_result['devices'][$gid]['items'][$gid."-".$i]['parentid'] = 1; |
$this->_result['devices'][$gid]['items'][$gid."-".$i]['status'] = "unknown"; |
$this->_result['devices'][$gid]['items'][$gid."-".$i]['name'] = $gid."-".$i; |
$id++; |
} |
} |
} |
foreach ($this->_result['devices'] as $gid=>$group) if ($group['prog'] === "dmraid") { |
if (($group['name'] !== $gid) && isset($group['items'][0]['parentid'])) { |
$this->_result['devices'][$gid]['items'][0]['name'] = $group['name']." ".$group['items'][0]['name']; |
} |
} |
} |
} |
} |
private function execute_megactl($buffer, $sas = false) |
{ |
$raiddata = preg_split("/(\r?\n)+(?=[a-z]\d+ )/", $buffer, -1, PREG_SPLIT_NO_EMPTY); |
if (!empty($raiddata)) foreach ($raiddata as $raidgroup) { |
if (preg_match("/^([a-z]\d+) /", $raidgroup, $buff)) { |
if (preg_match("/^[a-z]\d+ ([^:\r\n]+) [^:\r\n]+:/", $raidgroup, $geom) || preg_match("/^[a-z]\d+ ([^:\r\n]+)/", $raidgroup, $geom)) { |
$controller = trim($geom[1]); |
} else { |
$controller = ''; |
} |
if (preg_match("/^[a-z]\d+ [^:\r\n]+ [^\r\n]* batt:([^:\r\n,]+)/", $raidgroup, $batt)) { |
$battery = trim($batt[1]); |
} else { |
$battery = ''; |
} |
$group = $buff[1]; |
$lines = preg_split("/\r?\n/", $raidgroup, -1, PREG_SPLIT_NO_EMPTY); |
if (!empty($lines)) { |
if ($sas === true) { |
$prog = "megasasctl"; |
$prefix = "/"; //for megactl and megasasctl conflicts |
} else { |
$prog = "megactl"; |
$prefix = ""; |
} |
unset($lines[0]); |
foreach ($lines as $line) { |
$details = preg_split('/ /', preg_replace('/^hot spares +:/', 'hotspare:', $line), -1, PREG_SPLIT_NO_EMPTY); |
if ((count($details) == 6) && ($details[2] === "RAID")) { |
$this->_result['devices'][$prefix.$details[0]]['prog'] = $prog; |
$unit = preg_replace("/^\d+/", "", $details[1]); |
$value = preg_replace("/\D+$/", "", $details[1]); |
switch ($unit) { |
case 'B': |
$this->_result['devices'][$prefix.$details[0]]['size'] = $value; |
break; |
case 'KiB': |
$this->_result['devices'][$prefix.$details[0]]['size'] = 1024*$value; |
break; |
case 'MiB': |
$this->_result['devices'][$prefix.$details[0]]['size'] = 1024*1024*$value; |
break; |
case 'GiB': |
$this->_result['devices'][$prefix.$details[0]]['size'] = 1024*1024*1024*$value; |
break; |
case 'TiB': |
$this->_result['devices'][$prefix.$details[0]]['size'] = 1024*1024*1024*1024*$value; |
break; |
case 'PiB': |
$this->_result['devices'][$prefix.$details[0]]['size'] = 1024*1024*1024*1024*1024*$value; |
break; |
} |
$this->_result['devices'][$prefix.$details[0]]['level'] = "RAID".$details[3]." ".$details[4]; |
$this->_result['devices'][$prefix.$details[0]]['status'] = $details[5]; |
if ($controller !== '') $this->_result['devices'][$prefix.$details[0]]['controller'] = $controller; |
if ($battery !== '') $this->_result['devices'][$prefix.$details[0]]['battery'] = $battery; |
$this->_result['devices'][$prefix.$details[0]]['items'][$details[0]]['parentid'] = 0; |
$this->_result['devices'][$prefix.$details[0]]['items'][$details[0]]['name'] = "RAID".$details[3]." ".$details[4]; |
if ($details[5] !== 'optimal') { |
$this->_result['devices'][$prefix.$details[0]]['items'][$details[0]]['info'] = $details[5]; |
} |
switch ($details[5]) { |
case 'optimal': |
$this->_result['devices'][$prefix.$details[0]]['items'][$details[0]]['status'] = "ok"; |
break; |
case 'OFFLINE': |
$this->_result['devices'][$prefix.$details[0]]['items'][$details[0]]['status'] = "F"; |
break; |
default: |
$this->_result['devices'][$prefix.$details[0]]['items'][$details[0]]['status'] = "W"; |
} |
} elseif (count($details) == 4) { |
if (isset($this->_result['devices'][$prefix.$details[2]])) { |
$this->_result['devices'][$prefix.$details[2]]['items'][$details[0]]['parentid'] = 1; |
$this->_result['devices'][$prefix.$details[2]]['items'][$details[0]]['type'] = 'disk'; |
$this->_result['devices'][$prefix.$details[2]]['items'][$details[0]]['name'] = $details[0]; |
if ($details[3] !== 'online') { |
$this->_result['devices'][$prefix.$details[2]]['items'][$details[0]]['info'] = $details[3]; |
} |
switch ($details[3]) { |
case 'online': |
$this->_result['devices'][$prefix.$details[2]]['items'][$details[0]]['status'] = "ok"; |
break; |
case 'hotspare': |
$this->_result['devices'][$prefix.$details[2]]['items'][$details[0]]['status'] = "S"; |
break; |
case 'rdy/fail': |
$this->_result['devices'][$prefix.$details[2]]['items'][$details[0]]['status'] = "F"; |
break; |
default: |
$this->_result['devices'][$prefix.$details[2]]['items'][$details[0]]['status'] = "W"; |
} |
} |
} elseif ((count($details) == 2) && (($details[0]==='unconfigured:') || ($details[0]==='hotspare:'))) { |
$itemn0 = rtrim($details[0], ':'); |
$itemn = $group .'-'.$itemn0; |
$this->_result['devices'][$prefix.$itemn]['status'] = $itemn0; |
$this->_result['devices'][$prefix.$itemn]['prog'] = $prog; |
if ($controller !== '') $this->_result['devices'][$prefix.$itemn]['controller'] = $controller; |
if ($battery !== '') $this->_result['devices'][$prefix.$itemn]['battery'] = $battery; |
$this->_result['devices'][$prefix.$itemn]['items'][$itemn]['parentid'] = 0; |
$this->_result['devices'][$prefix.$itemn]['items'][$itemn]['name'] = $itemn0; |
if ($details[0]==='unconfigured:') { |
$this->_result['devices'][$prefix.$itemn]['items'][$itemn]['status'] = "U"; |
} else { |
$this->_result['devices'][$prefix.$itemn]['items'][$itemn]['status'] = "S"; |
} |
} elseif (count($details) == 3) { |
$itemn = ''; |
switch ($details[2]) { |
case 'BAD': |
case 'ready': |
$itemn = $group .'-'.'unconfigured'; |
break; |
case 'hotspare': |
$itemn = $group .'-'.'hotspare'; |
} |
if (($itemn !== '') && isset($this->_result['devices'][$prefix.$itemn])) { |
$this->_result['devices'][$prefix.$itemn]['items'][$details[0]]['parentid'] = 1; |
$this->_result['devices'][$prefix.$itemn]['items'][$details[0]]['type'] = 'disk'; |
$this->_result['devices'][$prefix.$itemn]['items'][$details[0]]['name'] = $details[0]; |
$this->_result['devices'][$prefix.$itemn]['items'][$details[0]]['info'] = $details[2]; |
switch ($details[2]) { |
case 'ready': |
$this->_result['devices'][$prefix.$itemn]['items'][$details[0]]['status'] = "U"; |
break; |
case 'hotspare': |
$this->_result['devices'][$prefix.$itemn]['items'][$details[0]]['status'] = "S"; |
break; |
default: |
$this->_result['devices'][$prefix.$itemn]['items'][$details[0]]['status'] = "F"; |
} |
} |
} |
} |
} |
} |
} |
} |
private function execute_graid($buffer) |
{ |
if (preg_match('/^Geom name: +([^\n\r]+)/', $buffer, $geom)) { |
$controller = trim($geom[1]); |
} else { |
$controller = ''; |
} |
$raiddata = preg_split("/Consumers:\r?\n/", $buffer, -1, PREG_SPLIT_NO_EMPTY); |
if (!empty($raiddata)) { |
$disksinfo = array(); |
if (isset($raiddata[1]) && (trim($raiddata[1])!=="")) { |
$lines = preg_split("/\r?\n/", trim($raiddata[1]), -1, PREG_SPLIT_NO_EMPTY); |
$disk = ""; |
foreach ($lines as $line) { |
if (preg_match("/^\d+\.\s+Name:\s+(.+)/", $line, $data)) { |
$disk = $data[1]; |
} elseif (($disk!=="") && preg_match('/^\s+State:\s+(\S+)\s+\(([^\)\s]+)\s*([\d]*)(%*)([^\)]*)\)/', $line, $data)) { |
$disksinfo[$disk]['status'] = trim($data[1]); |
$disksinfo[$disk]['substatus'] = trim($data[2]); |
if (trim($data[4])=="%") { |
$disksinfo[$disk]['percent'] = trim($data[3]); |
} |
} |
} |
} |
$lines = preg_split("/\r?\n/", trim($raiddata[0]), -1, PREG_SPLIT_NO_EMPTY); |
$group = ""; |
foreach ($lines as $line) { |
if (preg_match("/^\d+\.\s+Name:\s+(.+)/", $line, $data)) { |
$group = $data[1]; |
$this->_result['devices'][$group]['prog'] = "graid"; |
if ($controller !== '') $this->_result['devices'][$group]['controller'] = $controller; |
} elseif ($group!=="") { |
if (preg_match('/^\s+Mediasize:\s+(\d+)/', $line, $data)) { |
$this->_result['devices'][$group]['size'] = trim($data[1]); |
} elseif (preg_match('/^\s+State:\s+(.+)/', $line, $data)) { |
$this->_result['devices'][$group]['status'] = trim($data[1]); |
} elseif (preg_match('/^\s+RAIDLevel:\s+(.+)/', $line, $data)) { |
$this->_result['devices'][$group]['level'] = trim($data[1]); |
} elseif (preg_match('/^\s+Components:\s+(\d+)/', $line, $data)) { |
$this->_result['devices'][$group]['devs'] = trim($data[1]); |
} elseif (preg_match('/^\s+Label:\s+(.+)/', $line, $data)) { |
$this->_result['devices'][$group]['name'] = trim($data[1]); |
} elseif (preg_match('/^\s+Subdisks:\s+(.+)/', $line, $data)) { |
$disks = preg_split('/\s*,\s*/', trim($data[1]), -1, PREG_SPLIT_NO_EMPTY); |
$nones = 0; |
$this->_result['devices'][$group]['items'][0]['parentid'] = 0; |
foreach ($disks as $disk) { |
if (preg_match("/^(\S+)\s+\(([^\)]+)\)/", $disk, $partition)) { |
$this->_result['devices'][$group]['items'][$partition[1]]['parentid'] = 1; |
$this->_result['devices'][$group]['items'][$partition[1]]['type'] = "disk"; |
if ($partition[2]=="ACTIVE") { |
if (isset($disksinfo[$partition[1]]["status"])) { |
if ($disksinfo[$partition[1]]["status"]!=="ACTIVE") { |
$this->_result['devices'][$group]['items'][$partition[1]]['status'] = "W"; |
} elseif ($disksinfo[$partition[1]]["substatus"]=="ACTIVE") { |
$this->_result['devices'][$group]['items'][$partition[1]]['status'] = "ok"; |
} else { |
$this->_result['devices'][$group]['items'][$partition[1]]['status'] = "W"; |
if (isset($disksinfo[$partition[1]]["percent"])) { |
$this->_result['devices'][$group]['action']['name'] = $disksinfo[$partition[1]]["substatus"]; |
$this->_result['devices'][$group]['action']['percent'] = $disksinfo[$partition[1]]["percent"]; |
} |
} |
} else { |
$this->_result['devices'][$group]['items'][$partition[1]]['status'] = "ok"; |
$this->_result['devices'][$group]['items'][$partition[1]]['name'] = $partition[1]; |
} |
$this->_result['devices'][$group]['items'][$partition[1]]['name'] = $partition[1]; |
} elseif ($partition[2]=="NONE") { |
$this->_result['devices'][$group]['items']["none".$nones]['status'] = 'E'; |
$this->_result['devices'][$group]['items']["none".$nones]['name'] = "none".$nones; |
$nones++; |
} |
} |
} |
} |
} |
} |
if (isset($this->_result['devices'][$group]['items'][0]['parentid'])) { |
$name = ""; |
if (isset($this->_result['devices'][$group]['name'])) { |
$name = $this->_result['devices'][$group]['name']; |
} |
if (isset($this->_result['devices'][$group]['level'])) { |
$name .= " " .$this->_result['devices'][$group]['level']; |
} |
$this->_result['devices'][$group]['items'][0]['name'] = trim($name); |
if (isset($this->_result['devices'][$group]['status'])) { |
if ($this->_result['devices'][$group]['status']==="OPTIMAL") { |
$this->_result['devices'][$group]['items'][0]['status'] = "ok"; |
} else { |
$this->_result['devices'][$group]['items'][0]['status'] = "W"; |
$this->_result['devices'][$group]['items'][0]['info'] = $this->_result['devices'][$group]['status']; |
} |
} else { |
$this->_result['devices'][$group]['items'][0]['status'] = "ok"; |
} |
} |
} |
} |
private function execute_zpool($buffer) |
{ |
$raiddata = preg_split("/(\r?\n)+ +(?=pool: )/", $buffer, -1, PREG_SPLIT_NO_EMPTY); |
if (!empty($raiddata)) foreach ($raiddata as $raid) { |
if (preg_match("/^pool: (\S+)/", $raid, $buff)) { |
$group = $buff[1]; |
$this->_result['devices'][$group]['prog'] = "zpool"; |
if (preg_match("/^ +state: (\S+)/m", $raid, $buff)) { |
$this->_result['devices'][$group]['status'] = $buff[1]; |
} |
$databegin = preg_split("/\n[ \t]+NAME +STATE +READ +WRITE +CKSUM\r?\n/", $raid, -1, PREG_SPLIT_NO_EMPTY); |
if (!empty($databegin) && (count($databegin)==2)) { |
$datas = preg_split("/\r?\n[ \t]*\r?\n/", $databegin[1], -1, PREG_SPLIT_NO_EMPTY); |
$datalines = preg_split("/\r?\n/", $datas[0], -1, PREG_SPLIT_NO_EMPTY); |
$rootoffset = false; |
$lastparentids = array(0=>-1); |
$lastindent = 0; |
$lastid = 0; |
foreach ($datalines as $id=>$data) { |
if (preg_match("/^([ \t]+)\S/", $data, $buff)) {; |
$fullbuff = preg_split("/[ \t]+/", $data, 6, PREG_SPLIT_NO_EMPTY); |
$offset=strlen($buff[1]); |
if ($rootoffset === false) { // first line means root |
$rootoffset = $offset; |
$this->_result['devices'][$group]['items'][$id]['name'] = "";//$fullbuff[0]; |
if (count($fullbuff) > 1) { |
$this->_result['devices'][$group]['items'][$id]['status'] = $fullbuff[1]; |
} |
$this->_result['devices'][$group]['items'][$id]['parentid'] = -2; |
continue; |
} |
if ($offset < $rootoffset) { // some errors |
continue; |
} |
$this->_result['devices'][$group]['items'][$id]['name'] = $fullbuff[0]; |
if (count($fullbuff) > 1) { |
$this->_result['devices'][$group]['items'][$id]['status'] = $fullbuff[1]; |
} |
if (count($fullbuff) > 5) { |
$this->_result['devices'][$group]['items'][$id]['info'] = $fullbuff[5]; |
} |
$indent = ($offset - $rootoffset)/2; |
if ($indent > $lastindent) { |
$lastparentids[$indent] = $lastid; |
} |
$this->_result['devices'][$group]['items'][$id]['parentid'] = $lastparentids[$indent]; |
if ($lastparentids[$indent] >= 0) { |
if (isset($this->_result['devices'][$group]['items'][$lastparentids[$indent]]['childs'])) { |
$this->_result['devices'][$group]['items'][$lastparentids[$indent]]['childs']++; |
} else { |
$this->_result['devices'][$group]['items'][$lastparentids[$indent]]['childs'] = 1; |
} |
} |
$lastindent = $indent; |
$lastid = $id; |
} |
} |
foreach ($this->_result['devices'][$group]['items'] as $id=>$data) { // type analize |
if ((!isset($data['childs']) || ($data['childs']<1)) && ($data['parentid']>=0) && !preg_match("/^mirror$|^mirror-|^spare$|^spare-|^replacing$|^replacing-|^raidz[123]$|^raidz[123]-/", $data['name'])) { |
$this->_result['devices'][$group]['items'][$id]['type'] = "disk"; |
} elseif (isset($data['childs']) && !preg_match("/^spares$|^mirror$|^mirror-|^spare$|^spare-|^replacing$|^replacing-|^raidz[123]$|^raidz[123]-/", $data['name'])) { |
if (($data['childs']==1) && ($data['parentid']==-2) && isset($this->_result['devices'][$group]['items'][$id+1]) && !preg_match("/^mirror$|^mirror-|^spare$|^spare-|^replacing$|^replacing-|^raidz[123]$|^raidz[123]-/", $this->_result['devices'][$group]['items'][$id+1]['name'])) { |
$this->_result['devices'][$group]['items'][$id]['name2'] = "jbod"; |
} elseif ($data['childs']>1) { |
$this->_result['devices'][$group]['items'][$id]['name2'] = "stripe"; |
} |
} |
} |
foreach ($this->_result['devices'][$group]['items'] as $id=>$data) { // size optimize |
if (($data['parentid']<0) && isset($data['childs']) && ($data['childs']==1) && (!isset($data['name2']) || ($data['name2']!=="jbod"))) { |
if ($data['parentid']==-2) { |
unset($this->_result['devices'][$group]['items'][$id]); |
} elseif (($data['parentid'] == -1) && !isset($this->_result['devices'][$group]['items'][$id+1]['type'])) { |
$this->_result['devices'][$group]['items'][$id+1]['name2'] = $data['name']; |
$this->_result['devices'][$group]['items'][$id+1]['parentid'] = $data['parentid']; |
unset($this->_result['devices'][$group]['items'][$id]); |
foreach ($this->_result['devices'][$group]['items'] as $id2=>$data2) { |
if ($data2['parentid']>$id) { |
$this->_result['devices'][$group]['items'][$id2]['parentid'] = $data2['parentid'] - 1; |
} |
} |
} |
} |
} |
if (isset($this->_result['devices'][$group]['items'][0])) { |
$shift = true; |
} else { |
$shift = false; |
} |
foreach ($this->_result['devices'][$group]['items'] as $id=>$data) { |
// reindex |
if ($shift) { |
$this->_result['devices'][$group]['items'][$id]['parentid']++; |
} |
if ($data['parentid']<0) { |
$this->_result['devices'][$group]['items'][$id]['parentid'] = 0; |
} |
// name append |
if (isset($data['name2'])) { |
if (($data['name2']==="cache") || ($data['name2']==="logs")) { |
$this->_result['devices'][$group]['items'][$id]['name'] = trim($data['name2']." ".$data['name']); |
} else { |
$this->_result['devices'][$group]['items'][$id]['name'] = trim($data['name']." ".$data['name2']); |
} |
unset($this->_result['devices'][$group]['items'][$id]['name2']); |
} |
// status and info normalize |
if (isset($data['status'])) { |
switch ($data['status']) { |
case 'AVAIL': |
if (isset($data['info'])) { |
$this->_result['devices'][$group]['items'][$id]['info'] = $data['status']." ".$data['info']; |
} else { |
$this->_result['devices'][$group]['items'][$id]['info'] = $data['status']; |
} |
$this->_result['devices'][$group]['items'][$id]['status'] = "S"; |
break; |
case 'INUSE': |
case 'DEGRADED': |
if (isset($data['info'])) { |
$this->_result['devices'][$group]['items'][$id]['info'] = $data['status']." ".$data['info']; |
} else { |
$this->_result['devices'][$group]['items'][$id]['info'] = $data['status']; |
} |
$this->_result['devices'][$group]['items'][$id]['status'] = "W"; |
break; |
case 'UNAVAIL': |
case 'FAULTED': |
if (isset($data['info'])) { |
$this->_result['devices'][$group]['items'][$id]['info'] = $data['status']." ".$data['info']; |
} else { |
$this->_result['devices'][$group]['items'][$id]['info'] = $data['status']; |
} |
$this->_result['devices'][$group]['items'][$id]['status'] = "F"; |
break; |
default: |
$this->_result['devices'][$group]['items'][$id]['status'] = "ok"; |
} |
} else { |
if ($this->_result['devices'][$group]['items'][$id]['name'] == "spares") { |
$this->_result['devices'][$group]['items'][$id]['status'] = "S"; |
} else { |
$this->_result['devices'][$group]['items'][$id]['status'] = "ok"; |
} |
} |
} |
} |
} |
} |
} |
private function execute_idrac($buffer, $device) |
{ |
$snmptablec = array(); //controller table |
$snmptableb = array(); //battery table |
$snmptablev = array(); //virtual disks table |
$snmptablep = array(); //physical disks table |
$buffer = preg_replace('/End of MIB\r?\n/', '', $buffer); |
$buffer = preg_replace('/\s\r?\n([^\.])/', ' $1', $buffer); |
$raiddata = preg_split("/\r?\n/", $buffer, -1, PREG_SPLIT_NO_EMPTY); |
if (!empty($raiddata)) { |
foreach ($raiddata as $line) { |
if (preg_match('/^(.+) = Hex-STRING:\s(.+)/', $line, $linetmp)) { |
$hexchars = explode(" ", trim($linetmp[2])); |
$newstring = ""; |
foreach ($hexchars as $hexchar) { |
$hexint = hexdec($hexchar); |
if (($hexint<32) || ($hexint>126)) { |
$newstring .= "."; |
} else { |
$newstring .= chr($hexint); |
} |
} |
if ($newstring!=="") { |
$line = $linetmp[1]." = STRING: ".$newstring; |
} |
} |
if (preg_match('/^\.1\.3\.6\.1\.4\.1\.674\.10892\.5\.5\.1\.20\.130\.1\.1\.2\.(.*) = STRING:\s(.*)/', $line, $data)) { |
$snmptablec[$data[1]]['controllerName']=trim($data[2], "\""); |
// } elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.674\.10892\.5\.5\.1\.20\.130\.1\.1\.8\.(.*) = STRING:\s(.*)/', $line, $data)) { |
// $snmptablec[$data[1]]['controllerFWVersion']=trim($data[2], "\""); |
} elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.674\.10892\.5\.5\.1\.20\.130\.1\.1\.9\.(.*) = INTEGER:\s(.*)/', $line, $data)) { |
$snmptablec[$data[1]]['controllerCacheSizeInMB']=$data[2]; |
} elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.674\.10892\.5\.5\.1\.20\.130\.1\.1\.37\.(.*) = INTEGER:\s(.*)/', $line, $data)) { |
$snmptablec[$data[1]]['controllerRollUpStatus']=$data[2]; |
} elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.674\.10892\.5\.5\.1\.20\.130\.1\.1\.78\.(.*) = STRING:\s(.*)/', $line, $data)) { |
$snmptablec[$data[1]]['controllerFQDD']=trim($data[2], "\""); |
} elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.674\.10892\.5\.5\.1\.20\.130\.15\.1\.4\.(.*) = INTEGER:\s(.*)/', $line, $data)) { |
$snmptableb[$data[1]]['batteryState']=$data[2]; |
// } elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.674\.10892\.5\.5\.1\.20\.130\.15\.1\.6\.(.*) = INTEGER:\s(.*)/', $line, $data)) { |
// $snmptableb[$data[1]]['batteryComponentStatus']=$data[2]; |
} elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.674\.10892\.5\.5\.1\.20\.130\.15\.1\.20\.(.*) = STRING:\s(.*)/', $line, $data)) { |
$snmptableb[$data[1]]['batteryFQDD']=trim($data[2], "\""); |
} elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.674\.10892\.5\.5\.1\.20\.130\.4\.1\.2\.(.*) = STRING:\s(.*)/', $line, $data)) { |
$snmptablep[$data[1]]['physicalDiskName']=trim($data[2], "\""); |
} elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.674\.10892\.5\.5\.1\.20\.130\.4\.1\.4\.(.*) = INTEGER:\s(.*)/', $line, $data)) { |
$snmptablep[$data[1]]['physicalDiskState']=$data[2]; |
// } elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.674\.10892\.5\.5\.1\.20\.130\.4\.1\.11\.(.*) = INTEGER:\s(.*)/', $line, $data)) { |
// $snmptablep[$data[1]]['physicalDiskCapacityInMB']=$data[2]; |
// } elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.674\.10892\.5\.5\.1\.20\.130\.4\.1\.22\.(.*) = INTEGER:\s(.*)/', $line, $data)) { |
// $snmptablep[$data[1]]['physicalDiskSpareState']=$data[2]; |
// } elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.674\.10892\.5\.5\.1\.20\.130\.4\.1\.24\.(.*) = INTEGER:\s(.*)/', $line, $data)) { |
// $snmptablep[$data[1]]['physicalDiskComponentStatus']=$data[2]; |
// } elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.674\.10892\.5\.5\.1\.20\.130\.4\.1\.50\.(.*) = INTEGER:\s(.*)/', $line, $data)) { |
// $snmptablep[$data[1]]['physicalDiskOperationalState']=$data[2]; |
// } elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.674\.10892\.5\.5\.1\.20\.130\.4\.1\.51\.(.*) = INTEGER:\s(.*)/', $line, $data)) { |
// $snmptablep[$data[1]]['physicalDiskProgress']=$data[2]; |
} elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.674\.10892\.5\.5\.1\.20\.130\.4\.1\.54\.(.*) = STRING:\s(.*)/', $line, $data)) { |
$snmptablep[$data[1]]['physicalDiskFQDD']=trim($data[2], "\""); |
} elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.674\.10892\.5\.5\.1\.20\.140\.1\.1\.2\.(.*) = STRING:\s(.*)/', $line, $data)) { |
$snmptablev[$data[1]]['virtualDiskName']=trim($data[2], "\""); |
} elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.674\.10892\.5\.5\.1\.20\.140\.1\.1\.4\.(.*) = INTEGER:\s(.*)/', $line, $data)) { |
$snmptablev[$data[1]]['virtualDiskState']=$data[2]; |
} elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.674\.10892\.5\.5\.1\.20\.140\.1\.1\.6\.(.*) = INTEGER:\s(.*)/', $line, $data)) { |
$snmptablev[$data[1]]['virtualDiskSizeInMB']=$data[2]; |
} elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.674\.10892\.5\.5\.1\.20\.140\.1\.1\.10\.(.*) = INTEGER:\s(.*)/', $line, $data)) { |
$snmptablev[$data[1]]['virtualDiskWritePolicy']=$data[2]; |
} elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.674\.10892\.5\.5\.1\.20\.140\.1\.1\.11\.(.*) = INTEGER:\s(.*)/', $line, $data)) { |
$snmptablev[$data[1]]['virtualDiskReadPolicy']=$data[2]; |
} elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.674\.10892\.5\.5\.1\.20\.140\.1\.1\.13\.(.*) = INTEGER:\s(.*)/', $line, $data)) { |
$snmptablev[$data[1]]['virtualDiskLayout']=$data[2]; |
// } elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.674\.10892\.5\.5\.1\.20\.140\.1\.1\.14\.(.*) = INTEGER:\s(.*)/', $line, $data)) { |
// $snmptablev[$data[1]]['virtualDiskStripeSize']=$data[2]; |
// } elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.674\.10892\.5\.5\.1\.20\.140\.1\.1\.20\.(.*) = INTEGER:\s(.*)/', $line, $data)) { |
// $snmptablev[$data[1]]['virtualDiskComponentStatus']=$data[2]; |
} elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.674\.10892\.5\.5\.1\.20\.140\.1\.1\.23\.(.*) = INTEGER:\s(.*)/', $line, $data)) { |
$snmptablev[$data[1]]['virtualDiskBadBlocksDetected']=$data[2]; |
// } elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.674\.10892\.5\.5\.1\.20\.140\.1\.1\.26\.(.*) = INTEGER:\s(.*)/', $line, $data)) { |
// $snmptablev[$data[1]]['virtualDiskDiskCachePolicy']=$data[2]; |
} elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.674\.10892\.5\.5\.1\.20\.140\.1\.1\.30\.(.*) = INTEGER:\s(.*)/', $line, $data)) { |
$snmptablev[$data[1]]['virtualDiskOperationalState']=$data[2]; |
} elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.674\.10892\.5\.5\.1\.20\.140\.1\.1\.31\.(.*) = INTEGER:\s(.*)/', $line, $data)) { |
$snmptablev[$data[1]]['virtualDiskProgress']=$data[2]; |
} elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.674\.10892\.5\.5\.1\.20\.140\.1\.1\.35\.(.*) = STRING:\s(.*)/', $line, $data)) { |
$snmptablev[$data[1]]['virtualDiskFQDD']=trim($data[2], "\""); |
} |
} |
foreach ($snmptablec as $raid_controller) { |
$tablec = array(); //controller result table |
if (isset($raid_controller['controllerRollUpStatus'])) { |
switch ($raid_controller['controllerRollUpStatus']) { |
case 1: |
$tablec['status'] = "W"; |
$tablec['info'] = "Other"; |
break; |
case 2: |
$tablec['status'] = "W"; |
$tablec['info'] = "Unknown"; |
break; |
case 3: |
$tablec['status'] ="ok"; |
break; |
case 4: |
$tablec['status'] ="W"; |
$tablec['info'] ="Non-critical"; |
break; |
case 5: |
$tablec['status'] = "F"; |
$tablec['info'] = "Critical"; |
break; |
case 6: |
$tablec['status'] = "F"; |
$tablec['info'] = "Non-recoverable"; |
break; |
} |
} |
if (isset($raid_controller['controllerName'])) { |
$tablec['controller'] = $raid_controller['controllerName']; |
} |
if (isset($raid_controller['controllerCacheSizeInMB'])) { |
$tablec['cache_size'] = $raid_controller['controllerCacheSizeInMB'] * 1024 * 1024; |
} |
foreach ($snmptableb as $raid_battery) { |
if (isset($raid_battery['batteryFQDD']) |
&& isset($raid_controller['controllerFQDD']) |
&& preg_match("/:".$raid_controller['controllerFQDD']."$/", $raid_battery['batteryFQDD'])) { |
if (isset($raid_battery['batteryState'])) { |
switch ($raid_battery['batteryState']) { |
case 1: |
$tablec['battery'] = "unknown"; |
break; |
case 2: |
$tablec['battery'] = "ready"; |
break; |
case 3: |
$tablec['battery'] = "failed"; |
break; |
case 4: |
$tablec['battery'] = "degraded"; |
break; |
case 5: |
$tablec['battery'] = "missing"; |
break; |
case 6: |
$tablec['battery'] = "charging"; |
break; |
case 7: |
$tablec['battery'] = "bellowThreshold"; |
break; |
} |
} |
break; |
} |
} |
foreach ($snmptablep as $raid_physical) { |
if (isset($raid_physical['physicalDiskFQDD']) |
&& isset($raid_controller['controllerFQDD']) |
&& preg_match("/:".$raid_controller['controllerFQDD']."$/", $raid_physical['physicalDiskFQDD'])) { |
$devname = $device.'-'.preg_replace('/[a-zA-Z\.]/', '', $raid_controller['controllerFQDD']); |
$this->_result['devices'][$devname]['prog'] = 'idrac'; |
$this->_result['devices'][$devname]['name']=$raid_controller['controllerFQDD']; |
if (isset($tablec['controller'])) { |
$this->_result['devices'][$devname]['controller'] = $tablec['controller']; |
} |
if (isset($tablec['battery'])) { |
$this->_result['devices'][$devname]['battery'] = $tablec['battery']; |
} |
if (isset($tablec['info'])) { |
$this->_result['devices'][$devname]['status'] = $tablec['info']; |
} elseif (isset($tablec['status'])) { |
$this->_result['devices'][$devname]['status'] = $tablec['status']; |
} |
$this->_result['devices'][$devname]['items'][0]['name']=$raid_controller['controllerFQDD']; |
$this->_result['devices'][$devname]['items'][0]['parentid'] = 0; |
if (isset($tablec['status'])) { |
$this->_result['devices'][$devname]['items'][0]['status'] = $tablec['status']; |
if (isset($tablec['info'])) { |
$this->_result['devices'][$devname]['items'][0]['info'] = $tablec['info']; |
} |
} |
$this->_result['devices'][$devname]['items'][$raid_physical['physicalDiskName']]['name']=$raid_physical['physicalDiskName']; |
$this->_result['devices'][$devname]['items'][$raid_physical['physicalDiskName']]['parentid'] = 1; |
$this->_result['devices'][$devname]['items'][$raid_physical['physicalDiskName']]['type'] = 'disk'; |
if (isset($raid_physical['physicalDiskState'])) { |
switch ($raid_physical['physicalDiskState']) { |
case 1: |
$this->_result['devices'][$devname]['items'][$raid_physical['physicalDiskName']]['status'] = "W"; |
$this->_result['devices'][$devname]['items'][$raid_physical['physicalDiskName']]['info'] = "unknown"; |
break; |
case 2: |
$this->_result['devices'][$devname]['items'][$raid_physical['physicalDiskName']]['status'] = "W"; |
$this->_result['devices'][$devname]['items'][$raid_physical['physicalDiskName']]['info'] = "ready"; |
break; |
case 3: |
$this->_result['devices'][$devname]['items'][$raid_physical['physicalDiskName']]['status'] = "ok"; |
$this->_result['devices'][$devname]['items'][$raid_physical['physicalDiskName']]['info'] = "online"; |
break; |
case 4: |
$this->_result['devices'][$devname]['items'][$raid_physical['physicalDiskName']]['status'] = "W"; |
$this->_result['devices'][$devname]['items'][$raid_physical['physicalDiskName']]['info'] = "foreign"; |
break; |
case 5: |
$this->_result['devices'][$devname]['items'][$raid_physical['physicalDiskName']]['status'] = "F"; |
$this->_result['devices'][$devname]['items'][$raid_physical['physicalDiskName']]['info'] = "offline"; |
break; |
case 6: |
$this->_result['devices'][$devname]['items'][$raid_physical['physicalDiskName']]['status'] = "F"; |
$this->_result['devices'][$devname]['items'][$raid_physical['physicalDiskName']]['info'] = "blocked"; |
break; |
case 7: |
$this->_result['devices'][$devname]['items'][$raid_physical['physicalDiskName']]['status'] = "F"; |
$this->_result['devices'][$devname]['items'][$raid_physical['physicalDiskName']]['info'] = "failed"; |
break; |
case 8: |
$this->_result['devices'][$devname]['items'][$raid_physical['physicalDiskName']]['status'] = "S"; |
$this->_result['devices'][$devname]['items'][$raid_physical['physicalDiskName']]['info'] = "non-raid"; |
break; |
case 9: |
$this->_result['devices'][$devname]['items'][$raid_physical['physicalDiskName']]['status'] = "F"; |
$this->_result['devices'][$devname]['items'][$raid_physical['physicalDiskName']]['info'] = "removed"; |
break; |
} |
} |
} |
} |
foreach ($snmptablev as $raid_virtual) { |
if (isset($raid_virtual['virtualDiskFQDD']) |
&& isset($raid_controller['controllerFQDD']) |
&& preg_match("/:".$raid_controller['controllerFQDD']."$/", $raid_virtual['virtualDiskFQDD'])) { |
$devname = $device.'-'.preg_replace('/[a-zA-Z\.]/', '', $raid_virtual['virtualDiskFQDD']); |
$this->_result['devices'][$devname]['prog'] = 'idrac'; |
$this->_result['devices'][$devname]['name']=$raid_virtual['virtualDiskFQDD']; |
$this->_result['devices'][$devname]['items'][0]['name']=$raid_virtual['virtualDiskFQDD']; |
$this->_result['devices'][$devname]['items'][0]['parentid'] = 0; |
if (isset($tablec['controller'])) { |
$this->_result['devices'][$devname]['controller'] = $tablec['controller']; |
} |
if (isset($tablec['battery'])) { |
$this->_result['devices'][$devname]['battery'] = $tablec['battery']; |
} |
if (isset($tablec['cache_size'])) { |
$this->_result['devices'][$devname]['cache_size'] = $tablec['cache_size']; |
} |
if (isset($raid_virtual['virtualDiskLayout'])) { |
switch ($raid_virtual['virtualDiskLayout']) { |
case 1: |
$this->_result['devices'][$devname]['level'] = "other"; |
break; |
case 2: |
$this->_result['devices'][$devname]['level'] = "raid0"; |
break; |
case 3: |
$this->_result['devices'][$devname]['level'] = "raid1"; |
break; |
case 4: |
$this->_result['devices'][$devname]['level'] = "raid5"; |
break; |
case 5: |
$this->_result['devices'][$devname]['level'] = "raid6"; |
break; |
case 6: |
$this->_result['devices'][$devname]['level'] = "raid10"; |
break; |
case 7: |
$this->_result['devices'][$devname]['level'] = "raid50"; |
break; |
case 8: |
$this->_result['devices'][$devname]['level'] = "raid60"; |
break; |
case 9: |
$this->_result['devices'][$devname]['level'] = "concatraid1"; |
break; |
case 10: |
$this->_result['devices'][$devname]['level'] = "concatraid5"; |
break; |
default: |
$this->_result['devices'][$devname]['level'] = "unknown"; |
} |
if (isset($this->_result['devices'][$devname]['level'])) { |
$this->_result['devices'][$devname]['items'][0]['name'] = $this->_result['devices'][$devname]['level']; |
} |
} |
if (isset($raid_virtual['virtualDiskState'])) { |
switch ($raid_virtual['virtualDiskState']) { |
case 1: |
$this->_result['devices'][$devname]['status'] = "unknown"; |
$this->_result['devices'][$devname]['items'][0]['status']="W"; |
$this->_result['devices'][$devname]['items'][0]['info'] = $this->_result['devices'][$devname]['status']; |
break; |
case 2: |
$this->_result['devices'][$devname]['status'] = "online"; |
$this->_result['devices'][$devname]['items'][0]['status']="ok"; |
$this->_result['devices'][$devname]['items'][0]['info'] = $this->_result['devices'][$devname]['status']; |
break; |
case 3: |
$this->_result['devices'][$devname]['status'] = "failed"; |
$this->_result['devices'][$devname]['items'][0]['status']="F"; |
$this->_result['devices'][$devname]['items'][0]['info'] = $this->_result['devices'][$devname]['status']; |
break; |
case 4: |
$this->_result['devices'][$devname]['status'] = "degraded"; |
$this->_result['devices'][$devname]['items'][0]['status']="W"; |
$this->_result['devices'][$devname]['items'][0]['info'] = $this->_result['devices'][$devname]['status']; |
break; |
} |
} |
if (isset($raid_virtual['virtualDiskOperationalState'])) { |
switch ($raid_virtual['virtualDiskOperationalState']) { |
case 1: |
//$this->_result['devices'][$devname]['action']['name'] = "notApplicable"; |
break; |
case 2: |
$this->_result['devices'][$devname]['action']['name'] = "reconstructing"; |
if (isset($raid_virtual['virtualDiskProgress'])) { |
$this->_result['devices'][$devname]['action']['percent'] = $raid_virtual['virtualDiskProgress']; |
} else { |
$this->_result['devices'][$devname]['action']['percent'] = 0; |
} |
break; |
case 3: |
$this->_result['devices'][$devname]['action']['name'] = "resyncing"; |
if (isset($raid_virtual['virtualDiskProgress'])) { |
$this->_result['devices'][$devname]['action']['percent'] = $raid_virtual['virtualDiskProgress']; |
} else { |
$this->_result['devices'][$devname]['action']['percent'] = 0; |
} |
break; |
case 4: |
$this->_result['devices'][$devname]['action']['name'] = "initializing"; |
if (isset($raid_virtual['virtualDiskProgress'])) { |
$this->_result['devices'][$devname]['action']['percent'] = $raid_virtual['virtualDiskProgress']; |
} else { |
$this->_result['devices'][$devname]['action']['percent'] = 0; |
} |
break; |
case 5: |
$this->_result['devices'][$devname]['action']['name'] = "backgroundInit"; |
if (isset($raid_virtual['virtualDiskProgress'])) { |
$this->_result['devices'][$devname]['action']['percent'] = $raid_virtual['virtualDiskProgress']; |
} else { |
$this->_result['devices'][$devname]['action']['percent'] = 0; |
} |
break; |
} |
} |
if (isset($raid_virtual['virtualDiskSizeInMB'])) { |
$this->_result['devices'][$devname]['size'] = $raid_virtual['virtualDiskSizeInMB'] * 1024 * 1024; |
} |
if (isset($raid_virtual['virtualDiskReadPolicy'])) { |
switch ($raid_virtual['virtualDiskReadPolicy']) { |
case 1: |
$this->_result['devices'][$devname]['readpolicy'] = "noReadAhead"; |
break; |
case 2: |
$this->_result['devices'][$devname]['readpolicy'] = "readAhead"; |
break; |
case 3: |
$this->_result['devices'][$devname]['readpolicy'] = "adaptiveReadAhead"; |
break; |
} |
} |
if (isset($raid_virtual['virtualDiskWritePolicy'])) { |
switch ($raid_virtual['virtualDiskWritePolicy']) { |
case 1: |
$this->_result['devices'][$devname]['writepolicy'] = "writeThrough"; |
break; |
case 2: |
$this->_result['devices'][$devname]['writepolicy'] = "writeBack"; |
break; |
case 3: |
$this->_result['devices'][$devname]['writepolicy'] = "writeBackForce"; |
break; |
} |
} |
if (isset($raid_virtual['virtualDiskState'])) { |
switch ($raid_virtual['virtualDiskState']) { |
case 1: |
$this->_result['devices'][$devname]['status'] = "unknown"; |
break; |
case 2: |
$this->_result['devices'][$devname]['status'] = "online"; |
break; |
case 3: |
$this->_result['devices'][$devname]['status'] = "failed"; |
break; |
case 4: |
$this->_result['devices'][$devname]['status'] = "degraded"; |
break; |
} |
} |
if (isset($raid_virtual['virtualDiskBadBlocksDetected'])) { |
$this->_result['devices'][$devname]['bad_blocks'] = $raid_virtual['virtualDiskBadBlocksDetected']; |
} |
} |
} |
} |
} |
} |
/** |
* doing all tasks to get the required informations that the plugin needs |
* result is stored in an internal array<br>the array is build like a tree, |
* so that it is possible to get only a specific process with the childs |
* |
* @return void |
*/ |
public function execute() |
{ |
if (count($this->_filecontent)>0) { |
foreach ($this->prog_items as $item) if (isset($this->_filecontent[$item])) { |
if ($item !== 'idrac') { |
if (!is_null($buffer = $this->_filecontent[$item]) && (($buffer = trim($buffer)) != "")) { |
switch ($item) { |
case 'mdstat': |
$this->execute_mdstat($buffer); |
break; |
case 'dmraid': |
$this->execute_dmraid($buffer); |
break; |
case 'megactl': |
$this->execute_megactl($buffer, false); |
break; |
case 'megasasctl': |
$this->execute_megactl($buffer, true); |
break; |
case 'graid': |
$this->execute_graid($buffer); |
break; |
case 'zpool': |
$this->execute_zpool($buffer); |
break; |
} |
} |
} else { |
if (is_array($this->_filecontent[$item])) { |
foreach ($this->_filecontent[$item] as $device=>$buffer) if (($buffer = trim($buffer)) != "") { |
$this->execute_idrac($buffer, /*'idrac-'.*/$device); |
} |
} |
} |
} |
} |
} |
/** |
* generates the XML content for the plugin |
* |
* @return SimpleXMLElement entire XML content for the plugin |
*/ |
public function xml() |
{ |
if (empty($this->_result)) { |
return $this->xml->getSimpleXmlElement(); |
} |
$hideRaids = array(); |
if (defined('PSI_PLUGIN_RAID_HIDE_DEVICES') && is_string(PSI_PLUGIN_RAID_HIDE_DEVICES)) { |
if (preg_match(ARRAY_EXP, PSI_PLUGIN_RAID_HIDE_DEVICES)) { |
$hideRaids = eval(PSI_PLUGIN_RAID_HIDE_DEVICES); |
} else { |
$hideRaids = array(PSI_PLUGIN_RAID_HIDE_DEVICES); |
} |
} |
foreach ($this->_result['devices'] as $key=>$device) { |
if (!in_array(ltrim($key, "/"), $hideRaids, true)) { |
$dev = $this->xml->addChild("Raid"); |
$dev->addAttribute("Device_Name", ltrim($key, "/")); //for megactl and megasasctl conflicts |
$dev->addAttribute("Program", $device["prog"]); |
if (isset($device['level'])) $dev->addAttribute("Level", strtolower($device["level"])); |
$dev->addAttribute("Status", strtolower($device["status"])); |
if (isset($device['name'])) $dev->addAttribute("Name", $device["name"]); |
if (isset($device['size'])) $dev->addAttribute("Size", $device["size"]); |
if (isset($device['stride'])) $dev->addAttribute("Stride", $device["stride"]); |
if (isset($device['subsets'])) $dev->addAttribute("Subsets", $device["subsets"]); |
if (isset($device['devs'])) $dev->addAttribute("Devs", $device["devs"]); |
if (isset($device['spares'])) $dev->addAttribute("Spares", $device["spares"]); |
if (isset($device['chunk_size'])) $dev->addAttribute("Chunk_Size", $device["chunk_size"]); |
if (isset($device['pers_superblock'])) $dev->addAttribute("Persistend_Superblock", $device["pers_superblock"]); |
if (isset($device['algorithm'])) $dev->addAttribute("Algorithm", $device["algorithm"]); |
if (isset($device['registered'])) $dev->addAttribute("Disks_Registered", $device["registered"]); |
if (isset($device['active'])) $dev->addAttribute("Disks_Active", $device["active"]); |
if (isset($device['controller'])) $dev->addAttribute("Controller", $device["controller"]); |
if (isset($device['battery'])) $dev->addAttribute("Battery", $device["battery"]); |
if (isset($device['supported'])) $dev->addAttribute("Supported", $device["supported"]); |
if (isset($device['readpolicy'])) $dev->addAttribute("ReadPolicy", $device["readpolicy"]); |
if (isset($device['writepolicy'])) $dev->addAttribute("WritePolicy", $device["writepolicy"]); |
if (isset($device['cache_size'])) $dev->addAttribute("Cache_Size", $device["cache_size"]); |
if (isset($device['bad_blocks'])) $dev->addAttribute("Bad_Blocks", $device["bad_blocks"]); |
if (isset($device['action'])) { |
$action = $dev->addChild("Action"); |
$action->addAttribute("Name", $device['action']['name']); |
if (isset($device['action']['percent'])) $action->addAttribute("Percent", $device['action']['percent']); |
if (isset($device['action']['finish_time'])) $action->addAttribute("Time_To_Finish", $device['action']['finish_time']); |
if (isset($device['action']['finish_unit'])) $action->addAttribute("Time_Unit", $device['action']['finish_unit']); |
} |
$disks = $dev->addChild("RaidItems"); |
if (isset($device['items']) && (sizeof($device['items'])>0)) foreach ($device['items'] as $disk) { |
if (isset($disk['name'])) { |
$disktemp = $disks->addChild("Item"); |
$disktemp->addAttribute("Name", $disk['name']); |
// if (isset($disk['raid_index'])) $disktemp->addAttribute("Index", $disk['raid_index']); |
if (isset($disk['parentid'])) $disktemp->addAttribute("ParentID", $disk['parentid']); |
if (isset($disk['type'])) $disktemp->addAttribute("Type", $disk['type']); |
// if (in_array(strtolower($device["status"]), array('ok', 'optimal', 'active', 'online', 'degraded'))) { |
$disktemp->addAttribute("Status", $disk['status']); |
//} else { |
// $disktemp->addAttribute("Status", "W"); |
//} |
if (isset($disk['info'])) $disktemp->addAttribute("Info", $disk['info']); |
} |
} |
} |
} |
return $this->xml->getSimpleXmlElement(); |
} |
} |
/web/acc/phpsysinfo/plugins/raid/css/raid.css |
---|
0,0 → 1,27 |
/* |
$Id: raid.css 661 2012-08-27 11:26:39Z namiltd $ |
*/ |
.plugin_raid_biun { |
text-align: center; |
margin-bottom: 5px; |
margin-left: 10px; |
_margin-left: 5px; /* ie6 */ |
margin-right: 10px; |
_margin-right: 5px; /* ie6 */ |
float: left; |
} |
.plugin_raid_item { |
border: solid; |
border-width: 2px; |
border-radius: 5px; |
text-align: center; |
margin: 10px; |
_margin: 10px 10px 10px 5px; /* ie6 */ |
_padding-bottom: 8px; /* ie6 */ |
float: left; |
} |
img.plugin_raid_biun { |
margin: auto; |
} |
/web/acc/phpsysinfo/plugins/raid/gfx/error.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes: |
Added: svn:mime-type |
+image/png |
\ No newline at end of property |
/web/acc/phpsysinfo/plugins/raid/gfx/harddrivefail.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes: |
Added: svn:mime-type |
+image/png |
\ No newline at end of property |
/web/acc/phpsysinfo/plugins/raid/gfx/harddriveok.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes: |
Added: svn:mime-type |
+image/png |
\ No newline at end of property |
/web/acc/phpsysinfo/plugins/raid/gfx/harddrivespare.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes: |
Added: svn:mime-type |
+image/png |
\ No newline at end of property |
/web/acc/phpsysinfo/plugins/raid/gfx/harddriveunc.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes: |
Added: svn:mime-type |
+image/png |
\ No newline at end of property |
/web/acc/phpsysinfo/plugins/raid/gfx/harddrivewarn.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes: |
Added: svn:mime-type |
+image/png |
\ No newline at end of property |
/web/acc/phpsysinfo/plugins/raid/js/raid.js |
---|
0,0 → 1,264 |
/*************************************************************************** |
* Copyright (C) 2008 by phpSysInfo - A PHP System Information Script * |
* http://phpsysinfo.sourceforge.net/ * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License, or * |
* (at your option) any later version. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
***************************************************************************/ |
// |
// $Id: raid.js 679 2012-09-04 10:10:11Z namiltd $ |
// |
/*global $, jQuery, buildBlock, genlang, createBar, plugin_translate, datetime */ |
"use strict"; |
var raid_show = false; |
/** |
* get the details of the raid |
* @param {jQuery} xml part of the plugin-XML |
* @param {number} id id of the device |
*/ |
function raid_buildinfos(xml, id) { |
var html = "", prog = "", devname = "", devstatus = "", devlevel = "", devcontroller = "", devbattery = "", devsupported = "", devsize = 0, devstride = 0, devsubsets = 0, devdevs = 0, devspares = 0, devchunk = 0, devalgor = "", devpersist = 0, devreg = 0, devact = 0, devcache = 0, devbad = 0, devread = "", devwrite = "", button = ""; |
prog = $(xml).attr("Program"); |
devname = $(xml).attr("Name"); |
devstatus = $(xml).attr("Status"); |
devlevel = $(xml).attr("Level"); |
devcontroller = $(xml).attr("Controller"); |
devbattery = $(xml).attr("Battery"); |
devsupported = $(xml).attr("Supported"); |
devsize = parseInt($(xml).attr("Size"), 10); |
devstride = parseInt($(xml).attr("Stride"), 10); |
devsubsets = parseInt($(xml).attr("Subsets"), 10); |
devdevs = parseInt($(xml).attr("Devs"), 10); |
devspares = parseInt($(xml).attr("Spares"), 10); |
devchunk = parseInt($(xml).attr("Chunk_Size"), 10); |
devalgor = $(xml).attr("Algorithm"); |
devpersist = parseInt($(xml).attr("Persistend_Superblock"), 10); |
devreg = parseInt($(xml).attr("Disks_Registered"), 10); |
devact = parseInt($(xml).attr("Disks_Active"), 10); |
devcache = parseInt($(xml).attr("Cache_Size"), 10); |
devbad = parseInt($(xml).attr("Bad_Blocks"), 10); |
devread = $(xml).attr("ReadPolicy"); |
devwrite = $(xml).attr("WritePolicy"); |
html += "<tr><td>" + genlang(22, "Raid") + "</td><td>" + prog + "</td></tr>"; |
if (devname !== undefined) html += "<tr><td>" + genlang(3, "Raid") + "</td><td>" + devname + "</td></tr>"; |
html += "<tr><td>" + genlang(4, "Raid") + "</td><td>" + devstatus + "</td></tr>"; |
if (devlevel !== undefined) html += "<tr><td>" + genlang(5, "Raid") + "</td><td>" + devlevel + "</td></tr>"; |
if (!isNaN(devsize)) html += "<tr><td>" + genlang(6, "Raid") + "</td><td>" + formatBytes(devsize, xml) + "</td></tr>"; |
if (!isNaN(devstride)) html += "<tr><td>" + genlang(7, "Raid") + "</td><td>" + devstride + "</td></tr>"; |
if (!isNaN(devsubsets)) html += "<tr><td>" + genlang(8, "Raid") + "</td><td>" + devsubsets + "</td></tr>"; |
if (!isNaN(devdevs)) html += "<tr><td>" + genlang(9, "Raid") + "</td><td>" + devdevs + "</td></tr>"; |
if (!isNaN(devspares)) html += "<tr><td>" + genlang(10, "Raid") + "</td><td>" + devspares + "</td></tr>"; |
if (!isNaN(devchunk)) html += "<tr><td>" + genlang(13, "Raid") + "</td><td>" + devchunk + "K</td></tr>"; |
if (devalgor !== undefined) html += "<tr><td>" + genlang(14, "Raid") + "</td><td>" + devalgor + "</td></tr>"; |
if (!isNaN(devpersist)) { |
if (devpersist == 1) { |
html += "<tr><td>" + genlang(15, "Raid") + "</td><td>" + genlang(16, "Raid") + "</td></tr>"; |
} else { |
html += "<tr><td>" + genlang(15, "Raid") + "</td><td>" + genlang(17, "Raid") + "</td></tr>"; |
} |
} |
if (!isNaN(devreg) && !isNaN(devact)) html += "<tr><td>" + genlang(18, "Raid") + "</td><td>" + devreg + "/" + devact + "</td></tr>"; |
if (devcontroller !== undefined) html += "<tr><td>" + genlang(19, "Raid") + "</td><td>" + devcontroller + "</td></tr>"; |
if (devbattery !== undefined) html += "<tr><td>" + genlang(20, "Raid") + "</td><td>" + devbattery + "</td></tr>"; |
if (devsupported !== undefined) html += "<tr><td>" + genlang(21, "Raid") + "</td><td>" + devsupported + "</td></tr>"; |
if (devread !== undefined) html += "<tr><td>" + genlang(23, "Raid") + "</td><td>" + devread + "</td></tr>"; |
if (devwrite !== undefined) html += "<tr><td>" + genlang(24, "Raid") + "</td><td>" + devwrite + "</td></tr>"; |
if (!isNaN(devcache)) html += "<tr><td>" + genlang(25, "Raid") + "</td><td>" + formatBytes(devcache, xml) + "</td></tr>"; |
if (!isNaN(devbad)) html += "<tr><td>" + genlang(26, "Raid") + "</td><td>" + devbad + "</td></tr>"; |
button += "<h3 style=\"cursor:pointer\" id=\"sPlugin_Raid_Info" + id + "\"><img src=\"./gfx/bullet_toggle_plus.gif\" alt=\"plus\" title=\"\" style=\"vertical-align:middle;width:16px;\" />" + genlang(2, "Raid") + "</h3>"; |
button += "<h3 style=\"cursor:pointer; display:none;\" id=\"hPlugin_Raid_Info" + id + "\"><img src=\"./gfx/bullet_toggle_minus.gif\" alt=\"minus\" title=\"\" style=\"vertical-align:middle;width:16px;\" />" + genlang(2, "Raid") + "</h3>"; |
button += "<table id=\"Plugin_Raid_InfoTable" + id + "\" style=\"border:none; border-collapse:collapse; display:none;\"><tbody>" + html + "</tbody></table>"; |
return button; |
} |
/** |
* generate a html string with the current action on the disks |
* @param {jQuery} xml part of the plugin-XML |
*/ |
function raid_buildaction(xml) { |
var html = "", name = "", time = "", tunit = "", percent = 0; |
$("Action", xml).each(function mdstatus_getaction(id) { |
name = $(this).attr("Name"); |
if (parseInt(name, 10) !== -1) { |
time = $(this).attr("Time_To_Finish"); |
tunit = $(this).attr("Time_Unit"); |
percent = parseFloat($(this).attr("Percent")); |
html += "<div style=\"padding-left:10px;\">"; |
html += genlang(11, "Raid") + ": " + name + "<br>"; |
html += createBar(percent); |
if ((time !== undefined) && (tunit !== undefined)) { |
html += "<br>"; |
html += genlang(12, "Raid") + ": " + time + " " + tunit; |
} |
html += "</div>"; |
} |
}); |
return html; |
} |
/** |
* choose the right diskdrive icon |
* @param {jQuery} xml part of the plugin-XML |
*/ |
function raid_diskicon(xml, id) { |
$("RaidItems Item", xml).each(function raid_getitems(itemid) { |
var status = "", name = "", type = "", info = "", parentid = 0; |
status = $(this).attr("Status"); |
name = $(this).attr("Name"); |
type = $(this).attr("Type"); |
info = $(this).attr("Info"); |
if (info === undefined) info = ""; |
parentid = parseInt($(this).attr("ParentID"), 10); |
var img = "", alt = "", bcolor = ""; |
switch (status) { |
case "ok": |
img = "harddriveok.png"; |
alt = "ok"; |
bcolor = "green"; |
break; |
case "F": |
img = "harddrivefail.png"; |
alt = "fail"; |
bcolor = "red"; |
break; |
case "U": |
img = "harddriveunc.png"; |
alt = "unconfigured"; |
bcolor = "purple"; |
break; |
case "S": |
img = "harddrivespare.png"; |
alt = "spare"; |
bcolor = "gray"; |
break; |
case "W": |
img = "harddrivewarn.png"; |
alt = "warning"; |
bcolor = "orange"; |
break; |
default: |
// alert("--" + diskstatus + "--"); |
img = "error.png"; |
alt = "error"; |
break; |
} |
if (!isNaN(parentid)) { |
if (type === "disk") { |
$("#Plugin_Raid_Item" + id + "-" + parentid).append("<div class=\"plugin_raid_biun\" title=\"" + info + "\"><img src=\"./plugins/raid/gfx/" + img + "\" alt=\"" + alt + "\" style=\"width:60px;height:60px;\" onload=\"PNGload($(this));\" /><br><small>" + name + "</small></div>"); //onload IE6 PNG fix |
} else { |
if (parentid === 0) { |
$("#Plugin_Raid_List-" + id).append("<div class=\"plugin_raid_item\" id=\"Plugin_Raid_Item" + id + "-" + (itemid+1) + "\" style=\"border-color:" + bcolor + "\">" + name + "<br></div>"); |
} else { |
$("#Plugin_Raid_Item" + id + "-" + parentid).append("<div class=\"plugin_raid_item\" id=\"Plugin_Raid_Item" + id + "-" + (itemid+1) + "\" style=\"border-color:" + bcolor + "\">" + name + "<br></div>"); |
} |
} |
} |
}); |
} |
/** |
* fill the plugin block |
* @param {jQuery} xml plugin-XML |
*/ |
function raid_populate(xml) { |
$("#Plugin_RaidTable").empty(); |
$("#Plugin_RaidTable").append("<tbody>"); |
var arr = $("Plugins Plugin_Raid Raid", xml); |
arr.each(function raid_getdevice(id) { |
var htmldisks = "", buildedaction = ""; |
htmldisks += "<table style=\"border:none; width:100%;\"><tbody>"; |
htmldisks += "<tr><td id=\"Plugin_Raid_List-" + id + "\"></td></tr>"; |
buildedaction = raid_buildaction($(this)); |
if (buildedaction) { |
htmldisks += "<tr><td>" + buildedaction + "</td></tr>"; |
} |
htmldisks += "<tr><td>" + raid_buildinfos($(this), id); |
/*if (id != (arr.length - 1)) { // not last element |
htmldisks += "<br>"; |
}*/ |
htmldisks += "</td></tr>"; |
htmldisks += "</tbody></table>"; |
$("#Plugin_RaidTable").append("<tr><td><br>" + $(this).attr("Device_Name") + "</td><td>" + htmldisks + "</td></tr>"); |
raid_diskicon(this, id); |
$("#sPlugin_Raid_Info" + id).click(function raid_showinfo() { |
$("#Plugin_Raid_InfoTable" + id).slideDown("fast"); |
$("#sPlugin_Raid_Info" + id).hide(); |
$("#hPlugin_Raid_Info" + id).show(); |
}); |
$("#hPlugin_Raid_Info" + id).click(function raid_hideinfo() { |
$("#Plugin_Raid_InfoTable" + id).slideUp("fast"); |
$("#hPlugin_Raid_Info" + id).hide(); |
$("#sPlugin_Raid_Info" + id).show(); |
}); |
raid_show = true; |
}); |
$("#Plugin_RaidTable").append("</tbody>"); |
} |
/** |
* load the xml via ajax |
*/ |
function raid_request() { |
$("#Reload_RaidTable").attr("title", "reload"); |
$.ajax({ |
url: "xml.php?plugin=Raid", |
dataType: "xml", |
error: function raid_error() { |
$.jGrowl("Error loading XML document for Plugin Raid"); |
}, |
success: function raid_buildblock(xml) { |
populateErrors(xml); |
raid_populate(xml); |
if (raid_show) { |
plugin_translate("Raid"); |
$("#Plugin_Raid").show(); |
} |
} |
}); |
} |
$(document).ready(function raid_buildpage() { |
var html = ""; |
$("#footer").before(buildBlock("Raid", 1, true)); |
html += " <div style=\"overflow-x:auto;\">\n"; |
html += " <table id=\"Plugin_RaidTable\" style=\"border-collapse:collapse;\">\n"; |
html += " </table>\n"; |
html += " </div>\n"; |
$("#Plugin_Raid").append(html); |
$("#Plugin_Raid").css("width", "915px"); |
raid_request(); |
$("#Reload_RaidTable").click(function raid_reload(id) { |
raid_request(); |
$(this).attr("title", datetime()); |
}); |
}); |
/web/acc/phpsysinfo/plugins/raid/js/raid_bootstrap.js |
---|
0,0 → 1,160 |
function renderPlugin_raid(data) { |
function raid_buildaction(data) { |
var html = "", name = "", percent = 0; |
if (data !== undefined) { |
name = data.Name; |
if ((name !== undefined) && (parseInt(name) !== -1)) { |
percent = Math.round(parseFloat(data.Percent)); |
html += "<div>" + genlang(11,'raid') + ":" + String.fromCharCode(160) + name + "<br>"; |
html += '<table class="table table-nopadding" style="width:100%;"><tbody><tr><td style="width:44%;"><div class="progress">' + |
'<div class="progress-bar progress-bar-info" style="width:' + percent + '%;"></div>' + |
'</div><div class="percent">' + percent + '%</div></td><td> </td></tr></tbody></table>'; |
if ((data.Time_To_Finish !== undefined) && (data.Time_Unit !== undefined)) { |
html += genlang(12,'raid') + ":" + String.fromCharCode(160) + data.Time_To_Finish + String.fromCharCode(160) + data.Time_Unit; |
} |
html += "</div>"; |
} |
} |
return html; |
} |
function raid_diskicon(data , id, itemid) { |
var info = ""; |
info = data.Info; |
if (info === undefined) info = ""; |
parentid = parseInt(data.ParentID, 10); |
var img = "", alt = "", bcolor = ""; |
switch (data.Status) { |
case "ok": |
img = "harddriveok.png"; |
alt = "ok"; |
bcolor = "green"; |
break; |
case "F": |
img = "harddrivefail.png"; |
alt = "fail"; |
bcolor = "red"; |
break; |
case "S": |
img = "harddrivespare.png"; |
alt = "spare"; |
bcolor = "gray"; |
break; |
case "U": |
img = "harddriveunc.png"; |
alt = "unconfigured"; |
bcolor = "purple"; |
break; |
case "W": |
img = "harddrivewarn.png"; |
alt = "warning"; |
bcolor = "orange"; |
break; |
default: |
// alert("--" + diskstatus + "--"); |
img = "error.png"; |
alt = "error"; |
break; |
} |
if (!isNaN(parentid)) { |
if (data.Type === "disk") { |
$("#raid_item" + id + "-" + parentid).append("<div style=\"margin-bottom:5px;margin-right:10px;margin-left:10px;float:left;text-align:center\" title=\"" + info + "\"><img src=\"./plugins/raid/gfx/" + img + "\" alt=\"" + alt + "\" style=\"width:60px;height:60px;\" /><br><small>" + data.Name + "</small></div>"); |
} else { |
if (parentid === 0) { |
$("#raid_list-" + id).append("<div id=\"raid_item" + id + "-" + (itemid+1) + "\" style=\"border:solid;border-width:2px;border-radius:5px;border-color:" + bcolor + ";margin:10px;float:left;text-align:center\">" + data.Name + "<br></div>"); |
} else { |
$("#raid_item" + id + "-" + parentid).append("<div id=\"raid_item" + id + "-" + (itemid+1) + "\" style=\"border:solid;border-width:2px;border-radius:5px;border-color:" + bcolor + ";margin:10px;float:left;text-align:center\">" + data.Name + "<br></div>"); |
} |
} |
} |
} |
if (data.Plugins.Plugin_Raid !== undefined) { |
var raiditems = items(data.Plugins.Plugin_Raid.Raid); |
if (raiditems.length > 0) { |
var html = ''; |
for (var i = 0; i < raiditems.length ; i++) { |
html += "<tr><th>"+raiditems[i]["@attributes"].Device_Name+"</th><td>"; |
if (raiditems[i].RaidItems !== undefined) { |
html += "<table class=\"table table-nopadding\" style=\"width:100%;\"><tbody>"; |
html += "<tr><td id=\"raid_list-" + i + "\"></td></tr>"; |
if (raiditems[i].Action !== undefined) { |
var buildedaction = raid_buildaction(raiditems[i].Action['@attributes']); |
if (buildedaction) { |
html += "<tr><td>" + buildedaction + "</td></tr>"; |
} |
} |
html += "<tr><td>"; |
html += "<table id=\"raid-" + i + "\"class=\"table table-hover table-sm\"><tbody>"; |
html += "<tr class=\"treegrid-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">" + genlang(2, "raid") + "</span></td><td></td></tr>"; |
html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(22, 'raid')+"</span></td><td>" + raiditems[i]["@attributes"].Program + "</td></tr>"; // Program |
if (raiditems[i]["@attributes"].Name !== undefined) html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(3, 'raid')+"</span></td><td>" + raiditems[i]["@attributes"].Name + "</td></tr>"; // Name |
html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(4, 'raid')+"</span></td><td>" + raiditems[i]["@attributes"].Status + "</td></tr>"; // Status |
if (raiditems[i]["@attributes"].Level !== undefined) html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(5, 'raid')+"</span></td><td>" + raiditems[i]["@attributes"].Level + "</td></tr>"; // RAID-Level |
if (!isNaN(parseInt(raiditems[i]["@attributes"].Size))) html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(6, 'raid')+"</span></td><td>" + formatBytes(parseInt(raiditems[i]["@attributes"].Size), data.Options["@attributes"].byteFormat) + "</td></tr>";// Size |
if (!isNaN(parseInt(raiditems[i]["@attributes"].Stride))) html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(7, 'raid')+"</span></td><td>" + parseInt(raiditems[i]["@attributes"].Stride) + "</td></tr>"; // Stride |
if (!isNaN(parseInt(raiditems[i]["@attributes"].Subsets))) html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(8, 'raid')+"</span></td><td>" + parseInt(raiditems[i]["@attributes"].Subsets) + "</td></tr>"; // Subsets |
if (raiditems[i]["@attributes"].Devs !== undefined) html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(9, 'raid')+"</span></td><td>" + parseInt(raiditems[i]["@attributes"].Devs) + "</td></tr>"; // Devices |
if (!isNaN(parseInt(raiditems[i]["@attributes"].Spares))) html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(10, 'raid')+"</span></td><td>" + parseInt(raiditems[i]["@attributes"].Spares) + "</td></tr>"; // Spares |
if (!isNaN(parseInt(raiditems[i]["@attributes"].Chunk_Size))) html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(13, 'raid')+"</span></td><td>" + parseInt(raiditems[i]["@attributes"].Chunk_Size) + "K</td></tr>"; |
if (raiditems[i]["@attributes"].Algorithm !== undefined) html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(14, 'raid')+"</span></td><td>" + raiditems[i]["@attributes"].Algorithm + "</td></tr>"; |
if (!isNaN(parseInt(raiditems[i]["@attributes"].Persistend_Superblock))) { |
if (parseInt(raiditems[i]["@attributes"].Persistend_Superblock) == 1) { |
html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(15, 'raid')+"</span></td><td>"+genlang(16, 'raid')+"</td></tr>"; |
} else { |
html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(15, 'raid')+"</span></td><td>"+genlang(17, 'raid')+"</td></tr>"; |
} |
} |
if (!isNaN(parseInt(raiditems[i]["@attributes"].Disks_Registered)) && !isNaN(parseInt(raiditems[i]["@attributes"].Disks_Active))) { |
html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(18, 'raid')+"</span></td><td>" + parseInt(raiditems[i]["@attributes"].Disks_Registered) + "/<wbr>" + parseInt(raiditems[i]["@attributes"].Disks_Active) + "</td></tr>"; |
} |
if (raiditems[i]["@attributes"].Controller !== undefined) html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(19, 'raid')+"</span></td><td>" + raiditems[i]["@attributes"].Controller + "</td></tr>"; // Controller |
if (raiditems[i]["@attributes"].Battery !== undefined) html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(20, 'raid')+"</span></td><td>" + raiditems[i]["@attributes"].Battery + "</td></tr>"; // Battery Condition |
if (raiditems[i]["@attributes"].Supported !== undefined) html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(21, 'raid')+"</span></td><td>" + raiditems[i]["@attributes"].Supported + "</td></tr>"; // Supported RAID-Types |
if (raiditems[i]["@attributes"].ReadPolicy !== undefined) html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(23, 'raid')+"</span></td><td>" + raiditems[i]["@attributes"].ReadPolicy + "</td></tr>"; // Read Policy |
if (raiditems[i]["@attributes"].WritePolicy !== undefined) html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(24, 'raid')+"</span></td><td>" + raiditems[i]["@attributes"].WritePolicy + "</td></tr>"; // Write Policy |
if (raiditems[i]["@attributes"].Cache_Size !== undefined) html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(25, 'raid')+"</span></td><td>" + formatBytes(parseInt(raiditems[i]["@attributes"].Cache_Size), data.Options["@attributes"].byteFormat) + "</td></tr>"; // Cache_Size |
if (raiditems[i]["@attributes"].Bad_Blocks !== undefined) html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(26, 'raid')+"</span></td><td>" + parseInt(raiditems[i]["@attributes"].Bad_Blocks) + "</td></tr>"; // Bad_Blocks |
html += "</tbody></table>"; |
html += "</td></tr>"; |
html += "</tbody></table>"; |
} |
/*if (i < raiditems.length-1) { // not last element |
html += "<br>"; |
}*/ |
html +="</td></tr>"; |
} |
$('#raid-data').empty().append(html); |
for (var k = 0; k < raiditems.length ; k++) { |
if (raiditems[k].RaidItems !== undefined) { |
var diskitems = items(raiditems[k].RaidItems.Item); |
for (var j = 0; j < diskitems.length ; j++) { |
raid_diskicon(diskitems[j]["@attributes"], k, j); |
} |
$('#raid-'+k).treegrid({ |
initialState: 'collapsed', |
expanderExpandedClass: 'normalicon normalicon-down', |
expanderCollapsedClass: 'normalicon normalicon-right' |
}); |
} |
} |
$('#block_raid').show(); |
} else { |
$('#block_raid').hide(); |
} |
} else { |
$('#block_raid').hide(); |
} |
} |
/web/acc/phpsysinfo/plugins/raid/lang/cz.xml |
---|
0,0 → 1,87 |
<?xml version="1.0" encoding="utf-8"?> |
<!-- $Id: cz.xml 661 2012-08-27 11:26:39Z namiltd $ --> |
<!-- |
phpSysInfo language file Language: Czech Created by: Tomáš Růžička |
--> |
<tns:translationPlugin language="czech" charset="utf-8" |
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd"> |
<expression id="plugin_raid_001" name="raid_title"> |
<exp>Stav RAIDu</exp> |
</expression> |
<expression id="plugin_raid_002" name="raid_infos"> |
<exp>Dodatečné informace </exp> |
</expression> |
<expression id="plugin_raid_003" name="raid_name"> |
<exp>Name</exp> |
</expression> |
<expression id="plugin_raid_004" name="raid_status"> |
<exp>Stav</exp> |
</expression> |
<expression id="plugin_raid_005" name="raid_level"> |
<exp>Úroveň RAIDu</exp> |
</expression> |
<expression id="plugin_raid_006" name="raid_size"> |
<exp>Size</exp> |
</expression> |
<expression id="plugin_raid_007" name="raid_stride"> |
<exp>Stride</exp> |
</expression> |
<expression id="plugin_raid_008" name="raid_subsets"> |
<exp>Subsets</exp> |
</expression> |
<expression id="plugin_raid_009" name="raid_devs"> |
<exp>Devices</exp> |
</expression> |
<expression id="plugin_raid_010" name="raid_spares"> |
<exp>Spares</exp> |
</expression> |
<expression id="plugin_raid_011" name="raid_curact"> |
<exp>Current Action</exp> |
</expression> |
<expression id="plugin_raid_012" name="raid_finish"> |
<exp>Čas dokončení</exp> |
</expression> |
<expression id="plugin_raid_013" name="raid_chunk"> |
<exp>Velikost proužku</exp> |
</expression> |
<expression id="plugin_raid_014" name="raid_algo"> |
<exp>Algoritmus</exp> |
</expression> |
<expression id="plugin_raid_015" name="raid_superb"> |
<exp>Persistentní Superblock</exp> |
</expression> |
<expression id="plugin_raid_016" name="raid_avail"> |
<exp>dostupný</exp> |
</expression> |
<expression id="plugin_raid_017" name="raids_navail"> |
<exp>nedostupný</exp> |
</expression> |
<expression id="plugin_raid_018" name="raid_regact"> |
<exp>Registrovné/aktivní disky</exp> |
</expression> |
<expression id="plugin_raid_019" name="raid_controller"> |
<exp>Controller</exp> |
</expression> |
<expression id="plugin_raid_020" name="raid_battcond"> |
<exp>Battery Condition</exp> |
</expression> |
<expression id="plugin_raid_021" name="raid_supported"> |
<exp>Poodporované typy RAID</exp> |
</expression> |
<expression id="plugin_raid_022" name="raid_program"> |
<exp>Program</exp> |
</expression> |
<expression id="plugin_raid_023" name="raid_readpolicy"> |
<exp>Read Policy</exp> |
</expression> |
<expression id="plugin_raid_024" name="raid_writepolicy"> |
<exp>Write Policy</exp> |
</expression> |
<expression id="plugin_raid_025" name="raid_cachesize"> |
<exp>Cache Size</exp> |
</expression> |
<expression id="plugin_raid_026" name="raid_badblocks"> |
<exp>Bad Blocks</exp> |
</expression> |
</tns:translationPlugin> |
/web/acc/phpsysinfo/plugins/raid/lang/de.xml |
---|
0,0 → 1,87 |
<?xml version="1.0" encoding="utf-8"?> |
<!-- $Id: de.xml 661 2012-08-27 11:26:39Z namiltd $ --> |
<!-- |
phpSysInfo language file Language: German Created by: Michael Cramer |
--> |
<tns:translationPlugin language="german" charset="utf-8" |
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd"> |
<expression id="plugin_raid_001" name="raid_title"> |
<exp>RAID Status</exp> |
</expression> |
<expression id="plugin_raid_002" name="raid_infos"> |
<exp>Zusätzliche Informationen</exp> |
</expression> |
<expression id="plugin_raid_003" name="raid_name"> |
<exp>Name</exp> |
</expression> |
<expression id="plugin_raid_004" name="raid_status"> |
<exp>Status</exp> |
</expression> |
<expression id="plugin_raid_005" name="raid_level"> |
<exp>RAID-Level</exp> |
</expression> |
<expression id="plugin_raid_006" name="raid_size"> |
<exp>Size</exp> |
</expression> |
<expression id="plugin_raid_007" name="raid_stride"> |
<exp>Stride</exp> |
</expression> |
<expression id="plugin_raid_008" name="raid_subsets"> |
<exp>Subsets</exp> |
</expression> |
<expression id="plugin_raid_009" name="raid_devs"> |
<exp>Devices</exp> |
</expression> |
<expression id="plugin_raid_010" name="raid_spares"> |
<exp>Spares</exp> |
</expression> |
<expression id="plugin_raid_011" name="raid_curact"> |
<exp>Current Action</exp> |
</expression> |
<expression id="plugin_raid_012" name="raid_finish"> |
<exp>Fertig in</exp> |
</expression> |
<expression id="plugin_raid_013" name="raid_chunk"> |
<exp>Blockgröße</exp> |
</expression> |
<expression id="plugin_raid_014" name="raid_algo"> |
<exp>Algorithmus</exp> |
</expression> |
<expression id="plugin_raid_015" name="raid_superb"> |
<exp>Persistenter Superblock</exp> |
</expression> |
<expression id="plugin_raid_016" name="raid_avail"> |
<exp>verfügbar</exp> |
</expression> |
<expression id="plugin_raid_017" name="raids_navail"> |
<exp>nicht verfügbar</exp> |
</expression> |
<expression id="plugin_raid_018" name="raid_regact"> |
<exp>Registrierte/Aktive Platten</exp> |
</expression> |
<expression id="plugin_raid_019" name="raid_controller"> |
<exp>Controller</exp> |
</expression> |
<expression id="plugin_raid_020" name="raid_battcond"> |
<exp>Akku-Zustand</exp> |
</expression> |
<expression id="plugin_raid_021" name="raid_supported"> |
<exp>Unterstützte RAID-Typen</exp> |
</expression> |
<expression id="plugin_raid_022" name="raid_program"> |
<exp>Program</exp> |
</expression> |
<expression id="plugin_raid_023" name="raid_readpolicy"> |
<exp>Read Policy</exp> |
</expression> |
<expression id="plugin_raid_024" name="raid_writepolicy"> |
<exp>Write Policy</exp> |
</expression> |
<expression id="plugin_raid_025" name="raid_cachesize"> |
<exp>Cache Size</exp> |
</expression> |
<expression id="plugin_raid_026" name="raid_badblocks"> |
<exp>Bad Blocks</exp> |
</expression> |
</tns:translationPlugin> |
/web/acc/phpsysinfo/plugins/raid/lang/en.xml |
---|
0,0 → 1,87 |
<?xml version="1.0" encoding="utf-8"?> |
<!-- $Id: en.xml 661 2012-08-27 11:26:39Z namiltd $ --> |
<!-- |
phpSysInfo language file Language: English Created by: Michael Cramer |
--> |
<tns:translationPlugin language="english" charset="utf-8" |
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd"> |
<expression id="plugin_raid_001" name="raid_title"> |
<exp>RAID Status</exp> |
</expression> |
<expression id="plugin_raid_002" name="raid_infos"> |
<exp>Additional Information</exp> |
</expression> |
<expression id="plugin_raid_003" name="raid_name"> |
<exp>Name</exp> |
</expression> |
<expression id="plugin_raid_004" name="raid_status"> |
<exp>Status</exp> |
</expression> |
<expression id="plugin_raid_005" name="raid_level"> |
<exp>RAID-Level</exp> |
</expression> |
<expression id="plugin_raid_006" name="raid_size"> |
<exp>Size</exp> |
</expression> |
<expression id="plugin_raid_007" name="raid_stride"> |
<exp>Stride</exp> |
</expression> |
<expression id="plugin_raid_008" name="raid_subsets"> |
<exp>Subsets</exp> |
</expression> |
<expression id="plugin_raid_009" name="raid_devs"> |
<exp>Devices</exp> |
</expression> |
<expression id="plugin_raid_010" name="raid_spares"> |
<exp>Spares</exp> |
</expression> |
<expression id="plugin_raid_011" name="raid_curact"> |
<exp>Current Action</exp> |
</expression> |
<expression id="plugin_raid_012" name="raid_finish"> |
<exp>Finishing in</exp> |
</expression> |
<expression id="plugin_raid_013" name="raid_chunk"> |
<exp>Chunk Size</exp> |
</expression> |
<expression id="plugin_raid_014" name="raid_algo"> |
<exp>Algorithm</exp> |
</expression> |
<expression id="plugin_raid_015" name="raid_superb"> |
<exp>Persistent Superblock</exp> |
</expression> |
<expression id="plugin_raid_016" name="raid_avail"> |
<exp>available</exp> |
</expression> |
<expression id="plugin_raid_017" name="raids_navail"> |
<exp>not available</exp> |
</expression> |
<expression id="plugin_raid_018" name="raid_regact"> |
<exp>Registered/Active Disks</exp> |
</expression> |
<expression id="plugin_raid_019" name="raid_controller"> |
<exp>Controller</exp> |
</expression> |
<expression id="plugin_raid_020" name="raid_battcond"> |
<exp>Battery Condition</exp> |
</expression> |
<expression id="plugin_raid_021" name="raid_supported"> |
<exp>Supported RAID-Types</exp> |
</expression> |
<expression id="plugin_raid_022" name="raid_program"> |
<exp>Program</exp> |
</expression> |
<expression id="plugin_raid_023" name="raid_readpolicy"> |
<exp>Read Policy</exp> |
</expression> |
<expression id="plugin_raid_024" name="raid_writepolicy"> |
<exp>Write Policy</exp> |
</expression> |
<expression id="plugin_raid_025" name="raid_cachesize"> |
<exp>Cache Size</exp> |
</expression> |
<expression id="plugin_raid_026" name="raid_badblocks"> |
<exp>Bad Blocks</exp> |
</expression> |
</tns:translationPlugin> |
/web/acc/phpsysinfo/plugins/raid/lang/fr.xml |
---|
0,0 → 1,86 |
<?xml version="1.0" encoding="utf-8"?> |
<!-- |
phpSysInfo language file Language: French Created by: phpsysinfo |
--> |
<tns:translationPlugin language="french" charset="utf-8" |
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd"> |
<expression id="plugin_raid_001" name="raid_title"> |
<exp>Statut RAID</exp> |
</expression> |
<expression id="plugin_raid_002" name="raid_infos"> |
<exp>Informations additionnelles</exp> |
</expression> |
<expression id="plugin_raid_003" name="raid_name"> |
<exp>Nom</exp> |
</expression> |
<expression id="plugin_raid_004" name="raid_status"> |
<exp>Status</exp> |
</expression> |
<expression id="plugin_raid_005" name="raid_level"> |
<exp>Type de RAID</exp> |
</expression> |
<expression id="plugin_raid_006" name="raid_size"> |
<exp>Taille</exp> |
</expression> |
<expression id="plugin_raid_007" name="raid_stride"> |
<exp>Granularité</exp> |
</expression> |
<expression id="plugin_raid_008" name="raid_subsets"> |
<exp>Sous-ensembles</exp> |
</expression> |
<expression id="plugin_raid_009" name="raid_devs"> |
<exp>Périphériques</exp> |
</expression> |
<expression id="plugin_raid_010" name="raid_spares"> |
<exp>Rechanges</exp> |
</expression> |
<expression id="plugin_raid_011" name="raid_curact"> |
<exp>Action courante</exp> |
</expression> |
<expression id="plugin_raid_012" name="raid_finish"> |
<exp>Temps restant</exp> |
</expression> |
<expression id="plugin_raid_013" name="raid_chunk"> |
<exp>Granularité</exp> |
</expression> |
<expression id="plugin_raid_014" name="raid_algo"> |
<exp>Algorithme</exp> |
</expression> |
<expression id="plugin_raid_015" name="raid_superb"> |
<exp>Superblocs persistants</exp> |
</expression> |
<expression id="plugin_raid_016" name="raid_avail"> |
<exp>disponible</exp> |
</expression> |
<expression id="plugin_raid_017" name="raids_navail"> |
<exp>non disponible</exp> |
</expression> |
<expression id="plugin_raid_018" name="raid_regact"> |
<exp>Disques Enregistrés/Actives</exp> |
</expression> |
<expression id="plugin_raid_019" name="raid_controller"> |
<exp>Controller</exp> |
</expression> |
<expression id="plugin_raid_020" name="raid_battcond"> |
<exp>Battery Condition</exp> |
</expression> |
<expression id="plugin_raid_021" name="raid_supported"> |
<exp>Type de RAID supporté</exp> |
</expression> |
<expression id="plugin_raid_022" name="raid_program"> |
<exp>Program</exp> |
</expression> |
<expression id="plugin_raid_023" name="raid_readpolicy"> |
<exp>Read Policy</exp> |
</expression> |
<expression id="plugin_raid_024" name="raid_writepolicy"> |
<exp>Write Policy</exp> |
</expression> |
<expression id="plugin_raid_025" name="raid_cachesize"> |
<exp>Cache Size</exp> |
</expression> |
<expression id="plugin_raid_026" name="raid_badblocks"> |
<exp>Bad Blocks</exp> |
</expression> |
</tns:translationPlugin> |
/web/acc/phpsysinfo/plugins/raid/lang/gr.xml |
---|
0,0 → 1,87 |
<?xml version="1.0" encoding="utf-8"?> |
<!-- $Id: gr.xml 661 2012-08-27 11:26:39Z namiltd $ --> |
<!-- |
phpSysInfo language file Language: Greek Created by: ChriZathens |
--> |
<tns:translationPlugin language="greek" charset="utf-8" |
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd"> |
<expression id="plugin_raid_001" name="raid_title"> |
<exp>Κατάσταση RAID</exp> |
</expression> |
<expression id="plugin_raid_002" name="raid_infos"> |
<exp>Επιπρόσθετες Πληροφορίες</exp> |
</expression> |
<expression id="plugin_raid_003" name="raid_name"> |
<exp>Όνομα</exp> |
</expression> |
<expression id="plugin_raid_004" name="raid_status"> |
<exp>Κατάσταση</exp> |
</expression> |
<expression id="plugin_raid_005" name="raid_level"> |
<exp>Τύπος RAID</exp> |
</expression> |
<expression id="plugin_raid_006" name="raid_size"> |
<exp>Μέγεθος</exp> |
</expression> |
<expression id="plugin_raid_007" name="raid_stride"> |
<exp>Stride</exp> |
</expression> |
<expression id="plugin_raid_008" name="raid_subsets"> |
<exp>Υποσύνολα</exp> |
</expression> |
<expression id="plugin_raid_009" name="raid_devs"> |
<exp>Συσκευές</exp> |
</expression> |
<expression id="plugin_raid_010" name="raid_spares"> |
<exp>Spares</exp> |
</expression> |
<expression id="plugin_raid_011" name="raid_curact"> |
<exp>Τρέχουσα Ενέργεια</exp> |
</expression> |
<expression id="plugin_raid_012" name="raid_finish"> |
<exp>Ολοκληρώνεται σε</exp> |
</expression> |
<expression id="plugin_raid_013" name="raid_chunk"> |
<exp>Μέγεθος Chunk</exp> |
</expression> |
<expression id="plugin_raid_014" name="raid_algo"> |
<exp>Αλγόριθμος</exp> |
</expression> |
<expression id="plugin_raid_015" name="raid_superb"> |
<exp>Μόνιμο Superblock</exp> |
</expression> |
<expression id="plugin_raid_016" name="raid_avail"> |
<exp>διαθέσιμο</exp> |
</expression> |
<expression id="plugin_raid_017" name="raids_navail"> |
<exp>μη διαθέσιμο</exp> |
</expression> |
<expression id="plugin_raid_018" name="raid_regact"> |
<exp>Δηλωμένοι/Ενεργοί Δίσκοι</exp> |
</expression> |
<expression id="plugin_raid_019" name="raid_controller"> |
<exp>Controller</exp> |
</expression> |
<expression id="plugin_raid_020" name="raid_battcond"> |
<exp>Κατάσταση Μπαταρίας</exp> |
</expression> |
<expression id="plugin_raid_021" name="raid_supported"> |
<exp>Αχρησιμοποίητοι Δίσκοι</exp> |
</expression> |
<expression id="plugin_raid_022" name="raid_program"> |
<exp>Πρόγραμμα</exp> |
</expression> |
<expression id="plugin_raid_023" name="raid_readpolicy"> |
<exp>Πολιτικές Ανάγνωσης</exp> |
</expression> |
<expression id="plugin_raid_024" name="raid_writepolicy"> |
<exp>Πολιτικές Εγγραφής</exp> |
</expression> |
<expression id="plugin_raid_025" name="raid_cachesize"> |
<exp>Μέγεθος Λανθάνουσας Μνήμης</exp> |
</expression> |
<expression id="plugin_raid_026" name="raid_badblocks"> |
<exp>Bad Blocks</exp> |
</expression> |
</tns:translationPlugin> |
/web/acc/phpsysinfo/plugins/raid/lang/ro.xml |
---|
0,0 → 1,87 |
<?xml version="1.0" encoding="utf-8"?> |
<!-- $Id: ro.xml 661 2014-05-02 11:26:39Z namiltd $ --> |
<!-- |
phpSysInfo language file Language: Romană Created by: Iulian Alexe |
--> |
<tns:translationPlugin language="romana" charset="utf-8" |
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd"> |
<expression id="plugin_raid_001" name="raid_title"> |
<exp>Stare RAID</exp> |
</expression> |
<expression id="plugin_raid_002" name="raid_infos"> |
<exp>Informații Aditionale </exp> |
</expression> |
<expression id="plugin_raid_003" name="raid_name"> |
<exp>Nume</exp> |
</expression> |
<expression id="plugin_raid_004" name="raid_status"> |
<exp>Stare</exp> |
</expression> |
<expression id="plugin_raid_005" name="raid_level"> |
<exp>Nivele RAID</exp> |
</expression> |
<expression id="plugin_raid_006" name="raid_size"> |
<exp>Dimensiune</exp> |
</expression> |
<expression id="plugin_raid_007" name="raid_stride"> |
<exp>Pas</exp> |
</expression> |
<expression id="plugin_raid_008" name="raid_subsets"> |
<exp>Subseturi</exp> |
</expression> |
<expression id="plugin_raid_009" name="raid_devs"> |
<exp>Dispozitive</exp> |
</expression> |
<expression id="plugin_raid_010" name="raid_spares"> |
<exp>Piese</exp> |
</expression> |
<expression id="plugin_raid_011" name="raid_curact"> |
<exp>Acțiune curentă</exp> |
</expression> |
<expression id="plugin_raid_012" name="raid_finish"> |
<exp>finisare în</exp> |
</expression> |
<expression id="plugin_raid_013" name="raid_chunk"> |
<exp>Chunk Size</exp> |
</expression> |
<expression id="plugin_raid_014" name="raid_algo"> |
<exp>Algoritm</exp> |
</expression> |
<expression id="plugin_raid_015" name="raid_superb"> |
<exp>Superblock persistente</exp> |
</expression> |
<expression id="plugin_raid_016" name="raid_avail"> |
<exp>disponibil</exp> |
</expression> |
<expression id="plugin_raid_017" name="raids_navail"> |
<exp>indisponibil</exp> |
</expression> |
<expression id="plugin_raid_018" name="raid_regact"> |
<exp>Înregistrate/Discuri Active</exp> |
</expression> |
<expression id="plugin_raid_019" name="raid_controller"> |
<exp>Controller</exp> |
</expression> |
<expression id="plugin_raid_020" name="raid_battcond"> |
<exp>Condiții Baterie</exp> |
</expression> |
<expression id="plugin_raid_021" name="raid_supported"> |
<exp>Discuri defolosite</exp> |
</expression> |
<expression id="plugin_raid_022" name="raid_program"> |
<exp>Program</exp> |
</expression> |
<expression id="plugin_raid_023" name="raid_readpolicy"> |
<exp>Read Policy</exp> |
</expression> |
<expression id="plugin_raid_024" name="raid_writepolicy"> |
<exp>Write Policy</exp> |
</expression> |
<expression id="plugin_raid_025" name="raid_cachesize"> |
<exp>Cache Size</exp> |
</expression> |
<expression id="plugin_raid_026" name="raid_badblocks"> |
<exp>Bad Blocks</exp> |
</expression> |
</tns:translationPlugin> |
/web/acc/phpsysinfo/plugins/raid/lang/ru.xml |
---|
0,0 → 1,86 |
<?xml version="1.0" encoding="utf-8"?> |
<!-- |
phpSysInfo language file Language: Russian Created by: Denis Sevostyanov (den007) |
--> |
<tns:translationPlugin language="russian" charset="utf-8" |
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd"> |
<expression id="plugin_raid_001" name="raid_title"> |
<exp>RAID Статус</exp> |
</expression> |
<expression id="plugin_raid_002" name="raid_infos"> |
<exp>Дополнительная Информация</exp> |
</expression> |
<expression id="plugin_raid_003" name="raid_name"> |
<exp>Имя</exp> |
</expression> |
<expression id="plugin_raid_004" name="raid_status"> |
<exp>Статус</exp> |
</expression> |
<expression id="plugin_raid_005" name="raid_level"> |
<exp>RAID-Уровень</exp> |
</expression> |
<expression id="plugin_raid_006" name="raid_size"> |
<exp>Размер</exp> |
</expression> |
<expression id="plugin_raid_007" name="raid_stride"> |
<exp>Шаг</exp> |
</expression> |
<expression id="plugin_raid_008" name="raid_subsets"> |
<exp>Подмножество</exp> |
</expression> |
<expression id="plugin_raid_009" name="raid_devs"> |
<exp>Устройство</exp> |
</expression> |
<expression id="plugin_raid_010" name="raid_spares"> |
<exp>Резервировано</exp> |
</expression> |
<expression id="plugin_raid_011" name="raid_curact"> |
<exp>Текущее действие</exp> |
</expression> |
<expression id="plugin_raid_012" name="raid_finish"> |
<exp>Окончание в</exp> |
</expression> |
<expression id="plugin_raid_013" name="raid_chunk"> |
<exp>Размер блока</exp> |
</expression> |
<expression id="plugin_raid_014" name="raid_algo"> |
<exp>Алгоритм</exp> |
</expression> |
<expression id="plugin_raid_015" name="raid_superb"> |
<exp>Постоянный суперблок</exp> |
</expression> |
<expression id="plugin_raid_016" name="raid_avail"> |
<exp>доступен</exp> |
</expression> |
<expression id="plugin_raid_017" name="raids_navail"> |
<exp>не доступен</exp> |
</expression> |
<expression id="plugin_raid_018" name="raid_regact"> |
<exp>Зарегистрировано/Активных Дисков</exp> |
</expression> |
<expression id="plugin_raid_019" name="raid_controller"> |
<exp>Controller</exp> |
</expression> |
<expression id="plugin_raid_020" name="raid_battcond"> |
<exp>Состояние аккумулятора</exp> |
</expression> |
<expression id="plugin_raid_021" name="raid_supported"> |
<exp>Неиспользуемые диски</exp> |
</expression> |
<expression id="plugin_raid_022" name="raid_program"> |
<exp>Program</exp> |
</expression> |
<expression id="plugin_raid_023" name="raid_readpolicy"> |
<exp>Read Policy</exp> |
</expression> |
<expression id="plugin_raid_024" name="raid_writepolicy"> |
<exp>Write Policy</exp> |
</expression> |
<expression id="plugin_raid_025" name="raid_cachesize"> |
<exp>Cache Size</exp> |
</expression> |
<expression id="plugin_raid_026" name="raid_badblocks"> |
<exp>Bad Blocks</exp> |
</expression> |
</tns:translationPlugin> |