Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to use tsar to monitor system status in Linux

Shulou Source: shulou.com Published: 2022-06-01 05:07:05 11月06日 Update

Editor to share with you how to use tsar in Linux to monitor the status of the system, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

A brief introduction

Tsar (Taobao System Activity Reporter) can store the collected data on disk, and it can also support storing the data in MySQL or sending the data to the Nagios alarm server. At the data display level, you can specify a module and support Merge output for data with multiple messages. If you have-- live parameter, you can also output real-time information in seconds. Tsar can monitor CPU, IO, memory, TCP and other system status, as well as Apache, Nginx/Tengine, Squid and other server status.

How to use it

This article mainly introduces how tsar monitors linux servers. Interested friends can try to monitor nginx and apache services.

1 tsar-L/--list to view the list of available modules

-- modname to view the operation status of the specified module. Module refers to the name listed in tsar-L, such as: tsar-- cpu.

$tsar-L

Tsar enable follow modules:

Cpu

Mem

Swap

Tcp

Udp

Traffic

Io

Pcsw

Partition

Tcpx

Load

2-s/--spec specified field, tsar-- cpu-s sys,util

View different specified fields for multiple modules

$tsar-load-cpu-s runq,util

Time-cpu---load-

Time util runq

17-09-14-21:20 21.00 32.00

17-09-14-21:25 14.51 9.00

17-09-14-21:30 3.25 9.00

17-09-14-21:35 3.16 7.00

17-09-14-21:40 0.57 12.00

17-09-14-21:45 0.76 9.00

17-09-14-21:50 0.16 8.00

17-09-14-21:55 0.15 7.00

17-09-14-22:00 0.15 11.00

3-l/--live view real-time data

$tsar-l

Time-cpu---mem---tcp---traffic-----sda----sdb----load-

Time util util retran bytin bytout util util load1

18-09-14-21:27:18 0.27 30.66 0.00 4.0K 4.2K 0.00 0.00 0.13

18-09-14-21:27:23 0.06 30.66 0.00 438.00 1.2K 0.00 0.00 0.12

18-09-14-21:27:28 0.01 30.66 0.00 338.00 335.00 0.00 0.00 0.11

18-09-14-21:27:33 0.05 30.66 0.00 176.00 377.00 0.00 0.00 0.10

18-09-14-21:27:38 0.36 30.67 0.00 4.4K 5.1K 0.00 0.10

18-09-14-21:27:43 0.13 30.67 0.00 242.00 1.1K 0.00 0.00 0.09

18-09-14-21:27:48 0.42 30.66 0.00 4.0K 4.7K 0.00 0.00 0.08

18-09-14-21:27:53 0.04 30.66 0.00 418.00 962.00 0.00 0.00 0.08

18-09-14-21:27:58 0.09 30.66 0.00 1.0K 2.0K 0.00 0.02 0.07

18-09-14-21:28:03 0.29 30.66 0.00 358.00 4.1K 0.00 0.00 0.06

18-09-14-21:28:08 0.02 30.66 0.00 92.00 154.00 0.00 0.00 0.06

18-09-14-21:28:13 0.11 30.66 0.00 117.00 803.00 0.00 0.00

View the real-time information of the specified module

4$ tsar-l-cpu

Time-cpu--

Time user sys wait hirq sirq util

18-09-14-21:29:25 0.03 0.07 0.00 0.00 0.00 0.10

18-09-14-21:29:30 0.01 0.02 0.00 0.00 0.00 0.02

18-09-14-21:29:35 0.03 0.05 0.00 0.00 0.00 0.08

18-09-14-21:29:40 0.01 0.01 0.00 0.00 0.00 0.02

18-09-14-21:29:45 0.04 0.09 0.00 0.00 0.00 0.13

18-09-14-21:29:50 0.01 0.01 0.00 0.00 0.00 0.02

18-09-14-21:29:55 0.10 0.19 0.00 0.00 0.01 0.30

18-09-14-21:30:00 0.01 0.02 0.00 0.00 0.00 0.02

5-i/--interval specifies interval, history, tsar-I 1-- cpu

$tsar-io-I sdb-l

Time-sdb

Time rrqms wrqms rs ws rsecs wsecs rqsize qusize await svctm util

18-09-14-21:59:01 0.00 0.00 0.00 2.8K 0.00 75.3 K 26.77 0.00 0.05 0.02 7.00

18-09-14-21:59:06 0.00 0.00 0.20 2.8K 0.80 75.7K 26.82 0.00 0.05 0.02 7.10

18-09-14-21:59:11 0.00 0.00 0.00 2.8K 0.00 74.9K 26.83 0.00 0.05 0.02 6.84

18-09-14-21:59:16 0.00 0.00 0.00 1.4K 0.00 37.9K 26.29 0.00 0.05 0.02 3.66

6-d/--date specifies the date, YYYYMMDD or n represents n days ago

The following two commands have the same meaning

$tsar-- load-d 20140917

$tsar-- load-d 1

Time-load-

Time load1 load5 load15 runq plit

17-09-14-00:05 0.00 0.02 0.05 6.00 918.00

17-09-14-00:10 0.08 0.05 0.05 6.00 920.00

17-09-14-00:15 0.22 0.12 0.07 6.00 919.00

17-09-14-00:20 0.04 0.11 0.08 8.00 934.00

17-09-14-00:25 0.05 0.07 0.06 6.00 921.00

17-09-14-00:30 0.12 0.10 0.07 8.00 921.00

17-09-14-00:35 0.11 0.09 0.06 6.00 913.00

17-09-14-00:40 0.02 0.10 0.08 12.00 929.00

17-09-14-00:45 0.07 0.05 0.05 6.00 919.00

17-09-14-00:50 0.01 0.04 0.05 9.00 932.00

17-09-14-00:55 0.01 0.05 0.05 8.00 920.00

17-09-14-01:00 0.00 0.02 0.05 11.00 931.00

17-09-14-01:05 0.00 0.01 0.05 7.00 920.00

17-09-14-01:10 0.00 0.01 0.05 6.00 928.00

17-09-14-01:15 0.08 0.03 0.05 7.00 920.00

17-09-14-01:20 0.01 0.04 0.05 8.00 939.00

17-09-14-01:25 0.12 0.07 0.05 6.00 924.00

7-D/--detail can specify whether to view main fields or all fields of the module

The difference between adding-D and not adding D on the command line

$tsar-mem-D

Time-mem--

Time free used buff cach total util

17-09-14-21:50 9325842432.00 86052364288.00 261754880.00 175354589184.00 270994550784.00 31.75

17-09-14-21:55 9324318720.00 86052917248.00 262361088.00 175354953728.00 270994550784.00 31.75

17-09-14-22:00 9352749056.00 86023622656.00 262938624.00 175355240448.00 270994550784.00 31.74

17-09-14-22:05 9323311104.00 86051930112.00 263589888.00 175355719680.00 270994550784.00 31.75

17-09-14-22:10 9320034304.00 86054137856.00 264204288.00 175356174336.00 270994550784.00 31.75

17-09-14-22:15 9321422848.00 86051889152.00 264806400.00 175356432384.00 270994550784.00 31.75

17-09-14-22:20 9316368384.00 86056013824.00 265383936.00 175356784640.00 270994550784.00 31.76

$tsar-mem

Time-mem--

Time free used buff cach total util

17-09-14-21:50 8.7G 80.1G 249.6M 163.3G 252.4G 31.75

17-09-14-21:55 8.7G 80.1G 250.2m 163.3G 252.4G 31.75

17-09-14-22:00 8.7G 80.1G 250.8m 163.3G 252.4G 31.74

17-09-14-22:05 8.7G 80.1G 251.4M 163.3G 252.4G 31.75

17-09-14-22:10 8.7G 80.1G 252.0M 163.3G 252.4G 31.75

8-- partition looks at the usage of the system directory specified by fstab, and-I specifies to view a directory

$tsar-- partition-I / U01

Time-/ u01-

Time bfree bused btotl util

19-09-14-15:20 1.9T 1.7T 3.8T 47.29

19-09-14-15:25 1.9T 1.7T 3.8T 47.29

19-09-14-15:30 1.9T 1.7T 3.8T 47.29

19-09-14-15:35 1.9T 1.7T 3.8T 47.29

19-09-14-15:40 1.9T 1.7T 3.8T 47.29

19-09-14-15:45 1.9T 1.7T 3.8T 47.29

19-09-14-15:50 1.9T 1.7T 3.8T 47.29

19-09-14-15:55 1.9T 1.7T 3.8T 47.29

19-09-14-16:00 1.9T 1.7T 3.8T 47.29

19-09-14-16:05 1.9T 1.7T 3.8T 47.29

19-09-14-16:10 1.9T 1.7T 3.8T 47.29

19-09-14-16:15 1.9T 1.7T 3.8T 47.29

19-09-14-16:20 1.9T 1.7T 3.8T 47.29

19-09-14-16:25 1.9T 1.7T 3.8T 47.29

19-09-14-16:30 1.9T 1.7T 3.8T 47.29

19-09-14-16:35 1.9T 1.7T 3.8T 47.29

19-09-14-16:40 1.9T 1.7T 3.8T 47.29

19-09-14-16:45 1.9T 1.7T 3.8T 47.29

19-09-14-16:50 1.9T 1.7T 3.8T 47.29

The above is all the contents of the article "how to use tsar to monitor system status in Linux". 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!

Tags: Modules monitoring data status systems fields services information real-time servers articles monitoring systems content commands directories storage support output different Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno MariaDB Redmi Xiaomi Shulou Information