Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use dstat, a Linux system information statistics tool

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the Linux system information statistics tool dstat how to use, the article introduces in great detail, has a certain reference value, interested friends must read it!

The dstat command is a tool that replaces the commands vmstat, iostat, netstat, nfsstat and ifstat, and is an omnipotent system information statistics tool. Compared with sysstat, dstat has a color interface, and the data is more conspicuous and easy to observe when observing performance manually.

Installation method

Ubuntu/Mint and Debin systems:

There are related installation packages in the local software library. You can install them with the following command:

# sudo apt-get install dstat

RHEL/Centos and Fedora systems:

You can add relevant installation packages to the romforge software library. Refer to the instructions and use the following command to install them easily:

# yum install dstat

ArchLinux system:

The related software package is in the community repository, and you can install it with this command:

# how to use pacman-S dstat

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

This is the information displayed by the default output:

CPU status: usage of CPU. The more interesting part of the report is that it shows the users, systems, and free parts, which gives a better analysis of the current usage of CPU. If you see that the status of CPU in the "wait" column is a high usage value, there are some other problems with the system. When the state of CPU is in "waits", it is because it is waiting for a response from an Imax O device (such as memory, disk, or network) and has not yet received it.

Disk statistics: the read and write operations of the disk. This column shows the total number of reads and writes to the disk.

Network statistics: data sent and received by network equipment. This column shows the total number of data received and sent by the network.

Paging statistics: the paging activity of the system. Paging refers to a memory management technique used to find system scenarios. A large page indicates that the system is using a lot of swap space, or memory is very scattered, and in most cases you want to see that the values of page in and page out are 0.

System statistics: this item shows int and context switching (csw). This statistic makes sense only when there is a comparative baseline. The higher statistics in this column usually indicate that a large number of processes are causing congestion and require attention to CPU. Your server will normally run some programs, so this item always displays some values.

By default, dstat refreshes data every second. If you want to quit 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 numerical values.

This is because dstat gives a summary from the previous report, so the first run does not have data about averages and total values.

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

Dstat 3 10

There are many parameters to choose from in the dstat command, which you can see through the man dstat command. Most commonly used parameters are these:

-l: display load statistics-m: display memory usage (including used,buffer,cache) Free value)-r: show TCP O statistics-s: show swap partition usage-t: display current time on the first line-fs: display file system statistics (including total number of files and inodes values)-nocolor: do not display colors (sometimes useful)-socket: display network statistics-tcp: show commonly used TCP statistics-udp: show some dynamic data about the monitored UDP interface and its current usage

Of course, more than these uses, dstat comes with a number of plug-ins that greatly expand its functionality. You can check out some of their uses by looking at the / usr/share/dstat directory, some of which are commonly used:

-- disk-util: show disk busy status at a certain time-- freespace: show current disk space utilization-- proc-count: show the number of programs running-- top-bio: point out the largest process of block CPU O-- top-cpu: graphically show the process with the largest CPU usage-- top-io: show the process with the largest amount of memory consumed by normal iUnip O-- top-mem: show the process with the most memory.

To give some examples:

See who is using all the memory:

Dstat-g-l-m-s-- top-mem

Displays some data about CPU resource depletion:

Dstat-c-y-l-- proc-count-- how does top-cpu output a csv file

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

# dstat-output / tmp/sampleoutput.csv-cdn

The above is all the contents of this article entitled "how to use dstat, a statistical tool for Linux systems". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report