Leveling up your mind

Clear all

Sys Monitoring

Member Admin

The ‘dmesg‘ command displays the messages from the kernel ring buffer. A system passes multiple runlevel from where we can get lot of information like system architecture, cpu, attached device, RAM etc. When computer boots up, a kernel (core of an operating system) is loaded into memory. During that period number of messages are being displayed where we can see hardware devices detected by kernel.


To display USB

dmesg | grep -i usb


$ dmesg | grep -i usb
[    0.390613] ACPI: bus type USB registered
[    0.390648] usbcore: registered new interface driver usbfs
[    0.390664] usbcore: registered new interface driver hub
[    0.390701] usbcore: registered new device driver usb
[    0.874753] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.875645] ehci-pci 0000:00:0b.0: new USB bus registered, assigned bus number 1
[    0.881081] ehci-pci 0000:00:0b.0: USB 2.0 started, EHCI 1.00
[    0.881197] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 3.10
[    0.881199] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    0.881202] usb usb1: Product: EHCI Host Controller
[    0.881204] usb usb1: Manufacturer: Linux 3.10.0-1062.9.1.el7.x86_64 ehci_hcd
[    0.881205] usb usb1: SerialNumber: 0000:00:0b.0
[    0.881416] hub 1-0:1.0: USB hub found
[    0.881745] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.882562] ohci-pci 0000:00:06.0: new USB bus registered, assigned bus number 2
[    0.959336] usb usb2: New USB device found, idVendor=1d6b, idProduct=0001, bcdDevice= 3.10
[    0.959344] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    0.959346] usb usb2: Product: OHCI PCI host controller
[    0.959348] usb usb2: Manufacturer: Linux 3.10.0-1062.9.1.el7.x86_64 ohci_hcd
[    0.959349] usb usb2: SerialNumber: 0000:00:06.0
[    0.959800] hub 2-0:1.0: USB hub found
[    0.960193] uhci_hcd: USB Universal Host Controller Interface driver
[    0.960285] usbcore: registered new interface driver usbserial_generic
[    0.960293] usbserial: USB Serial support registered for generic
[    0.963443] usbcore: registered new interface driver usbhid
[    0.963445] usbhid: USB HID core driver
Topic starter Posted : 16/02/2020 9:52 pm
Member Admin

**NOTE: iostat works on RedHat/Fedora/CentOS**

The iostat command is used for monitoring system input/output device loading by observing the time the devices are active in relation to their average transfer rates. The iostat command generates reports that can be used to change system configuration to better balance the input/output load between physical disks.

$ iostat 
Linux 3.10.0-1062.9.1.el7.x86_64 (CentOS.localdomain) 	02/16/2020 	_x86_64_	(2 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.03    0.00    0.04    0.04    0.00   99.89

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sda               0.19         0.49         1.55     764751    2425249
scd0              0.00         0.00         0.00       1046          0
dm-0              0.16         0.47         1.55     732534    2423061
dm-1              0.00         0.00         0.00       2204          0

Topic starter Posted : 16/02/2020 10:01 pm
Member Admin

netstat (network statistics) is a command line tool for monitoring network connections both incoming and outgoing as well as viewing routing tables, interface statistics etc.

$ netstat -at
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 localhost:ipp *               LISTEN     
tcp        0      0 localhost:smtp*               LISTEN     
tcp        0      0*               LISTEN     
tcp        0      0 CentOS.localdoma:domain*               LISTEN     
tcp        0      0   *               LISTEN     
tcp        0      0 CentOS.localdomain:ssh      ESTABLISHED
tcp6       0      0 localhost:ipp           [::]:*                  LISTEN     
tcp6       0      0 localhost:smtp          [::]:*                  LISTEN     
tcp6       0      0 [::]:sunrpc             [::]:*                  LISTEN     
tcp6       0      0 [::]:ssh                [::]:*                  LISTEN   
Topic starter Posted : 16/02/2020 10:08 pm
Member Admin

free displays the total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel. The shared memory column should be ignored; it is obsolete.


$ free -ht
              total        used        free      shared  buff/cache   available
Mem:            47G         12G         25G        466M        8.6G         33G
Swap:          2.0G          0B        2.0G
Total:          49G         12G         27G
Topic starter Posted : 16/02/2020 10:13 pm
Member Admin

To view the information for you CPU is by

$ head -n30 /proc/cpuinfo 
processor	: 0
vendor_id	: AuthenticAMD
cpu family	: 23
model		: 1
model name	: AMD Ryzen Threadripper 1920X 12-Core Processor
stepping	: 1
microcode	: 0x8001129
cpu MHz		: 2162.359
cache size	: 512 KB
physical id	: 0
siblings	: 24
core id		: 0
cpu cores	: 12
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid amd_dcm aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate sme ssbd sev vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca
bugs		: sysret_ss_attrs null_seg spectre_v1 spectre_v2 spec_store_bypass
bogomips	: 6986.00
TLB size	: 2560 4K pages
clflush size	: 64
cache_alignment	: 64
address sizes	: 43 bits physical, 48 bits virtual
power management: ts ttp tm hwpstate eff_freq_ro [13] [14]

processor	: 1
vendor_id	: AuthenticAMD
Topic starter Posted : 16/02/2020 10:16 pm
Member Admin

dmidecode is a tool for dumping a computer's DMI (some say SMBIOS ) table contents in a human-readable format. This table contains a description of the system's hardware components, as well as other useful pieces of information such as serial numbers and BIOS revision. Thanks to this table, you can retrieve this information without having to probe for the actual hardware. While this is a good point in terms of report speed and safeness, this also makes the presented information possibly unreliable.

Handle 0x0002, DMI type 2, 8 bytes. Base Board Information Manufacturer: Intel
Product Name: C440GX+
Version: 727281-001
Serial Number: INCY92700942

Topic starter Posted : 18/02/2020 7:03 pm
Member Admin

Memory(ram) Usage

The free command displays:

Total amount of free and used physical memory

Total amount of swap memory in the system

Buffers and caches used by the kernel

$ free -ht
              total        used        free      shared  buff/cache   available
Mem:            47G         10G         14G        495M         21G         35G
Swap:          2.0G          0B        2.0G
Total:          49G         10G         16G
Topic starter Posted : 28/03/2020 12:55 am
Member Admin

tcpdump is a most powerful and widely used command-line packets sniffer or package analyzer tool which is used to capture or filter TCP/IP packets that received or transferred over a network on a specific interface. It is available under most of the Linux/Unix based operating systems. tcpdump also gives us a option to save captured packets in a file for future analysis

**you must be root to run this command**

# tcpdump -i eth0

Topic starter Posted : 28/03/2020 1:27 am
Member Admin

iftop listens to network traffic on a named interface, or on the first interface it can find which looks like an external interface if none is specified, and displays a table of current bandwidth usage by pairs of hosts. iftop must be run with sufficient permissions to monitor all network traffic on the interface; see pcap(3) for more information, but on most systems this means that it must be run as root.

$ sudo iftop -
-b  -B  -c  -f  -F  -G  -h  -i  -l  -L  -m  -n  -N  -o  -p  -P  -s  -t 
Topic starter Posted : 28/03/2020 1:38 am