Subversion Repositories ALCASAR

Rev

Rev 2976 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2976 Rev 3037
Line 31... Line 31...
31
        if (!defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_IPMITOOL_ACCESS')?strtolower(PSI_SENSOR_IPMITOOL_ACCESS):'command') {
31
        if (!defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_IPMITOOL_ACCESS')?strtolower(PSI_SENSOR_IPMITOOL_ACCESS):'command') {
32
        case 'command':
32
        case 'command':
33
            CommonFunctions::executeProgram('ipmitool', 'sensor -v', $lines);
33
            CommonFunctions::executeProgram('ipmitool', 'sensor -v', $lines);
34
            break;
34
            break;
35
        case 'data':
35
        case 'data':
36
            CommonFunctions::rfts(PSI_APP_ROOT.'/data/ipmitool.txt', $lines);
36
            CommonFunctions::rftsdata('ipmitool.tmp', $lines);
37
            break;
37
            break;
38
        default:
38
        default:
39
            $this->error->addConfigError('__construct()', '[sensor_ipmitool] ACCESS');
39
            $this->error->addConfigError('__construct()', '[sensor_ipmitool] ACCESS');
40
            break;
-
 
41
        }
40
        }
42
        if (trim($lines) !== "") {
41
        if (trim($lines) !== "") {
43
            if (preg_match("/^Sensor ID\s+/", $lines)) { //new data format ('ipmitool sensor -v')
42
            if (preg_match("/^Sensor ID\s+/", $lines)) { //new data format ('ipmitool sensor -v')
44
                $lines = preg_replace("/\n?Unable to read sensor/", "\nUnable to read sensor", $lines);
43
                $lines = preg_replace("/\n?Unable to read sensor/", "\nUnable to read sensor", $lines);
45
                $sensors = preg_split("/Sensor ID\s+/", $lines, -1, PREG_SPLIT_NO_EMPTY);
44
                $sensors = preg_split("/Sensor ID\s+/", $lines, -1, PREG_SPLIT_NO_EMPTY);
Line 124... Line 123...
124
                                    if (($buffer[1]==='0x0') || ($buffer[1]==='0x1')) {
123
                                    if (($buffer[1]==='0x0') || ($buffer[1]==='0x1')) {
125
                                        $sens['State'] = $buffer[1];
124
                                        $sens['State'] = $buffer[1];
126
                                        $sens['Sensor Type (Discrete)'] = '';
125
                                        $sens['Sensor Type (Discrete)'] = '';
127
                                        $sens['State'] = $buffer[1];
126
                                        $sens['State'] = $buffer[1];
128
                                    }
127
                                    }
129
                                    break;
-
 
130
                                }
128
                                }
131
                                $this->_buf[] = $sens;
129
                                $this->_buf[] = $sens;
132
                            }
130
                            }
133
                        }
131
                        }
134
                    }
132
                    }
Line 304... Line 302...
304
    /**
302
    /**
305
     * get the information
303
     * get the information
306
     *
304
     *
307
     * @see PSI_Interface_Sensor::build()
305
     * @see PSI_Interface_Sensor::build()
308
     *
306
     *
309
     * @return Void
307
     * @return void
310
     */
308
     */
311
    public function build()
309
    public function build()
312
    {
310
    {
313
        $this->_temperature();
311
        $this->_temperature();
314
        $this->_voltage();
312
        $this->_voltage();