40,8 → 40,33 |
public function __construct() |
{ |
parent::__construct(); |
if (!defined('PSI_UPS_NUT_ACCESS')) { |
define('PSI_UPS_NUT_ACCESS', false); |
} |
switch (strtolower(PSI_UPS_NUT_ACCESS)) { |
case 'data': |
if (defined('PSI_UPS_NUT_LIST') && is_string(PSI_UPS_NUT_LIST)) { |
if (preg_match(ARRAY_EXP, PSI_UPS_NUT_LIST)) { |
$upss = eval(PSI_UPS_NUT_LIST); |
} else { |
$upss = array(PSI_UPS_NUT_LIST); |
} |
} else { |
$upss = array('UPS'); |
} |
$un = 0; |
foreach ($upss as $ups) { |
$temp = ""; |
CommonFunctions::rftsdata("upsnut{$un}.tmp", $temp); |
if (! empty($temp)) { |
$this->_output[$ups] = $temp; |
} |
$un++; |
} |
break; |
default: |
if (defined('PSI_UPS_NUT_LIST') && is_string(PSI_UPS_NUT_LIST)) { |
if (preg_match(ARRAY_EXP, PSI_UPS_NUT_LIST)) { |
$upses = eval(PSI_UPS_NUT_LIST); |
} else { |
$upses = array(PSI_UPS_NUT_LIST); |
50,9 → 75,11 |
CommonFunctions::executeProgram('upsc', '-l '.trim($ups), $output, PSI_DEBUG); |
$ups_names = preg_split("/\n/", $output, -1, PREG_SPLIT_NO_EMPTY); |
foreach ($ups_names as $ups_name) { |
CommonFunctions::executeProgram('upsc', trim($ups_name).'@'.trim($ups), $temp, PSI_DEBUG); |
$upsname = trim($ups_name).'@'.trim($ups); |
$temp = ""; |
CommonFunctions::executeProgram('upsc', $upsname, $temp, PSI_DEBUG); |
if (! empty($temp)) { |
$this->_output[trim($ups_name).'@'.trim($ups)] = $temp; |
$this->_output[$upsname] = $temp; |
} |
} |
} |
64,6 → 91,7 |
} |
$ups_names = preg_split("/\n/", $output, -1, PREG_SPLIT_NO_EMPTY); |
foreach ($ups_names as $ups_name) { |
$temp = ""; |
CommonFunctions::executeProgram('upsc', trim($ups_name), $temp, PSI_DEBUG); |
if (! empty($temp)) { |
$this->_output[trim($ups_name)] = $temp; |
71,6 → 99,7 |
} |
} |
} |
} |
|
/** |
* parse the input and store data in resultset for xml generation |
99,6 → 128,9 |
if (isset($ups_data['ups.status'])) { |
$dev->setStatus($ups_data['ups.status']); |
} |
if (isset($ups_data['ups.beeper.status'])) { |
$dev->setBeeperStatus($ups_data['ups.beeper.status']); |
} |
|
//Line |
if (isset($ups_data['input.voltage'])) { |
137,7 → 169,7 |
* |
* @see PSI_Interface_UPS::build() |
* |
* @return Void |
* @return void |
*/ |
public function build() |
{ |