Changeset 311 for trunk/network/dostupnost.php
- Timestamp:
- Apr 9, 2011, 8:15:31 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/network/dostupnost.php
r284 r311 7 7 var $FullTitle = 'Dostupnost aktivních prvků sítě'; 8 8 var $ShortTitle = 'Dostupnost sítě'; 9 var $PeriodCount = 12;9 var $PeriodCount = 24; 10 10 var $Period = array( 11 11 array('Column' => 'Hour', 'Title' => 'Hodina', 'Period' => 1, 'MinPercent' => 100), … … 37 37 $HostTypeList[$DbRow['Id']] = $DbRow; 38 38 39 // Zařízení 40 $Output .= '<br /><table class="WideTable" style="font-size: small;">'; 41 $Output .= '<tr><th>Jméno</th>'; 39 40 $DbResult = $this->Database->query('SELECT COUNT(*) FROM NetworkInterface JOIN NetworkDevice ON NetworkInterface.Device = NetworkDevice.Id WHERE NetworkDevice.Used = 1 AND NetworkDevice.PermanentOnline=1'); 41 $DbRow = $DbResult->fetch_row(); 42 $PageList = GetPageList($DbRow[0]); 43 44 $Output .= '<br />'; 45 46 $Output .= $PageList['Output']; 47 $Output .= '<table class="WideTable" style="font-size: small;">'; 48 49 $TableColumns = array( 50 array('Name' => 'DeviceName', 'Title' => 'Jméno'), 51 ); 52 42 53 43 54 $Join = ''; … … 45 56 if(!array_key_exists('Period', $_GET)) 46 57 { 47 foreach($this->Period as $ Period)58 foreach($this->Period as $Index => $Period) 48 59 { 49 $ Output .= '<th>'.$Period['Title'].' [%]</th>';60 $TableColumns[] = array('Name' => $Period['Column'], 'Title' => $Period['Title'].' [%]'); 50 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'] + 1).' HOUR)) AND (Time < DATE_SUB(NOW(), INTERVAL 1 HOUR)) GROUP BY NetworkInterface) AS Period'.$Period['Column'].' ON Period'.$Period['Column'].'.NetworkInterface = NetworkInterface.Id'; 51 62 $Columns .= ', Period'.$Period['Column'].'.Percent AS '.$Period['Column']; … … 58 69 { 59 70 $Period = $this->Period[$_GET['Period']]; 60 $ Output .= '<th>-'.$I.' [%]</th>';71 $TableColumns[] = array('Name' => 'Period'.$I.'Column', 'Title' => $I.' [%]'); 61 72 $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'; 62 73 $Columns .= ', Period'.$I.'.Percent AS Period'.$I.'Column'; … … 65 76 } 66 77 67 $Output .= '</tr>'; 78 $Order = GetOrderTableHeader($TableColumns, 'Name', 0); 79 $Output .= $Order['Output']; 68 80 69 $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.PermanentOnline=1 ORDER BY DeviceName, Name');81 $DbResult2 = $this->Database->query('SELECT NetworkInterface.Name AS InterfaceName'.$Columns.', CONCAT(NetworkDevice.Name, "-", NetworkInterface.Name) AS Name, NetworkDevice.Name AS DeviceName FROM NetworkInterface '.$Join.' JOIN NetworkDevice ON NetworkInterface.Device = NetworkDevice.Id WHERE NetworkDevice.Used = 1 AND NetworkDevice.PermanentOnline=1'.$Order['SQL'].$PageList['SQLLimit']); 70 82 while($Interface = $DbResult2->fetch_assoc()) 71 83 { 72 84 $Name = $Interface['DeviceName']; 73 if($Interface[' Name'] != '') $Name .= '-'.$Interface['Name'];85 if($Interface['InterfaceName'] != '') $Name .= '-'.$Interface['InterfaceName']; 74 86 $Output .= '<tr><td>'.$Name.'</td>'; 75 87 if(!array_key_exists('Period', $_GET)) … … 96 108 } 97 109 $Output .= '</table></div>'; 110 $Output .= $PageList['Output']; 98 111 return($Output); 99 112 }
Note:
See TracChangeset
for help on using the changeset viewer.