Linux Administrator Monitoring

Discover and Monitor Hardware in Linux/UNIX

discover-monitor-hardware
mm
Written by Santosh Prasad

There are lots of utilities available for discovering and monitoring hardware health. In this tutorial we are explaining good tools for spotting possible hard drive failure, gathering hardware information and monitoring voltages, temperatures, fans, email, and more.

Health of Hard Drive

We are familiar with the good smartmontools to monitor hard drive health and get early warning of possible hard drive failure. This tools runs a test and reads the data from hard drive which has the self-monitoring,and S.M.A.R.T Reporting Technology. We can also run a short or large test and GSmartControl is valuable for quickly and easily finding logs and reading SMART data. See the detailed data on our hard drive using test result.

Monitor and Alert

If our server’s CPU fan is melted-down and it is failed, it is critical warning for us to fix this. We can monitor the CPU fans, temperatures, and voltages using lm-sensors.

# sensors
atk0110-acpi-0
Adapter: ACPI interface
Vcore Voltage: +1.23 V (min = +0.85 V, max = +1.60 V)
+3.3 Voltage: +3.31 V (min = +2.97 V, max = +3.63 V)
+5 Voltage: +4.97 V (min = +4.50 V, max = +5.50 V)
+12 Voltage: +12.15 V (min = +10.20 V, max = +13.80 V)
CPU FAN Speed: 3083 RPM (min = 600 RPM)
CPU Temperature: +34.0°C (high = +60.0°C, crit = +95.0°C)
MB Temperature: +30.0°C (high = +45.0°C, crit = +75.0°C)

We can also use Xsensors it is simple, xfce4-sensors-plugin looks great in XFCE, and the KDE4 system. But it is not very configurable and no alerting system. psensor is also good. It can run as a server  for remote monitoring. GKrellM is also good with full of features, alerting and configurable. Conky is my favourite. It monitor email, instant messaging, music players, log-files, weather forecast and more.

Hardware Probing

To know the what is on your system use lspci command. lscpi command used for getting detailed information on everything connected to the PCI bus.

lspci :- Without any options it shows a hardware list with its Vendor Names, Chipsets and Device types.

# lspci
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 Processor Family DRAM Controller (rev 09)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port (rev 09)
00:06.0 PCI bridge: Intel Corporation Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port (rev 09)
00:16.0 Communication controller: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1 (rev 04)
00:16.1 Communication controller: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #2 (rev 04)
00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 05)
00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 (rev b5)
00:1c.4 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 5 (rev b5)
00:1c.5 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 6 (rev b5)
00:1c.6 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 7 (rev b5)
00:1c.7 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 8 (rev b5)
00:1d.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 (rev 05)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev a5)
00:1f.0 ISA bridge: Intel Corporation C204 Chipset Family LPC Controller (rev 05)
00:1f.2 IDE interface: Intel Corporation 6 Series/C200 Series Chipset Family 4 port SATA IDE Controller (rev 05)
00:1f.3 SMBus: Intel Corporation 6 Series/C200 Series Chipset Family SMBus Controller (rev 05)
00:1f.5 IDE interface: Intel Corporation 6 Series/C200 Series Chipset Family 2 port SATA IDE Controller (rev 05)
01:00.0 RAID bus controller: Adaptec AAC-RAID (rev 09)
04:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
05:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
06:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
07:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
08:03.0 VGA compatible controller: Matrox Electronics Systems Ltd. MGA G200eW WPCM450 (rev 0a)

lspci -k :- With -k options it shows the kernel driver in user for each device and available kernel modules.

# lspci -k

You will get some output like below.

00:00.0 Host bridge: Intel Corporation Xeon E3-1200 Processor Family DRAM Controller (rev 09)
Subsystem: Super Micro Computer Inc Device 0631
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port (rev 09)
Kernel driver in use: pcieport
Kernel modules: shpchp
00:06.0 PCI bridge: Intel Corporation Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port (rev 09)
Kernel driver in use: pcieport
Kernel modules: shpchp
00:16.0 Communication controller: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1 (rev 04)
Subsystem: Super Micro Computer Inc Device 0631
00:16.1 Communication controller: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #2 (rev 04)
Subsystem: Super Micro Computer Inc Device 0631
00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 05)
Subsystem: Super Micro Computer Inc Device 0631
Kernel driver in use: ehci_hcd
00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 (rev b5)
Kernel modules: shpchp
00:1c.4 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 5 (rev b5)
Kernel modules: shpchp
00:1c.5 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 6 (rev b5)
Kernel modules: shpchp
00:1c.6 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 7 (rev b5)
Kernel modules: shpchp
00:1c.7 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 8 (rev b5)
Kernel modules: shpchp
00:1d.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 (rev 05)
Subsystem: Super Micro Computer Inc Device 0631
Kernel driver in use: ehci_hcd
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev a5)
00:1f.0 ISA bridge: Intel Corporation C204 Chipset Family LPC Controller (rev 05)
Subsystem: Super Micro Computer Inc Device 0631
Kernel driver in use: lpc_ich
Kernel modules: lpc_ich
00:1f.2 IDE interface: Intel Corporation 6 Series/C200 Series Chipset Family 4 port SATA IDE Controller (rev 05)
Subsystem: Super Micro Computer Inc Device 0631
Kernel driver in use: ata_piix
Kernel modules: ata_generic, pata_acpi, ata_piix
00:1f.3 SMBus: Intel Corporation 6 Series/C200 Series Chipset Family SMBus Controller (rev 05)
Subsystem: Super Micro Computer Inc Device 0631
Kernel driver in use: i801_smbus
Kernel modules: i2c-i801
00:1f.5 IDE interface: Intel Corporation 6 Series/C200 Series Chipset Family 2 port SATA IDE Controller (rev 05)
Subsystem: Super Micro Computer Inc Device 0631
Kernel driver in use: ata_piix
Kernel modules: ata_generic, pata_acpi, ata_piix
01:00.0 RAID bus controller: Adaptec AAC-RAID (rev 09)
Subsystem: Adaptec 5405G
Kernel driver in use: aacraid
Kernel modules: aacraid
04:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
Subsystem: Super Micro Computer Inc Device 0000
Kernel driver in use: e1000e
Kernel modules: e1000e
05:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
Subsystem: Super Micro Computer Inc Device 0000
Kernel driver in use: e1000e
Kernel modules: e1000e
06:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
Subsystem: Super Micro Computer Inc Device 0000
Kernel driver in use: e1000e
Kernel modules: e1000e
07:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
Subsystem: Super Micro Computer Inc Device 0000
Kernel driver in use: e1000e
Kernel modules: e1000e
08:03.0 VGA compatible controller: Matrox Electronics Systems Ltd. MGA G200eW WPCM450 (rev 0a)
Subsystem: Super Micro Computer Inc Device 0631

lspci -t :- Shows the tree view that display the relationship between devices.

# lspci -t
-[0000:00]-+-00.0
+-01.0-[01]----00.0
+-06.0-[02]--
+-16.0
+-16.1
+-1a.0
+-1c.0-[03]--
+-1c.4-[04]----00.0
+-1c.5-[05]----00.0
+-1c.6-[06]----00.0
+-1c.7-[07]----00.0
+-1d.0
+-1e.0-[08]----03.0
+-1f.0
+-1f.2
+-1f.3
\-1f.5

All information displayed by lspci comes from a database. We can update our local copy of this database “/usr/share/misc/pci.ids” using update-pciids command.

dmidecode usage

dmidecode is a powerful utility for getting all information of your motherboard without opening the case, and without booting to the BIOS. If we run the dmidecode without ant options it spits out pages of data. Follow the below command to get the motherboard information.

Know How much RAM does your motherboard support

# dmidecode -t 16

# dmidecode 2.12
SMBIOS 2.7 present.

Handle 0x0007, DMI type 16, 23 bytes
Physical Memory Array
Location: System Board Or Motherboard
Use: System Memory
Error Correction Type: Single-bit ECC
Maximum Capacity: 32 GB
Error Information Handle: 0x0009
Number Of Devices: 4

Above we can see server max RAM capacity is 32 GB.

Know how much RAM is installed and in which slots

Follow the below command to show the installed RAM and in which slots.

# dmidecode -t 17

You will get some output like below.

# dmidecode 2.12
SMBIOS 2.7 present.

Handle 0x000A, DMI type 17, 34 bytes
Memory Device
Array Handle: 0x0007
Error Information Handle: 0x000B
Total Width: 128 bits
Data Width: 64 bits
Size: 8192 MB
Form Factor: DIMM
Set: None
Locator: DIMM_1A
Bank Locator: BANK 0
Type: DDR3
Type Detail: Synchronous
Speed: Unknown
Manufacturer: Kingston
Serial Number: 375A3946
Asset Tag: 9876543210
Part Number: SL8D316E11D8KF
Rank: 2
Configured Clock Speed: 1333 MHz

Handle 0x000C, DMI type 17, 34 bytes
Memory Device
Array Handle: 0x0007
Error Information Handle: 0x0011
Total Width: Unknown
Data Width: Unknown
Size: No Module Installed
Form Factor: DIMM
Set: None
Locator: DIMM_2A
Bank Locator: BANK 0
Type: Unknown
Type Detail: None
Speed: Unknown
Manufacturer: [Empty]
Serial Number: [Empty]
Asset Tag: 9876543210
Part Number: [Empty]
Rank: Unknown
Configured Clock Speed: Unknown

Handle 0x0012, DMI type 17, 34 bytes
Memory Device
Array Handle: 0x0007
Error Information Handle: 0x0013
Total Width: 128 bits
Data Width: 64 bits
Size: 8192 MB
Form Factor: DIMM
Set: None
Locator: DIMM_1B
Bank Locator: BANK 1
Type: DDR3
Type Detail: Synchronous
Speed: Unknown
Manufacturer: Kingston
Serial Number: 375A4259
Asset Tag: 9876543210
Part Number: SL8D316E11D8KF
Rank: 2
Configured Clock Speed: 1333 MHz

Handle 0x0014, DMI type 17, 34 bytes
Memory Device
Array Handle: 0x0007
Error Information Handle: 0x0015
Total Width: Unknown
Data Width: Unknown
Size: No Module Installed
Form Factor: DIMM
Set: None
Locator: DIMM_2B
Bank Locator: BANK 1
Type: Unknown
Type Detail: None
Speed: Unknown
Manufacturer: [Empty]
Serial Number: [Empty]
Asset Tag: 9876543210
Part Number: [Empty]
Rank: Unknown
Configured Clock Speed: Unknown

Handle 0x0017, DMI type 17, 34 bytes
Memory Device
Array Handle: 0x0007
Error Information Handle: No Error
Total Width: 8 bits
Data Width: 8 bits
Size: 8 MB
Form Factor: <OUT OF SPEC>
Set: None
Locator: Not Specified
Bank Locator: Not Specified
Type: Flash
Type Detail: None
Speed: Unknown
Manufacturer: Winbond
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: 25X/Q Series
Rank: Unknown
Configured Clock Speed: Unknown

Check Onboard Device like Video, Networking and Sound

# dmidecode -t 10

# dmidecode 2.12
SMBIOS 2.7 present.

Handle 0x000E, DMI type 10, 6 bytes
On Board Device Information
Type: Video
Status: Enabled
Description: To Be Filled By O.E.M.

lshw

lshw command provide a detailed peek inside PC and it also provide graphical view with lshw -x. We can use lshw to present information. It give the full detail like file-system type and sizes, buses information and capabilities. It also provides extras with -sanitize option to scrubs IP address, Serial Numbers and other identity and with -class option lets you choose categories like volume and disk for block device, memory and display. Use lshw with -short to see what the categories are. Follow the below example.

# lshw -short
H/W path Device Class Description
=====================================================
/0/33/2 memory 4GiB DIMM DDR2 Synchronous 800 MHz (1.2 ns
/0/33/3 memory DIMM [empty]
/0/100/a/0 eth0 network RTL8111/8168B PCI Express Gigabit Ethernet
/0/100/11/0 /dev/sda disk 1TB SAMSUNG HD204UI
/0/100/11/0/1 /dev/sda1 volume 1451GiB EXT4 volume
/0/100/11/0/2 /dev/sda2 volume 221GiB EXT4 volume
/0/100/11/1 /dev/sdb disk 540GB WDC WD6401AALS-0
/0/100/11/1/1 /dev/sdb1 volume 37GiB EXT4 volume
/0/100/11/1/2 /dev/sdb2 volume 1707MiB Linux swap volume
/0/100/11/0.0.0 /dev/cdrom2 disk iHAS424 B
/1 wlan0 network Wireless interface

I hope this article will be helpful to discover and monitor hardware in Linux. Read our another article Manage Linux Server With Ajenti (Web Based Control Panel) and Awstats – Log Analyzer To Analize Apache Logs On CentOS,Fedora and RHEL System. If you have any queries and problem please comment in comment section or you can also ask your question.

About the author

mm

Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

Leave a Comment