Collect OUI Database and do OUI lookups (#12842)

* first draft

refresh time

refresh time

* return codes

style

style

* presentation

* Exception details

more

fix

fix

* add tooltips

fixes for dns display

* create WebUI config option

languages

* refresh data every 7 to 11 days, keep it 15 days max

* 'Ports' and 'Port' ARP table

* Stp page support

style

style

* fix dnsname column finding when vendor is added/removed

fix dnsname column finding when vendor is added/removed

* nac vendor column

nac

* filter fields to reduce size of AJAX reply

filter fields to reduce size of AJAX reply

* fix typo on dns column detection

* default enabled
This commit is contained in:
PipoCanaja 2021-05-10 21:56:48 +02:00 committed by GitHub
parent d81a0255c5
commit fff8b8e832
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 278 additions and 46 deletions

View File

@ -25,6 +25,7 @@
namespace LibreNMS\Util;
use App\Models\Device;
use Cache;
use LibreNMS\Config;
class Rewrite
@ -145,6 +146,19 @@ class Rewrite
return rtrim(chunk_split($mac, 2, ':'), ':');
}
/**
* Extract the OUI and match it against cached values
*
* @param string $mac
* @return string
*/
public static function readableOUI($mac)
{
$key = 'OUIDB-' . (substr($mac, 0, 6));
return Cache::get($key, '');
}
/**
* Reformat hex MAC as oid MAC (dotted-decimal)
*

View File

@ -157,6 +157,7 @@ class FdbTablesController extends TableController
$item = [
'device' => $fdb_entry->device ? Url::deviceLink($fdb_entry->device) : '',
'mac_address' => Rewrite::readableMac($fdb_entry->mac_address),
'mac_oui' => Rewrite::readableOUI($fdb_entry->mac_address),
'ipv4_address' => $ip_info['ips']->implode(', '),
'interface' => '',
'vlan' => $fdb_entry->vlan ? $fdb_entry->vlan->vlan_vlan : '',

View File

@ -47,6 +47,7 @@ class PortNacController extends TableController
return [
'port_id',
'mac_address',
'mac_oui',
'ip_address',
'vlan',
'domain',
@ -70,7 +71,10 @@ class PortNacController extends TableController
*/
public function baseQuery($request)
{
return PortsNac::where('device_id', $request->device_id)->hasAccess($request->user())->with('port');
return PortsNac::select('port_id', 'mac_address', 'ip_address', 'vlan', 'domain', 'host_mode', 'username', 'authz_by', 'timeout', 'time_elapsed', 'time_left', 'authc_status', 'authz_status', 'method')
->where('device_id', $request->device_id)
->hasAccess($request->user())
->with('port');
}
/**
@ -80,7 +84,9 @@ class PortNacController extends TableController
{
$item = $nac->toArray();
$item['port_id'] = Url::portLink($nac->port, $nac->port->getShortLabel());
$item['mac_oui'] = Rewrite::readableOUI($item['mac_address']);
$item['mac_address'] = Rewrite::readableMac($item['mac_address']);
$item['port'] = null; //free some unused data to be sent to the browser
return $item;
}

View File

@ -346,6 +346,15 @@ if ($options['f'] === 'peeringdb') {
}
}
if ($options['f'] === 'mac_oui') {
$lock = Cache::lock('macouidb', 86000);
if ($lock->get()) {
$res = cache_mac_oui();
$lock->release();
exit($res);
}
}
if ($options['f'] === 'refresh_os_cache') {
echo 'Clearing OS cache' . PHP_EOL;
unlink(Config::get('install_dir') . '/cache/os_defs.cache');

View File

@ -369,6 +369,7 @@ main () {
status_run 'Cleaning up DB' "$DAILY_SCRIPT cleanup"
status_run 'Fetching notifications' "$DAILY_SCRIPT notifications"
status_run 'Caching PeeringDB data' "$DAILY_SCRIPT peeringdb"
status_run 'Caching Mac OUI data' "$DAILY_SCRIPT mac_oui"
;;
cleanup)
# Cleanups
@ -404,6 +405,9 @@ main () {
options=("peeringdb")
call_daily_php "${options[@]}"
;;
mac_oui)
options=("mac_oui")
call_daily_php "${options[@]}"
esac
fi
}

View File

@ -4,8 +4,8 @@
"/css/app.css": "/css/app.css?id=996b9e3da0c3ab98067e",
"/js/vendor.js": "/js/vendor.js?id=54e44dd06cb8f6a3e6fe",
"/js/lang/de.js": "/js/lang/de.js?id=db973f6aaff0cda764c6",
"/js/lang/en.js": "/js/lang/en.js?id=1b381cf5180cf72bee65",
"/js/lang/fr.js": "/js/lang/fr.js?id=acd514ce666ebf45ef7b",
"/js/lang/en.js": "/js/lang/en.js?id=fd41f6b9991c32a36645",
"/js/lang/fr.js": "/js/lang/fr.js?id=096c9e010fc548e53b0a",
"/js/lang/it.js": "/js/lang/it.js?id=b28a63928155eeb4e2a1",
"/js/lang/ru.js": "/js/lang/ru.js?id=f6b7c078755312a0907c",
"/js/lang/uk.js": "/js/lang/uk.js?id=c19a5dcee4724579cb41",

View File

@ -1858,6 +1858,53 @@ function update_device_logo(&$device)
}
}
/**
* Function to generate Mac OUI Cache
*/
function cache_mac_oui()
{
// timers:
$mac_oui_refresh_int_min = 86400 * rand(7, 11); // 7 days + a random number between 0 and 4 days
$mac_oui_cache_time = 1296000; // we keep data during 15 days maximum
$lock = Cache::lock('macouidb-refresh', $mac_oui_refresh_int_min); //We want to refresh after at least $mac_oui_refresh_int_min
if (Config::get('mac_oui.enabled') !== true) {
echo 'Mac OUI integration disabled' . PHP_EOL;
return 0;
}
if ($lock->get()) {
echo 'Caching Mac OUI' . PHP_EOL;
try {
$mac_oui_url = 'https://macaddress.io/database/macaddress.io-db.json';
echo ' -> Downloading ...' . PHP_EOL;
$get = Requests::get($mac_oui_url, [], ['proxy' => get_proxy()]);
echo ' -> Processing ...' . PHP_EOL;
$json_data = $get->body;
foreach (explode("\n", $json_data) as $json_line) {
$entry = json_decode($json_line);
if ($entry && $entry->{'assignmentBlockSize'} == 'MA-L') {
$oui = strtolower(str_replace(':', '', $entry->{'oui'}));
$key = 'OUIDB-' . $oui;
Cache::put($key, $entry->{'companyName'}, $mac_oui_cache_time);
}
}
} catch (Exception $e) {
echo 'Error processing Mac OUI :' . PHP_EOL;
echo 'Exception: ' . get_class($e) . PHP_EOL;
echo $e->getMessage() . PHP_EOL;
$lock->release(); // we did not succeed so we'll try again next time
return 1;
}
}
return 0;
}
/**
* Function to generate PeeringDB Cache
*/

View File

@ -37,6 +37,11 @@ if ($device['os'] === 'vrp') {
<tr>
<th data-column-id="port_id" data-width="100px">Port</th>
<th data-column-id="mac_address" data-width="150px" data-formatter="tooltip">MAC Address</th>
<?php
if (\LibreNMS\Config::get('mac_oui.enabled') === true) {
echo ' <th data-column-id="mac_oui" data-sortable="false" data-width="130px" data-visible="false" data-formatter="tooltip">Vendor</th>';
}
?>
<th data-column-id="ip_address" data-width="140px" data-formatter="tooltip">IP Address</th>
<th data-column-id="vlan" data-width="60px" data-formatter="tooltip"<?php echo $vlan_visibility ?>>Vlan</th>
<th data-column-id="domain" data-formatter="nac_domain" data-formatter="tooltip">Domain</th>
@ -75,8 +80,13 @@ if ($device['os'] === 'vrp') {
},
"tooltip": function (column, row) {
var value = row[column.id];
var vendor = '';
if (column.id == 'mac_address' && ((vendor = row['mac_oui']) != '' )) {
return "<span title=\'" + value + " (" + vendor + ")\' data-toggle=\'tooltip\'>" + value + "</span>";
}
return "<span title=\'" + value + "\' data-toggle=\'tooltip\'>" + value + "</span>";
}, "nac_authz": function (column, row) {
},
"nac_authz": function (column, row) {
var value = row[column.id];
if (value === 'authorizationSuccess' || value === 'sussess') {

View File

@ -4,8 +4,13 @@ $no_refresh = true;
<table id="port-arp" class="table table-condensed table-hover table-striped">
<thead>
<tr>
<th data-column-id="mac_address">MAC address</th>
<th data-column-id="ipv4_address">IPv4 address</th>
<th data-column-id="mac_address" data-formatter="tooltip">MAC address</th>
<?php
if (\LibreNMS\Config::get('mac_oui.enabled') === true) {
echo ' <th data-column-id="mac_oui" data-sortable="false" data-width="150px" data-visible="false" data-formatter="tooltip">Vendor</th>';
}
?>
<th data-column-id="ipv4_address" data-formatter="tooltip">IPv4 address</th>
<th data-column-id="remote_device" data-sortable="false">Remote device</th>
<th data-column-id="remote_interface" data-sortable="false">Remote interface</th>
</tr>
@ -24,6 +29,16 @@ var grid = $("#port-arp").bootgrid({
port_id: "<?php echo $port['port_id']; ?>"
};
},
formatters: {
"tooltip": function (column, row) {
var value = row[column.id];
var vendor = '';
if (column.id == 'mac_address' && ((vendor = row['mac_oui']) != '' )) {
return "<span title=\'" + value + " (" + vendor + ")\' data-toggle=\'tooltip\'>" + value + "</span>";
}
return "<span title=\'" + value + "\' data-toggle=\'tooltip\'>" + value + "</span>";
},
},
url: "ajax_table.php"
});
</script>

View File

@ -1,14 +1,20 @@
<?php
$no_refresh = true;
?>
<table id="port-fdb" class="table table-condensed table-hover table-striped">
<thead>
<tr>
<th data-column-id="mac_address" data-width="150px">MAC Address</th>
<th data-column-id="ipv4_address" data-sortable="false">IPv4 Address</th>
<th data-column-id="mac_address" data-width="150px" data-formatter="tooltip">MAC Address</th>
<?php
if (\LibreNMS\Config::get('mac_oui.enabled') === true) {
echo ' <th data-column-id="mac_oui" data-sortable="false" data-width="150px" data-visible="false" data-formatter="tooltip">Vendor</th>';
}
?>
<th data-column-id="ipv4_address" data-sortable="false" data-formatter="tooltip">IPv4 Address</th>
<th data-column-id="interface">Port</th>
<th data-column-id="vlan" data-width="60px">Vlan</th>
<th data-column-id="dnsname" data-sortable="false" data-visible="false">DNS Name</th>
<th data-column-id="dnsname" data-sortable="false" data-visible="false" data-formatter="tooltip">DNS Name</th>
<th data-column-id="first_seen" data-width="165px">First seen</th>
<th data-column-id="last_seen" data-width="165px">Last seen</th>
</tr>
@ -23,9 +29,19 @@ var grid = $("#port-fdb").bootgrid({
{
return {
port_id: "<?php echo $port['port_id']; ?>",
dns: $("#port-fdb").bootgrid("getColumnSettings")[4].visible
dns: $("#port-fdb").bootgrid("getColumnSettings").find(col => col.id === "dnsname").visible,
};
},
formatters: {
"tooltip": function (column, row) {
var value = row[column.id];
var vendor = '';
if (column.id == 'mac_address' && ((vendor = row['mac_oui']) != '' )) {
return "<span title=\'" + value + " (" + vendor + ")\' data-toggle=\'tooltip\'>" + value + "</span>";
}
return "<span title=\'" + value + "\' data-toggle=\'tooltip\'>" + value + "</span>";
},
},
url: "<?php echo url('/ajax/table/fdb-tables'); ?>"
});
</script>

View File

@ -5,8 +5,13 @@ $no_refresh = true;
<thead>
<tr>
<th data-column-id="interface">Port</th>
<th data-column-id="mac_address">MAC address</th>
<th data-column-id="ipv4_address">IPv4 address</th>
<th data-column-id="mac_address" data-formatter="tooltip">MAC address</th>
<?php
if (\LibreNMS\Config::get('mac_oui.enabled') === true) {
echo ' <th data-column-id="mac_oui" data-sortable="false" data-width="150px" data-visible="false" data-formatter="tooltip">Vendor</th>';
}
?>
<th data-column-id="ipv4_address" data-formatter="tooltip">IPv4 address</th>
<th data-column-id="remote_device" data-sortable="false">Remote device</th>
<th data-column-id="remote_interface" data-sortable="false">Remote interface</th>
</tr>
@ -25,6 +30,16 @@ var grid = $("#ports-arp").bootgrid({
device_id: "<?php echo $device['device_id']; ?>"
};
},
formatters: {
"tooltip": function (column, row) {
var value = row[column.id];
var vendor = '';
if (column.id == 'mac_address' && ((vendor = row['mac_oui']) != '' )) {
return "<span title=\'" + value + " (" + vendor + ")\' data-toggle=\'tooltip\'>" + value + "</span>";
}
return "<span title=\'" + value + "\' data-toggle=\'tooltip\'>" + value + "</span>";
},
},
url: "ajax_table.php"
});
</script>

View File

@ -4,12 +4,17 @@ $no_refresh = true;
<table id="ports-fdb" class="table table-condensed table-hover table-striped">
<thead>
<tr>
<th data-column-id="mac_address" data-width="150px">MAC Address</th>
<th data-column-id="ipv4_address" data-sortable="false">IPv4 Address</th>
<th data-column-id="mac_address" data-width="150px" data-formatter="tooltip">MAC Address</th>
<?php
if (\LibreNMS\Config::get('mac_oui.enabled') === true) {
echo ' <th data-column-id="mac_oui" data-sortable="false" data-width="150px" data-visible="false" data-formatter="tooltip">Vendor</th>';
}
?>
<th data-column-id="ipv4_address" data-sortable="false" data-formatter="tooltip">IPv4 Address</th>
<th data-column-id="interface">Port</th>
<th data-column-id="description">Description</th>
<th data-column-id="description" data-formatter="tooltip">Description</th>
<th data-column-id="vlan" data-width="60px">Vlan</th>
<th data-column-id="dnsname" data-sortable="false" data-visible="false">DNS Name</th>
<th data-column-id="dnsname" data-sortable="false" data-visible="false" data-formatter="tooltip">DNS Name</th>
<th data-column-id="first_seen" data-width="165px">First seen</th>
<th data-column-id="last_seen" data-width="165px">Last seen</th>
</tr>
@ -24,9 +29,19 @@ var grid = $("#ports-fdb").bootgrid({
{
return {
device_id: "<?php echo $device['device_id']; ?>",
dns: $("#ports-fdb").bootgrid("getColumnSettings")[5].visible
dns: $("#ports-fdb").bootgrid("getColumnSettings").find(col => col.id === "dnsname").visible,
};
},
formatters: {
"tooltip": function (column, row) {
var value = row[column.id];
var vendor = '';
if (column.id == 'mac_address' && ((vendor = row['mac_oui']) != '' )) {
return "<span title=\'" + value + " (" + vendor + ")\' data-toggle=\'tooltip\'>" + value + "</span>";
}
return "<span title=\'" + value + "\' data-toggle=\'tooltip\'>" + value + "</span>";
},
},
url: "<?php echo url('/ajax/table/fdb-tables') ?>"
});
</script>

View File

@ -5,8 +5,9 @@
<table id="arp-search" class="table table-hover table-condensed table-striped">
<thead>
<tr>
<th data-column-id="mac_address">MAC Address</th>
<th data-column-id="ipv4_address">IP Address</th>
<th data-column-id="mac_address" data-formatter="tooltip">MAC Address</th>
<th data-column-id="mac_oui" data-sortable="false" data-visible="false" data-formatter="tooltip">Vendor</th>
<th data-column-id="ipv4_address" data-formatter="tooltip">IP Address</th>
<th data-column-id="hostname" data-order="asc">Device</th>
<th data-column-id="interface">Interface</th>
<th data-column-id="remote_device" data-sortable="false">Remote device</th>
@ -94,7 +95,17 @@ echo '"' . $_POST['searchPhrase'] . '"+';
searchPhrase: '<?php echo $_POST['searchPhrase']; ?>'
};
},
url: "ajax_table.php"
url: "ajax_table.php",
formatters: {
"tooltip": function (column, row) {
var value = row[column.id];
var vendor = '';
if (column.id == 'mac_address' && ((vendor = row['mac_oui']) != '' )) {
return "<span title=\'" + value + " (" + vendor + ")\' data-toggle=\'tooltip\'>" + value + "</span>";
}
return "<span title=\'" + value + "\' data-toggle=\'tooltip\'>" + value + "</span>";
},
},
});
</script>

View File

@ -6,12 +6,17 @@
<thead>
<tr>
<th data-column-id="device">Device</th>
<th data-column-id="mac_address" data-width="150px">MAC Address</th>
<th data-column-id="ipv4_address" data-sortable="false">IPv4 Address</th>
<th data-column-id="mac_address" data-width="150px" data-formatter="tooltip">MAC Address</th>
<?php
if (\LibreNMS\Config::get('mac_oui.enabled') === true) {
echo ' <th data-column-id="mac_oui" data-sortable="false" data-width="150px" data-visible="false" data-formatter="tooltip">Vendor</th>';
}
?>
<th data-column-id="ipv4_address" data-sortable="false" data-formatter="tooltip">IPv4 Address</th>
<th data-column-id="interface">Port</th>
<th data-column-id="vlan" data-width="60px">Vlan</th>
<th data-column-id="description">Description</th>
<th data-column-id="dnsname" data-sortable="false" data-visible="false">DNS Name</th>
<th data-column-id="description" data-formatter="tooltip">Description</th>
<th data-column-id="dnsname" data-sortable="false" data-visible="false" data-formatter="tooltip">DNS Name</th>
<th data-column-id="first_seen" data-width="165px">First seen</th>
<th data-column-id="last_seen" data-width="165px">Last seen</th>
</tr>
@ -118,10 +123,20 @@ echo '"' . $vars['searchPhrase'] . '"+';
device_id: '<?php echo $vars['device_id']; ?>',
searchby: '<?php echo $vars['searchby']; ?>',
searchPhrase: '<?php echo $vars['searchPhrase']; ?>',
dns: $("#fdb-search").bootgrid("getColumnSettings")[6].visible
dns: $("#fdb-search").bootgrid("getColumnSettings").find(col => col.id === "dnsname").visible,
};
},
url: "<?php echo url('/ajax/table/fdb-tables'); ?>"
url: "<?php echo url('/ajax/table/fdb-tables'); ?>",
formatters: {
"tooltip": function (column, row) {
var value = row[column.id];
var vendor = '';
if (column.id == 'mac_address' && ((vendor = row['mac_oui']) != '' )) {
return "<span title=\'" + value + " (" + vendor + ")\' data-toggle=\'tooltip\'>" + value + "</span>";
}
return "<span title=\'" + value + "\' data-toggle=\'tooltip\'>" + value + "</span>";
},
},
});
</script>

View File

@ -7,8 +7,8 @@
<tr>
<th data-column-id="hostname" data-order="asc">Device</th>
<th data-column-id="interface">Interface</th>
<th data-column-id="address" data-sortable="false">Address</th>
<th data-column-id="description" data-sortable="false">Description</th>
<th data-column-id="address" data-sortable="false" data-formatter="tooltip">Address</th>
<th data-column-id="description" data-sortable="false" data-formatter="tooltip">Description</th>
</tr>
</thead>
</table>
@ -89,7 +89,13 @@ if ($_POST['interface'] == 'Vlan%') {
address: '<?php echo $_POST['address']; ?>'
};
},
url: "ajax_table.php"
url: "ajax_table.php",
formatters: {
"tooltip": function (column, row) {
var value = row[column.id];
return "<span title=\'" + value + "\' data-toggle=\'tooltip\'>" + value + "</span>";
},
},
});
</script>

View File

@ -7,8 +7,8 @@
<tr>
<th data-column-id="hostname">Device</th>
<th data-column-id="interface">Interface</th>
<th data-column-id="address" data-sortable="false">Address</th>
<th data-column-id="description" data-sortable="false">Description</th>
<th data-column-id="address" data-sortable="false" data-formatter="tooltip">Address</th>
<th data-column-id="description" data-sortable="false" data-formatter="tooltip">Description</th>
</tr>
<thead>
</table>
@ -90,7 +90,13 @@ if ($_POST['interface'] == 'Vlan%') {
address: '<?php echo $_POST['address']; ?>'
};
},
url: "ajax_table.php"
url: "ajax_table.php",
formatters: {
"tooltip": function (column, row) {
var value = row[column.id];
return "<span title=\'" + value + "\' data-toggle=\'tooltip\'>" + value + "</span>";
},
},
});
</script>

View File

@ -7,8 +7,12 @@
<tr>
<th data-column-id="hostname" data-order="asc">Device</th>
<th data-column-id="interface">Interface</th>
<th data-column-id="address" data-sortable="false">MAC Address</th>
<th data-column-id="description" data-sortable="false">Description</th></tr>
<th data-column-id="address" data-sortable="false" data-formatter="tooltip">MAC Address</th>
<?php
if (\LibreNMS\Config::get('mac_oui.enabled') === true) {
echo ' <th data-column-id="mac_oui" data-sortable="false" data-width="150px" data-visible="false" data-formatter="tooltip">Vendor</th>';
}
?> <th data-column-id="description" data-sortable="false" data-formatter="tooltip">Description</th></tr>
</tr>
</thead>
</table>
@ -92,7 +96,17 @@ echo '"' . $_POST['address'] . '"+';
address: '<?php echo $_POST['address']; ?>'
};
},
url: "ajax_table.php"
url: "ajax_table.php",
formatters: {
"tooltip": function (column, row) {
var value = row[column.id];
var vendor = '';
if (column.id == 'address' && ((vendor = row['mac_oui']) != '' )) {
return "<span title=\'" + value + " (" + vendor + ")\' data-toggle=\'tooltip\'>" + value + "</span>";
}
return "<span title=\'" + value + "\' data-toggle=\'tooltip\'>" + value + "</span>";
},
},
});
</script>

View File

@ -4,12 +4,12 @@ echo '<table class="table table-condensed table-striped table-hover">';
$stp_raw = dbFetchRow('SELECT * FROM `stp` WHERE `device_id` = ?', [$device['device_id']]);
$stp = [
'Root bridge' => ($stp_raw['rootBridge'] == 1) ? 'Yes' : 'No',
'Bridge address (MAC)' => $stp_raw['bridgeAddress'],
'Bridge address (MAC)' => \LibreNMS\Util\Rewrite::readableMac($stp_raw['bridgeAddress']) . ' (' . \LibreNMS\Util\Rewrite::readableOUI($stp_raw['bridgeAddress']) . ')',
'Protocol specification' => $stp_raw['protocolSpecification'],
'Priority (0-61440)' => $stp_raw['priority'],
'Time since topology change' => \LibreNMS\Util\Time::formatInterval($stp_raw['timeSinceTopologyChange']),
'Topology changes' => $stp_raw['topChanges'],
'Designated root (MAC)' => $stp_raw['designatedRoot'],
'Designated root (MAC)' => \LibreNMS\Util\Rewrite::readableMac($stp_raw['designatedRoot']) . ' (' . \LibreNMS\Util\Rewrite::readableOUI($stp_raw['designatedRoot']) . ')',
'Root cost' => $stp_raw['rootCost'],
'Root port' => $stp_raw['rootPort'],
'Max age (s)' => $stp_raw['maxAge'],
@ -21,11 +21,11 @@ $stp = [
'Bridge forward delay (s)' => $stp_raw['bridgeForwardDelay'],
];
foreach (array_keys($stp) as $key) {
echo "
echo '
<tr>
<td>$key</td>
<td>$stp[$key]</td>
<td>' . $key . '</td>
<td>' . $stp[$key] . '</td>
</tr>
";
';
}
echo '</table>';

View File

@ -87,6 +87,7 @@ foreach (dbFetchRows($sql, $param) as $interface) {
$address = (string) IP::parse($interface['ipv6_address'], true) . '/' . $interface['ipv6_prefixlen'];
} elseif ($vars['search_type'] == 'mac') {
$address = \LibreNMS\Util\Rewrite::readableMac($interface['ifPhysAddress']);
$mac_oui = \LibreNMS\Util\Rewrite::readableOUI($interface['ifPhysAddress']);
} else {
$address = (string) IP::parse($interface['ipv4_address'], true) . '/' . $interface['ipv4_prefixlen'];
}
@ -99,12 +100,16 @@ foreach (dbFetchRows($sql, $param) as $interface) {
if (port_permitted($interface['port_id'])) {
$interface = cleanPort($interface, $interface);
$response[] = [
$row = [
'hostname' => generate_device_link($interface),
'interface' => generate_port_link($interface) . ' ' . $error_img,
'address' => $address,
'description' => $interface['ifAlias'],
];
if ($vars['search_type'] == 'mac') {
$row['mac_oui'] = $mac_oui;
}
$response[] = $row;
}
}//end foreach

View File

@ -95,6 +95,7 @@ foreach (dbFetchRows($sql, $param) as $entry) {
$response[] = [
'mac_address' => \LibreNMS\Util\Rewrite::readableMac($entry['mac_address']),
'mac_oui' => \LibreNMS\Util\Rewrite::readableOUI($entry['mac_address']),
'ipv4_address' => $entry['ipv4_address'],
'hostname' => generate_device_link($entry),
'interface' => generate_port_link($entry, makeshortif($entry['label'])) . ' ' . $error_img,

View File

@ -40,9 +40,9 @@ foreach (dbFetchRows($sql, [$device_id]) as $stp_ports_db) {
'state' => $stp_ports_db['state'],
'enable' => $stp_ports_db['enable'],
'pathCost' => $stp_ports_db['pathCost'],
'designatedRoot' => generate_device_link($root_device, $root_device['hostname']) . '<br>' . $stp_ports_db['designatedRoot'],
'designatedRoot' => ($root_device ? generate_device_link($root_device, $root_device['hostname']) : \LibreNMS\Util\Rewrite::readableOUI($stp_ports_db['designatedRoot'])) . '<br>' . \LibreNMS\Util\Rewrite::readableMac($stp_ports_db['designatedRoot']),
'designatedCost' => $stp_ports_db['designatedCost'],
'designatedBridge' => generate_device_link($bridge_device, $bridge_device['hostname']) . '<br>' . $stp_ports_db['designatedBridge'],
'designatedBridge' => ($bridge_device ? generate_device_link($bridge_device, $bridge_device['hostname']) : \LibreNMS\Util\Rewrite::readableOUI($stp_ports_db['designatedBridge'])) . '<br>' . \LibreNMS\Util\Rewrite::readableMac($stp_ports_db['designatedBridge']),
'designatedPort' => $stp_ports_db['designatedPort'],
'forwardTransitions' => $stp_ports_db['forwardTransitions'],
];

View File

@ -3729,6 +3729,13 @@
"order": 4,
"type": "text"
},
"mac_oui.enabled": {
"default": true,
"group": "external",
"section": "mac_oui",
"order": 0,
"type": "boolean"
},
"map.engine": {
"default": "leaflet",
"type": "select",
@ -4533,8 +4540,9 @@
"group": "system",
"section": "cleanup",
"order": 9,
"default": false,
"type": "boolean"
"units": "days",
"default": "10",
"type": "integer"
},
"project_home": {
"default": "https://www.librenms.org/",

View File

@ -46,6 +46,7 @@ return [
'location' => 'Location Settings',
'graylog' => 'Graylog Integration',
'oxidized' => 'Oxidized Integration',
'mac_oui' => 'Mac OUI Lookup Integration',
'peeringdb' => 'PeeringDB Integration',
'nfsen' => 'NfSen Integration',
'unix-agent' => 'Unix-Agent Integration',
@ -846,6 +847,12 @@ return [
'description' => 'Logon Message',
'help' => 'Displayed on the login page',
],
'mac_oui' => [
'enabled' => [
'description' => 'Enable MAC OUI lookup',
'help' => 'Enable mac-address vendor (OUI) lookup (data is downloaded by daily.sh)',
],
],
'mono_font' => [
'description' => 'Monospaced Font',
],

View File

@ -43,6 +43,7 @@ return [
'location' => 'Cartes',
'graylog' => 'Intégration Graylog',
'oxidized' => 'Intégration Oxidized',
'mac_oui' => 'Intégration des prefixes OUI d\'adresses mac',
'peeringdb' => 'Intégration PeeringDB',
'nfsen' => 'Intégration NfSen',
'unix-agent' => 'Intégration Unix-Agent',
@ -657,6 +658,12 @@ return [
'description' => 'Logon Message',
'help' => 'Displayed on the login page',
],
'mac_oui' => [
'enabled' => [
'description' => 'Activer la recherche des préfixes OUI (prefixes d\'adresses mac par fournisseur)',
'help' => 'Les données sont mises à jour via daily.sh',
],
],
'mono_font' => [
'description' => 'Monospaced Font',
],