Changeset 66 for client/php/Client.php
- Timestamp:
- Jan 2, 2016, 12:17:56 AM (9 years ago)
- Location:
- client/php
- Files:
-
- 1 added
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
client/php/Client.php
r65 r66 1 1 <?php 2 2 3 // Toto je ukázkový skript pro aktualizaci dat. Zkopírujte si jej jako monitor.php a upravte podle potřeby. 3 include('Global.php'); 4 4 5 include('../global.php'); 6 include('system.php'); 7 include('wow.php'); 5 // Various measure libraries 6 include('Linux.php'); 7 include('WoW.php'); 8 include('Centrala.php'); 9 include('Routerboard.php'); 8 10 9 //GetNetworkState(); 10 while(1) 11 function ProcessMeasure() 11 12 { 13 $Values[3] = MemoryUsage(); 14 $Values[4] = CpuUsage(); 15 $Values[5] = WoWPlayersOnline(); 16 $Values[6] = WoWEmulatorRestartCount(); 17 $Values[7] = DiskFree('/'); 18 $Values[8] = WoWAccountCount(); 19 $Values[10] = WoWGMOnline(); 12 20 $NetworkState = GetNetworkState(); 13 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=3&Value='.MemoryUsage()); 14 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=4&Value='.CpuUsage()); 15 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=5&Value='.WoWPlayersOnline()); 16 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=6&Value='.WoWEmulatorRestartCount()); 17 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=7&Value='.DiskFree()); 18 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=8&Value='.WoWAccountCount()); 19 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=10&Value='.WoWGMOnline()); 20 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=11&Value='.round($NetworkState['eth1']['DownAverage'])); 21 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=12&Value='.round($NetworkState['eth1']['UpAverage'])); 22 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=13&Value='.WoWCharacterCount()); 23 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=14&Value='.WoWGuildCount()); 24 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=15&Value='.WoWEmulatorAvailability()); 25 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=16&Value='.Ping()); 26 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=17&Value='.TeamSpeak()); 27 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=18&Value='.WoWTranslatedQuestsCount()); 28 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=19&Value='.DiskUtilization()); 21 $Values[11] = round($NetworkState['eth1']['DownAverage']); 22 $Values[12] = round($NetworkState['eth1']['UpAverage']); 23 $Values[13] = WoWCharacterCount(); 24 $Values[14] = WoWGuildCount(); 25 $Values[15] = WoWEmulatorAvailability(); 26 $Values[16] = Ping(); 27 $Values[17] = TeamSpeak(); 28 $Values[18] = WoWTranslatedQuestsCount(); 29 $Values[18] = DiskUtilization('sda'); 30 $RBNetworkState = GetRouterBoardNetworkState(); 31 $Values[19] = $RBNetworkState['DownAverage'] * 8; 32 $Values[20] = $RBNetworkState['UpAverage'] * 8; 33 $Values[21] = HostsOnline(); 34 $Values[22] = MemberCount(); 35 $Values[23] = ProcessorTemperature('Core0'); 29 36 30 sleep(58); // 60(measure period) - 2(disk utilization) 37 foreach($Values as $Index => $Value) 38 { 39 file_get_contents($URL.'?MeasureId='.$Index.'&Value='.$Value); 40 } 31 41 } 42 43 function RepeatFunction($Period, $Function) 44 { 45 while(1) 46 { 47 $StartTime = time(); 48 $Function(); 49 $EndTime = time(); 50 $Delay = $Period - ($EndTime - $StartTime); 51 if($Delay < 0) $Delay = 0; 52 53 echo('Waiting '.$Delay.' seconds...'."\n"); 54 sleep($Delay); 55 } 56 } 57 58 RepeatFunction(60 * 60, 'ProcessMeasure');
Note:
See TracChangeset
for help on using the changeset viewer.