Changeset 37 for system/statistic/traffic.php
Legend:
- Unmodified
- Added
- Removed
-
system
-
Property svn:ignore
set to
nohup.out
-
Property svn:ignore
set to
-
system/statistic
-
Property svn:ignore
set to
nohup.out
-
Property svn:ignore
set to
-
system/statistic/traffic.php
r1 r37 1 <? 2 1 <?php 2 3 include('../../html/global.php'); 4 $Database->select_db('statistic'); 5 $Config['Web']['ShowError'] = 1; 3 6 echo("\nSledovac prenesenych dat\n"); 4 include('/a/html/is/db.php');5 DB_Init('localhost','root','','statistic');6 7 $ERR = 0; 7 8 8 9 function CpuUsage() 9 10 { 10 global $cpuIDLEprev, $cpuSYSTprev, $cpuUSERprev; 11 global $cpuIDLEprev, $cpuSYSTprev, $cpuUSERprev, $Database; 12 11 13 // get processor usage seconds for pct stats ### 12 14 $File = fopen('/proc/stat', 'r'); … … 88 90 function Resetuj() 89 91 { 90 global $ERR, $ID; 92 global $ERR, $ID, $Database; 93 91 94 echo("Error ".$ERR.". - restartuji pripojeni..."); 92 95 if($ERR == 0) 93 96 { 94 DB_Insert('failure', array('time' => 'NOW()', 'attempt' => 0));95 DB_Query('SELECT LAST_INSERT_ID() FROM failure LIMIT 0,1');96 $Row = DB_Row();97 $Database->insert('failure', array('time' => 'NOW()', 'attempt' => 0)); 98 $DbResult = $Database->query('SELECT LAST_INSERT_ID() FROM failure LIMIT 0,1'); 99 $Row = $DbResult->fetch_array(); 97 100 $ID = $Row[0]; 98 101 } 99 else DB_Update('failure', 'id='.$ID,array('attempt' => $ERR));102 else $Database->update('failure', 'id='.$ID,array('attempt' => $ERR)); 100 103 // echo($ID); 101 104 // if($ERR == 5) exec('killall -TERM pppd',$Output); … … 123 126 sleep(60); 124 127 $NetworkStat = GetNetworkStat(); 125 // zji ¹tìní vytí¾eníprocesoru128 // zjit��vyt�n�procesoru 126 129 $CPU = CpuUsage(); 127 130 //$loadavg = fopen('/proc/loadavg','r'); … … 129 132 //$CPU = $data[0]; 130 133 //fclose($loadavg); 131 // zji ¹tìní poètu zapnutých poèítaèù134 // zjit��po�u zapnutch po�ta� 132 135 133 DB_Init('localhost','root','','is');134 DB_Query('SELECT COUNT(*) FROM hosts WHERE online=1 AND show_online=1');135 $Row = DB_Row();136 $Database->select_db('is'); 137 $DbResult = $Database->query('SELECT COUNT(*) FROM hosts WHERE online=1 AND show_online=1'); 138 $Row = $DbResult->fetch_array(); 136 139 $OnlineHosts = $Row[0]; 137 140 138 DB_Query('SELECT COUNT(*) FROM users WHERE role=0');139 $Row = DB_Row();141 $DbResult = $Database->query('SELECT COUNT(*) FROM users WHERE role=0'); 142 $Row = $DbResult->fetch_array(); 140 143 $MembersCount = $Row[0]; 141 144 142 DB_Init('localhost','root','','statistic');145 $Database->select_db('statistic'); 143 146 $HDD = round(disk_free_space('/')/1024); 144 147 $HDD2 = round(disk_free_space('/mnt/sda1')/1024); 145 148 146 // Na èteníteploty149 // Na�en�teploty 147 150 fseek($TemperatureFile,0); 148 151 $Temperature = fgets($TemperatureFile, 1000); … … 153 156 $Ping = Ping(); 154 157 158 /* 155 159 file_get_contents('http://localhost/statistic/new/add.php?MeasureId=1&Value='.$NetworkStat['eth1']['down_avg']); 156 160 file_get_contents('http://localhost/statistic/new/add.php?MeasureId=2&Value='.$NetworkStat['eth1']['up_avg']); … … 171 175 file_get_contents('http://localhost/statistic/new/add.php?MeasureId=20&Value='.$NetworkStat['eth2']['down_avg']); 172 176 echo(file_get_contents('http://localhost/statistic/new/add.php?MeasureId=21&Value='.$NetworkStat['eth2']['up_avg'])); 177 */ 173 178 174 179 // echo('Down: '.$NetworkStat['eth1']['down_avg'].' Up: '.$NetworkStat['eth1']['up_avg'].' CPU: '.$CPU.' HDD: '.$HDD.' Hosts: '.$OnlineHosts.' Temperature: '.$Temperature.' GameServerCpu: '.$GameServerCpu.' WowPlayerCount2: '.$WowPlayerCount2.' Game-serverUsedMemory: '.$Centrala2UsedMemory.' Ping: '.$Ping); … … 185 190 'wlan2_down' => $NetworkStat['wlan2']['down_avg'], 'wlan2_up' => $NetworkStat['wlan2']['up_avg'], 186 191 'eth2_down' => $NetworkStat['eth2']['down_avg'], 'eth2_up' => $NetworkStat['eth2']['up_avg']); 187 DB_Insert('traffic', $NewItem);192 $Database->insert('traffic', $NewItem); 188 193 //echo(serialize($NewItem)."\n"); 189 194 //$LevelDivider = 10;
Note:
See TracChangeset
for help on using the changeset viewer.