Kanrisuru

dmi

Get cpu hardware information from the BIOS in ruby.
linux manual

Basic Usage

require 'kanrisuru'
host = Kanrisuru::Remote::Host.new(host: 'centos-host', username: 'centos', keys: ['~/.ssh/id_rsa'])

host.su('root')
result = host.dmi(types: 4)
result.success?
true

result[0].dmi_type
'Processor'

result[0].manufacturer
'QEMU'

result[0].thread_count
"1"

This command needs escalated privileges to make changes to certain files and directory ownership.

Parameters

Field Type Description
types string
integer
array
The DMI type to filter system information by. See DMI Type to see all available types to filter by.

Result

Returns an array of type specific instances depending on types param. If none is given, all types will be returned for the available system.

Return Example

host.dmi(types: ['BIOS', 'System']).to_a
[
  [0] #<Struct:Kanrisuru::Core::Dmi::BIOS:0x00000e10
    address = "0xE8000",
    bios_revision = "0.0",
    characteristics = [
      [0] "BIOS characteristics not supported",
      [1] "Targeted content distribution is supported"
    ],
    dmi_handle = "0x0000",
    dmi_size = 24,
    dmi_type = "BIOS",
    firmware_revision = nil,
    release_date = "04/01/2014",
    rom_size = "64 kB",
    runtime_size = "96 kB",
    vendor = "SeaBIOS",
    version = "1.13.0-1ubuntu1.1"
  >,
  [1] #<Struct:Kanrisuru::Core::Dmi::System:0x00000ff0
    dmi_handle = "0x0100",
    dmi_size = 27,
    dmi_type = "System",
    family = "Virtual Machine",
    manufacturer = "OpenStack Foundation",
    product_name = "OpenStack Nova",
    serial_number = "6da6f569-1cfc-4214-829d-b1c6adf6b353",
    sku_number = "Not Specified",
    uuid = "6da6f569-1cfc-4214-829d-b1c6adf6b353",
    version = "21.2.0",
    wake_up_type = "Power Switch"
  >
]

Exit Status

Code Description
0 Success
1 Failure

Tested On

  • Ubuntu, Debian, Centos, Fedora, Redhat, OpenSuse, SLES