How to use dstat to monitor your Linux/UNIX server So verwenden Sie dstat zur Überwachung Ihrer Linux / UNIX-Server

by Sukrit Dhandhania on November 13, 2008 von Sukrit Dhandhania am 13 November, 2008

Linux

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. Wenn Sie ein Linux-Server laufen in Ihrem Büro oder in einem Data Center, für die Sie verantwortlich sind, Sie wollen ein Verfügbarkeit von so nahe wie möglich an ein hundert Prozent. In such a case you want to make sure you keep an eye on how the system is running. In einem solchen Fall, dass Sie wollen, um sicherzustellen, dass Sie im Auge behalten, wie das System in Betrieb ist. 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. Um genau zu sein den Sie überwachen möchten das System alle Ressourcen, die dazu beitragen, das System läuft Geldbuße, die Ergebnisse dann in einer hohen Verfügbarkeit. Memory, CPU, disk usage… are some of the things you want to observe. Speicher, CPU, Festplatte Nutzung ... sind einige der Dinge, die Sie beobachten wollen. 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. Wir würden in der Regel eine Kombination der Werkzeuge, die mit einem Linux-oder UNIX-Installation, wie z. B. "frei", "top", "vmstat" ... Ich werde Ihnen ein Werkzeug, das Ihnen nur über alle Informationen, dass die anderen Werkzeugen kombiniert Ihnen, alle unter einem Dach - Dstat. The developer of this command line tool, Dag Wieers, calls it “a versatile replacement for vmstat, iostat, netstat and ifstat”. Die Entwickler von diesem Kommandozeilen-Tool, Dag Wieers, nennt es "ein vielseitiges Ersatz für vmstat, iostat, netstat und 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. Er fügt hinzu, dass "Dstat überwindet einige ihrer Grenzen und fügt einige zusätzliche Features ..." Für mich Dstat ist die Mutter aller Befehlszeile System-Monitoring-Tools. 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. Es ist einfach zu installieren, einfach zu verwenden, kann gezwickt mit Leichtigkeit, und es generiert Berichte, die Sie Plot als Grafik zu beeindrucken Ihren Chef.

Installing Dstat Installieren Dstat

Start by downloading the Dstat installer. Starten Sie, indem Sie die Dstat Installer. Point your web browser to the Dstat project’s homepage - Können Sie mit Ihrem Web-Browser auf die Dstat Projekt-Homepage -- http://dag.wieers.com/home-made/dstat/ . Scroll down to the section of the page where the downloads are listed. Scrollen Sie zum Abschnitt der Seite, wo die Downloads werden aufgelistet. Pick the flavor of Linux on which you want to install the application and click on the download link. Wählen Sie die Variante des Linux, auf dem Sie installieren möchten, die Anwendung und klicken Sie auf den Download-Link. Now download the latest version of Dstat for the version of the Linux distribution you are running. Jetzt laden Sie die neueste Version von Dstat für die Version des Linux-Distribution Sie ausgeführt werden. I’ll show you how to do it for a Red Hat Enterprise Linux version 4 machine: Ich zeige Ihnen, wie Sie es für eine Red Hat Enterprise Linux Version 4 Maschine:

# 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: Jetzt installieren Dstat:

# rpm -Uvh dstat-0.6.6-1.el4.rf.noarch.rpm # 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. Wenn die Installation verlief ohne Fehler, das war's, Sie haben Dstat installiert und bereit für den Einsatz. If there were some dependencies that came up during the installation just install the required packages and try again. Wenn es einige Abhängigkeiten, die die während der Installation installieren Sie einfach die benötigten Pakete und versuchen Sie es erneut. I don’t think that Dstat has too many dependencies, so you should not face any problems. Ich glaube nicht, dass Dstat hat zu viele Abhängigkeiten, so sollten Sie sich nicht alle Probleme.

Using Dstat Mit Dstat

With Dstat installed on your system you should be good to go. Mit Dstat auf Ihrem System installiert sollten Sie gut zu gehen. Begin by launching the command from a terminal: Beginn der Einführung der Befehl von einem Terminal aus:

# dstat # Dstat

The output would be something like the following. Der Ausgang wäre so etwas wie die folgenden. Hit the key combination of ctrl+c to exit. Drücken Sie die Tastenkombination von Strg + C um das Menü zu verlassen.

# dstat # Dstat
—-total-cpu-usage—- -disk/total -net/total- —paging– —system– - Total-CPU-Nutzung - -disk/total -net/total--Paging-System -
usr sys idl wai hiq siq|_read write|_recv _send|__in_ _out_|_int_ _csw_ usr sys IDL wai HIQ SIQ | _read schreiben | _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. Es gibt eine Reihe von Optionen zur Verfügung Dstat. As I mentioned earlier Dstat is quite easy to tweak. Wie ich bereits erwähnt Dstat ist recht leicht zu zwicken. So if you want to limit the data reading to the CPU, disk, and network, run the following command: Wenn Sie also wollen, um die Daten Lesung auf die CPU, Festplatte und Netzwerk, führen Sie den folgenden Befehl ein:

# dstat -CDN # Dstat-EUR
-disk/total -net/total- —paging– —system– -disk/total -net/total--Paging-System -
_read write|_recv _send|__in_ _out_|_int_ _csw_ _read schreiben | _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: Hier finden Sie weitere Optionen in der Anwendung helfen Dokument, das Sie zugreifen können, indem Sie die folgenden Schritte aus:

# dstat -h # Dstat-h

Play with the options a little so you get comfortable with them. Spielen Sie mit den Optionen ein wenig, so dass Sie sich bequem mit ihnen. The default interval between data reads is two seconds. Die Standard-Intervall zwischen den Daten liest ist zwei Sekunden. You can change that interval if you need to. Du kannst das ändern, Intervall, falls nötig. To increase the interval to ten seconds enter the following: So erhöhen Sie das Intervall auf zehn Sekunden geben Sie die folgenden Schritte aus:

# dstat 10 # Dstat 10

Another useful feature is to get aggregated updates for each entry. Eine andere nützliche Eigenschaft ist, um aggregierte Updates für jeden Eintrag. 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. So können Sie Dstat geben Sie eine Aktualisierung alle zehn Sekunden in eine neue Zeile, aber da die Daten Änderungen Ihrer Linie selbst wird jede Sekunde aktualisiert.

You might optionally want Dstat to give you five updates with a frequency of three seconds. Sie können optional wollen Dstat Ihnen fünf Updates mit einer Frequenz von drei Sekunden. Here’s how you would go about doing that: Hier ist, wie geht man etwa tun, dass:

# dstat 3 5 # Dstat 3 5
—-total-cpu-usage—- -disk/total -net/total- —paging– —system– - Total-CPU-Nutzung - -disk/total -net/total--Paging-System -
usr sys idl wai hiq siq|_read write|_recv _send|__in_ _out_|_int_ _csw_ usr sys IDL wai HIQ SIQ | _read schreiben | _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. Die Funktion, dass ich am nützlichsten ist die Ausgabe. 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 ermöglicht es Ihnen, haben die Ausgabe von einer Sitzung in ein Komma separierte Datei, die später bei der Einfuhr in ein Tabellenkalkulationsprogramm wie Microsoft Excel und die Daten können in Kurvenform in ein Diagramm. Here is how it can be used. Hier ist, wie es verwendet werden kann.

# dstat –output /tmp/dstat_data.csv -CDN # Dstat-Output / tmp / dstat_data.csv-EUR

Let the above command run while you run your applications or do your testing on this machine. Lassen Sie den oben genannten Befehl ausführen, während Sie Ihre Anwendungen oder Ihre Tests auf dieser Maschine. Hit the key combination of ctrl+c when you are done. Drücken Sie die Tastenkombination von Strg + C, wenn Sie fertig sind. Open the file dstat_data.csv with a spreadsheet application such as Microsoft Excel or Open Office. Öffnen Sie die Datei dstat_data.csv mit einem Tabellenkalkulationsprogramm wie Microsoft Excel oder Open Office. You can then select the columns you want plotted into a graph and let your spreadsheet application do the magic. Sie können dann wählen Sie die Spalten, die Sie wollen Abhängigkeit in eine Grafik und lassen Sie Ihre Tabellenkalkulation tun, die Magie.

Get a Report by Mail Holen Sie sich ein Bericht von E-Mail

There may be cases wherein you want to observe how your server is performing over a period of time. Es kann Fälle geben, in dem Sie wollen beobachten, wie Ihr Server führt über einen bestimmten Zeitraum. 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. Sie können einen Hintergrund-Prozess in Linux, das Ihnen eine Lesung mit einem bestimmten Intervall, Erstellen eines Berichts und E-Mail die Datei auf Sie. This can be especially useful during a stress-test. Dies kann besonders nützlich während einer Stress-Test. Here’s how you could do that. Hier ist, wie Sie tun können, dass. 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. Das folgende Skript läuft Dstat für drei Stunden, das Lesen der Daten alle 30 Sekunden ein, und E-Mail wird aus dem Bericht zu me@myemailid.com.

#!/bin/bash #! / bin / bash
dstat –output /tmp/dstat_data_mail.csv -CDN 30 360 dstat-Output / tmp / dstat_data_mail.csv-EUR 30 360
mutt -a /tmp/dstat_data_mail.csv -s “Dstat Report for 3 hour run” me@myemailid.com < /dev/null mutt-a / tmp / dstat_data_mail.csv-s "Dstat Bericht für 3 Stunden laufen" me@myemailid.com </ dev / null

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: Speichern Sie das Skript in eine Datei mit dem Namen dstat_script.sh auf Ihrem Server, geben Sie es ausführbar Erlaubnis und führen Sie es als Hintergrund-Prozess:

# chmod +x dstat_script.sh # Chmod + x dstat_script.sh
# nohup ./dstat_script.sh & # Nohup. / Dstat_script.sh &

Done. Getan. Yes, it’s that simple. Ja, es ist so einfach. You will now be mailed this report after it’s done running. Sie werden nun per E-Mail diesen Bericht, nachdem es lang geht, läuft. You can optionally schedule this script as a daily cron job so that you can receive this data every day. Sie können optional Zeitplan dieses Skript als Cron-Job täglich, so dass Sie erhalten diese Daten jeden Tag.

As you may already have realized Dstat is a wonderful tool when applied to performance monitoring and debugging. Wie Sie vielleicht bereits realisiert Dstat ist ein wunderbares Werkzeug, wenn es sich um Performance-Überwachung und Fehlersuche. The granularity, frequency, and nature of the data collected are completely up to you. Die Granularität, Häufigkeit und Art der gesammelten Daten sind vollständig bei Ihnen. Dstat empowers you to know what is going on on your server. Dstat ermächtigt dass Sie wissen, was los ist auf Ihrem Server. Used wisely this power can result in a lot less sleepless nights for you. Gebraucht klug dieser Macht kann dazu führen, dass viel weniger schlaflose Nächte für Sie.

Related Posts: Verwandte Einträge:
  • How to monitor your Mac laptop’s battery health Wie zu überwachen Ihren Mac Laptop-Batterie Gesundheit
  • How to share a keyboard and mouse with multiple computers Wie gibt man eine Tastatur und Maus mit mehreren Computern
  • How to monitor your Internet bandwidth usage in OS X Wie zur Überwachung der Bandbreite Ihrer Internet-Nutzung in OS X
  • 5 More OS X Dashbooard Widgets for Bloggers 5 Weitere OS X Dashbooard Widgets für Blogger
  • How to monitor your Internet bandwidth usage in OS X, redux Wie zur Überwachung der Bandbreite Ihrer Internet-Nutzung in OS X, Redux
  • Get Simple Help tutorials just like this one in your email inbox every day - for free! Holen Sie sich Einfache Hilfe Tutorials wie diese ein in Ihrem E-Mail-Posteingang jeden Tag - gratis! Just enter your email address below: Geben Sie einfach Ihre E-Mail-Adresse unten ein:

    You can always opt out of this email subscription at any time. Sie können immer Opt-out in dieser E-Mail-Abonnement zu jeder Zeit.


    Bookmark and Share Lesezeichen und Aktie

    { 0 comments… (0 Kommentare ... add one now Add jetzt ein } )

    Leave a Comment Schreibe einen Kommentar

    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> Sie können diese HTML-Tags und Attribute: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>