Linux Network Command (ix) dstat

Source: Internet
Author: User
Tags time interval cpu usage

First, Dstat use

1. Introduction

Dstat is a versatile product that can replace Vmstat,iostat,netstat and Ifstat commands. Dstat overcomes the limitations of these commands and adds additional functionality, increasing the number of monitoring items and becoming more flexible. The dstat can easily monitor system health and be used for benchmarking and troubleshooting.

Dstat allows you to see all of your system resources in real time, for example, by counting the current state of the IDE controller to compare disk utilization, or by comparing the throughput rate of the disk (at the same time interval) directly over the network bandwidth value.

Dstat will give you the option information in the form of a list and clearly tell you what the amplitude and unit display output is. This avoids information confusion and false positives better. More importantly, it makes it easier for you to write plug-ins to collect the data you want and expand it in ways you never had before.

The default output of Dstat is designed for people to view in real time, but you can also export details to a file via CSV and import it into a gnumeric or Excel generated table.


2. Characteristics

  • Combined with vmstat,iostat,ifstat,netstat and more information

  • Real-time display of statistics

  • When analyzing and troubleshooting, you can sort by enabling monitoring items

  • Modular design

  • Written in Python for easier extension of existing work tasks

  • Easily expand and add your counters (please contribute to this)

  • Many of the extensions that are included fully illustrate the convenience of adding new monitoring items

  • Statistics block devices/network devices can be grouped and the total number given

  • can display the current status of each device

  • Extremely accurate time accuracy, even if the system load is high, will not delay the display

  • Display accurate unit and limit conversion error ranges

  • Display different units in different colors

  • Show intermediate result delay less than 1 seconds

  • Supports output of CSV format reports and can be imported into Gnumeric and Excel to generate graphs


3. Installation and use

[email protected] ~]# Yum install-y dstat

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

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7A/48/wKiom1am5ljS5EaeAAAjfd60rAc162.png "title=" 1.png " alt= "Wkiom1am5ljs5eaeaaajfd60rac162.png"/>

This is the information that the default output displays:

    • CPU Status: CPU usage. The more interesting part of the report is the display of the user, the system, and the idle part, which better analyzes the current state of CPU usage. If you see the "Wait" column, the state of the CPU is a high usage value, which indicates that there are some other problems with the system. When the state of the CPU is "waits", it is because it is waiting for a response from the I/O device (such as memory, disk, or network) and has not yet received it. HiQ, Siq, respectively, are hard interrupts and the number of soft interrupts.

    • disk statistics: disk read and write operations, this column shows the total number of reads and writes for the disk.  

    • network statistics: Data sent and received by network devices, This column shows the total number of data received and sent by the network.  

    • paging statistics: Paging activity of the system. Paging refers to a memory management technique used to find a system scenario, a large paging indicates that the system is using a large amount of swap space, or that the memory is very fragmented, and in most cases you want to see the value of page in (swapped in) and page out (swapped out) to 0 0.  

By default, Dstat refreshes the data every second. If you want to exit Dstat, you can press the "Ctrl-c" key.


It is important to note that the first line of the report, usually all the statistics here do not show the value.  This is because Dstat will give a summary through the last report, so the first run time is the data with no mean and total value.

However, Dstat can control the reporting interval and the number of reports by passing 2 parameters to run. For example, if you want to Dstat output default monitoring, the report output is 2 seconds apart, and the report outputs 3 results, you can run the following command:

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/7A/48/wKioL1am5r3TfcGcAAAg4we5SmM267.png "title=" 2.png " alt= "Wkiol1am5r3tfcgcaaag4we5smm267.png"/>


4. Common parameters

  • -L: Display load statistics

  • -M: Show memory utilization (including Used,buffer,cache,free value)

  • -R: Show I/O statistics

  • -S: Show swap partition usage

  • -T: Displays the current time in the first row

  • –FS: Displays file system statistics (including total number of files and inodes values)

  • –nocolor: Color not displayed (sometimes useful)

  • --socket: Displaying network statistics

  • --TCP: Displaying commonly used TCP statistics

  • --UDP: Displays some dynamic data for the monitored UDP interface and its current usage

  • -C: Displays information such as CPU system occupancy, user occupancy, idle, waiting, interruption, software interruption, etc.

  • -C: When there are multiple CPUs, this parameter can display the CPU status on demand, for example:-C 0,1 is the information that displays cpu0 and CPU1.

  • -D: Displays the disk read and write data size.

  • -D hda,total:include hda and total.

  • -N: Displays the network status.

  • -N eth1,total: Specifies the network card to display when there are multiple NICs.

  • -G: Displays the usage of the page.

  • -P: Displays the status of the process.

  • -S: similar to d/n.

  • -Y: System state.

  • --IPC: Displays information such as IPC Message Queuing, signals, etc.

  • -A: This is the default option, equivalent to-cdngy.

  • -V: equivalent to-pmgdsc-d total.

  • --output files: This option is also useful for redirecting status information to the specified file in CSV format for later viewing. Example: Dstat--output/root/dstat.csv & Now let the program silently run in the background and output the results to the/root/dstat.csv file.

dstat comes with a few plugins that extend its functionality to a large extent. You can see some of the ways in which they are used by looking at the/usr/share/dstat directory, which is commonly used:

    • -–disk-util: Displays the busy state of a time disk

    • -–freespace: Displays the current disk space utilization

    • -–proc-count: Shows the number of programs that are running

    • -–top-bio: Indicates the maximum block I/O process

    • -–TOP-CPU: Graphically displays the most CPU-intensive processes

    • -–top-io: Shows the most normal I/O processes

    • -–TOP-MEM: Show processes that occupy the most memory


5. Example

See who is occupying all of the memory:

# dstat-g-l-m-S--top-mem

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/7A/48/wKiom1am5pXxzuBwAAAhS90jgGo189.png "title=" 3.png " alt= "Wkiom1am5pxxzubwaaahs90jggo189.png"/>

Show some data about CPU resource loss:

# dstat-c-y-l--proc-count--top-cpu

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/7A/48/wKioL1am5vPwJb5UAAAgcLacsyo970.png "title=" 4.png " alt= "Wkiol1am5vpwjb5uaaagclacsyo970.png"/>

To export a file in CSV format for later, you can use the following command:

# DSTAT–OUTPUT/TMP/SAMPLEOUTPUT.CSV-CDN


Monitor the Swap,process,sockets,filesystem and display the monitoring time:

# DSTAT-TSP--socket--fs

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/7A/48/wKiom1am5sfBez00AAA2I0AHhaw805.png "title=" 5.png " alt= "Wkiom1am5sfbez00aaa2i0ahhaw805.png"/>

The following plug-ins are not all directly available, and some rely on other packages, such as to monitor MySQL, you must install Python to connect some of the MySQL package.

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7A/48/wKiom1am5t3R9LXLAABBbi3LHP0807.png "title=" 6.png " alt= "Wkiom1am5t3r9lxlaabbbi3lhp0807.png"/>

This article is from the "Bread" blog, make sure to keep this source http://cuchadanfan.blog.51cto.com/9940284/1738560

Linux Network Command (ix) dstat

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.