Wednesday, September 13, 2017

checking host hardware using linux kernel

How to collect information about  host without trivial system command

  I'm using a lot of hardware boxes with no limit on distro types and versions.  In this case using system command such as ifconfig has a limited usage.  Also,  system config files have a different path and best way for me is getting information from the kernel. Of course,  I'm using cat command for doing this.
Next table has information about hardware. Let me know if something is interesting for you and you know something interesting

hardware information in the linux kernel
file path information
/proc/cpuinfo CPU
/proc/meminfo memory
/sys/block List of block devices. HDD has sd or hd at the beginning
/sys/class/block/{digit}/device/model HDD drive and vendor
/sys/block/{digit}/size HDD size
 /sys/block List of block devices. HDD has sd or hd at the beginning
/sys/bus/pci/devices/0000:{digit}/net System name of the network card
/sys/devices/virtual/dmi/id/board_* Motherboard information
/proc/net/route Netcard names with VLAN datas, network and netmask
/proc/net/fib_trie route caching (also has information about local IPs)
/proc/version kernel version and uptime

Simple bonus

I've written a simple python script for  checking all information at remote host via SSH connection. you need ssh key  for connection only.  Link is here: python code is here.

No comments:

Post a Comment