Suppress VMWare nic "change" logs

Hi everyone,
I seem to be getting the following kinds of messages in my logs exactly every 6 hours from my VMWare ESXi 6.5 host:

ifDescr: Device vmnic0 at 01:00.0 ntg3 -> vmnic0
ifDescr: Device vmnic1 at 01:00.1 ntg3 -> vmnic1

Does anyone know why these are being listed, and how I can suppress them?
The server is not being rebooted, and from the message I can’t see what is changing and why it is significant enough to be logged.

Thanks

Hi,
I have the same problem, and it looks like it’s due to a difference between the discovery (running every 6 hours on my setup) and poller processes, specific to VMware OS.
As I undestand it, every 6 hours discovery will set ifDescr like Device vmnic0 at 01:00.0 ntg3.
Then, every polling time, poller will set ifDescr like vmnic0.

In the ports polling code (includes/polling/ports.inc.php) I found this bit of code that does the string pruning:
if ($device[‘os’] == ‘vmware’ && preg_match(‘/Device ([a-z0-9]+) at .*/’, $this_port[‘ifDescr’], $matches)) {
$this_port[‘ifDescr’] = $matches[1];
}

I added something very similar to the discovery code (includes/discovery/ports.inc.php), so that the discovery process does the same pruning before storing ifDescr. It seems to work well on my setup.

Now I need to make a bug report and learn how to send a patch :slight_smile:

You should submit your patch in git hub as a pull request. :grin:

I most certainly will :slight_smile: Just need to take the time to learn how do do that properly.

No worries you should just submit what you have and everyone will help.

Any progress of this modification?
I also get those log-entries and I did not really understand the fix.

Can you post your code here by any chance?

Not yet, sorry, been busy!

Here is the diff, relative to librenms home:

--- includes/discovery/ports.inc.php.2019-12-18-nm	2019-11-26 11:49:24.491167259 +0100
+++ includes/discovery/ports.inc.php	2019-12-18 10:20:45.748802227 +0100
@@ -48,6 +48,10 @@
 foreach ($port_stats as $ifIndex => $snmp_data) {
     $snmp_data['ifIndex'] = $ifIndex; // Store ifIndex in port entry
 
+    if ($device['os'] == 'vmware' && preg_match('/Device ([a-z0-9]+) at .*/', $snmp_data['ifDescr'], $matches)) {
+        $snmp_data['ifDescr'] = $matches[1];
+    }
+
     // Get port_id according to port_association_mode used for this device
     $port_id = get_port_id($ports_mapped, $snmp_data, $port_association_mode);
1 Like

Hi everyone, sorry for the very late reply, and thanks @skanx for the solution.
It didn’t quite work for me, as the os is listed as " VMware ESXi 6.5.0 (build 5969303) " in LibreNMS.
I changed the first line of your code to the following

if (strpos($device['os'],'vmware') !==false && preg_match('/Device ([a-z0-9]+) at .*/', $snmp_data['ifDescr'], $matches)) {

And this seems to have worked. Can the devs check if this is a good solution and if it can be implemented?