librenms/html/pages/ports/list.inc.php
Adam Amstrong 7ca62bbe04 changes (though i remember not what)
git-svn-id: http://www.observium.org/svn/observer/trunk@2687 61d68cd4-352d-0410-923a-c4978735b2b8
2011-10-17 10:33:06 +00:00

60 lines
2.0 KiB
PHP

<table cellpadding=3 cellspacing=0 class="devicetable sortable" width=100%>
<?php
echo("<tr class=tablehead><td></td><th>Device</a></th><th>Interface</th><th>Speed</th><th>Down</th><th>Up</th><th>Media</th><th>Description</th></tr>");
$row = 1;
$ports_disabled = 0; $ports_down = 0; $ports_up = 0; $ports_total = 0;
foreach ($ports as $port)
{
if ($port['ifAdminStatus'] == "down") { $ports_disabled++;
} elseif ($port['ifAdminStatus'] == "up" && $port['ifOperStatus']== "down") { $ports_down++;
} elseif ($port['ifAdminStatus'] == "up" && $port['ifOperStatus']== "up") { $ports_up++; }
$ports_total++;
if (port_permitted($port['interface_id'], $port['device_id']))
{
if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
$speed = humanspeed($port['ifSpeed']);
$type = humanmedia($port['ifType']);
$ifclass = ifclass($port['ifOperStatus'], $port['ifAdminStatus']);
if ($port['in_errors'] > 0 || $port['out_errors'] > 0)
{
$error_img = generate_port_link($port,"<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>",errors);
} else { $error_img = ""; }
$port['in_rate'] = formatRates($port['ifInOctets_rate'] * 8);
$port['out_rate'] = formatRates($port['ifOutOctets_rate'] * 8);
$port = ifLabel($port, $device);
echo("<tr bgcolor=$row_colour>
<td width=5></td>
<td width=200 class=list-bold><a href='" . generate_device_url($port) . "'>".$port['hostname']."</a></td>
<td width=150 class=list-bold><a class='".$ifclass."'href='" . generate_port_url($port) . "'>".fixIfName($port['label'])." $error_img</td>
<td width=110 >$speed</td>
<td width=110 class=green>".$port['in_rate']."</td>
<td width=110 class=blue>".$port['out_rate']."</td>
<td width=200>$type</td>
<td>" . $port['ifAlias'] . "</td>
</tr>\n");
$row++;
}
}
echo("</table>");
echo("Ports: $ports_total ( Up $ports_up | Down $ports_down | Disabled $ports_disabled )");
?>