Changeset 39 for trunk/measure_scripts/monitor_sample.php
- Timestamp:
- Mar 21, 2009, 9:38:58 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/measure_scripts/monitor_sample.php
r37 r39 2 2 3 3 // Toto je ukázkový skript pro aktualizaci dat. Zkopírujte si jej jako monitor.php a upravte podle potřeby. 4 // Skript spouštět přes crona každou minutu 4 5 5 6 include('../global.php'); … … 7 8 include('wow.php'); 8 9 9 //GetNetworkState(); 10 while(1) 11 { 12 $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()); 10 $LastNetworkState = unserializa(file_get_contents('/tmp/LastNetworkState')); 11 $LastCpuUsage = unserializa(file_get_contents('/tmp/LastCpuUsage')); 29 12 30 sleep(58); // 60(measure period) - 2(disk utilization) 31 } 13 $NetworkState = GetNetworkState(); 14 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=3&Value='.MemoryUsage()); 15 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=4&Value='.CpuUsage()); 16 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=5&Value='.WoWPlayersOnline()); 17 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=6&Value='.WoWEmulatorRestartCount()); 18 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=7&Value='.DiskFree()); 19 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=8&Value='.WoWAccountCount()); 20 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=10&Value='.WoWGMOnline()); 21 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=11&Value='.round($NetworkState['eth1']['DownAverage'])); 22 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=12&Value='.round($NetworkState['eth1']['UpAverage'])); 23 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=13&Value='.WoWCharacterCount()); 24 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=14&Value='.WoWGuildCount()); 25 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=15&Value='.WoWEmulatorAvailability()); 26 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=16&Value='.Ping()); 27 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=17&Value='.TeamSpeak()); 28 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=18&Value='.WoWTranslatedQuestsCount()); 29 file_get_contents($Config['AddNewValueUrl'].'?MeasureId=19&Value='.DiskUtilization()); 30 31 file_put_contents('/tmp/LastNetworkState', serialize($LastNetworkState)); 32 file_put_contents('/tmp/LastCpuUsage', serialize($LastCpuUsage)); 33 32 34 ?>
Note:
See TracChangeset
for help on using the changeset viewer.