Changeset 13 for measure_scripts/traffic.php
- Timestamp:
- Oct 17, 2007, 7:06:49 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
measure_scripts/traffic.php
r7 r13 3 3 include('../global.php'); 4 4 5 function CheckPortStatus($Ip, $Port) 6 { 7 function ErrorHandler($errno,$errmsg,$filename,$linenum,$vars) 8 { 9 } 10 set_error_handler('ErrorHandler'); 11 //error_reporting(0); 12 if($Fp1 = fsockopen($Ip, $Port, $ERROR_NO, $ERROR_STR,(float)0.5)) 13 { 14 fclose($Fp1); 15 return true; 16 } else 17 { 18 //echo($ERROR_NO.','.$ERROR_STR); 19 //die(); 20 return false; 21 } 22 restore_error_handler(); 23 } 24 5 25 function MemoryUsage() 6 26 { 7 27 $Output = array(); 8 exec('free - m', $Output);28 exec('free -b', $Output); 9 29 $Row = $Output[2]; 10 30 while(strpos($Row, ' ') !== false) $Row = str_replace(' ', ' ', $Row); … … 99 119 // Network load 100 120 $NetworkStat = GetNetworkStat(); 101 $Value = round($NetworkStat['eth1']['down_avg'] /1024);121 $Value = round($NetworkStat['eth1']['down_avg']); 102 122 file_get_contents($URL.'?MeasureId=11&Value='.$Value); 103 $Value = round($NetworkStat['eth1']['up_avg'] /1024);123 $Value = round($NetworkStat['eth1']['up_avg']); 104 124 file_get_contents($URL.'?MeasureId=12&Value='.$Value); 105 125 … … 155 175 $Value = $Row[0]; 156 176 file_get_contents($URL.'?MeasureId=6&Value='.$Value); 157 177 178 // MaNGOS worldd availability 179 if(CheckPortStatus('localhost', 8085)) $Value = 100; else $Value = 0; 180 file_get_contents($URL.'?MeasureId=15&Value='.$Value); 181 158 182 sleep(60); 159 183 }
Note:
See TracChangeset
for help on using the changeset viewer.