Dstat monitoring tool in Linux

Source: Internet
Author: User
Dstat is a versatile product that can replace vmstat, iostat, netstat, and ifstat commands. Dstat overcomes the limitations of these commands and adds some additional features, adds metrics, and becomes more flexible. Dstat can be used to conveniently monitor the system running status and label: Linux tool monitoring tool Linux Terminal

Dstat is a versatile product that can replace vmstat, iostat, netstat, and ifstat commands. Dstat overcomes the limitations of these commands and adds some additional features, adds metrics, and becomes more flexible. Dstat can easily monitor the system running status and be used for benchmarking and troubleshooting.

Dstat allows you to view all system resources in real time. for example, you can compare disk utilization by counting the current status of the IDE controller, or compare the disk throughput rate (within the same interval) by using the network bandwidth value ).

Dstat provides you with option information in the form of a list and clearly shows you the output range and unit. This avoids information confusion and false positives. More importantly, it makes it easier for you to write plug-ins to collect the data information you want and scale it out in a way that has never been used before.

Dstat's default output is designed for real-time viewing. However, you can also output the detailed information to a file through CSV and import it to Gnumeric or Excel to generate a table.

Features

  • Combined with vmstat, iostat, ifstat, netstat, and more information
  • Real-time display of statistics
  • You can enable and sort metrics during analysis and troubleshooting
  • Modular design
  • It is written in python to facilitate the expansion of existing jobs.
  • It is easy to expand and add your counters (please contribute)
  • The many extensions fully demonstrate the convenience of adding new monitoring projects.
  • Block Devices/network devices can be grouped and the total number is displayed.
  • Displays the current status of each device.
  • Extremely accurate time accuracy, even if the system load is high, it will not delay the display
  • Display accurate unit and limit conversion error range
  • Display different units in different colors
  • Show intermediate result delay less than 1 second
  • CSV reports can be output and imported to Gnumeric and Excel to generate images.

Installation method

Ubuntu/Mint and Debin systems:

The local software library has related installation packages. you can run the following command to install them:

 
 
  1. # sudo apt-get install dstat 

RHEL/Centos and Fedora systems:

You can add the relevant installation package in the romforge software library. For more information, run the following command to install the package:

 
 
  1. # yum install dstat

ArchLinux:

You can use this command to install related software packages in the Community Resource Library:

 
 
  1. # pacman -S dstat

Usage

The basic usage of dstat is to input the dstat command, and the output is as follows:

This is the information displayed by default output:

CPU status: CPU usage. The more interesting part of this report is that it shows the user, system, and idle part, which better analyzes the current CPU usage. If you see that the CPU status in the "wait" column is a high usage value, it indicates that the system has some other problems. When the CPU status is "waits", it is because it is waiting for the response of the I/O device (such as memory, disk, or network) and has not yet received.

Disk statistics: disk read/write operations. this column displays the total number of read and write operations on the disk.

Network statistics: the data sent and received by network devices. The total number of network receiving and sending data is displayed in this column.

Paging statistics: system paging activities. Paging refers to a memory management technology used to find system scenarios. a large paging indicates that the system is using a large amount of swap space, or the memory is very scattered, in most cases, you want to see that the value of page in and page out is 0.

System Statistics: This item shows the interrupt (int) and context switch (csw ). This statistic is meaningful only when compared baselines exist. The high statistical value in this column usually indicates that a large number of processes cause congestion and the CPU needs to be concerned. Generally, your server runs some programs, so this always displays some numerical values.

By default, dstat refreshes data every second. If you want to exit dstat, you can press the "CTRL-C" key.

Note that the first line of the report is usually not displayed in all statistics here.

This is because dstat will give a summary through the previous report, so there is no average and total value related data at the first runtime.

However, dstat can control the report interval and number by passing two parameters. For example, if you want dstat to output the default monitoring and report output interval of 3 seconds and 10 results in the report, you can run the following command:

 
 
  1. dstat 3 10

There are many optional parameters in the dstat command. you can view them using the man dstat command. most common parameters include:

  • -L: displays the load statistics.
  • -M: displays memory usage (including used, buffer, cache, and free values)
  • -R: displays I/O statistics.
  • -S: displays swap partition usage
  • -T: display the current time in the first line
  • -Fs: displays statistics on the file system, including the total number of files and inodes)
  • -Nocolor: do not display colors (sometimes useful)
  • -Socket: Displays network statistics
  • -Tcp: displays common TCP statistics.
  • -Udp: displays the listener's UDP interface and some dynamic data of its current usage.

Of course, more than this usage, dstat comes with some plug-ins that greatly expand its functionality. You can view some of their usage methods by viewing the/usr/share/dstat Directory. These are commonly used:

  • -- Disk-util: displays the busy status of the disk at a time.
  • -- Freespace: displays the current disk space usage.
  • -- Proc-count: displays the number of running programs.
  • -- Top-bio: indicates the largest process of block I/O.
  • -- Top-cpu: displays the process with the largest CPU usage graphically.
  • -- Top-io: displays the process with the largest normal I/O
  • -- Top-mem: displays the processes that occupy the most memory.

For example:

Check who is using all the memory:

 
 
  1. dstat -g -l -m -s --top-mem

Displays some CPU resource consumption data:

 
 
  1. dstat -c -y -l --proc-count --top-cpu

How to output a csv file

To output a csv file for later use, run the following command:

 
 
  1. # dstat –output /tmp/sampleoutput.csv -cdn
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.