[Linux]System Monitoring tools
Linux possess a variety of commands allowing you to monitor the different processes of your system and return information about thier status. The analysis of this information you to take the necessary actions based upon your requirements.
The uptime command
The uptime command gives up-to-date information:
- Since when the system is functional
- The number of users connected
- Average system load for first , 5 and last 15, minutes
#uptime
10:21:06 up 5 days, 19:11, 2 users, load average: 0.08, 0.03, 0.00
The top command
Provides a dynamic real-time view system. The command displays overall view of the system and the list of tasks managed by the kernel.
#top
top - 10:21:48 up 5 days, 19:11, 2 users, load average: 0.04, 0.03, 0.00
Tasks: 73 total, 2 running, 71 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0% us, 0.0% sy, 0.0% ni, 100.0% id, 0.0% wa, 0.0% hi, 0.0% si
Mem: 3632736k total, 1049496k used, 2583240k free, 359636k buffers
Swap: 1991920k total, 0k used, 1991920k free, 255052k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
28566 user 16 0 2196 1088 856 R 0.3 0.0 0:00.02 top
1 root 16 0 1564 532 464 S 0.0 0.0 0:01.21 init
The free command
The free command displays the data on memory usage. Note that the output of this command is static, in order to have a dynamic output of the memory usage it is possible to add the watch command:
#watch –n 1 –d free
Every 1,0s: free Wed Sep 23 10:22:47 2009
totalusedfree shared buffers cached
Mem:3632736 1049556 2583180 0 359644 255072
-/+ buffers/cache: 434840 3197896
Swap:1991920 0 1991920
The
-n stands for the time of refreshment and to highlight the evolution of snapshots.
vmstat
vmstat: displays reports on the use of virtual memory-related kernel threads, disk,and CPU activity.
#vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa
1 0 0 2583032 359664 255088 0 0 1 14 63 22 1 0 99 0
iostat
i
ostat: displays statistical reports of reading/writing activities of devices
#iostat
Linux 2.6.15-23-386 (owlt02.owliancet.local) 23.09.2009
avg-cpu: %user %nice %system %iowait %steal %idle
0,53 0,03 0,04 0,07 0,00 99,33
Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 1,53 1,21 28,79 604661 14429814