How to use dstat to monitor your Linux/UNIX server كيفية استخدام dstat لرصد الخاص بك لينكس / يونيكس خادم

by Sukrit Dhandhania on November 13, 2008 من جانب Sukrit Dhandhania 13 تشرين الثاني / نوفمبر ، 2008

لينكس

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”… 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. ونحن عادة استخدام مجموعة من الأدوات التي تأتي مع لينكس او يونيكس التركيب ، مثل "الحرة" ، و "كبار" ، و "vmstat"... سوف أعرض لكم لأداة والتي تمنحك فقط عن كل معلومة أن الأدوات الأخرى مجتمعة أعطيكم ، جميع تحت سقف واحد -- Dstat. The developer of this command line tool, Dag Wieers, calls it “a versatile replacement for vmstat, iostat, netstat and ifstat”. المطور من هذا أداة سطر الأوامر ، داغ Wieers ، سمتها "تنوعا لاستبدال vmstat ، iostat ، netstat وifstat". He adds that “Dstat overcomes some of their limitations and adds some extra features…” To me Dstat is the mother of all command line system monitoring tools. ويضيف ان "يتغلب Dstat بعض من القيود ويضيف بعض السمات اضافية..." بالنسبة لي Dstat هي أم كل سطر الأوامر النظام أدوات الرصد. It’s simple to install, easy to use, can be tweaked with ease, and it generates reports that you can plot as a graph to impress your boss. انها سهلة التركيب ، وسهلة الاستخدام ، يمكن أنب مع سهولة ، وأنه يولد تقارير تفيد بأن مؤامرة كما يمكنك رسم بياني لإقناع رئيسك.

Installing Dstat تركيب Dstat

Start by downloading the Dstat installer. قبل بدء تنزيل Dstat المثبت. Point your web browser to the Dstat project’s homepage - نقطة على متصفح الشبكة لديك إلى مشروع Dstat الصفحة الرئيسية -- 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. الآن تحميل أحدث نسخة من Dstat لنسخة من توزيعات لينكس تقوم بتشغيلها. I’ll show you how to do it for a Red Hat Enterprise Linux version 4 machine: أنا سأريك كيف نفعل ذلك لريد هات لينوكس المؤسسة النسخة 4 آلة :

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

Now install Dstat: الآن تركيب Dstat :

# rpm -Uvh dstat-0.6.6-1.el4.rf.noarch.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. وإذا كان تركيب ذهب ، لكن دون أخطاء ، هذا كل شيء ، لديك Dstat تركيب وجاهزة للاستعمال. 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. لا اعتقد ان Dstat وقد كثيرة جدا من التبعية ، لذلك لا ينبغي أن تواجه أي مشاكل.

Using Dstat باستخدام Dstat

With Dstat installed on your system you should be good to go. مع Dstat تركيبها على جهازك يجب أن تكون جيدة للذهاب. Begin by launching the command from a terminal: تبدأ بشن القيادة من الصالة :

# dstat # dstat

The output would be something like the following. وسيكون الناتج شيء من هذا القبيل التالية. Hit the key combination of ctrl+c to exit. ضرب الرئيسية مزيج من ctrl + ج لخروج.

# dstat # dstat
—-total-cpu-usage—- -disk/total -net/total- —paging– —system– -- مجموع بين وحدة المعالجة المركزية الاستعمال -- -disk/total -net/total- بين الاستدعاء وبين النظم
usr sys idl wai hiq siq|_read write|_recv _send|__in_ _out_|_int_ _csw_ usr sys المختبر الدولي للألماس واي hiq siq | _read الكتابة | _recv _send | __in_ _out_ | _int_ _csw_
7 1 91 1 0 0| 0 0 | 0 0 | 0 0 | 0 0 7 1 91 1 0 0 | 0 0 | 0 0 | 0 0 | 0 0
1 0 99 0 0 0| 0 0 | 0 0 | 0 0 |1051 1945 1 0 99 0 0 0 | 0 0 | 0 0 | 0 0 | 1051 1945
0 0 100 0 0 0| 0 12k|2269B 11.2k| 0 0 |1031 1923 0 0 100 0 0 0 | 0 12k | 2269B 11.2k | 0 0 | 1031 1923
1 0 99 0 0 0| 0 40k| 0 0 | 0 0 |1078 2235 1 0 99 0 0 0 | 0 40k | 0 0 | 0 0 | 1078 2235
0 0 100 0 0 0| 0 16k|6027B 21.5k| 0 0 |1008 2219 0 0 100 0 0 0 | 0 16k | 6027B 21.5k | 0 0 | 1008 2219

There are a number of options available for Dstat. وهناك عدد من الخيارات المتاحة لDstat. As I mentioned earlier Dstat is quite easy to tweak. وكما ذكرت من قبل Dstat من السهل جدا القرص. So if you want to limit the data reading to the CPU, disk, and network, run the following command: حتى إذا كنت تريد للحد من قراءة البيانات إلى وحدة المعالجة المركزية ، القرص ، وشبكة ، تديرها قيادة التالية :

# dstat -CDN # dstat - كندي
-disk/total -net/total- —paging– —system– -disk/total -net/total- بين الاستدعاء وبين النظم
_read write|_recv _send|__in_ _out_|_int_ _csw_ _read الكتابة | _recv _send | __in_ _out_ | _int_ _csw_
0 0 | 0 0 | 0 0 | 0 0 0 0 | 0 0 | 0 0 | 0 0
0 12k|2295B 9603B| 0 0 |1053 1957 0 12k | 2295B 9603B | 0 0 | 1053 1957
0 0 | 594B 0 | 0 0 |1002 1893 0 0 | 594B 0 | 0 0 | 1002 1893
0 960k| 292B 3346B| 0 0 |1072 2012 0 960k | 292B 3346B | 0 0 | 1072 2012
0 4096B| 64B 0 | 0 0 |1031 1939 0 4096B | 64B 0 | 0 0 | 1031 1939

You can find more options in the application’s help document which you can access by entering the following: يمكنك العثور على مزيد من الخيارات في تطبيق مساعدة الوثيقة التي يمكنك الوصول عن طريق إدخال ما يلي :

# dstat -h # dstat - ح

Play with the options a little so you get comfortable with them. لعب مع الخيارات قليلا حتى تحصل على مريحة معهم. The default interval between data reads is two seconds. فإن تقصير الفترة الفاصلة بين البيانات ما يلي هو ثانيتين. You can change that interval if you need to. يمكنك أن تغير الفاصلة إذا كنت تحتاج ل. To increase the interval to ten seconds enter the following: لزيادة الفاصلة لعشر ثوان من دخول التالية :

# dstat 10 dstat # 10

Another useful feature is to get aggregated updates for each entry. ميزة أخرى مفيدة للحصول على تحديثات لتجميع كل دخول. So you can have Dstat give you an update every ten seconds in a new line, but as the data changes your line itself gets updated every second. هل يمكن أن يكون لها Dstat أعطيكم تحديث كل عشر ثوان في الخط الجديد ، ولكن البيانات الخاصة بك خط تغييرات تحصل على تحديث نفسها كل ثانية.

You might optionally want Dstat to give you five updates with a frequency of three seconds. هل يمكن اختياريا تريد Dstat الى ان نعطيكم خمس التحديثات مع تواتر من ثلاث ثوان. Here’s how you would go about doing that: إليك كيف لك أن تذهب عن القيام بما يلي :

# dstat 3 5 dstat # 3 5
—-total-cpu-usage—- -disk/total -net/total- —paging– —system– -- مجموع بين وحدة المعالجة المركزية الاستعمال -- -disk/total -net/total- بين الاستدعاء وبين النظم
usr sys idl wai hiq siq|_read write|_recv _send|__in_ _out_|_int_ _csw_ usr sys المختبر الدولي للألماس واي hiq siq | _read الكتابة | _recv _send | __in_ _out_ | _int_ _csw_
3 1 95 2 0 0| 0 0 | 0 0 | 0 0 | 0 0 3 1 95 2 0 0 | 0 0 | 0 0 | 0 0 | 0 0
2 11 87 1 0 0| 0 180k|2581B 3239B| 0 0 |1136 697 2 11 87 1 0 0 | 0 180k | 2581B 3239B | 0 0 | 1136 697
7 8 85 0 0 0| 0 0 | 115k 106k| 0 0 |1603 3985 7 8 85 0 0 0 | 0 0 | 115k 106k | 0 0 | 1603 3985
2 1 98 0 0 0| 0 0 |77.5k 170k| 0 0 |1744 3856 2 1 98 0 0 0 | 0 0 | 77.5k 170k | 0 0 | 1744 3856
1 0 100 0 0 0| 0 0 |3451B 9993B| 0 0 |1045 149 1 0 100 0 0 0 | 0 0 | 3451B 9993B | 0 0 | 1045 149
2 1 94 4 0 0| 0 276k|20.4k 31.1k| 0 0 |1219 804 2 1 94 4 0 0 | 0 276k | 20.4k 31.1k | 0 0 | 1219 804

The feature that I find most useful is the output. الميزة أن أجد مفيدا للغاية هو الناتج. Dstat allows you to have the output of a session written into a comma separated file which can later be imported into a spreadsheet application such as Microsoft Excel and the data can be plotted into a graph. Dstat يسمح لك أن يكون الناتج من دورة مكتوبة إلى فاصلة فصل ملف الذي يمكن أن يكون في وقت لاحق المستوردة إلى تطبيق جدول بيانات مثل مايكروسوفت اكسل والبيانات التي يمكن توقيعها في الرسم البياني. Here is how it can be used. هنا هو كيف يمكن استخدامها.

# dstat –output /tmp/dstat_data.csv -CDN # dstat المخرجات / tmp / dstat_data.csv - كندي

Let the above command run while you run your applications or do your testing on this machine. واسمحوا أعلاه قيادة البعيد في حين تشغيل التطبيقات الخاصة بك أو التي تتبعونها التجارب على هذه الآلة. Hit the key combination of ctrl+c when you are done. ضرب الرئيسية مزيج من ctrl + ج عند الانتهاء منها. Open the file dstat_data.csv with a spreadsheet application such as Microsoft Excel or Open Office. فتح ملف dstat_data.csv مع تطبيق جدول بيانات مثل مايكروسوفت إكسل أو المفتوحة للمكتب. You can then select the columns you want plotted into a graph and let your spreadsheet application do the magic. بعد ذلك يمكنك اختيار الأعمدة التي تريد تآمر إلى الرسم البياني واسمحوا تطبيق جدول البيانات الخاص بك أن تفعل السحر.

Get a Report by Mail احصل على تقرير عن طريق البريد

There may be cases wherein you want to observe how your server is performing over a period of time. قد تكون هناك حالات حيث تريد لمراقبة كيفية الخادم الخاص بك هو المنفذ على مدى فترة من الزمن. You can setup a background process in Linux that will give you a reading with a certain interval, generate a report, and mail out the file to you. يمكنك إعداد معلومات أساسية لينكس في عملية من شأنها أن أعطيك القراءة مع بعض الفاصلة ، تولد التقرير ، والبريد خارج الملف لكم. This can be especially useful during a stress-test. وهذا يمكن أن يكون مفيدا بشكل خاص خلال التأكيد على التجارب. Here’s how you could do that. إليك كيف يمكن القيام بذلك. The following script will run Dstat for three hours, reading the data every 30 seconds, and will mail out the report to me@myemailid.com. النص التالي Dstat سيستمر لمدة ثلاث ساعات ، قراءة البيانات كل 30 ثانية ، وسوف البريد خارج التقرير إلى me@myemailid.com.

#!/bin/bash #! / بن / سحق
dstat –output /tmp/dstat_data_mail.csv -CDN 30 360 dstat المخرجات / tmp / dstat_data_mail.csv كندي 30 - 360
mutt -a /tmp/dstat_data_mail.csv -s “Dstat Report for 3 hour run” me@myemailid.com < /dev/null كلب مهجن بين أ / tmp / dstat_data_mail.csv - ق "Dstat تقرير ل3 ساعة البعيد" me@myemailid.com </ ديف / لاغية

Save the above script in a file called dstat_script.sh on your server, give it executable permission and then run it as a background process: إنقاذ السيناريو أعلاه في ملف ودعا dstat_script.sh على الخادم الخاص بك ، إعطاء إذن للتنفيذ عليه بعد ذلك ويحوله إلى خلفية عملية :

# chmod +x dstat_script.sh # chmod + س dstat_script.sh
# nohup ./dstat_script.sh & # nohup. / dstat_script.sh &

Done. فعل. Yes, it’s that simple. نعم ، ان الامر بسيط. You will now be mailed this report after it’s done running. أنت الآن بالبريد هذا التقرير بعد ان عمله الحالي. You can optionally schedule this script as a daily cron job so that you can receive this data every day. يمكنك اختياريا الجدول الزمني لهذا النص بوصفه وظيفة كرون يوميا بحيث يمكنك الحصول على هذه البيانات كل يوم.

As you may already have realized Dstat is a wonderful tool when applied to performance monitoring and debugging. وكما كنت قد أدركت بالفعل Dstat هو رائع عندما يطبق أداة لرصد الأداء وتصحيح الأخطاء. The granularity, frequency, and nature of the data collected are completely up to you. وقد الحبوبية ، وتواتر ، وطبيعة البيانات التي يتم جمعها تماما حتى لكم. Dstat empowers you to know what is going on on your server. Dstat يخول لكم لمعرفة ما يجري على الخادم الخاص بك. Used wisely this power can result in a lot less sleepless nights for you. الحكمة في استخدام هذه السلطة يمكن أن يؤدي في الكثير من الليالى بلا نوم لأقل لكم.

Related Posts: الوظائف ذات الصلة :
  • How to monitor your Mac laptop’s battery health كيفية رصد الخاص بك ماك المحمولة بطارية الصحة
  • How to share a keyboard and mouse with multiple computers كيف تشترك في لوحة المفاتيح والفأرة مع الحواسيب المتعددة
  • How to monitor your Internet bandwidth usage in OS X كيفية مراقبة استخدام عرض النطاق الترددي الخاص بك على الإنترنت في نظام التشغيل العاشر
  • 5 More OS X Dashbooard Widgets for Bloggers 5 نظام التشغيل العاشر Dashbooard المزيد من القطع لالمدونين
  • How to monitor your Internet bandwidth usage in OS X, redux كيفية مراقبة استخدام عرض النطاق الترددي الخاص بك على الإنترنت في نظام التشغيل العاشر ، مسترجع
  • Get Simple Help tutorials just like this one in your email inbox every day - for free! الحصول على مساعدة بسيطة مثل هذه الدروس واحد في صندوق الوارد في بريدك الإلكتروني كل يوم -- لالحرة! Just enter your email address below: فقط أدخل عنوان البريد الإلكتروني الخاص بك أدناه :

    You can always opt out of this email subscription at any time. يمكنك دائما أن تختار الانسحاب من الاشتراك في هذا البريد الإلكتروني في أي وقت.


    Bookmark and Share المرجعية والاسهم

    { 0 comments… (0 التعليقات... add one now إضافة واحد الآن } )

    Leave a Comment ترك التعليق

    You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> يمكنك استخدام هذه العلامات والصفات هتمل : <ahref="" title=""> <abbrtitle=""> <acronymtitle=""> <b><blockquotecite=""> <cite><code> <deldatetime=""> <em><i><qcite=""> <strike><strong>