Changeset 269 for trunk/network/dostupnost.php
- Timestamp:
- Jan 8, 2010, 8:11:29 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/network/dostupnost.php
r268 r269 13 13 array('Column' => 'Month', 'Title' => 'Měsíc', 'Period' => 720), // 24 * 30 14 14 array('Column' => 'Year', 'Title' => 'Rok', 'Period' => 8760), // 365 * 24 15 array('Column' => 'TenYear', 'Title' => 'Desetiletí', 'Period' => 87600), // 365 * 24 * 1015 //array('Column' => 'TenYear', 'Title' => 'Desetiletí', 'Period' => 87600), // 365 * 24 * 10 16 16 ); 17 17 … … 19 19 { 20 20 $Output = '<div style="font-size: small;">Dostupnost zařízení se kontroluje jednou za minutu. Hodnoty u delších intervalů nemusí odpovídat skutečnosti, protože záznam byl spuštěn až v průběhu těchto intervalu. 21 Všechny prvky sítě jsou kontrolovány z směrovačů, tj. pokud vypadne některé blízké zařízení, všechny další zařízení propojené přes něj jsou také nedostupné.</div>';21 Všechny prvky sítě jsou kontrolovány ze směrovačů, tj. pokud vypadne některé blízké zařízení, všechny další zařízení propojené přes něj jsou také nedostupné.</div>'; 22 22 $Output .= '<div align="center">'; 23 if(array_key_exists('Period', $_GET)) $Output .= 'Perioda: <a href="?">Smíšená</a> '; 24 else $Output .= 'Perioda: <a href="?"><strong>Smíšená</strong></a> '; 25 foreach($this->Period as $Index => $Period) 26 { 27 if(array_key_exists('Period', $_GET) and ($_GET['Period'] == $Index)) 28 $Output .= ' <a href="?Period='.$Index.'"><strong>'.$Period['Title'].'</strong></a>'; 29 else $Output .= ' <a href="?Period='.$Index.'">'.$Period['Title'].'</a>'; 30 } 31 $Output .= '<br/>'; 23 32 24 33 $HostTypeList = array(); … … 30 39 $Output .= '<br /><table class="WideTable" style="font-size: small;">'; 31 40 $Output .= '<tr><th>Jméno</th>'; 32 foreach($this->Period as $Period)33 $Output .= '<th>'.$Period['Title'].' [%]</th>';34 $Output .= '</tr>';35 41 36 42 $Join = ''; 37 43 $Columns = ''; 38 foreach($this->Period as $Period)44 if(!array_key_exists('Period', $_GET)) 39 45 { 40 $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'; 41 $Columns .= ', Period'.$Period['Column'].'.Percent AS '.$Period['Column']; 46 foreach($this->Period as $Period) 47 { 48 $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 $Columns .= ', Period'.$Period['Column'].'.Percent AS '.$Period['Column']; 51 } 52 } else 53 { 54 if(array_key_exists($_GET['Period'], $this->Period)) 55 { 56 for($I = 0; $I < 10; $I++) 57 { 58 $Period = $this->Period[$_GET['Period']]; 59 $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 $Columns .= ', Period'.$I.'.Percent AS Period'.$I.'Column'; 62 } 63 } else die('Neznámé id'); 42 64 } 65 66 $Output .= '</tr>'; 43 67 44 $DbResult2 = $this->Database->query('SELECT NetworkInterface.Name'.$Columns.', NetworkDevice.Name AS DeviceName FROM NetworkInterface '.$Join.' JOIN NetworkDevice ON NetworkInterface.Device = NetworkDevice.Id WHERE NetworkDevice.Used = 1 AND NetworkDevice.Type IN (1, 4, 5) ORDER BY Name');68 $DbResult2 = $this->Database->query('SELECT NetworkInterface.Name'.$Columns.', NetworkDevice.Name AS DeviceName FROM NetworkInterface '.$Join.' JOIN NetworkDevice ON NetworkInterface.Device = NetworkDevice.Id WHERE NetworkDevice.Used = 1 AND NetworkDevice.Type IN (1, 4, 5) ORDER BY DeviceName, Name'); 45 69 while($Interface = $DbResult2->fetch_assoc()) 46 70 { … … 48 72 if($Interface['Name'] != '') $Name .= '-'.$Interface['Name']; 49 73 $Output .= '<tr><td>'.$Name.'</td>'; 50 foreach($this->Period as $Period) 51 $Output .= '<td style="text-align: right;">'.sprintf('%01.2f', $Interface[$Period['Column']]).'</td>'; 74 if(!array_key_exists('Period', $_GET)) 75 { 76 foreach($this->Period as $Period) 77 $Output .= '<td style="text-align: right;">'.sprintf('%01.2f', $Interface[$Period['Column']]).'</td>'; 78 } else 79 { 80 if(array_key_exists($_GET['Period'], $this->Period)) 81 { 82 for($I = 0; $I < 10; $I++) 83 { 84 $Output .= '<td style="text-align: center;">'.sprintf('%01.2f', $Interface['Period'.$I.'Column']).'</td>'; 85 } 86 } else die('Neznámé id'); 87 } 52 88 $Output .= '</tr>'; 53 89 }
Note:
See TracChangeset
for help on using the changeset viewer.