Python obtains server vendor and model information

Source: Internet
Author: User
Tags hp server
Python obtains server vendor and model information. Python obtains server vendor and model information. in RHEHL6, the python-dmidecode package needs to be pre-installed by the system (it seems that it has 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] #

During execution, the root permission is required and the output is as follows:

[Root @ linuxidc tmp] #./test. py

HPProLiant DL380p Gen8

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

Note: The dmidecode command is used to obtain the information:

dmidecode -t1

The output is as follows:

[Root @ linuxidc tmp] # dmidecode-t1

# dmidecode 2.11SMBIOS 2.7 present.  Handle 0x0100, DMI type 1, 27 bytesSystem Information        Manufacturer: HP        Product Name: ProLiant DL380p Gen8        Version: 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.