Subversion Repositories ALCASAR

Rev

Rev 2770 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2770 Rev 3037
1
<?php
1
<?php
2
/**
2
/**
3
 * HP-UX System Class
3
 * HP-UX System Class
4
 *
4
 *
5
 * PHP version 5
5
 * PHP version 5
6
 *
6
 *
7
 * @category  PHP
7
 * @category  PHP
8
 * @package   PSI HPUX OS class
8
 * @package   PSI HPUX OS class
9
 * @author    Michael Cramer <BigMichi1@users.sourceforge.net>
9
 * @author    Michael Cramer <BigMichi1@users.sourceforge.net>
10
 * @copyright 2009 phpSysInfo
10
 * @copyright 2009 phpSysInfo
11
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
11
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
12
 * @version   SVN: $Id: class.HPUX.inc.php 596 2012-07-05 19:37:48Z namiltd $
12
 * @version   SVN: $Id: class.HPUX.inc.php 596 2012-07-05 19:37:48Z namiltd $
13
 * @link      http://phpsysinfo.sourceforge.net
13
 * @link      http://phpsysinfo.sourceforge.net
14
 */
14
 */
15
 /**
15
 /**
16
 * HP-UX sysinfo class
16
 * HP-UX sysinfo class
17
 * get all the required information from HP-UX system
17
 * get all the required information from HP-UX system
18
 *
18
 *
19
 * @category  PHP
19
 * @category  PHP
20
 * @package   PSI HPUX OS class
20
 * @package   PSI HPUX OS class
21
 * @author    Michael Cramer <BigMichi1@users.sourceforge.net>
21
 * @author    Michael Cramer <BigMichi1@users.sourceforge.net>
22
 * @copyright 2009 phpSysInfo
22
 * @copyright 2009 phpSysInfo
23
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
23
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
24
 * @version   Release: 3.0
24
 * @version   Release: 3.0
25
 * @link      http://phpsysinfo.sourceforge.net
25
 * @link      http://phpsysinfo.sourceforge.net
26
 */
26
 */
27
class HPUX extends OS
27
class HPUX extends OS
28
{
28
{
29
    /**
29
    /**
-
 
30
     * uptime command result.
-
 
31
     */
-
 
32
    private $_uptime = null;
-
 
33
 
-
 
34
    /**
30
     * Virtual Host Name
35
     * Virtual Host Name
31
     *
36
     *
32
     * @return void
37
     * @return void
33
     */
38
     */
34
    private function _hostname()
39
    private function _hostname()
35
    {
40
    {
36
        if (PSI_USE_VHOST === true) {
41
        if (PSI_USE_VHOST) {
37
            if (CommonFunctions::readenv('SERVER_NAME', $hnm)) $this->sys->setHostname($hnm);
42
            if (CommonFunctions::readenv('SERVER_NAME', $hnm)) $this->sys->setHostname($hnm);
38
        } else {
43
        } else {
39
            if (CommonFunctions::executeProgram('hostname', '', $ret)) {
44
            if (CommonFunctions::executeProgram('hostname', '', $ret)) {
40
                $this->sys->setHostname($ret);
45
                $this->sys->setHostname($ret);
41
            }
46
            }
42
        }
47
        }
43
    }
48
    }
44
 
49
 
45
    /**
50
    /**
46
     * HP-UX Version
51
     * HP-UX Version
47
     *
52
     *
48
     * @return void
53
     * @return void
49
     */
54
     */
50
    private function _kernel()
55
    private function _kernel()
51
    {
56
    {
52
        if (CommonFunctions::executeProgram('uname', '-srvm', $ret)) {
57
        if (CommonFunctions::executeProgram('uname', '-srvm', $ret)) {
53
            $this->sys->setKernel($ret);
58
            $this->sys->setKernel($ret);
54
        }
59
        }
55
    }
60
    }
56
 
61
 
57
    /**
62
    /**
58
     * UpTime
63
     * UpTime
59
     * time the system is running
64
     * time the system is running
60
     *
65
     *
61
     * @return void
66
     * @return void
62
     */
67
     */
63
    private function _uptime()
68
    private function _uptime()
64
    {
69
    {
65
        if (CommonFunctions::executeProgram('uptime', '', $buf)) {
70
        if (($this->_uptime !== null) || CommonFunctions::executeProgram('uptime', '', $this->_uptime)) {
66
            if (preg_match("/up (\d+) days,\s*(\d+):(\d+),/", $buf, $ar_buf)) {
71
            if (preg_match("/up (\d+) days,\s*(\d+):(\d+),/", $this->_uptime, $ar_buf)) {
67
                $min = $ar_buf[3];
72
                $min = $ar_buf[3];
68
                $hours = $ar_buf[2];
73
                $hours = $ar_buf[2];
69
                $days = $ar_buf[1];
74
                $days = $ar_buf[1];
70
                $this->sys->setUptime($days * 86400 + $hours * 3600 + $min * 60);
75
                $this->sys->setUptime($days * 86400 + $hours * 3600 + $min * 60);
71
            }
76
            }
72
        }
77
        }
73
    }
78
    }
74
 
79
 
75
    /**
80
    /**
76
     * Processor Load
81
     * Processor Load
77
     * optionally create a loadbar
82
     * optionally create a loadbar
78
     *
83
     *
79
     * @return void
84
     * @return void
80
     */
85
     */
81
    private function _loadavg()
86
    private function _loadavg()
82
    {
87
    {
83
        if (CommonFunctions::executeProgram('uptime', '', $buf)) {
88
        if (($this->_uptime !== null) || CommonFunctions::executeProgram('uptime', '', $this->_uptime)) {
84
            if (preg_match("/average: (.*), (.*), (.*)$/", $buf, $ar_buf)) {
89
            if (preg_match("/average: (.*), (.*), (.*)$/", $this->_uptime, $ar_buf)) {
85
                $this->sys->setLoad($ar_buf[1].' '.$ar_buf[2].' '.$ar_buf[3]);
90
                $this->sys->setLoad($ar_buf[1].' '.$ar_buf[2].' '.$ar_buf[3]);
86
            }
91
            }
87
        }
92
        }
88
    }
93
    }
89
 
94
 
90
    /**
95
    /**
91
     * CPU information
96
     * CPU information
92
     * All of the tags here are highly architecture dependant
97
     * All of the tags here are highly architecture dependant
93
     *
98
     *
94
     * @return void
99
     * @return void
95
     */
100
     */
96
    private function _cpuinfo()
101
    private function _cpuinfo()
97
    {
102
    {
98
        if (CommonFunctions::rfts('/proc/cpuinfo', $bufr)) {
103
        if (CommonFunctions::rfts('/proc/cpuinfo', $bufr)) {
99
            $processors = preg_split('/\s?\n\s?\n/', trim($bufr));
104
            $processors = preg_split('/\s?\n\s?\n/', trim($bufr));
100
            foreach ($processors as $processor) {
105
            foreach ($processors as $processor) {
101
                $dev = new CpuDevice();
106
                $dev = new CpuDevice();
102
                $details = preg_split("/\n/", $processor, -1, PREG_SPLIT_NO_EMPTY);
107
                $details = preg_split("/\n/", $processor, -1, PREG_SPLIT_NO_EMPTY);
103
                foreach ($details as $detail) {
108
                foreach ($details as $detail) {
104
                    $arrBuff = preg_split('/\s+:\s+/', trim($detail));
109
                    $arrBuff = preg_split('/\s+:\s+/', trim($detail));
105
                    if (count($arrBuff) == 2) {
110
                    if (count($arrBuff) == 2) {
106
                        switch (strtolower($arrBuff[0])) {
111
                        switch (strtolower($arrBuff[0])) {
107
                        case 'model name':
112
                        case 'model name':
108
                        case 'cpu':
113
                        case 'cpu':
109
                            $dev->setModel($arrBuff[1]);
114
                            $dev->setModel($arrBuff[1]);
110
                            break;
115
                            break;
111
                        case 'cpu mhz':
116
                        case 'cpu mhz':
112
                        case 'clock':
117
                        case 'clock':
113
                            $dev->setCpuSpeed($arrBuff[1]);
118
                            $dev->setCpuSpeed($arrBuff[1]);
114
                            break;
119
                            break;
115
                        case 'cycle frequency [hz]':
120
                        case 'cycle frequency [hz]':
116
                            $dev->setCpuSpeed($arrBuff[1] / 1000000);
121
                            $dev->setCpuSpeed($arrBuff[1] / 1000000);
117
                            break;
122
                            break;
118
                        case 'cpu0clktck':
123
                        case 'cpu0clktck':
119
                            $dev->setCpuSpeed(hexdec($arrBuff[1]) / 1000000); // Linux sparc64
124
                            $dev->setCpuSpeed(hexdec($arrBuff[1]) / 1000000); // Linux sparc64
120
                            break;
125
                            break;
121
                        case 'l2 cache':
126
                        case 'l2 cache':
122
                        case 'cache size':
127
                        case 'cache size':
123
                            $dev->setCache(preg_replace("/[a-zA-Z]/", "", $arrBuff[1]) * 1024);
128
                            $dev->setCache(preg_replace("/[a-zA-Z]/", "", $arrBuff[1]) * 1024);
124
                            break;
129
                            break;
125
                        case 'bogomips':
130
                        case 'bogomips':
126
                        case 'cpu0bogo':
131
                        case 'cpu0bogo':
127
                            $dev->setBogomips($arrBuff[1]);
132
                            $dev->setBogomips($arrBuff[1]);
128
                            break;
-
 
129
                        }
133
                        }
130
                    }
134
                    }
131
                }
135
                }
132
            }
136
            }
133
        }
137
        }
134
    }
138
    }
135
 
139
 
136
    /**
140
    /**
137
     * PCI devices
141
     * PCI devices
138
     *
142
     *
139
     * @return void
143
     * @return void
140
     */
144
     */
141
    private function _pci()
145
    private function _pci()
142
    {
146
    {
143
        if (CommonFunctions::rfts('/proc/pci', $bufr)) {
147
        if (CommonFunctions::rfts('/proc/pci', $bufr)) {
144
            $device = false;
148
            $device = false;
145
            $bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
149
            $bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
146
            foreach ($bufe as $buf) {
150
            foreach ($bufe as $buf) {
147
                if (preg_match('/^\s*Bus\s/', $buf)) {
151
                if (preg_match('/^\s*Bus\s/', $buf)) {
148
                    $device = true;
152
                    $device = true;
149
                    continue;
153
                    continue;
150
                }
154
                }
151
                if ($device) {
155
                if ($device) {
152
                    $dev = new HWDevice();
156
                    $dev = new HWDevice();
153
                    $dev->setName(preg_replace('/\([^\)]+\)\.$/', '', trim($buf)));
157
                    $dev->setName(preg_replace('/\([^\)]+\)\.$/', '', trim($buf)));
154
                    $this->sys->setPciDevices($dev);
158
                    $this->sys->setPciDevices($dev);
155
/*
159
/*
156
                    list($key, $value) = preg_split('/: /', $buf, 2);
160
                    list($key, $value) = preg_split('/: /', $buf, 2);
157
                    if (!preg_match('/bridge/i', $key) && !preg_match('/USB/i', $key)) {
161
                    if (!preg_match('/bridge/i', $key) && !preg_match('/USB/i', $key)) {
158
                        $dev = new HWDevice();
162
                        $dev = new HWDevice();
159
                        $dev->setName(preg_replace('/\([^\)]+\)\.$/', '', trim($value)));
163
                        $dev->setName(preg_replace('/\([^\)]+\)\.$/', '', trim($value)));
160
                        $this->sys->setPciDevices($dev);
164
                        $this->sys->setPciDevices($dev);
161
                    }
165
                    }
162
*/
166
*/
163
                    $device = false;
167
                    $device = false;
164
                }
168
                }
165
            }
169
            }
166
        }
170
        }
167
    }
171
    }
168
 
172
 
169
    /**
173
    /**
170
     * IDE devices
174
     * IDE devices
171
     *
175
     *
172
     * @return void
176
     * @return void
173
     */
177
     */
174
    private function _ide()
178
    private function _ide()
175
    {
179
    {
176
        $bufd = CommonFunctions::gdc('/proc/ide', false);
180
        $bufd = CommonFunctions::gdc('/proc/ide', false);
177
        foreach ($bufd as $file) {
181
        foreach ($bufd as $file) {
178
            if (preg_match('/^hd/', $file)) {
182
            if (preg_match('/^hd/', $file)) {
179
                $dev = new HWDevice();
183
                $dev = new HWDevice();
180
                $dev->setName(trim($file));
184
                $dev->setName(trim($file));
181
                if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS && CommonFunctions::rfts("/proc/ide/".$file."/media", $buf, 1)) {
185
                if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS && CommonFunctions::rfts("/proc/ide/".$file."/media", $buf, 1)) {
182
                    if (trim($buf) == 'disk') {
186
                    if (trim($buf) == 'disk') {
183
                        if (CommonFunctions::rfts("/proc/ide/".$file."/capacity", $buf, 1, 4096, false)) {
187
                        if (CommonFunctions::rfts("/proc/ide/".$file."/capacity", $buf, 1, 4096, false)) {
184
                            $dev->setCapacity(trim($buf) * 512);
188
                            $dev->setCapacity(trim($buf) * 512);
185
                        }
189
                        }
186
                    }
190
                    }
187
                }
191
                }
188
                $this->sys->setIdeDevices($dev);
192
                $this->sys->setIdeDevices($dev);
189
            }
193
            }
190
        }
194
        }
191
    }
195
    }
192
 
196
 
193
    /**
197
    /**
194
     * SCSI devices
198
     * SCSI devices
195
     *
199
     *
196
     * @return void
200
     * @return void
197
     */
201
     */
198
    private function _scsi()
202
    private function _scsi()
199
    {
203
    {
200
        $get_type = false;
204
        $get_type = false;
201
        if (CommonFunctions::rfts('/proc/scsi/scsi', $bufr, 0, 4096, PSI_DEBUG)) {
205
        if (CommonFunctions::rfts('/proc/scsi/scsi', $bufr, 0, 4096, PSI_DEBUG)) {
202
            $bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
206
            $bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
203
            foreach ($bufe as $buf) {
207
            foreach ($bufe as $buf) {
204
                if (preg_match('/Vendor: (.*) Model: (.*) Rev: (.*)/i', $buf, $dev)) {
208
                if (preg_match('/Vendor: (.*) Model: (.*) Rev: (.*)/i', $buf, $dev)) {
205
                    $get_type = true;
209
                    $get_type = true;
206
                    continue;
210
                    continue;
207
                }
211
                }
208
                if ($get_type) {
212
                if ($get_type) {
209
                    preg_match('/Type:\s+(\S+)/i', $buf, $dev_type);
213
                    preg_match('/Type:\s+(\S+)/i', $buf, $dev_type);
210
                    $dev = new HWDevice();
214
                    $dev = new HWDevice();
211
                    $dev->setName($dev[1].' '.$dev[2].' ('.$dev_type[1].')');
215
                    $dev->setName($dev[1].' '.$dev[2].' ('.$dev_type[1].')');
212
                    $this->sys->setScsiDevices($dev);
216
                    $this->sys->setScsiDevices($dev);
213
                    $get_type = false;
217
                    $get_type = false;
214
                }
218
                }
215
            }
219
            }
216
        }
220
        }
217
    }
221
    }
218
 
222
 
219
    /**
223
    /**
220
     * USB devices
224
     * USB devices
221
     *
225
     *
222
     * @return void
226
     * @return void
223
     */
227
     */
224
    private function _usb()
228
    private function _usb()
225
    {
229
    {
226
        if (CommonFunctions::rfts('/proc/bus/usb/devices', $bufr, 0, 4096, false)) {
230
        if (CommonFunctions::rfts('/proc/bus/usb/devices', $bufr, 0, 4096, false)) {
227
            $bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
231
            $bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
228
            $devnum = -1;
232
            $devnum = -1;
229
            $results = array();
233
            $results = array();
230
            foreach ($bufe as $buf) {
234
            foreach ($bufe as $buf) {
231
                if (preg_match('/^T/', $buf)) {
235
                if (preg_match('/^T/', $buf)) {
232
                    $devnum++;
236
                    $devnum++;
233
                    $results[$devnum] = "";
237
                    $results[$devnum] = "";
234
                } elseif (preg_match('/^S:/', $buf)) {
238
                } elseif (preg_match('/^S:/', $buf)) {
235
                    list($key, $value) = preg_split('/: /', $buf, 2);
239
                    list($key, $value) = preg_split('/: /', $buf, 2);
236
                    list($key, $value2) = preg_split('/=/', $value, 2);
240
                    list($key, $value2) = preg_split('/=/', $value, 2);
237
                    if (trim($key) != "SerialNumber") {
241
                    if (trim($key) != "SerialNumber") {
238
                        $results[$devnum] .= " ".trim($value2);
242
                        $results[$devnum] .= " ".trim($value2);
239
                    }
243
                    }
240
                }
244
                }
241
            }
245
            }
242
            foreach ($results as $var) {
246
            foreach ($results as $var) {
243
                $dev = new HWDevice();
247
                $dev = new HWDevice();
244
                $dev->setName($var);
248
                $dev->setName($var);
245
                $this->sys->setUsbDevices($dev);
249
                $this->sys->setUsbDevices($dev);
246
            }
250
            }
247
        }
251
        }
248
    }
252
    }
249
 
253
 
250
    /**
254
    /**
251
     * Network devices
255
     * Network devices
252
     * includes also rx/tx bytes
256
     * includes also rx/tx bytes
253
     *
257
     *
254
     * @return void
258
     * @return void
255
     */
259
     */
256
    private function _network()
260
    private function _network()
257
    {
261
    {
258
        if (CommonFunctions::executeProgram('netstat', '-ni | tail -n +2', $netstat)) {
262
        if (CommonFunctions::executeProgram('netstat', '-ni | tail -n +2', $netstat)) {
259
            $lines = preg_split("/\n/", $netstat, -1, PREG_SPLIT_NO_EMPTY);
263
            $lines = preg_split("/\n/", $netstat, -1, PREG_SPLIT_NO_EMPTY);
260
            foreach ($lines as $line) {
264
            foreach ($lines as $line) {
261
                $ar_buf = preg_split("/\s+/", $line);
265
                $ar_buf = preg_split("/\s+/", $line);
262
                if (! empty($ar_buf[0]) && ! empty($ar_buf[3])) {
266
                if (! empty($ar_buf[0]) && ! empty($ar_buf[3])) {
263
                    $dev = new NetDevice();
267
                    $dev = new NetDevice();
264
                    $dev->setName($ar_buf[0]);
268
                    $dev->setName($ar_buf[0]);
265
                    $dev->setRxBytes($ar_buf[4]);
269
                    $dev->setRxBytes($ar_buf[4]);
266
                    $dev->setTxBytes($ar_buf[6]);
270
                    $dev->setTxBytes($ar_buf[6]);
267
                    $dev->setErrors($ar_buf[5] + $ar_buf[7]);
271
                    $dev->setErrors($ar_buf[5] + $ar_buf[7]);
268
                    $dev->setDrops($ar_buf[8]);
272
                    $dev->setDrops($ar_buf[8]);
269
                    $this->sys->setNetDevices($dev);
273
                    $this->sys->setNetDevices($dev);
270
                }
274
                }
271
            }
275
            }
272
        }
276
        }
273
    }
277
    }
274
 
278
 
275
    /**
279
    /**
276
     * Physical memory information and Swap Space information
280
     * Physical memory information and Swap Space information
277
     *
281
     *
278
     * @return void
282
     * @return void
279
     */
283
     */
280
    private function _memory()
284
    private function _memory()
281
    {
285
    {
282
        if (CommonFunctions::rfts('/proc/meminfo', $bufr)) {
286
        if (CommonFunctions::rfts('/proc/meminfo', $bufr)) {
283
            $bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
287
            $bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
284
            foreach ($bufe as $buf) {
288
            foreach ($bufe as $buf) {
285
                if (preg_match('/Mem:\s+(.*)$/', $buf, $ar_buf)) {
289
                if (preg_match('/Mem:\s+(.*)$/', $buf, $ar_buf)) {
286
                    $ar_buf = preg_split('/\s+/', $ar_buf[1], 6);
290
                    $ar_buf = preg_split('/\s+/', $ar_buf[1], 6);
287
                    $this->sys->setMemTotal($ar_buf[0]);
291
                    $this->sys->setMemTotal($ar_buf[0]);
288
                    $this->sys->setMemUsed($ar_buf[1]);
292
                    $this->sys->setMemUsed($ar_buf[1]);
289
                    $this->sys->setMemFree($ar_buf[2]);
293
                    $this->sys->setMemFree($ar_buf[2]);
290
                    $this->sys->setMemApplication($ar_buf[3]);
294
                    $this->sys->setMemApplication($ar_buf[3]);
291
                    $this->sys->setMemBuffer($ar_buf[4]);
295
                    $this->sys->setMemBuffer($ar_buf[4]);
292
                    $this->sys->setMemCache($ar_buf[5]);
296
                    $this->sys->setMemCache($ar_buf[5]);
293
                }
297
                }
294
                // Get info on individual swap files
298
                // Get info on individual swap files
295
                if (CommonFunctions::rfts('/proc/swaps', $swaps)) {
299
                if (CommonFunctions::rfts('/proc/swaps', $swaps)) {
296
                    $swapdevs = preg_split("/\n/", $swaps, -1, PREG_SPLIT_NO_EMPTY);
300
                    $swapdevs = preg_split("/\n/", $swaps, -1, PREG_SPLIT_NO_EMPTY);
297
                    for ($i = 1, $max = (sizeof($swapdevs) - 1); $i < $max; $i++) {
301
                    for ($i = 1, $max = (sizeof($swapdevs) - 1); $i < $max; $i++) {
298
                        $ar_buf = preg_split('/\s+/', $swapdevs[$i], 6);
302
                        $ar_buf = preg_split('/\s+/', $swapdevs[$i], 6);
299
                        $dev = new DiskDevice();
303
                        $dev = new DiskDevice();
300
                        $dev->setMountPoint($ar_buf[0]);
304
                        $dev->setMountPoint($ar_buf[0]);
301
                        $dev->setName("SWAP");
305
                        $dev->setName("SWAP");
302
                        $dev->setFsType('swap');
306
                        $dev->setFsType('swap');
303
                        $dev->setTotal($ar_buf[2] * 1024);
307
                        $dev->setTotal($ar_buf[2] * 1024);
304
                        $dev->setUsed($ar_buf[3] * 1024);
308
                        $dev->setUsed($ar_buf[3] * 1024);
305
                        $dev->setFree($dev->getTotal() - $dev->getUsed());
309
                        $dev->setFree($dev->getTotal() - $dev->getUsed());
306
                        $this->sys->setSwapDevices($dev);
310
                        $this->sys->setSwapDevices($dev);
307
                    }
311
                    }
308
                }
312
                }
309
            }
313
            }
310
        }
314
        }
311
    }
315
    }
312
 
316
 
313
    /**
317
    /**
314
     * filesystem information
318
     * filesystem information
315
     *
319
     *
316
     * @return void
320
     * @return void
317
     */
321
     */
318
    private function _filesystems()
322
    private function _filesystems()
319
    {
323
    {
320
        if (CommonFunctions::executeProgram('df', '-kP', $df, PSI_DEBUG)) {
324
        if (CommonFunctions::executeProgram('df', '-kP', $df, PSI_DEBUG)) {
321
            $mounts = preg_split("/\n/", $df, -1, PREG_SPLIT_NO_EMPTY);
325
            $mounts = preg_split("/\n/", $df, -1, PREG_SPLIT_NO_EMPTY);
322
            if (CommonFunctions::executeProgram('mount', '-v', $s, PSI_DEBUG)) {
326
            if (CommonFunctions::executeProgram('mount', '-v', $s, PSI_DEBUG)) {
323
                $lines = preg_split("/\n/", $s, -1, PREG_SPLIT_NO_EMPTY);
327
                $lines = preg_split("/\n/", $s, -1, PREG_SPLIT_NO_EMPTY);
324
                foreach ($lines as $line) {
328
                foreach ($lines as $line) {
325
                    $a = preg_split('/ /', $line, -1, PREG_SPLIT_NO_EMPTY);
329
                    $a = preg_split('/ /', $line, -1, PREG_SPLIT_NO_EMPTY);
326
                    $fsdev[$a[0]] = $a[4];
330
                    $fsdev[$a[0]] = $a[4];
327
                }
331
                }
328
            }
332
            }
329
            foreach ($mounts as $mount) {
333
            foreach ($mounts as $mount) {
330
                $ar_buf = preg_split("/\s+/", $mount, 6);
334
                $ar_buf = preg_split("/\s+/", $mount, 6);
331
                $dev = new DiskDevice();
335
                $dev = new DiskDevice();
332
                $dev->setName($ar_buf[0]);
336
                $dev->setName($ar_buf[0]);
333
                $dev->setTotal($ar_buf[1] * 1024);
337
                $dev->setTotal($ar_buf[1] * 1024);
334
                $dev->setUsed($ar_buf[2] * 1024);
338
                $dev->setUsed($ar_buf[2] * 1024);
335
                $dev->setFree($ar_buf[3] * 1024);
339
                $dev->setFree($ar_buf[3] * 1024);
336
                $dev->setMountPoint($ar_buf[5]);
340
                $dev->setMountPoint($ar_buf[5]);
337
                if (isset($fsdev[$ar_buf[0]])) {
341
                if (isset($fsdev[$ar_buf[0]])) {
338
                    $dev->setFsType($fsdev[$ar_buf[0]]);
342
                    $dev->setFsType($fsdev[$ar_buf[0]]);
339
                }
343
                }
340
                $this->sys->setDiskDevices($dev);
344
                $this->sys->setDiskDevices($dev);
341
            }
345
            }
342
        }
346
        }
343
    }
347
    }
344
 
348
 
345
    /**
349
    /**
346
     * Distribution
350
     * Distribution
347
     *
351
     *
348
     * @return void
352
     * @return void
349
     */
353
     */
350
    private function _distro()
354
    private function _distro()
351
    {
355
    {
352
        $this->sys->setDistribution('HP-UX');
356
        $this->sys->setDistribution('HP-UX');
353
        $this->sys->setDistributionIcon('HPUX.png');
357
        $this->sys->setDistributionIcon('HPUX.png');
354
    }
358
    }
355
 
359
 
356
    /**
360
    /**
357
     * get the information
361
     * get the information
358
     *
362
     *
359
     * @see PSI_Interface_OS::build()
363
     * @see PSI_Interface_OS::build()
360
     *
364
     *
361
     * @return Void
365
     * @return void
362
     */
366
     */
363
    public function build()
367
    public function build()
364
    {
368
    {
365
        if (!$this->blockname || $this->blockname==='vitals') {
369
        if (!$this->blockname || $this->blockname==='vitals') {
366
            $this->_distro();
370
            $this->_distro();
367
            $this->_hostname();
371
            $this->_hostname();
368
            $this->_kernel();
372
            $this->_kernel();
369
            $this->_uptime();
373
            $this->_uptime();
370
            $this->_users();
374
            $this->_users();
371
            $this->_loadavg();
375
            $this->_loadavg();
372
        }
376
        }
373
        if (!$this->blockname || $this->blockname==='hardware') {
377
        if (!$this->blockname || $this->blockname==='hardware') {
374
            $this->_cpuinfo();
378
            $this->_cpuinfo();
375
            $this->_pci();
379
            $this->_pci();
376
            $this->_ide();
380
            $this->_ide();
377
            $this->_scsi();
381
            $this->_scsi();
378
            $this->_usb();
382
            $this->_usb();
379
        }
383
        }
380
        if (!$this->blockname || $this->blockname==='network') {
-
 
381
            $this->_network();
-
 
382
        }
-
 
383
        if (!$this->blockname || $this->blockname==='memory') {
384
        if (!$this->blockname || $this->blockname==='memory') {
384
            $this->_memory();
385
            $this->_memory();
385
        }
386
        }
386
        if (!$this->blockname || $this->blockname==='filesystem') {
387
        if (!$this->blockname || $this->blockname==='filesystem') {
387
            $this->_filesystems();
388
            $this->_filesystems();
388
        }
389
        }
-
 
390
        if (!$this->blockname || $this->blockname==='network') {
-
 
391
            $this->_network();
-
 
392
        }
389
    }
393
    }
390
}
394
}
391
 
395