Code Monkey home page Code Monkey logo

getinfo-basic's Introduction

Get info on cpu & nic & drives

getinfo.sh is a bash script providing basic info on hw:

  • cpu (models and core numbers)
  • nics (model numbers, and link state)
  • drives (logical and model name)

Tested on the following platforms:

  • Ubuntu 20.04 running on WSL2 - kernel: 5.10.102.1-microsoft-standard-WSL2
  • Debian 8 running on ReadyNAS 6.10 code - kernel: 4.4.218.x86_64.1

Pre requirements

Required to run this program are basic linux tools:

  • lscpi and lshw
  • if missing can install using your local package manager, below are examples for yum and apt.
yum install pciutils; yum install lshw;
apt-get install pciutils; apt-get install lshw;

To run the code:

./getinfo.sh     # saves to directories only
./getinfo.sh -s  # shows output on screen as well directories

The code then generates files named with the hostname & run date "-.out" to cpu, nic, and drives directory. These directories are created in the script's root directory, and not your current working directory.

root@starlord2:~/lbl-kk# tree cpu nic drives
cpu
├── starlord2-220331-161634.out
└── starlord2-220331-161707.out
nic
├── starlord2-220331-161634.out
└── starlord2-220331-161707.out
drives
├── starlord2-220331-161634.out
└── starlord2-220331-161707.out

Tips:

To see output in all dirs:

grep -r . cpu nic drives

To delete output in all dirs, to have clean output

rm -f cpu/* nic/* drives/*

Example output

These are example results from my Debian NAS server.

root@starlord2:~/lbl-kk# ./getinfo.sh

root@starlord2:~/lbl-kk# cat cpu/*
* cpu model name: Pentium(R) Dual-Core CPU E5300 @ 2.60GHz
* cpu core count: 2

root@starlord2:~/lbl-kk# cat nic/*
* eth0 - link state: down - model name: Marvell Technology Group Ltd. 88E8053 PCI-E Gigabit Ethernet Controller (rev 22)
* eth1 - link state: up - model name: Marvell Technology Group Ltd. 88E8053 PCI-E Gigabit Ethernet Controller (rev 22)

root@starlord2:~/lbl-kk# cat drives/*
* sda - model name: ST4000DM000-1F21
* sdb - model name: ST4000DM000-1F21
* sdc - model name: ST4000DM000-1F21
* sdd - model name: ST4000DM000-1F21
* sde - model name: ST4000DM000-1F21
* sdf - model name: ST4000DM000-1F21

root@starlord2:~/lbl-kk# find cpu nic drives -type f
cpu/starlord2-220331-162932.out
nic/starlord2-220331-162932.out
drives/starlord2-220331-162932.out

root@starlord2:~/lbl-kk# ./getinfo.sh -s
CPU:
* cpu model name: Pentium(R) Dual-Core CPU E5300 @ 2.60GHz
* cpu core count: 2
NETWORK:
* eth0 - link state: down - model name: Marvell Technology Group Ltd. 88E8053 PCI-E Gigabit Ethernet Controller (rev 22)
* eth1 - link state: up - model name: Marvell Technology Group Ltd. 88E8053 PCI-E Gigabit Ethernet Controller (rev 22)
DRIVES:
* sda - model name: ST4000DM000-1F21
* sdb - model name: ST4000DM000-1F21
* sdc - model name: ST4000DM000-1F21
* sdd - model name: ST4000DM000-1F21
* sde - model name: ST4000DM000-1F21
* sdf - model name: ST4000DM000-1F21

Caveats

  • If lspci doesn't have output, NIC models will be listed as not available "N/A" as that info is in lspci. For example if run from WSL2, it cannot get the NIC models as they are virtual.

getinfo-basic's People

Contributors

bhbmaster avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.