Changeset 543
- Timestamp:
- Jun 7, 2013, 11:02:33 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Network/Availability.php
r519 r543 18 18 function Show() 19 19 { 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 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>'; 20 $Output = '<div style="font-size: small;">Dostupnost zařízení se kontroluje jednou za minutu. '. 21 '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.'. 22 '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 23 $Output .= '<div align="center">'; 23 24 if(array_key_exists('Period', $_GET)) $Output .= 'Perioda: <a href="?">Smíšená</a> '; … … 37 38 38 39 39 $DbResult = $this->Database->query('SELECT COUNT(*) FROM NetworkInterface JOIN NetworkDevice ON NetworkInterface.Device = NetworkDevice.Id WHERE NetworkDevice.Used = 1 AND NetworkDevice.PermanentOnline=1'); 40 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `NetworkInterface` '. 41 'JOIN `NetworkDevice` ON `NetworkInterface`.`Device` = `NetworkDevice`.`Id` WHERE `NetworkDevice`.`Used` = 1 AND `NetworkDevice`.`PermanentOnline`=1'); 40 42 $DbRow = $DbResult->fetch_row(); 41 43 $PageList = GetPageList($DbRow[0]); … … 58 60 { 59 61 $TableColumns[] = array('Name' => $Period['Column'], 'Title' => $Period['Title'].' [%]'); 60 $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'; 61 $Columns .= ', Period'.$Period['Column'].'.Percent AS '.$Period['Column']; 62 $Join .= ' LEFT JOIN (SELECT `NetworkInterfaceStat`.`NetworkInterface`, (SUM(`NetworkInterfaceStat`.`PingCount`) / '. 63 $Period['Period'].' / 60 * 100) AS `Percent` FROM `NetworkInterfaceStat` WHERE (`Time` > DATE_SUB(NOW(), INTERVAL '. 64 ($Period['Period'] + 1).' HOUR)) AND (`Time` < DATE_SUB(NOW(), INTERVAL 1 HOUR)) GROUP BY `NetworkInterface`) AS `Period'. 65 $Period['Column'].'` ON `Period'.$Period['Column'].'`.`NetworkInterface` = `NetworkInterface`.`Id`'; 66 $Columns .= ', `Period'.$Period['Column'].'`.`Percent` AS `'.$Period['Column'].'`'; 62 67 } 63 68 } else … … 69 74 $Period = $this->Period[$_GET['Period']]; 70 75 $TableColumns[] = array('Name' => 'Period'.$I.'Column', 'Title' => $I.' [%]'); 71 $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'; 72 $Columns .= ', Period'.$I.'.Percent AS Period'.$I.'Column'; 76 $Join .= ' LEFT JOIN (SELECT `NetworkInterfaceStat`.`NetworkInterface`, (SUM(`NetworkInterfaceStat`.`PingCount`) / '. 77 $Period['Period'].' / 60 * 100) AS `Percent` FROM `NetworkInterfaceStat` WHERE (`Time` > DATE_SUB(NOW(), INTERVAL '. 78 ($Period['Period'] * ($I + 1) + 1).' HOUR)) AND (`Time` < DATE_SUB(NOW(), INTERVAL '.($Period['Period'] * $I + 1). 79 ' HOUR)) GROUP BY `NetworkInterface`) AS `Period'.$I.'` ON `Period'.$I.'`.`NetworkInterface` = `NetworkInterface`.`Id`'; 80 $Columns .= ', `Period'.$I.'`.`Percent` AS `Period'.$I.'Column`'; 73 81 } 74 82 } else die('Neznámé id'); … … 78 86 $Output .= $Order['Output']; 79 87 80 $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']); 88 $DbResult2 = $this->Database->query('SELECT `NetworkInterface`.`Name` AS `InterfaceName`'.$Columns.', '. 89 'CONCAT(`NetworkDevice`.`Name`, "-", `NetworkInterface`.`Name`) AS `Name`, `NetworkDevice`.`Name` AS `DeviceName` FROM `NetworkInterface` '. 90 $Join.' JOIN `NetworkDevice` ON `NetworkInterface`.`Device` = `NetworkDevice`.`Id` WHERE `NetworkDevice`.`Used` = 1 AND `NetworkDevice`.`PermanentOnline`=1'. 91 $Order['SQL'].$PageList['SQLLimit']); 81 92 while($Interface = $DbResult2->fetch_assoc()) 82 93 {
Note:
See TracChangeset
for help on using the changeset viewer.