1 | <?php
|
---|
2 |
|
---|
3 | include('Global.php');
|
---|
4 |
|
---|
5 | // Various measure libraries
|
---|
6 | include('Linux.php');
|
---|
7 | include('WoW.php');
|
---|
8 | include('Centrala.php');
|
---|
9 | include('Routerboard.php');
|
---|
10 |
|
---|
11 | function ProcessMeasure()
|
---|
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();
|
---|
20 | $NetworkState = GetNetworkState();
|
---|
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');
|
---|
36 |
|
---|
37 | foreach($Values as $Index => $Value)
|
---|
38 | {
|
---|
39 | file_get_contents($URL.'?MeasureId='.$Index.'&Value='.$Value);
|
---|
40 | }
|
---|
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');
|
---|