Subversion Repositories ALCASAR

Rev

Rev 3037 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 3037 Rev 3100
Line 25... Line 25...
25
     * fill the private content var through tcp, command or data access
25
     * fill the private content var through tcp, command or data access
26
     */
26
     */
27
    public function __construct()
27
    public function __construct()
28
    {
28
    {
29
        parent::__construct();
29
        parent::__construct();
30
        if ((PSI_OS != 'WINNT') && !defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_MBMON_ACCESS')?strtolower(PSI_SENSOR_MBMON_ACCESS):'command') {
30
        if ((PSI_OS != 'WINNT') && (!defined('PSI_EMU_HOSTNAME') || defined('PSI_EMU_PORT'))) switch (defined('PSI_SENSOR_MBMON_ACCESS')?strtolower(PSI_SENSOR_MBMON_ACCESS):'command') {
31
        case 'tcp':
31
        case 'tcp':
32
            $fp = fsockopen("localhost", 411, $errno, $errstr, 5);
32
            $fp = fsockopen(defined('PSI_EMU_HOSTNAME')?PSI_EMU_HOSTNAME:'localhost', 411, $errno, $errstr, 5);
33
            if ($fp) {
33
            if ($fp) {
34
                $lines = "";
34
                $lines = "";
35
                while (!feof($fp)) {
35
                while (!feof($fp)) {
36
                    $lines .= fread($fp, 1024);
36
                    $lines .= fread($fp, 1024);
37
                }
37
                }
Line 43... Line 43...
43
        case 'command':
43
        case 'command':
44
            CommonFunctions::executeProgram('mbmon', '-c 1 -r', $lines, PSI_DEBUG);
44
            CommonFunctions::executeProgram('mbmon', '-c 1 -r', $lines, PSI_DEBUG);
45
            $this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
45
            $this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
46
            break;
46
            break;
47
        case 'data':
47
        case 'data':
48
            if (CommonFunctions::rftsdata('mbmon.tmp', $lines)) {
48
            if (!defined('PSI_EMU_PORT') && CommonFunctions::rftsdata('mbmon.tmp', $lines)) {
49
                $this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
49
                $this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
50
            }
50
            }
51
            break;
51
            break;
52
        default:
52
        default:
53
            $this->error->addConfigError('__construct()', '[sensor_mbmon] ACCESS');
53
            $this->error->addConfigError('__construct()', '[sensor_mbmon] ACCESS');