[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
1 <?php 2 3 // phpSysInfo - A PHP System Information Script 4 // http://phpsysinfo.sourceforge.net/ 5 6 // This program is free software; you can redistribute it and/or 7 // modify it under the terms of the GNU General Public License 8 // as published by the Free Software Foundation; either version 2 9 // of the License, or (at your option) any later version. 10 11 // This program is distributed in the hope that it will be useful, 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 // GNU General Public License for more details. 15 16 // You should have received a copy of the GNU General Public License 17 // along with this program; if not, write to the Free Software 18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 20 // $Id: class.OpenBSD.inc.php,v 1.21 2006/04/18 17:46:15 bigmichi1 Exp $ 21 if (!defined('IN_PHPSYSINFO')) { 22 die("No Hacking"); 23 } 24 25 require_once(APP_ROOT . '/includes/os/class.BSD.common.inc.php'); 26 27 class sysinfo extends bsd_common { 28 var $cpu_regexp = ""; 29 var $scsi_regexp1 = ""; 30 var $scsi_regexp2 = ""; 31 var $cpu_regexp2 = ""; 32 33 // Our contstructor 34 // this function is run on the initialization of this class 35 function sysinfo () { 36 $this->bsd_common(); 37 $this->cpu_regexp = "^cpu(.*) (.*) MHz"; 38 $this->scsi_regexp1 = "^(.*) at scsibus.*: <(.*)> .*"; 39 $this->scsi_regexp2 = "^(da[0-9]): (.*)MB "; 40 $this->cpu_regexp2 = "/(.*),(.*),(.*),(.*),(.*)/"; 41 $this->pci_regexp1 = '/(.*) at pci[0-9] .* "(.*)"/'; 42 $this->pci_regexp2 = '/"(.*)" (.*).* at [.0-9]+ irq/'; 43 } 44 45 function get_sys_ticks () { 46 $a = $this->grab_key('kern.boottime'); 47 $sys_ticks = time() - $a; 48 return $sys_ticks; 49 } 50 51 function network () { 52 $netstat_b = execute_program('netstat', '-nbdi | cut -c1-25,44- | grep Link | grep -v \'* \''); 53 $netstat_n = execute_program('netstat', '-ndi | cut -c1-25,44- | grep Link | grep -v \'* \''); 54 $lines_b = split("\n", $netstat_b); 55 $lines_n = split("\n", $netstat_n); 56 $results = array(); 57 for ($i = 0, $max = sizeof($lines_b); $i < $max; $i++) { 58 $ar_buf_b = preg_split("/\s+/", $lines_b[$i]); 59 $ar_buf_n = preg_split("/\s+/", $lines_n[$i]); 60 if (!empty($ar_buf_b[0]) && !empty($ar_buf_n[3])) { 61 $results[$ar_buf_b[0]] = array(); 62 63 $results[$ar_buf_b[0]]['rx_bytes'] = $ar_buf_b[3]; 64 $results[$ar_buf_b[0]]['rx_packets'] = $ar_buf_n[3]; 65 $results[$ar_buf_b[0]]['rx_errs'] = $ar_buf_n[4]; 66 $results[$ar_buf_b[0]]['rx_drop'] = $ar_buf_n[8]; 67 68 $results[$ar_buf_b[0]]['tx_bytes'] = $ar_buf_b[4]; 69 $results[$ar_buf_b[0]]['tx_packets'] = $ar_buf_n[5]; 70 $results[$ar_buf_b[0]]['tx_errs'] = $ar_buf_n[6]; 71 $results[$ar_buf_b[0]]['tx_drop'] = $ar_buf_n[8]; 72 73 $results[$ar_buf_b[0]]['errs'] = $ar_buf_n[4] + $ar_buf_n[6]; 74 $results[$ar_buf_b[0]]['drop'] = $ar_buf_n[8]; 75 } 76 } 77 return $results; 78 } 79 // get the ide device information out of dmesg 80 function ide () { 81 $results = array(); 82 83 $s = 0; 84 for ($i = 0, $max = count($this->read_dmesg()); $i < $max; $i++) { 85 $buf = $this->dmesg[$i]; 86 if (preg_match('/^(.*) at pciide[0-9] (.*): <(.*)>/', $buf, $ar_buf)) { 87 $s = $ar_buf[1]; 88 $results[$s]['model'] = $ar_buf[3]; 89 $results[$s]['media'] = 'Hard Disk'; 90 // now loop again and find the capacity 91 for ($j = 0, $max1 = count($this->read_dmesg()); $j < $max1; $j++) { 92 $buf_n = $this->dmesg[$j]; 93 if (preg_match("/^($s): (.*), (.*), (.*)MB, .*$/", $buf_n, $ar_buf_n)) { 94 $results[$s]['capacity'] = $ar_buf_n[4] * 2048 * 1.049;; 95 } 96 } 97 } 98 } 99 asort($results); 100 return $results; 101 } 102 103 function distroicon () { 104 $result = 'OpenBSD.png'; 105 return($result); 106 } 107 108 } 109 110 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 10:22:19 2007 | par Balluche grâce à PHPXref 0.7 |