Pages

Unixbhaskar's Blog

Thursday, August 13, 2009

Dstat - All in one powerfull command to get system info

If you have a Linux server running at your office or at a data center for which you are responsible, you want to maintain an uptime of as close to a hundred percent. In such a case you want to make sure you keep an eye on how the system is running. To be precise you want to monitor all the system resources that contribute to the system running fine which then results in a high uptime. Memory, CPU, disk usage… are some of the things you want to observe. We would usually use a combination of the tools that come with a Linux or UNIX installation, such as “free”, “top”, “vmstat”, "iostat","mpstat"."df"… I’ll introduce you to a tool that gives you just about all the info that the other tools combined give you, all under one roof - Dstat. The developer of this command line tool, Dag Wieers, calls it “a versatile replacement for vmstat, iostat, netstat and ifstat”. He adds that “Dstat overcomes some of their limitations and adds some extra feature.

Installing Dstat

Start by downloading the Dstat installer. Point your web browser to the Dstat project’s homepage - http://dag.wieers.com/home-made/dstat/. Scroll down to the section of the page where the downloads are listed. Pick the flavor of Linux on which you want to install the application and click on the download link. Now download the latest version of Dstat for the version of the Linux distribution you are running. I’ll show you how to do it for a Red Hat Enterprise Linux version 4 machine:

# wget http://dag.wieers.com/rpm/packages/dstat/dstat-0.6.6-1.el4.rf.noarch.rpm

Now install Dstat:

# rpm -Uvh dstat-0.6.6-1.el4.rf.noarch.rpm

If the installation went though without errors, that’s it, you have Dstat installed and ready for use. If there were some dependencies that came up during the installation just install the required packages and try again. I don’t think that Dstat has too many dependencies, so you should not face any problems.


Using Dstat:

To run it from the command line ,simply fire ;

#dstat -afv

And the output will be like below
-------cpu0-usage--------------cpu1-usage------ --dsk/sda-- --net/ppp0- ---paging-- ---system-- ---procs--- ---paging-->
usr sys idl wai hiq siq:usr sys idl wai hiq siq| read writ| recv send| in out | int csw |run blk new| in out >
21 5 52 21 0 0: 11 2 84 3 0 0| 569k 414k| 0 0 | 811B 9263B| 953 2150 | 0 0 3| 811B 9263B>
8 0 92 0 0 0: 1 0 99 0 0 0| 0 664k| 0 0 | 0 640k| 534 605 | 1 0 0| 0 640k>
0 0 100 0 0 0: 1 0 99 0 0 0| 0 0 | 0 0 | 0 0 | 514 646 | 2 0 0| 0 0 >
0 0 100 0 0 0: 1 0 99 0 0 0| 0 84k| 0 0 | 0 0 | 502 593 | 2 0 0| 0 0 >
0 0 100 0 0 0: 1 0 99 0 0 0| 0 0 | 0 0 | 0 0 | 516 689 | 1 0 0| 0 0 >
5 0 95 0 0 0: 6 1 93 0 0 0| 0 4096B| 0 77B| 0 0 | 504 1047 | 1 0 4| 0 0 >
0 0 100 0 0 0: 2 1 97 0 0 0| 0 0 | 385B 404B| 0 0 | 554 1119 | 1 0 0| 0 0 >
0 0 100 0 0 0: 1 0 99 0 0 0| 0 0 | 40B 0 | 0 0 | 525 972 | 2 0 0| 0 0 >
0 0 100 0 0 0: 1 0 99 0 0 0| 0 16k|1675B 358B| 0 0 | 551 1041 | 2 0 0| 0 0 >
1 0 99 0 0 0: 1 0 99 0 0 0| 0 0 | 99B 829B| 0 0 | 520 1044 | 2 0 0| 0 0 >
2 0 97 1 0 0: 0 0 100 0 0 0| 0 92k| 535B 274B| 0 0 | 798 1462 | 0 0 0| 0 0 >
2 2 95 0 1 0: 1 0 99 0 0 0| 0 0 | 281B 352B| 0 0 | 959 1428 | 0 0 0| 0 0 >
0 0 100 0 0 0: 0 0 100 0 0 0| 0 0 |1667B 318B| 0 0 |1002 1397 | 0 0 0| 0 0 >
1 1 98 0 0 0: 0 0 100 0 0 0| 0 0 | 99B 893B| 0 0 | 699 1209 | 0 0 0| 0 0 >^C


And it will keeps on rolling on the terminal until you pres CTRL-C.It gives you beautiful color output on workstation and in the server you will get as usual black and white output.

I think a it's an command worth to have in your armory.

Bhaskar Chowdhury
Chat Google Talk: unixbhaskar Skype: unixbhaskar Y! messenger: unixbhaskar
Contact Me StumbleuponFacebookDiggTwitterLinkedinRedditWordpressTechnoratiBlogger

No comments:

Post a Comment