@@ -5,7 +5,125 @@ python-hwinfo
55======
66
77This is a python library for inspecting hardware and devices by parsing
8- the outputs of system utils such as lspci and dmidecode.
8+ the outputs of system utilities such as lspci and dmidecode.
99
1010
11+ Installation
12+ ------------
13+ This package can be installed using pip either directly from this repository
14+ or from the latest published version on PyPi:
15+
16+ pip install python-hwinfo
1117
18+ Or,
19+
20+ pip install git+https://github.com/rdobson/python-hwinfo.git
21+
22+
23+ Library Usage
24+ -----
25+ The library consists of a number of command parsers, and a number of higher-level
26+ objects. The parsers simply return a record, or a list of records associated with
27+ a particular command output. The higher-level objects are populated with the records
28+ obtained from a command output and include additional logic.
29+
30+ For example, to parse a list of PCI devices:
31+
32+ from hwinfo.pci import PCIDevice
33+ from hwinfo.pci.lspci import LspciNNMMParser
34+
35+ # Obtain the output of lspci -nnmm from somewhere
36+ lspci_output = exec_command('lspci -nnmm')
37+
38+ # Parse the output using the LspciNNMMParser object
39+ parser = LspciNNMMParser(lspci_output)
40+ device_recs = parser.parse_items()
41+
42+ # Instantiate the records as PCI devices
43+ pci_devs = [PCIDevice(device_rec) for device_rec in device_recs]
44+
45+ # Use the PCIDevice class to query info for subdevices
46+ for dev in pci_devs:
47+ if dev.is_subdevice():
48+ print dev.get_info()
49+
50+
51+ CLI
52+ ---
53+ Along with the classes for parsing/inspecting objects, the library also includes
54+ a simple CLI tool which can be used for inspecting local, remote and captured hosts.
55+
56+ For inspecting the hardware present on a local machine, execute:
57+
58+ $> hwinfo
59+ $>
60+ Bios Info:
61+
62+ +----------------------+--------------------------------------+
63+ | Key | Value |
64+ +----------------------+--------------------------------------+
65+ | bios_vendor_name | Dell Inc. |
66+ | system_product_name | Precision T3610 |
67+ | system_serial_number | 2Q2R212 |
68+ | system_uuid | 4C4C4544-0051-3210-8052-B2C04F323132 |
69+ | system_manufacturer | Dell Inc. |
70+ | bios_release_date | 02/28/2014 |
71+ | bios_version | A06 |
72+ +----------------------+--------------------------------------+
73+
74+ CPU Info:
75+
76+ +-----------+--------------+------------+-------+----------+-------------------------------------------+----------+
77+ | processor | vendor_id | cpu_family | model | stepping | model_name | cpu_mhz |
78+ +-----------+--------------+------------+-------+----------+-------------------------------------------+----------+
79+ | 0 | GenuineIntel | 6 | 62 | 4 | Intel(R) Xeon(R) CPU E5-1607 v2 @ 3.00GHz | 1200.000 |
80+ | 1 | GenuineIntel | 6 | 62 | 4 | Intel(R) Xeon(R) CPU E5-1607 v2 @ 3.00GHz | 2200.000 |
81+ | 2 | GenuineIntel | 6 | 62 | 4 | Intel(R) Xeon(R) CPU E5-1607 v2 @ 3.00GHz | 1200.000 |
82+ | 3 | GenuineIntel | 6 | 62 | 4 | Intel(R) Xeon(R) CPU E5-1607 v2 @ 3.00GHz | 2800.000 |
83+ +-----------+--------------+------------+-------+----------+-------------------------------------------+----------+
84+
85+ Ethernet Controller Info:
86+
87+ +-------------------+-----------+------------------------------------+-----------+----------------+--------------+----------------+--------------+
88+ | vendor_name | vendor_id | device_name | device_id | subvendor_name | subvendor_id | subdevice_name | subdevice_id |
89+ +-------------------+-----------+------------------------------------+-----------+----------------+--------------+----------------+--------------+
90+ | Intel Corporation | 8086 | 82579LM Gigabit Network Connection | 1502 | Dell | 1028 | [Device 05d2] | 05d2 |
91+ +-------------------+-----------+------------------------------------+-----------+----------------+--------------+----------------+--------------+
92+
93+ Storage Controller Info:
94+
95+ +-------------------+-----------+----------------------------------------------+-----------+----------------+--------------+----------------+--------------+
96+ | vendor_name | vendor_id | device_name | device_id | subvendor_name | subvendor_id | subdevice_name | subdevice_id |
97+ +-------------------+-----------+----------------------------------------------+-----------+----------------+--------------+----------------+--------------+
98+ | Intel Corporation | 8086 | C600/X79 series chipset IDE-r Controller | 1d3c | Dell | 1028 | [Device 05d2] | 05d2 |
99+ | Intel Corporation | 8086 | C600/X79 series chipset SATA RAID Controller | 2826 | Dell | 1028 | [Device 05d2] | 05d2 |
100+ +-------------------+-----------+----------------------------------------------+-----------+----------------+--------------+----------------+--------------+
101+
102+ GPU Info:
103+
104+ +--------------------+-----------+-----------------------+-----------+--------------------+--------------+----------------+--------------+
105+ | vendor_name | vendor_id | device_name | device_id | subvendor_name | subvendor_id | subdevice_name | subdevice_id |
106+ +--------------------+-----------+-----------------------+-----------+--------------------+--------------+----------------+--------------+
107+ | NVIDIA Corporation | 10de | GK107GL [Quadro K600] | 0ffa | NVIDIA Corporation | 10de | [Device 094b] | 094b |
108+ +--------------------+-----------+-----------------------+-----------+--------------------+--------------+----------------+--------------+
109+
110+ _ Note: you may need to execute ` hwinfo ` with sudo depending on your systems permissions._
111+
112+ For remote executions you must provide a machine address, username and password:
113+
114+ $> hwinfo -m 10.80.100.152 -u root -p password
115+
116+ If you have the captured outputs of the following:
117+ * /proc/cpuinfo as 'cpuinfo'
118+ * dmidecode as 'dmidecode.out'
119+ * lspci -nnm as 'lspci-nnm.out'
120+
121+ Then you can run ` hwinfo ` on that data in the following way:
122+
123+ $> hwinfo -f <path to directory containing files>
124+
125+
126+ Reporting Issues
127+ ----------------
128+ This library is currently regarded as being in beta and so bugs are to be fully expected.
129+ If you encounter any, please [ report them] ( https://github.com/rdobson/python-hwinfo ) .
0 commit comments