Python Gets the vendor and model information for the server

Source: Internet
Author: User
Python gets the server's manufacturer and model information, under RHEHL6, requires the system preinstalled Python-dmidecode this package (it seems to have been installed by default)

The script content is as follows

[ROOT@LINUXIDC tmp]# Cat test.py

#!/usr/bin/env pythonimport Dmidecodeinfo=dmidecode.system () Info_keys=info.keys () for I in Range (len (Info_keys)):    if info[info_keys[i]][' dmi_type ' = = 1:        print info[info_keys[i]][' data ' [' manufacturer ']        print info[ info_keys[i]][' data ' [' Product Name ']

[ROOT@LINUXIDC tmp]#

When executing, the root permission is required and the output is as follows:

[ROOT@LINUXIDC tmp]#./test.py

Hpproliant dl380p Gen8

The first line is manufacturer HP, and the second line is the model of the HP server.

Note: This information is obtained through the Dmidecode command in the following ways:

Dmidecode-t1

The output is as follows:

[ROOT@LINUXIDC tmp]# Dmidecode-t1

# Dmidecode 2.11SMBIOS 2.7 present.  Handle 0x0100, DMI type 1, bytessystem information        manufacturer:hp        Product name:proliant dl380p        Gen8 Vers Ion:not Specified        Serial number:cng230shdq        uuid:32333536-3030-4e43-4732-333053484451        wake-up Type: Power Switch        SKU number:653200-b21        family:proliant

[ROOT@LINUXIDC tmp]#

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.