Linux Unix help !!

"Give respect to Time, One day at right Time, Time will respect You"

Wednesday, September 1, 2010

How to monitor server load on GNU/Linux


How to monitor server load on GNU/Linux
========================================

Gkrellm
==========
Gkrellm is the choice of the “g33k” types. It’s a graphical program that monitors all

sorts of statistics and displays them as numbers and charts. You can see examples of it

in use on nearly every GNU/Linux screenshot website. It is very flexible and capable,

and can monitor useful as well as ridiculous things via plugins. It can monitor the

status of a remote system, since it’s a client/server system.


“Task Manager” clones
=====================
gnome-system-monitor is a graphical program installed as part of the base Gnome system.

It is somewhat similar to the Task Manager in Microsoft Windows. It isn’t very

full-featured, with only three tabs (Processes, Resources, Devices). The Devices tab

just shows devices, Resources shows the history of CPU, memory, swap and network usage,

and the Processes tab shows the processes. The Processes tab is the only one that really

lets the user “do” anything, such as killing or re-nicing processes, or showing their

memory maps.

Of course, this tool is only available on systems with Gnome installed, and requires an

X server to be running. This makes it impractical for use on a server.

vmstat and related tools
=========================
vmstat is part of the base installation on most GNU/Linux systems. By default, it

displays information about virtual memory, CPU usage, I/O, processes, and swap, and can

print information about disks and more. It runs in a console. I find the command vmstat

-n 5 very helpful for printing a running status display in a tabular format.

It’s great for figuring out how heavily loaded a system truly is, and what the problem

(if any) is. For example, when I see a high number in the rightmost column (percent of

CPU time spent waiting for I/O) on a database server, I know the system is I/O-bound.

iostat
======
iostat is part of the sysstat package on Gentoo, as are mpstat and sar. iostat prints

similar statistics as vmstat, but gives more detail on specific devices and is geared

toward understanding I/O usage in more detail than vmstat is. mpstat is a similar tool

that prints processor statistics, and is multi-processor aware. sar collects, reports,

and saves system activity information (for example, for later analysis).

sysreport : A detail info about your system hw setup etc.. (Take a min to completed)
will create a bzip2 compressed file with all curretn deatil about ypur system

=========

All of these tools are very flexible and customizable. The user can choose what

information to see and what format to see it in. These tools are not usually installed

by default, except for vmstat.

top
======
top is the classic tool for monitoring any UNIX-like system. It runs in a terminal and

refreshes at intervals, displaying a list of processes in a tabular format. Each column

is something like virtual memory size, processor usage, and so forth. It is highly

customizable and has some interactive features, such as re-nicing or killing processes.

Since it’s the most widely known of the tools in this article, I won’t go into much

detail, other than to say there’s a lot to know about it — read the man page.

top is one of the programs in the procps package, along with:

ps, vmstat, w, kill, free, slabtop, and skill.

All these tools are in a default installation on most distributions.

htop
=====
is similar to top, except it is mouse-aware, has a color display, and displays little

charts to help see statistics at a glance. It also has some features top doesn’t have.

mytop :is a handy monitor for MySQL servers
======

tload
=========
tload runs in a terminal and displays a text-only “graph” of current system load

averages, garnered from /proc/loadavg. It is part of the base installation on most

GNU/Linux systems. I find it extremely useful for watching a system’s performance over

SSH, often within a GNU Screen session.

My favorite technique is to start a terminal, connect over SSH, resize the terminal to

150×80 or so, then start tload and shrink the window by CTRL-right-clicking and

selecting “Unreadable” as the font size. The result looks like the following:

watch
=========
watch isn’t really a load-monitoring tool, but it’s beastly handy because it takes any

command as input and monitors the result of running that command. For example, if I

wanted to monitor when the “foozle” program is executing, I could run


watch --interval=5 "ps aux | grep foozle | grep -v xaprb"

=========
running tload over SSH to monitor systems, and use vmstat, iostat and friends to

troubleshoot specific problems
========

lsof
=====
which lists open files. Don’t be fooled by how simple that sounds! It’s tremendously

powerful.

uptime
=======
System load averages is the average number of processes that are either in a runnable or

uninterruptable state. A process in a runnable state
is either using the CPU or waiting to use the CPU


How to create system report:
======================
# sysreport
<-- press Enter
Please enter your first initial and last name [server]: shirish
please neter case number that you are generating this report for: 1
<-- press Enter
now wait for few minutes it will create a biz2 compressed file in /tmp/sysreport-shirish.1-3-----.bz2
copy it and sent where yor require this file conatin all your sytem info capturede from /proc kernel...

---> Bow on some version it has been replace by command # sosreport but working is alomost same

# sosreport
==========
Display Memory status:
# free <--memory status on system
# free -t <--Total amt of memory available in system
# free -m <-- Display Memory used and free memory in MB

Disply information:
# dmidecode --type bios <--retrive bios info
# dmidecode --type system <--system hw info
# dmidecode --type processor <-- sys processor info
# dmidecode --type memory <--sys memory info
# dmidecode --type cache <--sys cahce info
# dmidecode -- connector <-- sys connector info
# dmidecode --type slot <--sys slots info

4 comments:

  1. Shirish thanks a lot for this interview question
    I wnat to know something about tools used to do so
    -Gyan

    ReplyDelete
  2. lage raho bhai

    ReplyDelete
  3. For "Watch" command:

    watch --interval=5 "ps aux | grep foozle | grep -v xaprb"

    I use this one: for Changes with Highlighted:

    watch -n1 --difference "ps aux | grep foozle | grep -v xaprb"

    ReplyDelete

Write Here .. your comments are always wellcome ..but no spam please !!

Followers

Pls LIKE my Story !!!