<?php

// Toto je ukázkový skript pro aktualizaci dat. Zkopírujte si jej jako monitor.php a upravte podle potřeby.
// Skript spouštět přes crona každou minutu

include('../global.php');
include('system.php');
include('wow.php');

$LastNetworkState = unserializa(file_get_contents('/tmp/LastNetworkState'));
$LastCpuUsage = unserializa(file_get_contents('/tmp/LastCpuUsage'));

$NetworkState = GetNetworkState();
file_get_contents($Config['AddNewValueUrl'].'?MeasureId=3&Value='.MemoryUsage());
file_get_contents($Config['AddNewValueUrl'].'?MeasureId=4&Value='.CpuUsage());
file_get_contents($Config['AddNewValueUrl'].'?MeasureId=5&Value='.WoWPlayersOnline());
file_get_contents($Config['AddNewValueUrl'].'?MeasureId=6&Value='.WoWEmulatorRestartCount());
file_get_contents($Config['AddNewValueUrl'].'?MeasureId=7&Value='.DiskFree());
file_get_contents($Config['AddNewValueUrl'].'?MeasureId=8&Value='.WoWAccountCount());
file_get_contents($Config['AddNewValueUrl'].'?MeasureId=10&Value='.WoWGMOnline());
file_get_contents($Config['AddNewValueUrl'].'?MeasureId=11&Value='.round($NetworkState['eth1']['DownAverage']));
file_get_contents($Config['AddNewValueUrl'].'?MeasureId=12&Value='.round($NetworkState['eth1']['UpAverage']));
file_get_contents($Config['AddNewValueUrl'].'?MeasureId=13&Value='.WoWCharacterCount());
file_get_contents($Config['AddNewValueUrl'].'?MeasureId=14&Value='.WoWGuildCount());
file_get_contents($Config['AddNewValueUrl'].'?MeasureId=15&Value='.WoWEmulatorAvailability());
file_get_contents($Config['AddNewValueUrl'].'?MeasureId=16&Value='.Ping());
file_get_contents($Config['AddNewValueUrl'].'?MeasureId=17&Value='.TeamSpeak());
file_get_contents($Config['AddNewValueUrl'].'?MeasureId=18&Value='.WoWTranslatedQuestsCount());
file_get_contents($Config['AddNewValueUrl'].'?MeasureId=19&Value='.DiskUtilization());

file_put_contents('/tmp/LastNetworkState', serialize($LastNetworkState));
file_put_contents('/tmp/LastCpuUsage', serialize($LastCpuUsage));
