diff --git a/src/im_mad/remotes/kvm-probes.d/kvm.rb b/src/im_mad/remotes/kvm-probes.d/kvm.rb index 9782b9af55..bc6129560d 100755 --- a/src/im_mad/remotes/kvm-probes.d/kvm.rb +++ b/src/im_mad/remotes/kvm-probes.d/kvm.rb @@ -67,7 +67,27 @@ $free_memory = $total_memory - $used_memory ###### # INTERFACE ###### -NETINTERFACE = "eth|bond|em|enp|p[0-9]+p[0-9]+" + +NETINTERFACE = [ + 'eth[0-9]+', + 'ib[0-9]+', + + # --- BIOS derived names: + 'em[0-9]+(_[0-9]+)?', + 'p[0-9]+p[0-9]+(_[0-9]+)?', + + # --- Systemd naming - type of names for en*: + # o[n|d] — on-board device index number + # s[f][n|d] — hotplug slot index number + # x — MAC address + # [P]ps[f][n|d] — PCI geographical location + # ai — Platform bus ACPI instance id + 'eno[0-9]+(n[0-9a-zA-Z]+|d[0-9]+)?', + 'ens[0-9]+(f[0-9]+)?(n[0-9a-zA-Z]+|d[0-9]+)?', + 'enx[0-9a-fA-F]{12}', + 'en(P[0-9]+)?p[0-9]+s[0-9]+(f[0-9]+)?(n[0-9a-zA-Z]+|d[0-9]+)?', + 'ena[0-9a-zA-Z]+i[0-9]+', +].join('|') net_text=`cat /proc/net/dev` exit(-1) if $?.exitstatus != 0 @@ -76,7 +96,7 @@ $netrx = 0 $nettx = 0 net_text.split(/\n/).each{|line| - if line.match("^ *#{NETINTERFACE}") + if line.match("^ *(#{NETINTERFACE}):") arr = line.split(":")[1].split(" ") $netrx += arr[0].to_i $nettx += arr[8].to_i