2010-02-07 14:17:02 +00:00
|
|
|
<?php print_optionbar_start(28); ?>
|
2009-08-12 15:01:01 +00:00
|
|
|
|
2014-01-13 10:05:19 +00:00
|
|
|
<form method="post" action="" class="form-inline" role="form">
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<select name="device_id" id="device_id" class="form-control input-sm">
|
|
|
|
|
<option value="">All Devices</option>
|
2011-03-17 00:09:20 +00:00
|
|
|
<?php
|
2011-05-16 09:38:44 +00:00
|
|
|
foreach (dbFetchRows("SELECT `device_id`,`hostname` FROM `devices` GROUP BY `hostname` ORDER BY `hostname`") as $data)
|
2011-03-17 00:09:20 +00:00
|
|
|
{
|
|
|
|
|
echo('<option value="'.$data['device_id'].'"');
|
|
|
|
|
if ($data['device_id'] == $_POST['device_id']) { echo("selected"); }
|
|
|
|
|
echo(">".$data['hostname']."</option>");
|
|
|
|
|
}
|
|
|
|
|
?>
|
2009-08-05 16:05:14 +00:00
|
|
|
</select>
|
2014-01-13 10:05:19 +00:00
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<select name="interface" id="interface" class="form-control input-sm">
|
|
|
|
|
<option value="">All Interfaces</option>
|
|
|
|
|
<option value="Loopback%" <?php if ($_POST['interface'] == "Loopback%") { echo("selected"); } ?> >Loopbacks</option>
|
|
|
|
|
<option value="Vlan%" <?php if ($_POST['interface'] == "Vlan%") { echo("selected"); } ?> >VLANs</option>
|
2009-08-05 16:05:14 +00:00
|
|
|
</select>
|
2014-01-13 10:05:19 +00:00
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<input type="text" name="address" id="address" size=40 value="<?php echo($_POST['address']); ?>" class="form-control input-sm" placeholder="Mac Address"/>
|
|
|
|
|
</div>
|
|
|
|
|
<button type="submit" class="btn btn-default input-sm">Search</button>
|
2009-08-05 16:05:14 +00:00
|
|
|
</form>
|
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
|
2010-02-07 14:17:02 +00:00
|
|
|
print_optionbar_end();
|
|
|
|
|
|
2014-03-02 16:34:09 +00:00
|
|
|
echo('<div class="panel panel-default panel-condensed">
|
|
|
|
|
<div class="panel-heading">
|
|
|
|
|
<strong>MAC Addresses</strong>
|
|
|
|
|
</div>
|
|
|
|
|
<table class="table table-hover table-condensed table-striped">');
|
2009-08-05 16:05:14 +00:00
|
|
|
|
2011-05-16 09:38:44 +00:00
|
|
|
$query = "SELECT * FROM `ports` AS P, `devices` AS D WHERE P.device_id = D.device_id ";
|
|
|
|
|
$query .= "AND `ifPhysAddress` LIKE ?";
|
2012-04-21 19:50:21 +00:00
|
|
|
$param = array("%".str_replace(array(':', ' ', '-', '.', '0x'),'',mres($_POST['address']))."%");
|
2009-08-05 16:05:14 +00:00
|
|
|
|
2011-09-20 09:55:11 +00:00
|
|
|
if (is_numeric($_POST['device_id']))
|
|
|
|
|
{
|
2012-04-10 17:24:15 +00:00
|
|
|
$query .= " AND P.device_id = ?";
|
2011-09-20 09:55:11 +00:00
|
|
|
$param[] = $_POST['device_id'];
|
2011-05-16 09:38:44 +00:00
|
|
|
}
|
2011-09-20 09:55:11 +00:00
|
|
|
if ($_POST['interface'])
|
|
|
|
|
{
|
2012-04-10 17:24:15 +00:00
|
|
|
$query .= " AND P.ifDescr LIKE ?";
|
2011-05-16 09:38:44 +00:00
|
|
|
$param[] = $_POST['interface'];
|
|
|
|
|
}
|
|
|
|
|
$query .= " ORDER BY P.ifPhysAddress";
|
2009-08-05 16:05:14 +00:00
|
|
|
|
2014-03-02 16:34:09 +00:00
|
|
|
echo('<tr><th>Device</a></th><th>Interface</th><th>MAC Address</th><th>Description</th></tr>');
|
2011-05-16 09:38:44 +00:00
|
|
|
foreach (dbFetchRows($query, $param) as $entry)
|
2011-03-17 00:09:20 +00:00
|
|
|
{
|
|
|
|
|
if (!$ignore)
|
|
|
|
|
{
|
2011-04-24 00:28:09 +00:00
|
|
|
$speed = humanspeed($entry['ifSpeed']);
|
|
|
|
|
$type = humanmedia($entry['ifType']);
|
2009-10-12 09:48:40 +00:00
|
|
|
|
2011-04-24 00:28:09 +00:00
|
|
|
if ($entry['in_errors'] > 0 || $entry['out_errors'] > 0)
|
2011-03-17 00:09:20 +00:00
|
|
|
{
|
2011-04-24 00:28:09 +00:00
|
|
|
$error_img = generate_port_link($entry,"<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>",errors);
|
2011-03-17 00:09:20 +00:00
|
|
|
} else { $error_img = ""; }
|
2009-08-05 16:05:14 +00:00
|
|
|
|
2012-05-16 13:25:50 +00:00
|
|
|
if (port_permitted($entry['port_id']))
|
2011-03-17 00:09:20 +00:00
|
|
|
{
|
2011-04-29 23:09:35 +00:00
|
|
|
$interface = ifLabel ($interface, $interface);
|
|
|
|
|
|
2014-03-02 16:34:09 +00:00
|
|
|
echo('<tr>
|
|
|
|
|
<td>' . generate_device_link($entry) . '</td>
|
|
|
|
|
<td>' . generate_port_link($entry, makeshortif(fixifname($entry['ifDescr']))) . ' ' . $error_img . '</td>
|
2011-04-24 00:28:09 +00:00
|
|
|
<td>' . formatMac($entry['ifPhysAddress']) . '</td>
|
|
|
|
|
<td>' . $entry['ifAlias'] . "</td>
|
2009-08-05 16:05:14 +00:00
|
|
|
</tr>\n");
|
2011-03-17 00:09:20 +00:00
|
|
|
}
|
2009-08-05 16:05:14 +00:00
|
|
|
}
|
|
|
|
|
|
2011-03-17 00:09:20 +00:00
|
|
|
unset($ignore);
|
2009-08-05 16:05:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
echo("</table>");
|
2014-03-02 16:34:09 +00:00
|
|
|
echo('</div>');
|
2009-08-05 16:05:14 +00:00
|
|
|
|
2011-04-24 00:28:09 +00:00
|
|
|
?>
|