Changeset 271
- Timestamp:
- Jan 8, 2010, 8:20:18 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/network/dostupnost.php
r269 r271 7 7 var $FullTitle = 'Dostupnost aktivních prvků sítě'; 8 8 var $ShortTitle = 'Dostupnost sítě'; 9 var $PeriodCount = 12; 9 10 var $Period = array( 10 11 array('Column' => 'Hour', 'Title' => 'Hodina', 'Period' => 1), … … 47 48 { 48 49 $Output .= '<th>'.$Period['Title'].' [%]</th>'; 49 $Join .= ' LEFT JOIN (SELECT NetworkInterfaceStat.NetworkInterface, (SUM(NetworkInterfaceStat. PingCount) / '.$Period['Period'].' / 60 * 100) AS Percent FROM NetworkInterfaceStat WHERE (Time > DATE_SUB( DATE_SUB(NOW(), INTERVAL 1 HOUR), INTERVAL '.$Period['Period'].' HOUR)) AND (Time < DATE_SUB(NOW(), INTERVAL 1 HOUR)) GROUP BY NetworkInterface) AS Period'.$Period['Column'].' ON Period'.$Period['Column'].'.NetworkInterface = NetworkInterface.Id';50 $Join .= ' LEFT JOIN (SELECT NetworkInterfaceStat.NetworkInterface, (SUM(NetworkInterfaceStat. PingCount) / '.$Period['Period'].' / 60 * 100) AS Percent FROM NetworkInterfaceStat WHERE (Time > DATE_SUB(NOW(), INTERVAL '.($Period['Period'] + 1).' HOUR)) AND (Time < DATE_SUB(NOW(), INTERVAL 1 HOUR)) GROUP BY NetworkInterface) AS Period'.$Period['Column'].' ON Period'.$Period['Column'].'.NetworkInterface = NetworkInterface.Id'; 50 51 $Columns .= ', Period'.$Period['Column'].'.Percent AS '.$Period['Column']; 51 52 } … … 54 55 if(array_key_exists($_GET['Period'], $this->Period)) 55 56 { 56 for($I = 0; $I < 10; $I++)57 for($I = 0; $I < $this->PeriodCount; $I++) 57 58 { 58 59 $Period = $this->Period[$_GET['Period']]; 59 60 $Output .= '<th>-'.$I.' [%]</th>'; 60 $Join .= ' LEFT JOIN (SELECT NetworkInterfaceStat.NetworkInterface, (SUM(NetworkInterfaceStat. PingCount) / '.$Period['Period'].' / 60 * 100) AS Percent FROM NetworkInterfaceStat WHERE (Time > DATE_SUB( DATE_SUB(NOW(), INTERVAL 1 HOUR), INTERVAL '.($Period['Period'] * ($I + 1)).' HOUR)) AND (Time < DATE_SUB(DATE_SUB(NOW(), INTERVAL 1 HOUR), INTERVAL '.($Period['Period'] * $I + 1).' HOUR)) GROUP BY NetworkInterface) AS Period'.$I.' ON Period'.$I.'.NetworkInterface = NetworkInterface.Id';61 $Join .= ' LEFT JOIN (SELECT NetworkInterfaceStat.NetworkInterface, (SUM(NetworkInterfaceStat. PingCount) / '.$Period['Period'].' / 60 * 100) AS Percent FROM NetworkInterfaceStat WHERE (Time > DATE_SUB(NOW(), INTERVAL '.($Period['Period'] * ($I + 1) + 1).' HOUR)) AND (Time < DATE_SUB(NOW(), INTERVAL '.($Period['Period'] * $I + 1).' HOUR)) GROUP BY NetworkInterface) AS Period'.$I.' ON Period'.$I.'.NetworkInterface = NetworkInterface.Id'; 61 62 $Columns .= ', Period'.$I.'.Percent AS Period'.$I.'Column'; 62 63 } … … 80 81 if(array_key_exists($_GET['Period'], $this->Period)) 81 82 { 82 for($I = 0; $I < 10; $I++)83 for($I = 0; $I < $this->PeriodCount; $I++) 83 84 { 84 85 $Output .= '<td style="text-align: center;">'.sprintf('%01.2f', $Interface['Period'.$I.'Column']).'</td>';
Note:
See TracChangeset
for help on using the changeset viewer.