mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Change ESXi port naming to be stable (#14639)
* Change ESXi port naming to be stable Currently every time discovery runs against ESXi, the port names change generating a lot of log spam. This is because ESXi uses this as the ifDescr: ```Device vmnic1000202 at 01:00.0 nmlx4_en``` The poller parses this, and extracts the interface name, whereas discovery does not, causing the interface names to flip every 6 hours. https://github.com/librenms/librenms/blob/22.10.0/includes/polling/ports.inc.php#L578-L580 This change gives the discovery process the same behaviour, so the naming is now stable. * Try to fix test data with a squash * vcsa test data * Synthesise VCSA ifName, use it in place of ifDescr * Refresh test data * Update ports.inc.php --------- Co-authored-by: Tony Murray <murraytony@gmail.com>
This commit is contained in:
@@ -4,6 +4,7 @@ group: unix
|
||||
text: VMware ESXi
|
||||
icon: vmware
|
||||
mib_dir: vmware
|
||||
ifname: true
|
||||
ifXmcbc: true
|
||||
over:
|
||||
- { graph: device_bits, text: 'Device Traffic' }
|
||||
|
@@ -4,6 +4,7 @@ type: server
|
||||
text: VMware vCenter
|
||||
icon: vmware
|
||||
mib_dir: vmware
|
||||
ifname: true
|
||||
over:
|
||||
- { graph: device_bits, text: 'Device Traffic' }
|
||||
discovery:
|
||||
|
@@ -104,6 +104,10 @@ foreach ($port_stats as $ifIndex => $snmp_data) {
|
||||
if (is_port_valid($snmp_data, $device)) {
|
||||
port_fill_missing_and_trim($snmp_data, $device);
|
||||
|
||||
if ($device['os'] == 'vmware-vcsa' && preg_match('/Device ([a-z0-9]+) at .*/', $snmp_data['ifDescr'], $matches)) {
|
||||
$snmp_data['ifName'] = $matches[1];
|
||||
}
|
||||
|
||||
// Port newly discovered?
|
||||
if (! isset($ports_db[$port_id]) || ! is_array($ports_db[$port_id])) {
|
||||
$snmp_data['device_id'] = $device['device_id'];
|
||||
|
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
|
||||
// Build SNMP Cache Array
|
||||
use Illuminate\Support\Str;
|
||||
use LibreNMS\Config;
|
||||
use LibreNMS\Enum\PortAssociationMode;
|
||||
use LibreNMS\RRD\RrdDefinition;
|
||||
use LibreNMS\Util\Debug;
|
||||
use LibreNMS\Util\Number;
|
||||
|
||||
// Build SNMP Cache Array
|
||||
$data_oids = [
|
||||
'ifName',
|
||||
'ifDescr',
|
||||
@@ -572,8 +571,8 @@ foreach ($ports as $port) {
|
||||
// Check to make sure Port data is cached.
|
||||
$this_port = &$port_stats[$ifIndex];
|
||||
|
||||
if (Str::startsWith($device['os'], 'vmware') && preg_match('/Device ([a-z0-9]+) at .*/', $this_port['ifDescr'], $matches)) {
|
||||
$this_port['ifDescr'] = $matches[1];
|
||||
if ($device['os'] == 'vmware-vcsa' && preg_match('/Device ([a-z0-9]+) at .*/', $this_port['ifDescr'], $matches)) {
|
||||
$this_port['ifName'] = $matches[1];
|
||||
}
|
||||
|
||||
$polled_period = ($polled - $port['poll_time']);
|
||||
|
@@ -633,7 +633,7 @@
|
||||
"port_descr_circuit": null,
|
||||
"port_descr_speed": null,
|
||||
"port_descr_notes": null,
|
||||
"ifDescr": "vmnic4",
|
||||
"ifDescr": "Device vmnic4 at 07:00.0 i40en",
|
||||
"ifName": "vmnic4",
|
||||
"portName": null,
|
||||
"ifIndex": 1,
|
||||
@@ -733,7 +733,7 @@
|
||||
"port_descr_circuit": null,
|
||||
"port_descr_speed": null,
|
||||
"port_descr_notes": null,
|
||||
"ifDescr": "vmnic5",
|
||||
"ifDescr": "Device vmnic5 at 07:00.1 i40en",
|
||||
"ifName": "vmnic5",
|
||||
"portName": null,
|
||||
"ifIndex": 2,
|
||||
@@ -833,7 +833,7 @@
|
||||
"port_descr_circuit": null,
|
||||
"port_descr_speed": null,
|
||||
"port_descr_notes": null,
|
||||
"ifDescr": "vmnic0",
|
||||
"ifDescr": "Device vmnic0 at 03:00.0 ntg3",
|
||||
"ifName": "vmnic0",
|
||||
"portName": null,
|
||||
"ifIndex": 3,
|
||||
@@ -933,7 +933,7 @@
|
||||
"port_descr_circuit": null,
|
||||
"port_descr_speed": null,
|
||||
"port_descr_notes": null,
|
||||
"ifDescr": "vmnic1",
|
||||
"ifDescr": "Device vmnic1 at 03:00.1 ntg3",
|
||||
"ifName": "vmnic1",
|
||||
"portName": null,
|
||||
"ifIndex": 4,
|
||||
@@ -1033,7 +1033,7 @@
|
||||
"port_descr_circuit": null,
|
||||
"port_descr_speed": null,
|
||||
"port_descr_notes": null,
|
||||
"ifDescr": "vmnic2",
|
||||
"ifDescr": "Device vmnic2 at 03:00.2 ntg3",
|
||||
"ifName": "vmnic2",
|
||||
"portName": null,
|
||||
"ifIndex": 5,
|
||||
@@ -1133,7 +1133,7 @@
|
||||
"port_descr_circuit": null,
|
||||
"port_descr_speed": null,
|
||||
"port_descr_notes": null,
|
||||
"ifDescr": "vmnic3",
|
||||
"ifDescr": "Device vmnic3 at 03:00.3 ntg3",
|
||||
"ifName": "vmnic3",
|
||||
"portName": null,
|
||||
"ifIndex": 6,
|
||||
|
@@ -30,7 +30,7 @@
|
||||
"port_descr_speed": null,
|
||||
"port_descr_notes": null,
|
||||
"ifDescr": "Device eth0 at 03:00.0 VMware - VMXNET3 Ethernet Controller",
|
||||
"ifName": "Device eth0 at 03:00.0 VMware - VMXNET3 Ethernet Controller",
|
||||
"ifName": "eth0",
|
||||
"portName": null,
|
||||
"ifIndex": 2,
|
||||
"ifSpeed": null,
|
||||
@@ -128,12 +128,12 @@
|
||||
"poller": {
|
||||
"ports": [
|
||||
{
|
||||
"port_descr_type": null,
|
||||
"port_descr_descr": null,
|
||||
"port_descr_type": "device eth0 at 03",
|
||||
"port_descr_descr": "00.0 VMware - VMXNET3 Ethernet Controller",
|
||||
"port_descr_circuit": null,
|
||||
"port_descr_speed": null,
|
||||
"port_descr_notes": null,
|
||||
"ifDescr": "eth0",
|
||||
"ifDescr": "Device eth0 at 03:00.0 VMware - VMXNET3 Ethernet Controller",
|
||||
"ifName": "eth0",
|
||||
"portName": null,
|
||||
"ifIndex": 2,
|
||||
@@ -147,7 +147,7 @@
|
||||
"ifDuplex": null,
|
||||
"ifMtu": 1500,
|
||||
"ifType": "ethernetCsmacd",
|
||||
"ifAlias": "eth0",
|
||||
"ifAlias": "Device eth0 at 03:00.0 VMware - VMXNET3 Ethernet Controller",
|
||||
"ifPhysAddress": "0050568b3265",
|
||||
"ifLastChange": 0,
|
||||
"ifVlan": null,
|
||||
|
Reference in New Issue
Block a user