source: branches/mvc/measure_scripts/monitor_sample.php

Last change on this file was 47, checked in by chronos, 10 years ago
  • Odstraněno: Zbytečná PHP ukončovací značka "?>" z konce všech souborů.
File size: 1.9 KB
Line 
1<?php
2
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
5
6include('../global.php');
7include('system.php');
8include('wow.php');
9
10$LastNetworkState = unserializa(file_get_contents('/tmp/LastNetworkState'));
11$LastCpuUsage = unserializa(file_get_contents('/tmp/LastCpuUsage'));
12
13$NetworkState = GetNetworkState();
14file_get_contents($Config['AddNewValueUrl'].'?MeasureId=3&Value='.MemoryUsage());
15file_get_contents($Config['AddNewValueUrl'].'?MeasureId=4&Value='.CpuUsage());
16file_get_contents($Config['AddNewValueUrl'].'?MeasureId=5&Value='.WoWPlayersOnline());
17file_get_contents($Config['AddNewValueUrl'].'?MeasureId=6&Value='.WoWEmulatorRestartCount());
18file_get_contents($Config['AddNewValueUrl'].'?MeasureId=7&Value='.DiskFree());
19file_get_contents($Config['AddNewValueUrl'].'?MeasureId=8&Value='.WoWAccountCount());
20file_get_contents($Config['AddNewValueUrl'].'?MeasureId=10&Value='.WoWGMOnline());
21file_get_contents($Config['AddNewValueUrl'].'?MeasureId=11&Value='.round($NetworkState['eth1']['DownAverage']));
22file_get_contents($Config['AddNewValueUrl'].'?MeasureId=12&Value='.round($NetworkState['eth1']['UpAverage']));
23file_get_contents($Config['AddNewValueUrl'].'?MeasureId=13&Value='.WoWCharacterCount());
24file_get_contents($Config['AddNewValueUrl'].'?MeasureId=14&Value='.WoWGuildCount());
25file_get_contents($Config['AddNewValueUrl'].'?MeasureId=15&Value='.WoWEmulatorAvailability());
26file_get_contents($Config['AddNewValueUrl'].'?MeasureId=16&Value='.Ping());
27file_get_contents($Config['AddNewValueUrl'].'?MeasureId=17&Value='.TeamSpeak());
28file_get_contents($Config['AddNewValueUrl'].'?MeasureId=18&Value='.WoWTranslatedQuestsCount());
29file_get_contents($Config['AddNewValueUrl'].'?MeasureId=19&Value='.DiskUtilization());
30
31file_put_contents('/tmp/LastNetworkState', serialize($LastNetworkState));
32file_put_contents('/tmp/LastCpuUsage', serialize($LastCpuUsage));
Note: See TracBrowser for help on using the repository browser.