This tip comes from my good friend Aleksey Tsalolikin.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
  bundle agent main
  {
    vars:

        # Creae a map of interface to MAC
        # Generate a classic array
        # Iterate over known interfaces, define interface as key and MAC as value

        "iface2mac[$(sys.interfaces)]"
          string => "$(sys.hardware_mac[$(sys.interfaces)])",
          meta => { "inventory", "attribute_name=$(sys.interfaces) MAC" };
      
    reports:

        "$(sys.interfaces) $(iface2mac[$(sys.interfaces)])";

  }
R: wlan0 5c:e0:c5:9f:f3:8f
R: virbr0 52:54:00:6b:62:06
R: docker0 02:42:e6:ee:26:c4