whatsthis
Am I in a cloud, on a container, or just plain baremetal? This is a Go-based
CLI and library to determine where a system is running and what makes up the
system. I found myself wanting a single screen with system information after
SSH'ing onto new systems to debug or test. Additionally, I started this after
wanting to explore /proc
and /sys
and learn what data are available in
each.
To determine where a system is running, whatsthis
is essentially an
all-in-one collection of systemd-detect-virt
, virt-what
, and cloud-id
.
This attempts to do a best effort guess based on a variety of heuristics as to
what container, virtualization, or cloud the system is running on.
To summarize the system components, whatsthis
will scan the filesystem
for known files in /sys
, /proc
, or other directories. This data is then
used to create a short summarize of the system in place of running a number of
other commands (e.g. lsblk
, ip
, dmesg
, dmidecode
)
Finally, I have never written a program in Go an saw this as an opportunity to
learn the ecosystem and language. If you have pointers on how the code can be
improved please do hesitate to let me know by opening an
issue. If you are interested
in a similar go-lang based cli and library, consider looking at
ghw for more detailed hardware information.
Install
TBD
Architecture Support
whatsthis
was developed with Linux in mind. There is one amd64 assembly file
as well, so the full execution is limited to linux on AMD64 for now.
Operating System Support
The *BSD do not mount /proc
by default and /sys
was essentially replaced
with the use of sysctl
. This app could be exteded to learn how to use
sysctl
down the road.
CLI Usage
To get a full summary of the system run whatsthis
and the output will show
a breakdown module name by module name:
$ whatsthis
cloud: not detected
virt: not detected
container: not detected
distro: Ubuntu 20.10 (amd64)
kernel: 5.8.0-33-generic
board: ASUSTeK COMPUTER INC. TUF GAMING X570-PRO (WI-FI)
bios: American Megatrends Inc. BIOS 3001 (12/04/2020)
cpu: AMD Ryzen 9 5950X 16-Core Processor with 16 cores (32 threads) on 1 socket
memory: 31.3G
storage:
- nvme0n1 931.5G
- nvme0n1p1 512M EFI System Partition
- nvme0n1p2 931G
- nvme1n1 1.9T
- nvme1n1p4 498M
- nvme1n1p2 16M Microsoft reserved partition
- nvme1n1p3 1.9T Basic data partition
- nvme1n1p1 100M EFI system partition
network:
- adapters:
- enp6s0 24:4b:fe:9a:a4:fa 1000 mtu 9000 (igc)
- virtual:
- virbr0-nic 52:54:00:6d:53:f1 mtu 1500
- bridges:
- docker0 02:42:96:01:ec:70 mtu 1500
- virbr0 52:54:00:6d:53:f1 mtu 1500
To run only one particular module, run with only that module name:
$ whatsthis cpu
cpu: AMD Ryzen 9 5950X 16-Core Processor with 16 cores (32 threads) on 1 socket
Finally, to get the output in JSON add the --json
flag:
$ whatsthis cpu --json
{
"model": "AMD Ryzen 9 5950X 16-Core Processor",
"numCore": 16,
"numThread": 32,
"numSocket": 1
}
See whatsthis help
for a full list of modules and more information on
options.
Library Usage
TODO
If you find a bug, have a question, or ideas for improvements please file an
issue on GitHub.