Saturday 29 September 2012

Monitoring Tools in rhel

Need to monitor Linux server performance? Try these built-in command 

top - Process Activity Command
 The top program provides a dynamic real-time view of a running system i.e. actual process activity. By default, it displays the most CPU-intensive tasks running on the server and updates the list every five seconds.
Commonly Used Hot Keys
The top command provides several useful hot keys:
Hot KeyUsage
tDisplays summary information off and on.
mDisplays memory information off and on.
ASorts the display by top consumers of various system resources. Useful for quick identification of performance-hungry tasks on a system.
fEnters an interactive configuration screen for top. Helpful for setting up top for a specific task.
oEnables you to interactively select the ordering within top.
rIssues renice command.
kIssues kill command.
zTurn on or off color/mono
vmstat - System Activity, Hardware and System Information

The command vmstat reports information about processes, memory, paging, block IO, traps, and cpu activity.

# vmstat 3

Display Memory Utilization Slabinfo

# vmstat -m

Get Information About Active / Inactive Memory Pages

# vmstat -a

w - Find Out Who Is Logged on And What They Are Doing

[root@station1 ~]# w root
 11:05:46 up 38 min,  3 users,  load average: 0.04, 0.11, 0.13
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     tty1     :0               10:28   38:23   1:37   1:37  /usr/bin/Xorg :
root     pts/0    :0.0             10:28   37:12   1.17s  0.00s sh reliance.sh
root     pts/3    :0.0             11:05    0.00s  0.02s  0.01s w root


uptime - Tell How Long The System Has Been Running

The uptime command can be used to see how long the server has been running. The current time, how long the system has been running, how many users are currently logged on, and the system load averages for the past 1, 5, and 15 minutes.

[root@station1 ~]# uptime
 11:06:36 up 39 min,  3 users,  load average: 0.02, 0.09, 0.12
  
1 can be considered as optimal load value. The load can change from system to system. For a single CPU system 1 - 3 and SMP systems 6-10 load value might be acceptable.

ps - Displays The Processes

ps command will report a snapshot of the current processes. To select all processes use the -A or -e option:

# ps -A

Print A Process Tree

# ps -ejH
# ps axjf
# pstree

See Every Process Running As User ranjith

# ps -U ranjith

Find Out The Top 10 Memory Consuming Process

# ps -auxf | sort -nr -k 4 | head -10

Find Out top 10 CPU Consuming Process

# ps -auxf | sort -nr -k 3 | head -10

free - Memory Usage
The command 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.

# free
  
iostat - Average CPU Load, Disk Activity
The command iostat report Central Processing Unit (CPU) statistics and input/output statistics for devices, partitions and network filesystems (NFS).
# iostat

tcpdump - Detailed Network Traffic Analysis

The tcpdump is simple command that dump traffic on a network. However, you need good understanding of TCP/IP protocol to utilize this tool. For.e.g to display traffic info about DNS, enter:

# tcpdump -i eth1 'udp port 53'

To display all HTTP session to 192.168.1.5:

# tcpdump -ni eth0 'dst 192.168.1.5 and tcp and port http'





No comments:

Post a Comment