Changeset 102 for devel/www/network/dostupnost.php
- Timestamp:
- Aug 3, 2008, 6:48:38 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/www/network/dostupnost.php
r101 r102 11 11 $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. 12 12 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>'; 13 $Output .= '< table width="100%"><tr><td valign="top"></td><td valign="top">';13 $Output .= '<div align="center">'; 14 14 15 15 // Zařízení 16 $Output .= '< strong>Zařízení:</strong><table style="font-size: small;" cellspacing="0" cellpadding="3" border="1">';16 $Output .= '<br /><table style="font-size: small;" cellspacing="0" cellpadding="3" border="1">'; 17 17 $Output .= '<tr><th>Jméno</th><th>Hodina [%]</th><th>Den [%]</th><th>Týden [%]</th><th>Měsíc [%]</th><th>Year [%]</th></tr>'; 18 18 $DbResult = $this->Database->query('SELECT hosts.name, PeriodHour.Percent as Hour, PeriodDay.Percent as Day, PeriodWeek.Percent as Week, PeriodMonth.Percent as Month, PeriodYear.Percent as Year FROM hosts LEFT JOIN (SELECT stat_hosts.host_id, (SUM(stat_hosts.count) / 1 / 60 * 100) as Percent FROM stat_hosts WHERE (time > DATE_SUB(DATE_SUB(NOW(), INTERVAL 1 HOUR), INTERVAL 1 HOUR)) AND (time< DATE_SUB(NOW(), INTERVAL 1 HOUR)) GROUP BY host_id) as PeriodHour ON PeriodHour.host_id=hosts.id LEFT JOIN (SELECT stat_hosts.host_id, (SUM(stat_hosts.count) / 24 / 60 * 100) as Percent FROM stat_hosts WHERE (time > DATE_SUB(DATE_SUB(NOW(), INTERVAL 1 HOUR), INTERVAL 24 HOUR)) AND (time< DATE_SUB(NOW(), INTERVAL 1 HOUR)) GROUP BY host_id) as PeriodDay ON PeriodDay.host_id=hosts.id LEFT JOIN (SELECT stat_hosts.host_id, (SUM(stat_hosts.count) / 24 / 7 / 60 * 100) as Percent FROM stat_hosts WHERE (time > DATE_SUB(DATE_SUB(NOW(), INTERVAL 1 HOUR), INTERVAL 24 * 7 HOUR)) AND (time< DATE_SUB(NOW(), INTERVAL 1 HOUR)) GROUP BY host_id) as PeriodWeek ON PeriodWeek.host_id=hosts.id LEFT JOIN (SELECT stat_hosts.host_id, (SUM(stat_hosts.count) / 24 / 30 / 60 * 100) as Percent FROM stat_hosts WHERE (time > DATE_SUB(DATE_SUB(NOW(), INTERVAL 1 HOUR), INTERVAL 24 * 30 HOUR)) AND (time< DATE_SUB(NOW(), INTERVAL 1 HOUR)) GROUP BY host_id) as PeriodMonth ON PeriodMonth.host_id=hosts.id LEFT JOIN (SELECT stat_hosts.host_id, (SUM(stat_hosts.count) / 24 / 365 / 60 * 100) as Percent FROM stat_hosts WHERE (time > DATE_SUB(DATE_SUB(NOW(), INTERVAL 1 HOUR), INTERVAL 24 * 365 HOUR)) AND (time< DATE_SUB(NOW(), INTERVAL 1 HOUR)) GROUP BY host_id) as PeriodYear ON PeriodYear.host_id=hosts.id WHERE hosts.used=1 AND hosts.show_online=0'); … … 20 20 while($Row = $DbResult->fetch_array()) 21 21 { 22 $Output .= '<tr><td>'.$Row['name'].'</td><td >'.sprintf("%01.2f", $Row['Hour']).'</td><td>'.sprintf("%01.2f", $Row['Day']).'</td><td>'.sprintf("%01.2f", $Row['Week']).'</td><td>'.sprintf("%01.2f", $Row['Month']).'</td><td>'.sprintf("%01.2f", $Row['Year']).'</td></tr>';22 $Output .= '<tr><td>'.$Row['name'].'</td><td style="text-align: right;">'.sprintf("%01.2f", $Row['Hour']).'</td><td style="text-align: right;">'.sprintf("%01.2f", $Row['Day']).'</td><td style="text-align: right;">'.sprintf("%01.2f", $Row['Week']).'</td><td style="text-align: right;">'.sprintf("%01.2f", $Row['Month']).'</td><td style="text-align: right;">'.sprintf("%01.2f", $Row['Year']).'</td></tr>'; 23 23 } 24 $Output .= '</table>'; 25 $Output .= '</td></tr></table>'; 24 $Output .= '</table></div>'; 26 25 return($Output); 27 26 }
Note:
See TracChangeset
for help on using the changeset viewer.