chef / ohai

Ohai profiles your system and emits JSON
https://docs.chef.io/ohai.html
Apache License 2.0
681 stars 450 forks source link

Missing Hardware Serial Number (VMware VMs) #1359

Closed MikeLingenfelter closed 4 years ago

MikeLingenfelter commented 5 years ago

Description

For Windows VMware VMs, the manufacture and serialnumber are not being discovered. We are only seeing this on Widnows VMware VMs. For Linux systems, HyperV VMs and HP physical servers, are seeing the discovered manufacture and serialnumber values. For VMware VMs we are seeing.

system_enclosure manufacturer: No Enclosure serialnumber: None

Ohai Version

15.0.4

Platform Version

Windows 2008 R2, 2012R2 and 2016

Ohai Output

btm commented 5 years ago

The 'manufacturer' and 'serialnumber' values under 'system_enclosure' from Ohai are collected directly from WMI. Whatever data Ohai returns is what the operating system and hardware are returning.

On my Windows 10 VM under Virtual Box on Linux, no serial number is returned from the system either. You can test this with these commands on Windows:

wmic systemenclosure get serialnumber
wmic systemenclosure get manufacturer

I don't believe VMWare populates that data.You could also try wmic bios get serialnumber and let us know if that reutrns the data you're looking for. I don't believe ohai collects the BIOS data.

MikeLingenfelter commented 5 years ago

Sorry for the delay, your message got lost in my email.

You are correct, those "wmic systemenclosure" commands do return "blank" informaiton, on Windows VMware systems. On our systems I used the following WMI objects to the the informaiton.

gwmi Win32_ComputerSystem | Select Manufacturer | Ft; gwmi Win32_Bios | Select SerialNumber

jschripsema commented 5 years ago

According to this: https://kb.vmware.com/s/article/1023616

The serial number of a machine is stored in WMI. The location in WMI can vary depending on the hardware manufacturer, but it is generally in one of these classes: Win32_BaseBoard, Win32_BIOS, or Win32_SystemEnclosure.

Windows does not present a consistent location in WMI for the enclosure serial number. The ohai code will need to search all of these classes.

btm commented 4 years ago

We should collect these and stuff them into the matching dmi tree for linux.

btm commented 4 years ago

Here are the 5 sections of node['dmi'] that are returned on my Ubuntu workstation, and what I believe are the Win32 equivalents.

chassis: https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-systemenclosure processor: https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-processor bios: https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-bios system: https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-computersystemproduct base_board: https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-baseboard

I think these are the equivalents.

Note the first one is what is in the system_enclosure plugin today. We can copy that pattern into the dmi plugin and use it to pull all of the sections. The system_enclosure plugin should then be set for future deprecation.

tas50 commented 4 years ago

For the values we already gather via the system_enclosure we can depend on that plugin in the DMI plugin and utlize the data we've already collected so we don't have to gather data twice. That'll be useful on windows where those wmi calls are pretty slow.

phiggins commented 4 years ago

I started out trying to figure out what information was present in the Ubuntu output and mapping the equivalent Windows data to it, but I wasn't sure that was the right approach, or if we just wanted everything. This was complicated by the fact that I'm using an Ubuntu vm through vagrant and it doesn't seem to return everything that you listed above. So I took a different approach and I'm grabbing all of the information returned. Is this what we want to do? If not, what specific information should I be getting from each of these things?

The WIP PR I opened is here: https://github.com/chef/ohai/pull/1445

This is the output in my Win2019 VM ``` { "uptime_seconds": 19643, "uptime": "5 hours 27 minutes 23 seconds", "chef_packages": { "ohai": { "version": "16.0.15", "ohai_root": "//vboxsvr/vagrant/ohai/lib/ohai" } }, "languages": { "ruby": { "platform": "x64-mingw32", "version": "2.6.5", "release_date": "2019-10-01", "target": "x86_64-w64-mingw32", "target_cpu": "x64", "target_vendor": "w64", "target_os": "mingw32", "host": "x86_64-w64-mingw32", "host_cpu": "x86_64", "host_os": "mingw32", "host_vendor": "w64", "bin_dir": "C:/opscode/chefdk/embedded/bin", "ruby_bin": "C:/opscode/chefdk/embedded/bin/ruby", "gems_dir": "C:/Users/vagrant/AppData/Local/chefdk/gem/ruby/2.6.0", "gem_bin": "C:/opscode/chefdk/embedded/bin/gem" }, "powershell": { "version": "5.1.17763.592", "ws_man_stack_version": "3.0", "serialization_version": "1.1.0.1", "clr_version": "4.0.30319.42000", "build_version": "10.0.17763.592", "compatible_versions": [ "1.0", "2.0", "3.0", "4.0", "5.0", "5.1.17763.592" ], "remoting_protocol_version": "2.3" }, "perl": { "version": "5.8.8", "archname": "msys-64int" } }, "network": { "interfaces": { "0x6": { "configuration": { "ip_address": [ "10.0.2.15", "fe80::c573:cb89:4e7:cd9d" ], "arp_always_source_route": null, "arp_use_ether_snap": null, "caption": "[00000001] Intel(R) PRO/1000 MT Desktop Adapter", "database_path": "%SystemRoot%\\System32\\drivers\\etc", "dead_gw_detect_enabled": null, "default_ip_gateway": [ "10.0.2.2" ], "default_tos": null, "default_ttl": null, "description": "Intel(R) PRO/1000 MT Desktop Adapter", "dhcp_enabled": true, "dhcp_lease_expires": "19340601064852.000000+000", "dhcp_lease_obtained": "19340531064852.000000+000", "dhcp_server": "10.0.2.2", "dns_domain": null, "dns_domain_suffix_search_order": [ ], "dns_enabled_for_wins_resolution": false, "dns_host_name": "VAGRANT-36IHG0U", "dns_server_search_order": [ "10.0.2.3" ], "domain_dns_registration_enabled": false, "forward_buffer_memory": null, "full_dns_registration_enabled": true, "gateway_cost_metric": [ 0 ], "igmp_level": null, "index": 1, "interface_index": 6, "ip_connection_metric": 25, "ip_enabled": true, "ip_filter_security_enabled": false, "ip_port_security_enabled": null, "ip_sec_permit_ip_protocols": [ ], "ip_sec_permit_tcp_ports": [ ], "ip_sec_permit_udp_ports": [ ], "ip_subnet": [ "255.255.255.0", "64" ], "ip_use_zero_broadcast": null, "ipx_address": null, "ipx_enabled": null, "ipx_frame_type": null, "ipx_media_type": null, "ipx_network_number": null, "ipx_virtual_net_number": null, "keep_alive_interval": null, "keep_alive_time": null, "mac_address": "08:00:27:10:89:72", "mtu": null, "num_forward_packets": null, "pmtubh_detect_enabled": null, "pmtu_discovery_enabled": null, "service_name": "E1G60", "setting_id": "{EFF03F45-46BA-4EA7-8E9B-A7E27BF307EB}", "tcpip_netbios_options": 0, "tcp_max_connect_retransmissions": null, "tcp_max_data_retransmissions": null, "tcp_num_connections": null, "tcp_use_rfc1122_urgent_pointer": null, "tcp_window_size": 64240, "wins_enable_lm_hosts_lookup": true, "wins_host_lookup_file": null, "wins_primary_server": null, "wins_scope_id": "", "wins_secondary_server": null }, "instance": { "adapter_type": "Ethernet 802.3", "adapter_type_id": 0, "auto_sense": null, "availability": 3, "caption": "[00000001] Intel(R) PRO/1000 MT Desktop Adapter", "config_manager_error_code": 0, "config_manager_user_config": false, "description": "Intel(R) PRO/1000 MT Desktop Adapter", "device_id": "1", "error_cleared": null, "error_description": null, "guid": "{EFF03F45-46BA-4EA7-8E9B-A7E27BF307EB}", "index": 1, "install_date": null, "installed": true, "interface_index": 6, "last_error_code": null, "mac_address": "08:00:27:10:89:72", "manufacturer": "Intel", "max_number_controlled": 0, "max_speed": null, "name": "Intel(R) PRO/1000 MT Desktop Adapter", "net_connection_id": "Ethernet", "net_connection_status": 2, "net_enabled": true, "network_addresses": null, "permanent_address": null, "physical_adapter": true, "pnp_device_id": "PCI\\VEN_8086&DEV_100E&SUBSYS_001E8086&REV_02\\3&267A616A&0&18", "power_management_capabilities": null, "power_management_supported": false, "product_name": "Intel(R) PRO/1000 MT Desktop Adapter", "service_name": "E1G60", "speed": "1000000000", "status": null, "status_info": null, "system_name": "VAGRANT-36IHG0U", "time_of_last_reset": "20200403183732.624624+000" }, "counters": { }, "addresses": { "10.0.2.15": { "prefixlen": "24", "netmask": "255.255.255.0", "broadcast": "10.0.2.255", "family": "inet" }, "fe80::c573:cb89:4e7:cd9d": { "prefixlen": "64", "family": "inet6", "scope": "Link" }, "08:00:27:10:89:72": { "family": "lladdr" } }, "mtu": null, "type": "Ethernet 802.3", "arp": { "10.0.2.2": "52:54:00:12:35:02", "10.0.2.3": "52:54:00:12:35:03", "10.0.2.255": "ff:ff:ff:ff:ff:ff", "224.0.0.22": "01:00:5e:00:00:16", "224.0.0.251": "01:00:5e:00:00:fb", "224.0.0.252": "01:00:5e:00:00:fc", "255.255.255.255": "ff:ff:ff:ff:ff:ff" }, "encapsulation": "Ethernet" } }, "default_gateway": "10.0.2.2", "default_interface": "0x6" }, "counters": { "network": { } }, "ipaddress": "10.0.2.15", "macaddress": "08:00:27:10:89:72", "ip6address": "fe80::c573:cb89:4e7:cd9d", "kernel": { "os_info": { "boot_device": "\\Device\\HarddiskVolume1", "build_number": "17763", "build_type": "Multiprocessor Free", "caption": "Microsoft Windows Server 2019 Datacenter Evaluation", "code_set": "1252", "country_code": "1", "csd_version": null, "cs_name": "VAGRANT-36IHG0U", "current_time_zone": 0, "data_execution_prevention_32_bit_applications": true, "data_execution_prevention_available": true, "data_execution_prevention_drivers": true, "data_execution_prevention_support_policy": 3, "debug": false, "description": "", "distributed": false, "encryption_level": 256, "foreground_application_boost": 2, "install_date": "20200205012548.000000+000", "large_system_cache": null, "last_boot_up_time": "20200403183732.624624+000", "local_date_time": "20200404000457.301000+000", "locale": "0409", "manufacturer": "Microsoft Corporation", "max_number_of_processes": -1, "max_process_memory_size": "137438953344", "mui_languages": [ "en-US" ], "name": "Microsoft Windows Server 2019 Datacenter Evaluation|C:\\Windows|\\Device\\Harddisk0\\Partition2", "number_of_licensed_users": 0, "number_of_processes": 87, "number_of_users": 1, "operating_system_sku": 80, "organization": "Bento by Chef Software, Inc.", "os_architecture": "64-bit", "os_language": 1033, "os_product_suite": 400, "os_type": 18, "other_type_description": null, "pae_enabled": null, "plus_product_id": null, "plus_version_number": null, "portable_operating_system": false, "primary": true, "product_type": 3, "registered_user": "Vagrant", "serial_number": "00431-20000-00000-AA715", "service_pack_major_version": 0, "service_pack_minor_version": 0, "size_stored_in_paging_files": "0", "status": "OK", "suite_mask": 400, "system_device": "\\Device\\HarddiskVolume2", "system_directory": "C:\\Windows\\system32", "system_drive": "C:", "total_visible_memory_size": "8388148", "version": "10.0.17763", "windows_directory": "C:\\Windows" }, "name": "Microsoft Windows Server 2019 Datacenter Evaluation", "release": "10.0.17763", "version": "10.0.17763 Build 17763", "os": "WINNT", "product_type": "Server", "server_core": false, "cs_info": { "admin_password_status": 3, "automatic_managed_pagefile": false, "automatic_reset_boot_option": true, "automatic_reset_capability": true, "boot_option_on_limit": null, "boot_option_on_watch_dog": null, "boot_rom_supported": true, "boot_status": null, "bootup_state": "Normal boot", "caption": "VAGRANT-36IHG0U", "chassis_bootup_state": 3, "chassis_sku_number": null, "current_time_zone": 0, "daylight_in_effect": null, "description": "AT/AT COMPATIBLE", "dns_host_name": "VAGRANT-36IHG0U", "domain": "WORKGROUP", "domain_role": 2, "enable_daylight_savings_time": true, "front_panel_reset_status": 3, "hypervisor_present": false, "infrared_supported": false, "initial_load_info": null, "install_date": null, "keyboard_password_status": 3, "last_load_info": null, "manufacturer": "innotek GmbH", "model": "VirtualBox", "name": "VAGRANT-36IHG0U", "name_format": null, "network_server_mode_enabled": true, "number_of_logical_processors": 2, "number_of_processors": 1, "oem_string_array": [ "vboxVer_6.1.4", "vboxRev_136177" ], "part_of_domain": false, "pause_after_reset": "-1", "pc_system_type": 2, "pc_system_type_ex": 2, "power_management_capabilities": null, "power_management_supported": null, "power_on_password_status": 3, "power_state": 0, "power_supply_state": 3, "primary_owner_contact": null, "primary_owner_name": "Vagrant", "reset_capability": 1, "reset_count": -1, "reset_limit": -1, "roles": [ "LM_Workstation", "LM_Server", "NT", "Server_NT" ], "status": "OK", "support_contact_description": null, "system_family": "Virtual Machine", "system_sku_number": null, "system_startup_delay": null, "system_startup_options": null, "system_startup_setting": null, "system_type": "x64-based PC", "thermal_state": 3, "total_physical_memory": "8589463552", "user_name": "VAGRANT-36IHG0U\\vagrant", "wake_up_type": 6, "workgroup": "WORKGROUP" }, "machine": "x86_64", "system_type": "Mobile" }, "os": "windows", "os_version": "10.0.17763", "platform": "windows", "platform_version": "10.0.17763", "platform_family": "windows", "memory": { "swap": { "total": "0kB", "free": "0kB" }, "total": "8388148kB", "free": "7244660kB" }, "dmi": { "chassis": { "audiblealarm": null, "breachdescription": null, "cablemanagementstrategy": null, "caption": "System Enclosure", "chassistypes": [ 1 ], "creationclassname": "Win32_SystemEnclosure", "currentrequiredorproduced": null, "depth": null, "description": "System Enclosure", "heatgeneration": null, "height": null, "hotswappable": null, "installdate": null, "lockpresent": false, "manufacturer": "Oracle Corporation", "model": null, "name": "System Enclosure", "numberofpowercords": null, "otheridentifyinginfo": null, "partnumber": null, "poweredon": null, "removable": null, "replaceable": null, "securitybreach": null, "securitystatus": 3, "serialnumber": "", "servicedescriptions": null, "servicephilosophy": null, "sku": null, "smbiosassettag": "", "status": null, "tag": "System Enclosure 0", "typedescriptions": null, "version": "", "visiblealarm": null, "weight": null, "width": null }, "processor": { "addresswidth": 64, "architecture": 9, "assettag": null, "availability": 3, "caption": "Intel64 Family 6 Model 70 Stepping 1", "characteristics": null, "configmanagererrorcode": null, "configmanageruserconfig": null, "cpustatus": 0, "creationclassname": "Win32_Processor", "currentclockspeed": 2794, "currentvoltage": null, "datawidth": 64, "description": "Intel64 Family 6 Model 70 Stepping 1", "deviceid": "CPU0", "errorcleared": null, "errordescription": null, "extclock": null, "family": 2, "installdate": null, "l2cachesize": null, "l2cachespeed": null, "l3cachesize": 0, "l3cachespeed": 0, "lasterrorcode": null, "level": 6, "loadpercentage": 0, "manufacturer": "GenuineIntel", "maxclockspeed": 2794, "name": "Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz", "numberofcores": 2, "numberofenabledcore": null, "numberoflogicalprocessors": 2, "otherfamilydescription": null, "partnumber": null, "pnpdeviceid": null, "powermanagementcapabilities": null, "powermanagementsupported": false, "processorid": null, "processortype": null, "revision": 17921, "role": "CPU", "secondleveladdresstranslationextensions": false, "serialnumber": null, "socketdesignation": null, "status": "OK", "statusinfo": 3, "stepping": null, "systemcreationclassname": "Win32_ComputerSystem", "systemname": "VAGRANT-36IHG0U", "threadcount": null, "uniqueid": null, "upgrademethod": 2, "version": "", "virtualizationfirmwareenabled": false, "vmmonitormodeextensions": false, "voltagecaps": null }, "bios": { "bioscharacteristics": [ 4, 7, 15, 16, 27, 30, 32 ], "biosversion": [ "VBOX - 1" ], "buildnumber": null, "caption": "Default System BIOS", "codeset": null, "currentlanguage": null, "description": "Default System BIOS", "embeddedcontrollermajorversion": 110, "embeddedcontrollerminorversion": 111, "identificationcode": null, "installablelanguages": null, "installdate": null, "languageedition": null, "listoflanguages": null, "manufacturer": "innotek GmbH", "name": "Default System BIOS", "othertargetos": null, "primarybios": true, "releasedate": "20061201000000.000000+000", "serialnumber": "0", "smbiosbiosversion": "VirtualBox", "smbiosmajorversion": 2, "smbiosminorversion": 5, "smbiospresent": true, "softwareelementid": "Default System BIOS", "softwareelementstate": 3, "status": "OK", "systembiosmajorversion": 105, "systembiosminorversion": 110, "targetoperatingsystem": 0, "version": "VBOX - 1" }, "system": { "caption": "Computer System Product", "description": "Computer System Product", "identifyingnumber": "0", "name": "VirtualBox", "skunumber": null, "uuid": "DBF47626-9602-4396-B121-94A6DEB3A06D", "vendor": "innotek GmbH", "version": "1.2" }, "base_board": { "caption": "Base Board", "configoptions": null, "creationclassname": "Win32_BaseBoard", "depth": null, "description": "Base Board", "height": null, "hostingboard": true, "hotswappable": false, "installdate": null, "manufacturer": "Oracle Corporation", "model": null, "name": "Base Board", "otheridentifyinginfo": null, "partnumber": null, "poweredon": true, "product": "VirtualBox", "removable": false, "replaceable": false, "requirementsdescription": null, "requiresdaughterboard": false, "serialnumber": "0", "sku": null, "slotlayout": null, "specialrequirements": null, "status": "OK", "tag": "Base Board", "version": "1.2", "weight": null, "width": null } }, "hostname": "VAGRANT-36IHG0U", "machinename": "VAGRANT-36IHG0U", "fqdn": "VAGRANT-36IHG0U", "domain": null, "virtualization": { "systems": { "vbox": "guest" }, "system": "vbox", "role": "guest" }, "virtualbox": { "host": { "language": "en_US", "revision": "136177", "version": "6.1.4" }, "guest": { "guest_additions_version": "6.1.2", "guest_additions_revision": "135662" } }, "time": { "timezone": "Coordinated Universal Time" }, "command": { }, "root_group": "Administrators", "fips": { "kernel": { "enabled": false } }, "shard_seed": 196727857, "keys": { "ssh": { } }, "packages": { "Oracle VM VirtualBox Guest Additions 6.1.2": { "version": "6.1.2.0", "publisher": "Oracle Corporation" }, "ChefDK v4.7.73": { "version": "4.7.73.1", "publisher": "Chef Software, Inc.", "installdate": "20200331" } }, "ohai_time": 1585958698.760297, "cpu": { "0": { "cores": 2, "vendor_id": "GenuineIntel", "family": "2", "model": "17921", "stepping": "1", "physical_id": "CPU0", "model_name": "Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz", "description": "Intel64 Family 6 Model 70 Stepping 1", "mhz": "2794", "cache_size": " KB" }, "total": 2, "cores": 2, "real": 1 }, "filesystem": { "C:": { "kb_size": 41573937, "kb_available": 30588485, "kb_used": 10985452, "percent_used": 26, "fs_type": "ntfs", "drive_type": 3, "drive_type_string": "local", "drive_type_human": "Local Fixed Disk", "volume_name": "Windows 2019" } }, "filesystem2": { "by_device": { "windows 2019": { "kb_size": 41573937, "kb_available": 30588485, "kb_used": 10985452, "percent_used": 26, "fs_type": "ntfs", "drive_type": 3, "drive_type_string": "local", "drive_type_human": "Local Fixed Disk", "volume_name": "Windows 2019", "mounts": [ "C:" ] } }, "by_mountpoint": { "C:": { "kb_size": 41573937, "kb_available": 30588485, "kb_used": 10985452, "percent_used": 26, "fs_type": "ntfs", "drive_type": 3, "drive_type_string": "local", "drive_type_human": "Local Fixed Disk", "volume_name": "Windows 2019", "devices": [ "windows 2019" ] } }, "by_pair": { "windows 2019,C:": { "kb_size": 41573937, "kb_available": 30588485, "kb_used": 10985452, "percent_used": 26, "mount": "C:", "fs_type": "ntfs", "drive_type": 3, "drive_type_string": "local", "drive_type_human": "Local Fixed Disk", "volume_name": "Windows 2019", "device": "windows 2019" } } }, "system_enclosure": { "manufacturer": "Oracle Corporation", "serialnumber": "" }, "cloud": null } ```

Obviously the code is in a rough state, but I thought it would be better to show what I mean with an example.

btm commented 4 years ago

@phiggins that looks like an acceptable amount of data to consume.

1) it's pretty important we figure out how to match the snake case from linux. right now I can't poke myself, but I hope we can find a source that allows conversion without mapping.

The real goal here is to have node['dmi']['system']['serial_number'] return the same data on Windows and Linux.

2) the "all_records" I don't know what to do with. I think we originally only took the top level keys and skipped a couple records. We might be able to use Ohai::Common::DMI.convenience_keys to duplicate the behavior outside of "all_records".

https://github.com/chef/ohai/blob/master/lib/ohai/common/dmi.rb#L117

phiggins commented 4 years ago

it's pretty important we figure out how to match the snake case from linux.

There's code in ohai that explicitly downcases all the keys, so if it's coming from the windows APIs as camelcase it can probably be converted in a straightforward way.

phiggins commented 4 years ago
After some more work I've got it looking like this ``` { "uptime_seconds": 79173, "uptime": "21 hours 59 minutes 33 seconds", "chef_packages": { "ohai": { "version": "16.0.15", "ohai_root": "//vboxsvr/vagrant/ohai/lib/ohai" } }, "languages": { "ruby": { "platform": "x64-mingw32", "version": "2.6.5", "release_date": "2019-10-01", "target": "x86_64-w64-mingw32", "target_cpu": "x64", "target_vendor": "w64", "target_os": "mingw32", "host": "x86_64-w64-mingw32", "host_cpu": "x86_64", "host_os": "mingw32", "host_vendor": "w64", "bin_dir": "C:/opscode/chefdk/embedded/bin", "ruby_bin": "C:/opscode/chefdk/embedded/bin/ruby", "gems_dir": "C:/Users/vagrant/AppData/Local/chefdk/gem/ruby/2.6.0", "gem_bin": "C:/opscode/chefdk/embedded/bin/gem" }, "powershell": { "version": "5.1.17763.592", "ws_man_stack_version": "3.0", "serialization_version": "1.1.0.1", "clr_version": "4.0.30319.42000", "build_version": "10.0.17763.592", "compatible_versions": [ "1.0", "2.0", "3.0", "4.0", "5.0", "5.1.17763.592" ], "remoting_protocol_version": "2.3" }, "perl": { "version": "5.8.8", "archname": "msys-64int" } }, "network": { "interfaces": { "0x6": { "configuration": { "ip_address": [ "10.0.2.15", "fe80::c573:cb89:4e7:cd9d" ], "arp_always_source_route": null, "arp_use_ether_snap": null, "caption": "[00000001] Intel(R) PRO/1000 MT Desktop Adapter", "database_path": "%SystemRoot%\\System32\\drivers\\etc", "dead_gw_detect_enabled": null, "default_ip_gateway": [ "10.0.2.2" ], "default_tos": null, "default_ttl": null, "description": "Intel(R) PRO/1000 MT Desktop Adapter", "dhcp_enabled": true, "dhcp_lease_expires": "19340610164714.000000+000", "dhcp_lease_obtained": "19340609164714.000000+000", "dhcp_server": "10.0.2.2", "dns_domain": null, "dns_domain_suffix_search_order": [ ], "dns_enabled_for_wins_resolution": false, "dns_host_name": "VAGRANT-36IHG0U", "dns_server_search_order": [ "10.0.2.3" ], "domain_dns_registration_enabled": false, "forward_buffer_memory": null, "full_dns_registration_enabled": true, "gateway_cost_metric": [ 0 ], "igmp_level": null, "index": 1, "interface_index": 6, "ip_connection_metric": 25, "ip_enabled": true, "ip_filter_security_enabled": false, "ip_port_security_enabled": null, "ip_sec_permit_ip_protocols": [ ], "ip_sec_permit_tcp_ports": [ ], "ip_sec_permit_udp_ports": [ ], "ip_subnet": [ "255.255.255.0", "64" ], "ip_use_zero_broadcast": null, "ipx_address": null, "ipx_enabled": null, "ipx_frame_type": null, "ipx_media_type": null, "ipx_network_number": null, "ipx_virtual_net_number": null, "keep_alive_interval": null, "keep_alive_time": null, "mac_address": "08:00:27:10:89:72", "mtu": null, "num_forward_packets": null, "pmtubh_detect_enabled": null, "pmtu_discovery_enabled": null, "service_name": "E1G60", "setting_id": "{EFF03F45-46BA-4EA7-8E9B-A7E27BF307EB}", "tcpip_netbios_options": 0, "tcp_max_connect_retransmissions": null, "tcp_max_data_retransmissions": null, "tcp_num_connections": null, "tcp_use_rfc1122_urgent_pointer": null, "tcp_window_size": 64240, "wins_enable_lm_hosts_lookup": true, "wins_host_lookup_file": null, "wins_primary_server": null, "wins_scope_id": "", "wins_secondary_server": null }, "instance": { "adapter_type": "Ethernet 802.3", "adapter_type_id": 0, "auto_sense": null, "availability": 3, "caption": "[00000001] Intel(R) PRO/1000 MT Desktop Adapter", "config_manager_error_code": 0, "config_manager_user_config": false, "description": "Intel(R) PRO/1000 MT Desktop Adapter", "device_id": "1", "error_cleared": null, "error_description": null, "guid": "{EFF03F45-46BA-4EA7-8E9B-A7E27BF307EB}", "index": 1, "install_date": null, "installed": true, "interface_index": 6, "last_error_code": null, "mac_address": "08:00:27:10:89:72", "manufacturer": "Intel", "max_number_controlled": 0, "max_speed": null, "name": "Intel(R) PRO/1000 MT Desktop Adapter", "net_connection_id": "Ethernet", "net_connection_status": 2, "net_enabled": true, "network_addresses": null, "permanent_address": null, "physical_adapter": true, "pnp_device_id": "PCI\\VEN_8086&DEV_100E&SUBSYS_001E8086&REV_02\\3&267A616A&0&18", "power_management_capabilities": null, "power_management_supported": false, "product_name": "Intel(R) PRO/1000 MT Desktop Adapter", "service_name": "E1G60", "speed": "1000000000", "status": null, "status_info": null, "system_name": "VAGRANT-36IHG0U", "time_of_last_reset": "20200408032453.676855+000" }, "counters": { }, "addresses": { "10.0.2.15": { "prefixlen": "24", "netmask": "255.255.255.0", "broadcast": "10.0.2.255", "family": "inet" }, "fe80::c573:cb89:4e7:cd9d": { "prefixlen": "64", "family": "inet6", "scope": "Link" }, "08:00:27:10:89:72": { "family": "lladdr" } }, "mtu": null, "type": "Ethernet 802.3", "arp": { "10.0.2.2": "52:54:00:12:35:02", "10.0.2.3": "52:54:00:12:35:03", "10.0.2.255": "ff:ff:ff:ff:ff:ff", "224.0.0.22": "01:00:5e:00:00:16", "224.0.0.251": "01:00:5e:00:00:fb", "224.0.0.252": "01:00:5e:00:00:fc", "255.255.255.255": "ff:ff:ff:ff:ff:ff" }, "encapsulation": "Ethernet" } }, "default_gateway": "10.0.2.2", "default_interface": "0x6" }, "counters": { "network": { } }, "ipaddress": "10.0.2.15", "macaddress": "08:00:27:10:89:72", "ip6address": "fe80::c573:cb89:4e7:cd9d", "kernel": { "os_info": { "boot_device": "\\Device\\HarddiskVolume1", "build_number": "17763", "build_type": "Multiprocessor Free", "caption": "Microsoft Windows Server 2019 Datacenter Evaluation", "code_set": "1252", "country_code": "1", "csd_version": null, "cs_name": "VAGRANT-36IHG0U", "current_time_zone": 0, "data_execution_prevention_32_bit_applications": true, "data_execution_prevention_available": true, "data_execution_prevention_drivers": true, "data_execution_prevention_support_policy": 3, "debug": false, "description": "", "distributed": false, "encryption_level": 256, "foreground_application_boost": 2, "install_date": "20200205012548.000000+000", "large_system_cache": null, "last_boot_up_time": "20200408032453.676855+000", "local_date_time": "20200409012429.238000+000", "locale": "0409", "manufacturer": "Microsoft Corporation", "max_number_of_processes": -1, "max_process_memory_size": "137438953344", "mui_languages": [ "en-US" ], "name": "Microsoft Windows Server 2019 Datacenter Evaluation|C:\\Windows|\\Device\\Harddisk0\\Partition2", "number_of_licensed_users": 0, "number_of_processes": 88, "number_of_users": 1, "operating_system_sku": 80, "organization": "Bento by Chef Software, Inc.", "os_architecture": "64-bit", "os_language": 1033, "os_product_suite": 400, "os_type": 18, "other_type_description": null, "pae_enabled": null, "plus_product_id": null, "plus_version_number": null, "portable_operating_system": false, "primary": true, "product_type": 3, "registered_user": "Vagrant", "serial_number": "00431-20000-00000-AA715", "service_pack_major_version": 0, "service_pack_minor_version": 0, "size_stored_in_paging_files": "0", "status": "OK", "suite_mask": 400, "system_device": "\\Device\\HarddiskVolume2", "system_directory": "C:\\Windows\\system32", "system_drive": "C:", "total_visible_memory_size": "8388148", "version": "10.0.17763", "windows_directory": "C:\\Windows" }, "name": "Microsoft Windows Server 2019 Datacenter Evaluation", "release": "10.0.17763", "version": "10.0.17763 Build 17763", "os": "WINNT", "product_type": "Server", "server_core": false, "cs_info": { "admin_password_status": 3, "automatic_managed_pagefile": false, "automatic_reset_boot_option": true, "automatic_reset_capability": true, "boot_option_on_limit": null, "boot_option_on_watch_dog": null, "boot_rom_supported": true, "boot_status": null, "bootup_state": "Normal boot", "caption": "VAGRANT-36IHG0U", "chassis_bootup_state": 3, "chassis_sku_number": null, "current_time_zone": 0, "daylight_in_effect": null, "description": "AT/AT COMPATIBLE", "dns_host_name": "VAGRANT-36IHG0U", "domain": "WORKGROUP", "domain_role": 2, "enable_daylight_savings_time": true, "front_panel_reset_status": 3, "hypervisor_present": false, "infrared_supported": false, "initial_load_info": null, "install_date": null, "keyboard_password_status": 3, "last_load_info": null, "manufacturer": "innotek GmbH", "model": "VirtualBox", "name": "VAGRANT-36IHG0U", "name_format": null, "network_server_mode_enabled": true, "number_of_logical_processors": 2, "number_of_processors": 1, "oem_string_array": [ "vboxVer_6.1.4", "vboxRev_136177" ], "part_of_domain": false, "pause_after_reset": "-1", "pc_system_type": 2, "pc_system_type_ex": 2, "power_management_capabilities": null, "power_management_supported": null, "power_on_password_status": 3, "power_state": 0, "power_supply_state": 3, "primary_owner_contact": null, "primary_owner_name": "Vagrant", "reset_capability": 1, "reset_count": -1, "reset_limit": -1, "roles": [ "LM_Workstation", "LM_Server", "NT", "Server_NT" ], "status": "OK", "support_contact_description": null, "system_family": "Virtual Machine", "system_sku_number": null, "system_startup_delay": null, "system_startup_options": null, "system_startup_setting": null, "system_type": "x64-based PC", "thermal_state": 3, "total_physical_memory": "8589463552", "user_name": "VAGRANT-36IHG0U\\vagrant", "wake_up_type": 6, "workgroup": "WORKGROUP" }, "machine": "x86_64", "system_type": "Mobile" }, "os": "windows", "os_version": "10.0.17763", "platform": "windows", "platform_version": "10.0.17763", "platform_family": "windows", "memory": { "swap": { "total": "0kB", "free": "0kB" }, "total": "8388148kB", "free": "7055944kB" }, "dmi": { "chassis": { "all_records": [ { "AudibleAlarm": null, "BreachDescription": null, "CableManagementStrategy": null, "Caption": "System Enclosure", "ChassisTypes": [ 1 ], "CreationClassName": "Win32_SystemEnclosure", "CurrentRequiredOrProduced": null, "Depth": null, "Description": "System Enclosure", "HeatGeneration": null, "Height": null, "HotSwappable": null, "InstallDate": null, "LockPresent": false, "Manufacturer": "Oracle Corporation", "Model": null, "Name": "System Enclosure", "NumberOfPowerCords": null, "OtherIdentifyingInfo": null, "PartNumber": null, "PoweredOn": null, "Removable": null, "Replaceable": null, "SecurityBreach": null, "SecurityStatus": 3, "SerialNumber": "", "ServiceDescriptions": null, "ServicePhilosophy": null, "SKU": null, "SMBIOSAssetTag": "", "Status": null, "Tag": "System Enclosure 0", "TypeDescriptions": null, "Version": "", "VisibleAlarm": null, "Weight": null, "Width": null } ], "caption": "System Enclosure", "creation_class_name": "Win32_SystemEnclosure", "description": "System Enclosure", "manufacturer": "Oracle Corporation", "name": "System Enclosure", "serial_number": "", "smbios_asset_tag": "", "tag": "System Enclosure 0", "version": "" }, "processor": { "all_records": [ { "AddressWidth": 64, "Architecture": 9, "AssetTag": null, "Availability": 3, "Caption": "Intel64 Family 6 Model 70 Stepping 1", "Characteristics": null, "ConfigManagerErrorCode": null, "ConfigManagerUserConfig": null, "CpuStatus": 0, "CreationClassName": "Win32_Processor", "CurrentClockSpeed": 2794, "CurrentVoltage": null, "DataWidth": 64, "Description": "Intel64 Family 6 Model 70 Stepping 1", "DeviceID": "CPU0", "ErrorCleared": null, "ErrorDescription": null, "ExtClock": null, "Family": 2, "InstallDate": null, "L2CacheSize": null, "L2CacheSpeed": null, "L3CacheSize": 0, "L3CacheSpeed": 0, "LastErrorCode": null, "Level": 6, "LoadPercentage": 0, "Manufacturer": "GenuineIntel", "MaxClockSpeed": 2794, "Name": "Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz", "NumberOfCores": 2, "NumberOfEnabledCore": null, "NumberOfLogicalProcessors": 2, "OtherFamilyDescription": null, "PartNumber": null, "PNPDeviceID": null, "PowerManagementCapabilities": null, "PowerManagementSupported": false, "ProcessorId": null, "ProcessorType": null, "Revision": 17921, "Role": "CPU", "SecondLevelAddressTranslationExtensions": false, "SerialNumber": null, "SocketDesignation": null, "Status": "OK", "StatusInfo": 3, "Stepping": null, "SystemCreationClassName": "Win32_ComputerSystem", "SystemName": "VAGRANT-36IHG0U", "ThreadCount": null, "UniqueId": null, "UpgradeMethod": 2, "Version": "", "VirtualizationFirmwareEnabled": false, "VMMonitorModeExtensions": false, "VoltageCaps": null } ], "caption": "Intel64 Family 6 Model 70 Stepping 1", "creation_class_name": "Win32_Processor", "description": "Intel64 Family 6 Model 70 Stepping 1", "device_id": "CPU0", "manufacturer": "GenuineIntel", "name": "Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz", "role": "CPU", "status": "OK", "system_creation_class_name": "Win32_ComputerSystem", "system_name": "VAGRANT-36IHG0U", "version": "" }, "bios": { "all_records": [ { "BiosCharacteristics": [ 4, 7, 15, 16, 27, 30, 32 ], "BIOSVersion": [ "VBOX - 1" ], "BuildNumber": null, "Caption": "Default System BIOS", "CodeSet": null, "CurrentLanguage": null, "Description": "Default System BIOS", "EmbeddedControllerMajorVersion": 110, "EmbeddedControllerMinorVersion": 111, "IdentificationCode": null, "InstallableLanguages": null, "InstallDate": null, "LanguageEdition": null, "ListOfLanguages": null, "Manufacturer": "innotek GmbH", "Name": "Default System BIOS", "OtherTargetOS": null, "PrimaryBIOS": true, "ReleaseDate": "20061201000000.000000+000", "SerialNumber": "0", "SMBIOSBIOSVersion": "VirtualBox", "SMBIOSMajorVersion": 2, "SMBIOSMinorVersion": 5, "SMBIOSPresent": true, "SoftwareElementID": "Default System BIOS", "SoftwareElementState": 3, "Status": "OK", "SystemBiosMajorVersion": 105, "SystemBiosMinorVersion": 110, "TargetOperatingSystem": 0, "Version": "VBOX - 1" } ], "caption": "Default System BIOS", "description": "Default System BIOS", "manufacturer": "innotek GmbH", "name": "Default System BIOS", "release_date": "20061201000000.000000+000", "serial_number": "0", "smbiosbios_version": "VirtualBox", "software_element_id": "Default System BIOS", "status": "OK", "version": "VBOX - 1" }, "system": { "all_records": [ { "Caption": "Computer System Product", "Description": "Computer System Product", "IdentifyingNumber": "0", "Name": "VirtualBox", "SKUNumber": null, "UUID": "DBF47626-9602-4396-B121-94A6DEB3A06D", "Vendor": "innotek GmbH", "Version": "1.2" } ], "caption": "Computer System Product", "description": "Computer System Product", "identifying_number": "0", "name": "VirtualBox", "uuid": "DBF47626-9602-4396-B121-94A6DEB3A06D", "vendor": "innotek GmbH", "version": "1.2" }, "base_board": { "all_records": [ { "Caption": "Base Board", "ConfigOptions": null, "CreationClassName": "Win32_BaseBoard", "Depth": null, "Description": "Base Board", "Height": null, "HostingBoard": true, "HotSwappable": false, "InstallDate": null, "Manufacturer": "Oracle Corporation", "Model": null, "Name": "Base Board", "OtherIdentifyingInfo": null, "PartNumber": null, "PoweredOn": true, "Product": "VirtualBox", "Removable": false, "Replaceable": false, "RequirementsDescription": null, "RequiresDaughterBoard": false, "SerialNumber": "0", "SKU": null, "SlotLayout": null, "SpecialRequirements": null, "Status": "OK", "Tag": "Base Board", "Version": "1.2", "Weight": null, "Width": null } ], "caption": "Base Board", "creation_class_name": "Win32_BaseBoard", "description": "Base Board", "manufacturer": "Oracle Corporation", "name": "Base Board", "product": "VirtualBox", "serial_number": "0", "status": "OK", "tag": "Base Board", "version": "1.2" } }, "hostname": "VAGRANT-36IHG0U", "machinename": "VAGRANT-36IHG0U", "fqdn": "VAGRANT-36IHG0U", "domain": null, "virtualization": { "systems": { "vbox": "guest" }, "system": "vbox", "role": "guest" }, "virtualbox": { "host": { "language": "en_US", "revision": "136177", "version": "6.1.4" }, "guest": { "guest_additions_version": "6.1.2", "guest_additions_revision": "135662" } }, "time": { "timezone": "Coordinated Universal Time" }, "command": { }, "root_group": "Administrators", "fips": { "kernel": { "enabled": false } }, "shard_seed": 196727857, "keys": { "ssh": { } }, "packages": { "Oracle VM VirtualBox Guest Additions 6.1.2": { "version": "6.1.2.0", "publisher": "Oracle Corporation" }, "ChefDK v4.7.73": { "version": "4.7.73.1", "publisher": "Chef Software, Inc.", "installdate": "20200331" } }, "ohai_time": 1586395470.9022436, "cpu": { "0": { "cores": 2, "vendor_id": "GenuineIntel", "family": "2", "model": "17921", "stepping": "1", "physical_id": "CPU0", "model_name": "Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz", "description": "Intel64 Family 6 Model 70 Stepping 1", "mhz": "2794", "cache_size": " KB" }, "total": 2, "cores": 2, "real": 1 }, "filesystem": { "C:": { "kb_size": 41573937, "kb_available": 30609346, "kb_used": 10964591, "percent_used": 26, "fs_type": "ntfs", "drive_type": 3, "drive_type_string": "local", "drive_type_human": "Local Fixed Disk", "volume_name": "Windows 2019" } }, "filesystem2": { "by_device": { "windows 2019": { "kb_size": 41573937, "kb_available": 30609346, "kb_used": 10964591, "percent_used": 26, "fs_type": "ntfs", "drive_type": 3, "drive_type_string": "local", "drive_type_human": "Local Fixed Disk", "volume_name": "Windows 2019", "mounts": [ "C:" ] } }, "by_mountpoint": { "C:": { "kb_size": 41573937, "kb_available": 30609346, "kb_used": 10964591, "percent_used": 26, "fs_type": "ntfs", "drive_type": 3, "drive_type_string": "local", "drive_type_human": "Local Fixed Disk", "volume_name": "Windows 2019", "devices": [ "windows 2019" ] } }, "by_pair": { "windows 2019,C:": { "kb_size": 41573937, "kb_available": 30609346, "kb_used": 10964591, "percent_used": 26, "mount": "C:", "fs_type": "ntfs", "drive_type": 3, "drive_type_string": "local", "drive_type_human": "Local Fixed Disk", "volume_name": "Windows 2019", "device": "windows 2019" } } }, "system_enclosure": { "manufacturer": "Oracle Corporation", "serialnumber": "" }, "cloud": null } ```

There is still no node['dmi']['system']['serial_number'] so I'll need to figure something out.

btm commented 4 years ago

@phiggins I looked again and couldn't find a closer match of a WMI class for 'system' than Win32computerSystemProduct.

Here is "system" on my windows 10 system using your branch.

  "system": {
    "all_records": [
      {
        "Caption": "Computer System Product",
        "Description": "Computer System Product",
        "IdentifyingNumber": "87GBNY1",
        "Name": "Inspiron 660",
        "SKUNumber": null,
        "UUID": "4C4C4544-0037-4710-8042-B8C04F4E5931",
        "Vendor": "Dell Inc.",
        "Version": "  "
      }
    ],
    "caption": "Computer System Product",
    "description": "Computer System Product",
    "identifying_number": "87GBNY1",
    "name": "Inspiron 660",
    "uuid": "4C4C4544-0037-4710-8042-B8C04F4E5931",
    "vendor": "Dell Inc.",
    "version": ""
  },

If that is the closest match, perhaps we leave the data as is under "all_records" but rename:

vendor -> manufacturer identifying_number -> serial_number name -> family

leave version and uuid as they are.

I would filter caption, creation_class_name, and description out of the records outside of "all_records". That information seems duplicative.

I'm comparing my linux laptop to my windows desktop, but comparing the same data on a dual-boot system would be ideal if someone had it handy.

phiggins commented 4 years ago

I'm comparing my linux laptop to my windows desktop, but comparing the same data on a dual-boot system would be ideal if someone had it handy.

I don't have any machines with linux and windows on them currently, but I could get that going sometime in the next few days if no one beats me to it.

btm commented 4 years ago

WOOT! Fixed in #1445.

btm_000@btm-desktop MINGW64 ~/src/ohai (master)
$ bin/ohai dmi/system/serial_number
[
  "87GBNY1"
]

@MikeLingenfelter in Chef 16 now you should be able to find what you are looking for in one of these places, depending where VMware is putting them. -- dmi/system/serial_number -- dmi/chassis/serial_number -- dmi/bios/serial_number

-- dmi/system/manufacturer -- dmi/chassis/manufacturer -- dmi/bios/manufacturer