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 monitor the performance of Linux server in real time

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly shows you "how to monitor Linux server performance in real time". The content is simple and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how to monitor Linux server performance in real time".

Brief introduction

Dstat is a powerful, flexible and universal tool for generating Linux system resource statistics, which can replace the multi-function products such as vmstat,iostat,netstat and ifstat. Dstat overcomes the limitations of these commands and adds some additional features, monitoring items, and flexibility. Dstat makes it easy to monitor system health and use it for benchmarking and troubleshooting. Users with knowledge of Python can build their own plug-ins.

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

Dstat will provide you with option information in the form of a list and clearly tell you in what magnitude and unit the output is displayed. In this way, information confusion and misinformation can be better avoided. More importantly, it makes it easier for you to write plug-ins to collect the data you want and extend it in a way that has never been done 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 them into Gnumeric or Excel generated tables.

Characteristics

⒈ combines vmstat,iostat,ifstat,netstat and more information

Real-time display of statistics by ⒉

⒊ can analyze and troubleshoot by enabling monitoring items and sorting

⒋ modular design

5. Written in python to make it easier to extend existing tasks

6. It is easy to expand and add your counters (please contribute to this)

7. Many of the included extensions fully illustrate the convenience of adding new monitoring projects

8. Block devices / network devices can be grouped and the total number is given.

9. You can display the current status of each device

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

11. Display accurate units and limit the range of conversion errors

twelve。 Display different units in different colors

13. Display the intermediate result with a delay of less than 1 second

14. Support for exporting reports in CSV format, and can be imported into Gnumeric and Excel to generate graphics

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:

# pacman-S dstat

Usage

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 (dsk): the read and write operations of the disk. This column shows the total number of reads and writes to the disk.

Network Statistics (net): data sent and received by network devices. This column shows the total number of data received and sent by the network.

Paging statistics (paging): 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 (system): 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:

-c: displays CPU system occupancy, user occupancy, idle, waiting, interrupt, software interruption and other information.

-C: when there are multiple CPU, this parameter can display the cpu status as needed, for example:-C 0Power1 shows the information of cpu0 and cpu1.

-d: displays the read and write data size of the disk.

-D hda,total:include hda and total.

-n: displays the network status.

-N eth2,total: specify the network card to display when there are multiple network cards.

-l: displays the system load.

-m: displays memory usage (including used,buffer,cache, free values).

-g: displays the page usage.

-p: displays the process status.

-s: displays the usage of the swap partition.

-S: similar to DhampN.

-r:I/O request status.

-y: system status.

-t: displays the current time on the first line

-- ipc: displays ipc message queues, signals and other information.

-- socket: used to display the tcp udp port status.

-a: this is the default option and is equivalent to-cdngy.

-v: equivalent to-pmgdsc-D total.

-socket: displays network statistics

-tcp: displays commonly used TCP statistics

-udp: displays some dynamic data about the listening UDP interface and its current usage-fs: displays file system statistics (including total number of files and inodes value)

-nocolor: do not display colors (sometimes useful)

-- output file: this option is also useful to redirect status information to a specified file in csv format for later viewing. Example: dstat-- output / root/dstat.csv & now let the program run silently in the background and output the results to the / root/dstat.csv file.

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: displays the busy status of the disk at a certain time

-- freespace: displays the current disk space utilization

-- proc-count: displays positive

Number of programs running

-- top-bio: indicates the largest process of block iBand O

-- top-cpu: graphically shows the processes that CPU takes up the most

-- top-io: displays the maximum process of normal Iamp O

-- top-mem: displays the processes that consume 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-- top-cpu

You can use multiple internal dstat plug-ins with external dstat plug-ins to see a list of all available plug-ins, run the following command:

$dstat-list

The above is all the contents of the article "how to monitor Linux server performance in real time". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more 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

Servers

Wechat

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

12
Report