HWRep gathers hardware information from the linux operating system.
Hostname
System:
- CPU cores
- CPU sockets
- number of threads
- CPU model info
Memory
- Amount of RAM
- Amount of SWAP
- NUMA layout
Storage
- drives
- capacity
- mount
Manufacturer info
- Bios/Bios ID
- Serial number
- ...
HWRep can display this information to the screen in plain text or a json format.
Why JSON?
With contemporary tools and languages we can easily parse the json object to extract details. example using jq
[vpalat@linux01 ~]$ ./hwrep -j |jq '.cpu_info'
{
"model": "Intel(R) Xeon(R) CPU E5-2640 v4 @ 2.40GHz",
"physical_cores": 10,
"execution_units": 40,
"threads_per_core": 2,
"sockets": 2
}
[vpalat@linux01 ~]$ ./hwrep -j |jq '.cpu_info.model'
"Intel(R) Xeon(R) CPU E5-2640 v4 @ 2.40GHz"
[vpalat@linux01 ~]$ ./hwrep -j |jq '.cpu_info.model' -r
Intel(R) Xeon(R) CPU E5-2640 v4 @ 2.40GHz
[vpalat@linux01 ~]$ ./hwrep -j |jq '.cpu_info.physical_cores' -r
10
hwrep can be built as a static binary.
rustup target add x86_64-unknown-linux-musl
cargo build --target x86_64-unknown-linux-musl
Note you will also need a linker on MacOS.
brew install FiloSottile/musl-cross/musl-cross
Details on how to build for linux on a mac: https://timryan.org/2018/07/27/cross-compiling-linux-binaries-from-macos.html
For the report:
./hwrep
In JSON:
./hwrep -j
- Inventory some older machines and really understand what we have.
- Learn a little rust to build a CLI and web client.
- Understand how linux represents the hardware.