accessing hardware information using python

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Johhny

    #1

    accessing hardware information using python

    Hello,

    I am currently looking to write a utility in python that will monitor
    the statis of a RAID card within linux. The card in Question is the LSI
    SAS1064 as the tools provided by the vendor to monitor the software
    does not suit our requirements.

    However I am unsure how to convert dmidecode information like so :

    Handle 0x0025
    DMI type 10, 6 bytes.
    On Board Device Information
    Type: SCSI Controller
    Status: Enabled
    Description: LSI serial-ATA #1


    Into anything that I can use to extract information using python? Does
    anyone have any ideas or any recommended reading about this matter?

    Regards,

    Johhny

  • sjdevnull@yahoo.com

    #2
    Re: accessing hardware information using python

    Johhny wrote:[color=blue]
    > I am currently looking to write a utility in python that will monitor
    > the statis of a RAID card within linux. The card in Question is the LSI
    > SAS1064 as the tools provided by the vendor to monitor the software
    > does not suit our requirements.[/color]

    What are your requirements?
    [color=blue]
    > However I am unsure how to convert dmidecode information like so :
    >
    > Handle 0x0025
    > DMI type 10, 6 bytes.
    > On Board Device Information
    > Type: SCSI Controller
    > Status: Enabled
    > Description: LSI serial-ATA #1[/color]

    If dmidecode is a command-line program, maybe something using os.popen:

    #!/usr/bin/env python
    import os

    dmiOutput = os.popen("dmide code", "r")

    status = None
    for line in dmiOutput:
    line = line.strip()
    if line.startswith ("Status: "):
    status = line.split("Sta tus: ", 1)[1]
    break

    if status is not None:
    print "Status is: ", status
    else:
    print "No status information found"

    Comment

    Working...