2010-04-11 13:45:19 +00:00
|
|
|
<?php
|
|
|
|
|
2010-07-24 19:14:41 +00:00
|
|
|
$graph_type = "processor_usage";
|
|
|
|
|
2011-03-17 00:09:20 +00:00
|
|
|
echo("<div style='margin-top: 5px; padding: 0px;'>");
|
2014-01-13 10:05:19 +00:00
|
|
|
echo(" <table class='table table-condensed'>");
|
2011-04-13 14:19:49 +00:00
|
|
|
|
2014-01-13 10:05:19 +00:00
|
|
|
echo("<tr>
|
|
|
|
<th>Device</th>
|
2011-04-13 14:19:49 +00:00
|
|
|
<th>Processor</th>
|
2014-01-13 10:05:19 +00:00
|
|
|
<th></th>
|
|
|
|
<th>Usage</th>
|
2011-04-13 14:19:49 +00:00
|
|
|
</tr>");
|
|
|
|
|
2011-05-16 09:55:27 +00:00
|
|
|
foreach (dbFetchRows("SELECT * FROM `processors` AS P, `devices` AS D WHERE D.device_id = P.device_id ORDER BY D.hostname") as $proc)
|
2011-03-17 00:09:20 +00:00
|
|
|
{
|
|
|
|
if (device_permitted($proc['device_id']))
|
|
|
|
{
|
2010-04-11 13:45:19 +00:00
|
|
|
$device = $proc;
|
|
|
|
|
2012-05-25 12:24:34 +00:00
|
|
|
// FIXME should that really be done here? :-)
|
2010-04-11 13:45:19 +00:00
|
|
|
$text_descr = $proc['processor_descr'];
|
|
|
|
$text_descr = str_replace("Routing Processor", "RP", $text_descr);
|
|
|
|
$text_descr = str_replace("Switching Processor", "SP", $text_descr);
|
|
|
|
$text_descr = str_replace("Sub-Module", "Module ", $text_descr);
|
|
|
|
$text_descr = str_replace("DFC Card", "DFC", $text_descr);
|
|
|
|
|
2015-04-15 13:31:26 +00:00
|
|
|
$proc_url = "device/device=".$device['device_id']."/tab=health/metric=processor/";
|
2010-04-11 13:45:19 +00:00
|
|
|
|
2012-05-06 18:38:11 +00:00
|
|
|
$mini_url = "graph.php?id=".$proc['processor_id']."&type=".$graph_type."&from=".$config['time']['day']."&to=".$config['time']['now']."&width=80&height=20&bg=f4f4f400";
|
2010-04-11 13:45:19 +00:00
|
|
|
|
|
|
|
$proc_popup = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$text_descr;
|
2015-05-24 20:51:52 +00:00
|
|
|
$proc_popup .= "</div><img src=\'graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=".$config['time']['month']."&to=".$config['time']['now']."&width=400&height=125\'>";
|
2010-04-11 13:45:19 +00:00
|
|
|
$proc_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"";
|
|
|
|
|
|
|
|
$perc = round($proc['processor_usage']);
|
|
|
|
|
2011-04-25 17:15:36 +00:00
|
|
|
$background = get_percentage_colours($perc);
|
2010-04-11 13:45:19 +00:00
|
|
|
|
2012-04-10 17:21:49 +00:00
|
|
|
echo(" <tr class=\"health\">
|
2010-08-02 22:09:52 +00:00
|
|
|
<td>".generate_device_link($proc)."</td>
|
2010-06-09 16:43:09 +00:00
|
|
|
<td class=\"tablehead\"><a href='".$proc_url."' $proc_popup>" . $text_descr . "</a></td>
|
|
|
|
<td width=\"90\"><a href=\"".$proc_url."\" $proc_popup><img src=\"$mini_url\" /></a></td>
|
|
|
|
<td width=\"200\"><a href=\"".$proc_url."\" $proc_popup>
|
2011-04-25 17:15:36 +00:00
|
|
|
".print_percentage_bar (400, 20, $perc, $perc."%", "ffffff", $background['left'], (100 - $perc)."%" , "ffffff", $background['right']));
|
2011-03-28 09:11:05 +00:00
|
|
|
echo('</a></td>
|
2010-06-09 16:43:09 +00:00
|
|
|
</tr>');
|
2010-06-12 13:37:39 +00:00
|
|
|
|
2011-09-18 13:11:04 +00:00
|
|
|
if ($vars['view'] == "graphs")
|
2012-04-10 17:21:49 +00:00
|
|
|
{
|
|
|
|
echo(' <tr></tr><tr class="health"><td colspan="5">');
|
2012-04-17 15:27:17 +00:00
|
|
|
|
2012-05-06 18:38:11 +00:00
|
|
|
$daily_graph = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=".$config['time']['day']."&to=".$config['time']['now']."&width=211&height=100";
|
|
|
|
$daily_url = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=".$config['time']['day']."&to=".$config['time']['now']."&width=400&height=150";
|
2010-04-11 13:45:19 +00:00
|
|
|
|
2012-05-06 18:38:11 +00:00
|
|
|
$weekly_graph = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=".$config['time']['week']."&to=".$config['time']['now']."&width=211&height=100";
|
|
|
|
$weekly_url = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=".$config['time']['week']."&to=".$config['time']['now']."&width=400&height=150";
|
2010-04-11 13:45:19 +00:00
|
|
|
|
2012-05-06 18:38:11 +00:00
|
|
|
$monthly_graph = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=".$config['time']['month']."&to=".$config['time']['now']."&width=211&height=100";
|
|
|
|
$monthly_url = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=".$config['time']['month']."&to=".$config['time']['now']."&width=400&height=150";
|
2010-04-11 13:45:19 +00:00
|
|
|
|
2014-10-09 17:12:07 +00:00
|
|
|
$yearly_graph = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=".$config['time']['year']."&to=".$config['time']['now']."&width=211&height=100";
|
|
|
|
$yearly_url = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=".$config['time']['year']."&to=".$config['time']['now']."&width=400&height=150";
|
2010-04-11 13:45:19 +00:00
|
|
|
|
2011-03-17 00:09:20 +00:00
|
|
|
echo(" <a onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT);\" onmouseout=\"return nd();\">
|
2010-06-09 19:22:03 +00:00
|
|
|
<img src=\"$daily_graph\" border=\"0\"></a> ");
|
2011-03-17 00:09:20 +00:00
|
|
|
echo(" <a onmouseover=\"return overlib('<img src=\'$weekly_url\'>', LEFT);\" onmouseout=\"return nd();\">
|
2010-06-09 19:22:03 +00:00
|
|
|
<img src=\"$weekly_graph\" border=\"0\"></a> ");
|
2011-03-17 00:09:20 +00:00
|
|
|
echo(" <a onmouseover=\"return overlib('<img src=\'$monthly_url\'>', LEFT);\" onmouseout=\"return nd();\">
|
2010-06-09 19:22:03 +00:00
|
|
|
<img src=\"$monthly_graph\" border=\"0\"></a> ");
|
2011-03-17 00:09:20 +00:00
|
|
|
echo(" <a onmouseover=\"return overlib('<img src=\'$yearly_url\'>', LEFT);\" onmouseout=\"return nd();\">
|
2010-06-09 16:43:09 +00:00
|
|
|
<img src=\"$yearly_graph\" border=\"0\"></a>");
|
2011-03-17 00:09:20 +00:00
|
|
|
echo(" </td>
|
2010-06-09 16:43:09 +00:00
|
|
|
</tr>");
|
2010-04-11 13:45:19 +00:00
|
|
|
|
2011-03-17 00:09:20 +00:00
|
|
|
} #end graphs if
|
2010-04-11 13:45:19 +00:00
|
|
|
}
|
2011-03-17 00:09:20 +00:00
|
|
|
}
|
2010-04-11 13:45:19 +00:00
|
|
|
|
2011-03-17 00:09:20 +00:00
|
|
|
echo("</table>");
|
|
|
|
echo("</div>");
|
2010-04-11 13:45:19 +00:00
|
|
|
|
2011-04-25 17:15:36 +00:00
|
|
|
?>
|