zoukankan      html  css  js  c++  java
  • Percona-Tookit工具包之pt-summary

     
    Preface
     
        As a dba,We are obliged to master several basic tools(such as vmstat,top,netstat,iostat,df,etc.) to monitor system status or analyze the the information of it espcially in trouble shooting and performance tunning.
        
    Introduce
     
        pt-summary is a tool which provide us the function of collecting the common system information for us instead of running the other various tools.It can print a report in summary on screen or write into a sepcific file either.It's better to run it as root to get as many as privieges.
     
    Procedure
     
    Usage
    1 pt-summary //We can executed it without any parameter.
    Common parameter
    1 --read-samples //Generate the report from sepcific files.
    2 --save-samples //Create a directory and put the collected information into different files in it.
    3 --sleep //Specify the how long to sleep while collecting samples of vmstat.
    4 --summarize-mounts //Report information of mounted filesystems and disk usage.
    5 --summarize-network //Report information of network.
    6 --summarize-processes //Report information of top processes and vmstat.
    Example
      1 [root@zlm2 10:09:49 ~]
      2 #pt-summary --save-samples=`date +%Y%m%d`
      3 # Percona Toolkit System Summary Report ######################
      4         Date | 2018-07-23 08:10:49 UTC (local TZ: CEST +0200)
      5     Hostname | zlm2
      6       Uptime |  2:51,  2 users,  load average: 0.03, 0.03, 0.05
      7       System | innotek GmbH; VirtualBox; v1.2 (Other)
      8  Service Tag | 0
      9     Platform | Linux
     10      Release | CentOS Linux release 7.1.1503 (Core) 
     11       Kernel | 3.10.0-229.el7.x86_64
     12 Architecture | CPU = 64-bit, OS = 64-bit
     13    Threading | NPTL 2.17
     14      SELinux | Disabled
     15  Virtualized | VirtualBox
     16 # Processor ##################################################
     17   Processors | physical = 1, cores = 1, virtual = 1, hyperthreading = no
     18       Speeds | 1x2396.405
     19       Models | 1xIntel(R) Core(TM) i5-6200U CPU @ 2.30GHz
     20       Caches | 1x3072 KB
     21 # Memory #####################################################
     22        Total | 993.6M
     23         Free | 588.3M
     24         Used | physical = 250.9M, swap allocated = 1016.0M, swap used = 0.0, virtual = 250.9M
     25       Shared | 6.5M
     26      Buffers | 154.5M
     27       Caches | 606.5M
     28        Dirty | 56 kB
     29      UsedRSS | 296.2M
     30   Swappiness | 30
     31  DirtyPolicy | 30, 10
     32  DirtyStatus | 0, 0
     33   Locator   Size     Speed             Form Factor   Type          Type Detail
     34   ========= ======== ================= ============= ============= ===========
     35 # Mounted Filesystems ########################################
     36   Filesystem               Size Used Type     Opts                                             Mountpoint
     37   /dev/mapper/centos-root  8.4G  83% xfs      rw,relatime,attr2,inode64,noquota                /
     38   /dev/sda1                497M  24% xfs      rw,relatime,attr2,inode64,noquota                /boot
     39   devtmpfs                 488M   0% devtmpfs rw,nosuid,size=499536k,nr_inodes=124884,mode=755 /dev
     40   none                      87G  93% vboxsf   rw,nodev,relatime                                /vagrant
     41   tmpfs                    497M   0% tmpfs    rw,nosuid,nodev                                  /dev/shm
     42   tmpfs                    497M   0% tmpfs    rw,nosuid,nodev,mode=755                         /dev/shm
     43   tmpfs                    497M   0% tmpfs    rw,nosuid,nodev,noexec,mode=755                  /dev/shm
     44   tmpfs                    497M   0% tmpfs    rw,nosuid,nodev                                  /sys/fs/cgroup
     45   tmpfs                    497M   0% tmpfs    rw,nosuid,nodev,mode=755                         /sys/fs/cgroup
     46   tmpfs                    497M   0% tmpfs    rw,nosuid,nodev,noexec,mode=755                  /sys/fs/cgroup
     47   tmpfs                    497M   2% tmpfs    rw,nosuid,nodev                                  /run
     48   tmpfs                    497M   2% tmpfs    rw,nosuid,nodev,mode=755                         /run
     49   tmpfs                    497M   2% tmpfs    rw,nosuid,nodev,noexec,mode=755                  /run
     50 # Disk Schedulers And Queue Size #############################
     51         dm-0 | 128
     52         dm-1 | 128
     53          sda | [cfq] 128
     54          sr0 | [cfq] 128
     55          sr1 | [cfq] 128
     56 # Disk Partioning ############################################
     57 Device       Type      Start        End               Size
     58 ============ ==== ========== ========== ==================
     59 /dev/dm-0    Disk                               8996782080
     60 /dev/dm-1    Disk                               1065353216
     61 /dev/sda     Disk                              10632560640
     62 /dev/sda1    Part       2048    1026047          524287488
     63 /dev/sda2    Part    1026048   20766719        10107223552
     64 # Kernel Inode State #########################################
     65 dentry-state | 22304    13658    45    0    0    0
     66      file-nr | 1056    0    99224
     67     inode-nr | 19311    307
     68 # LVM Volumes ################################################
     69   LV   VG     Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
     70   root centos -wi-ao----   <8.38g                                                    
     71   swap centos -wi-ao---- 1016.00m                                                    
     72 # LVM Volume Groups ##########################################
     73   VG     VSize VFree 
     74   centos 9.41g 40.00m
     75 # RAID Controller ############################################
     76   Controller | No RAID controller detected
     77 # Network Config #############################################
     78   Controller | Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)
     79   Controller | Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)
     80  FIN Timeout | 60
     81   Port Range | 61000
     82 # Interface Statistics #######################################
     83   interface  rx_bytes rx_packets  rx_errors   tx_bytes tx_packets  tx_errors
     84   ========= ========= ========== ========== ========== ========== ==========
     85   lo             5000         45          0       5000         45          0
     86   enp0s3        70000        700          0      70000        450          0
     87   enp0s8       250000       3000          0     125000       1250          0
     88 # Network Devices ############################################
     89   Device    Speed     Duplex
     90   ========= ========= =========
     91   enp0s3     1000Mb/s   Full      
     92   enp0s8     1000Mb/s   Full      
     93 # Network Connections ########################################
     94   Connections from remote IP addresses
     95     192.168.1.1         2
     96     192.168.1.101       1
     97   Connections to local IP addresses
     98     192.168.1.101       3
     99   Connections to top 10 local ports
    100     22                  2
    101     59131               1
    102   States of connections
    103     CLOSE_WAIT          1
    104     ESTABLISHED         2
    105     LISTEN              4
    106 # Top Processes ##############################################
    107   PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND
    108     1 root      20   0   54188   3940   2408 S  0.0  0.4   0:00.68 systemd
    109     2 root      20   0       0      0      0 S  0.0  0.0   0:00.00 kthreadd
    110     3 root      20   0       0      0      0 S  0.0  0.0   0:00.27 ksoftirqd/0
    111     5 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 kworker/0:0H
    112     6 root      20   0       0      0      0 S  0.0  0.0   0:00.00 kworker/u2:0
    113     7 root      rt   0       0      0      0 S  0.0  0.0   0:00.00 migration/0
    114     8 root      20   0       0      0      0 S  0.0  0.0   0:00.00 rcu_bh
    115     9 root      20   0       0      0      0 S  0.0  0.0   0:00.00 rcuob/0
    116    10 root      20   0       0      0      0 S  0.0  0.0   0:01.07 rcu_sched
    117 # Notable Processes ##########################################
    118   PID    OOM    COMMAND
    119   895    -17    sshd
    120 # Simplified and fuzzy rounded vmstat (wait please) ##########
    121   procs  ---swap-- -----io---- ---system---- --------cpu--------
    122    r  b    si   so    bi    bo     ir     cs  us  sy  il  wa  st
    123    1  0     0    0    15     3     35    100   0   0 100   0   0
    124    0  0     0    0     0     0    700   1250  11  18  70   0   0
    125    0  0     0    0     0     0     35     90   0   1  99   0   0
    126    0  0     0    0     0     0     35     80   0   0 100   0   0
    127    0  0     0    0     0     0     30     80   0   0 100   0   0
    128 # Memory mamagement ##########################################
    129 Transparent huge pages are enabled.
    130 # The End ####################################################
    131 
    132 [root@zlm2 10:10:53 ~]
    133 #ls -l
    134 total 16
    135 drwxr-xr-x   2 root root 4096 Jul 23 10:10 20180723 //This is the newly created directory which contains individual information of system status.
    136 -rw-------.  1 root root 1431 Jul 16  2015 anaconda-ks.cfg
    137 -rwxr-xr-x   1 root root   54 Jun 13 04:16 mysqld.sh
    138 drwxr-xr-x  13 root root 4096 Jul  4 03:21 sysbench-1.0
    139 
    140 [root@zlm2 10:10:54 ~]
    141 #cd 20180723/
    142 
    143 [root@zlm2 10:10:57 ~/20180723]
    144 #ls -l
    145 total 120
    146 -rw-r--r-- 1 root root 27356 Jul 23 10:10 dmesg_file
    147 -rw-r--r-- 1 root root  1788 Jul 23 10:10 dmidecode
    148 -rw-r--r-- 1 root root  1134 Jul 23 10:10 ip
    149 -rw-r--r-- 1 root root   757 Jul 23 10:10 lspci_file
    150 -rw-r--r-- 1 root root   258 Jul 23 10:10 lvs
    151 -rw-r--r-- 1 root root  1402 Jul 23 10:10 memory
    152 -rw-r--r-- 1 root root  1096 Jul 23 10:10 mounted_fs
    153 -rw-r--r-- 1 root root   862 Jul 23 10:10 netstat
    154 -rw-r--r-- 1 root root  1428 Jul 23 10:10 network_devices
    155 -rw-r--r-- 1 root root    45 Jul 23 10:10 notable_procs
    156 -rw-r--r-- 1 root root   854 Jul 23 10:10 partitioning
    157 -rw-r--r-- 1 root root   733 Jul 23 10:10 proc_cpuinfo_copy
    158 -rw-r--r-- 1 root root   770 Jul 23 10:10 processes
    159 -rw-r--r-- 1 root root   681 Jul 23 10:10 summary
    160 -rw-r--r-- 1 root root 28342 Jul 23 10:10 sysctl
    161 -rw-r--r-- 1 root root    62 Jul 23 10:10 uptime
    162 -rw-r--r-- 1 root root    44 Jul 23 10:10 vgs
    163 -rw-r--r-- 1 root root   570 Jul 23 10:10 vmstat
    164 
    165 [root@zlm2 10:19:06 ~/20180723]
    166 #cat memory //We can get detail information of memory usage in the collected file "memory".
    167               total        used        free      shared  buff/cache   available
    168 Mem:     1041899520   263057408   616837120     6823936   162004992   635920384
    169 Swap:    1065349120           0  1065349120
    170 MemTotal:        1017480 kB
    171 MemFree:          602380 kB
    172 MemAvailable:     621016 kB
    173 Buffers:             768 kB
    174 Cached:           127208 kB
    175 SwapCached:            0 kB
    176 Active:           254360 kB
    177 Inactive:         104200 kB
    178 Active(anon):     230776 kB
    179 Inactive(anon):     6488 kB
    180 Active(file):      23584 kB
    181 Inactive(file):    97712 kB
    182 Unevictable:           0 kB
    183 Mlocked:               0 kB
    184 SwapTotal:       1040380 kB
    185 SwapFree:        1040380 kB
    186 Dirty:                56 kB
    187 Writeback:             0 kB
    188 AnonPages:        230636 kB
    189 Mapped:            31420 kB
    190 Shmem:              6664 kB
    191 Slab:              30232 kB
    192 SReclaimable:      19928 kB
    193 SUnreclaim:        10304 kB
    194 KernelStack:        2288 kB
    195 PageTables:         4160 kB
    196 NFS_Unstable:          0 kB
    197 Bounce:                0 kB
    198 WritebackTmp:          0 kB
    199 CommitLimit:     1549120 kB
    200 Committed_AS:     796324 kB
    201 VmallocTotal:   34359738367 kB
    202 VmallocUsed:       22112 kB
    203 VmallocChunk:   34359713784 kB
    204 HardwareCorrupted:     0 kB
    205 AnonHugePages:    178176 kB
    206 HugePages_Total:       0
    207 HugePages_Free:        0
    208 HugePages_Rsvd:        0
    209 HugePages_Surp:        0
    210 Hugepagesize:       2048 kB
    211 DirectMap4k:       49088 kB
    212 DirectMap2M:      999424 kB
    Summary
    • pt-summary can work well in many Unix systems(based on the inside-command of collecting data) without any complex parameters.
    • pt-summary is only a tool of generating reports of system information instead of tuning and diagnosing performance.
    • We can deploy pt-summary in crontab and make it collecting data regularly as we need for future diagnosis.
     
  • 相关阅读:
    sass 基本语法
    ruby gem的安装步骤
    sass 安装与各种命令
    《转》阿里负责人揭秘面试潜规则
    Json数组基础知识
    Json序列化与反序列化
    《转》请放下你的无效社交
    Perfmon
    C# 连接SQL Server数据库的几种方式--server+data source等方式
    C#三种字符串拼接方法的效率对比
  • 原文地址:https://www.cnblogs.com/aaron8219/p/9344580.html
Copyright © 2011-2022 走看看