whatsthis

package module
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 24, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

README

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

Bugs & Contact

If you find a bug, have a question, or ideas for improvements please file an issue on GitHub.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CPU = cpu.New

CPU alias for new struct

View Source
var Cloud = cloud.New

Cloud alias for new struct

View Source
var Container = container.New

Container alias for new struct

View Source
var Distro = distro.New

Distro alias for new struct

View Source
var Memory = memory.New

Memory alias for new struct

View Source
var Network = network.New

Network alias for new struct

View Source
var Platform = platform.New

Platform alias for new struct

View Source
var Storage = storage.New

Storage alias for new struct

View Source
var Virt = virt.New

Virt alias for new struct

Functions

This section is empty.

Types

type CPUProbe

type CPUProbe = cpu.Probe

CPUProbe alias for cpu.Probe

type CloudProbe

type CloudProbe = cloud.Probe

CloudProbe alias for cloud.Probe

type ContainerProbe

type ContainerProbe = container.Probe

ContainerProbe alias for container.Probe

type DistroProbe

type DistroProbe = distro.Probe

DistroProbe alias for distro.Probe

type MemoryProbe

type MemoryProbe = memory.Probe

MemoryProbe alias for memory.Probe

type NetworkProbe

type NetworkProbe = network.Probe

NetworkProbe alias for network.Probe

type PlatformProbe

type PlatformProbe = platform.Probe

PlatformProbe alias for platform.Probe

type StorageProbe

type StorageProbe = storage.Probe

StorageProbe alias for storage.Probe

type VirtProbe

type VirtProbe = virt.Probe

VirtProbe alias for virt.Probe

Directories

Path Synopsis
cmd
internal
pkg
cpu

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL