FastHandle - IT Operations Examples

FastHandle is fast operation tools for infrastructure configurations and tests.

User Tools

Site Tools


os:linux:set:performance:etc_cron.d_performance.html



Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
os:linux:set:performance:etc_cron.d_performance.html [2017/12/01 02:18]
kurihara
os:linux:set:performance:etc_cron.d_performance.html [2018/02/04 23:24]
kurihara ↷ Page moved from os:set:performance:etc_cron.d_performance.html to os:linux:set:performance:etc_cron.d_performance.html
Line 1: Line 1:
-[[os:conf.html]] +[[os:set:index.html]] 
-====== /etc/cron.d/performance Performance survey of seconds interval on Cron ======+====== /etc/cron.d/performance ====== 
 +**Performance survey of seconds interval on Cron**
  
 \\ \\
Line 11: Line 12:
 LOGDIR=/var/log/performance LOGDIR=/var/log/performance
  
-# 60m = 60m x 1m = 60m x 60sec = 3600sec+1H = 60m = 60m x 1m = 60m x 60sec = 3600sec
 # 3600sec = 1sec x 3600 times # 3600sec = 1sec x 3600 times
 # 3600sec = 5sec x 720 times # 3600sec = 5sec x 720 times
Line 19: Line 20:
 #daily output #daily output
 #------------------------------------------------------------------- #-------------------------------------------------------------------
-0 * * * * root dstat -taf 5 720 >> ${LOGDIR}/dstat-taf.`date +\%Y\%m\%d`+# Multi
 0 * * * * root vmstat 5 720 | awk '{print strftime("\%y/\%m/\%d \%H:\%M:\%S"), $0} { system(":") }' >> ${LOGDIR}/vmstat.`date +\%Y\%m\%d` 0 * * * * root vmstat 5 720 | awk '{print strftime("\%y/\%m/\%d \%H:\%M:\%S"), $0} { system(":") }' >> ${LOGDIR}/vmstat.`date +\%Y\%m\%d`
 +#0 * * * * root dstat -taf 5 720 >> ${LOGDIR}/dstat-taf.`date +\%Y\%m\%d`
 +
 +# CPU Details
 0 * * * * root mpstat 5 720 >> ${DIR}/mpstat.`date +\%Y\%m\%d` 0 * * * * root mpstat 5 720 >> ${DIR}/mpstat.`date +\%Y\%m\%d`
 +
 +# Load Average Details
 +0 * * * * root sar -q 5 720 >> ${LOGDIR}/sar-q.`date +\%Y\%m\%d`
 +
 +# Memory
 +0 * * * * root sar -r 5 720 >> ${LOGDIR}/sar-r.`date +\%Y\%m\%d`
 +
 +# Disk Details
 0 * * * * root iostat -xtm 10 360 >> ${LOGDIR}/iostat.`date +\%Y\%m\%d` > /dev/null 2>&1 0 * * * * root iostat -xtm 10 360 >> ${LOGDIR}/iostat.`date +\%Y\%m\%d` > /dev/null 2>&1
  
-* * * * root /home/fasthandle/scripts/ps.sh /dev/null 2>&1 +# Network Details 
-* * * * * root /home/fasthandle/scripts/top.sh > /dev/null 2>&+* * * * root sar -n DEV 5 720 >> ${LOGDIR}/sar-n-DEV.`date +\%Y\%m\%d`
 * * * * * root /home/fasthandle/scripts/netstat-s.sh > /dev/null 2>&1 * * * * * root /home/fasthandle/scripts/netstat-s.sh > /dev/null 2>&1
 * * * * * root /home/fasthandle/scripts/netstat-i.sh > /dev/null 2>&1 * * * * * root /home/fasthandle/scripts/netstat-i.sh > /dev/null 2>&1
 +
 +# Process Details
 +* * * * * root /home/fasthandle/scripts/ps.sh > /dev/null 2>&1
 +* * * * * root /home/fasthandle/scripts/top.sh > /dev/null 2>&
 +
  
 #------------------------------------------------------------------- #-------------------------------------------------------------------
 # monthly output # monthly output
 #------------------------------------------------------------------- #-------------------------------------------------------------------
 +# Disk Details
 0  0,6,12,18 * * * root /home/fasthandle/scripts/df.sh > /dev/null 2>&1 0  0,6,12,18 * * * root /home/fasthandle/scripts/df.sh > /dev/null 2>&1
  
Line 49: Line 67:
 \\ \\
 \\ \\
-===== dstat-taf =====+===== Multi ===== 
 +==== vmstat ==== 
 +**memory, swap, io, system, cpu** 
 + 
 +==Output Example== 
 +<code> 
 +~]# vmstat 1 3 | awk '{print strftime("%y/%m/%d %H:%M:%S"), $0} { system(":") }' 
 +17/11/29 00:18:29 procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- 
 +17/11/29 00:18:29  r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st 
 +17/11/29 00:18:29  1  0      0 270248   1492 251820    0    0    85    36   64  117  0  0 99  0  0 
 +17/11/29 00:18:30  0  0      0 270092   1492 251852    0    0          149  265  0  0 100  0  0 
 +17/11/29 00:18:31  1  0      0 270092   1492 251852    0    0        21  139  236  0  0 100  0  0 
 +</code> 
 + 
 +\\ 
 +==== dstat -taf ====
 <code> <code>
 ~]# dstat -taf 2 5 ~]# dstat -taf 2 5
Line 63: Line 96:
  
  
-\\ 
-===== vmstat ===== 
-**memory, swap, io, system, cpu** 
  
-==Output Example== 
-<code> 
-~]# vmstat 1 3 | awk '{print strftime("%y/%m/%d %H:%M:%S"), $0} { system(":") }' 
-17/11/29 00:18:29 procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- 
-17/11/29 00:18:29  r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st 
-17/11/29 00:18:29  1  0      0 270248   1492 251820    0    0    85    36   64  117  0  0 99  0  0 
-17/11/29 00:18:30  0  0      0 270092   1492 251852    0    0          149  265  0  0 100  0  0 
-17/11/29 00:18:31  1  0      0 270092   1492 251852    0    0        21  139  236  0  0 100  0  0 
-</code> 
  
 \\ \\
-===== mpstat=====+\\ 
 +===== CPU Details===== 
 +==== mpstat====
 **CPU** **CPU**
  
Line 106: Line 129:
 Average:          0.00    0.00    0.00    0.34    0.00    0.00    0.00    0.00    0.00   99.66 Average:          0.00    0.00    0.00    0.34    0.00    0.00    0.00    0.00    0.00   99.66
 </code> </code>
 +
 \\ \\
-===== iostat =====+\\ 
 +===== Load Average Details===== 
 +==== sar -q ==== 
 +<code> 
 +~]# sar -q 2 3 
 +Linux 3.10.0-229.el7.x86_64 (centos7)   01/15/18        _x86_64_        (2 CPU) 
 + 
 +01:43:05      runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15   blocked 
 +01:43:07            0       219      0.00      0.01      0.05         0 
 +01:43:09            1       219      0.00      0.01      0.05         0 
 +01:43:11            0       219      0.00      0.01      0.05         0 
 +Average:            0       219      0.00      0.01      0.05         0 
 +</code> 
 + 
 +\\ 
 +===== Memory Details ===== 
 +==== sar -r ==== 
 +<code> 
 +~]# sar -r 2 3 
 +Linux 3.10.0-229.el7.x86_64 (centos7)   01/15/18        _x86_64_        (2 CPU) 
 + 
 +01:43:26    kbmemfree kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit  kbactive   kbinact   kbdirty 
 +01:43:28       249240    509760     67.16      1492    230356   1465816     91.69    247440    185552         0 
 +01:43:30       249240    509760     67.16      1492    230356   1465816     91.69    247444    185552         0 
 +01:43:32       249240    509760     67.16      1492    230360   1465816     91.69    247444    185556         0 
 +Average:       249240    509760     67.16      1492    230357   1465816     91.69    247443    185553         0 
 +</code> 
 + 
 +\\ 
 +\\ 
 +===== Disk Details===== 
 + 
 +==== iostat ====
 **IO** **IO**
  
Line 138: Line 194:
  
 </code> </code>
- 
- 
-\\ 
-===== ps.sh ===== 
-<sxh bash toolbar:false gutter:false> 
-#!/bin/bash 
-# 
-#/etc/cron.d/performance 
-#* * * * * root /home/fasthandle/scripts/ps.sh > /dev/null 2>&1 
- 
-LOGDIR=/var/log/performance 
-[ -d "$LOGDIR" ] || mkdir $LOGDIR 
- 
-NUM=1 
-while [ "${NUM}" -le 4 ] 
-do 
-    echo "`date` ##################################################" >> ${LOGDIR}/ps.`date +%Y%m%d` 
-    ps auxwf >> ${LOGDIR}/ps.`date +%Y%m%d` 
-    NUM=`expr ${NUM} + 1` 
-    sleep 15 
-done 
- 
-</sxh> 
- 
-<code> 
-~]# ps auxwf 
-USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND 
-root          0.0  0.0      0     0 ?        S    00:33   0:00 [kthreadd] 
-root          0.0  0.0      0     0 ?        S    00:33   0:00  \_ [ksoftirqd/0] 
-root          0.0  0.0      0     0 ?        S<   00:33   0:00  \_ [kworker/0:0H] 
-root          0.0  0.0      0     0 ?        S    00:33   0:00  \_ [kworker/u4:0] 
-root          0.0  0.0      0     0 ?        S    00:33   0:00  \_ [migration/0] 
-root          0.0  0.0      0     0 ?        S    00:33   0:00  \_ [rcu_bh] 
-root          0.0  0.0      0     0 ?        S    00:33   0:00  \_ [rcuob/0] 
-root        10  0.0  0.0      0     0 ?        S    00:33   0:00  \_ [rcuob/1] 
-............. 
-abbr 
-............. 
-root       898  0.0  0.4  83020  3652 ?        Ss   00:33   0:00 /usr/sbin/sshd -D 
-root      2532  0.0  0.7 141764  5700 ?        Ss   00:34   0:00  \_ sshd: root@pts/0 
-root      2534  0.0  0.4 116448  3096 pts/0    Ss+  00:34   0:00  |   \_ -bash 
-root      2668  0.0  0.7 141764  5700 ?        Ss   00:41   0:00  \_ sshd: root@pts/1 
-root      2670  0.0  0.4 116448  3096 pts/1    Ss   00:41   0:00      \_ -bash 
-root      2839  0.0  0.2 139628  1764 pts/1    R+   00:55   0:00          \_ ps auxwf 
-root       910  0.0  1.5 379552 12068 ?        Ss   00:33   0:00 php-fpm: master process (/etc/php-fpm.conf) 
-nginx     1338  0.0  0.7 379552  5468 ?        S    00:33   0:00  \_ php-fpm: pool www 
-nginx     1339  0.0  0.7 379552  5468 ?        S    00:33   0:00  \_ php-fpm: pool www 
-nginx     1340  0.0  0.7 379552  5472 ?        S    00:33   0:00  \_ php-fpm: pool www 
-nginx     1341  0.0  0.7 379552  5472 ?        S    00:33   0:00  \_ php-fpm: pool www 
-nginx     1342  0.0  0.7 379552  5472 ?        S    00:33   0:00  \_ php-fpm: pool www 
-</code> 
- 
-\\ 
-===== top.sh ===== 
-<sxh bash toolbar:false gutter:false> 
-#!/bin/sh 
-# 
-# /etc/cron.d/performance 
-# * * * * * root /home/fasthandle/scripts/top.sh > /dev/null 2>&1 
- 
-LOGDIR=/var/log/performance 
-[ -d "$DIR" ] || mkdir $DIR 
- 
-NUM=1 
-while [ "${NUM}" -le 4 ] 
-do 
-    echo "##################################################" >> ${LOGDIR}/top.`date +%Y%m%d` 
-    top -b -n 1 >> ${LOGDIR}/top.`date +%Y%m%d` 
-    NUM=`expr ${NUM} + 1` 
-    sleep 15 
-done 
-</sxh> 
  
  
  
 \\ \\
-===== df.sh =====+==== df.sh ====
  
 <sxh bash toolbar:false gutter:false> <sxh bash toolbar:false gutter:false>
Line 243: Line 227:
 17/11/30 01:58:50 tmpfs                         75M    0M       75M   0% /run/user/0 17/11/30 01:58:50 tmpfs                         75M    0M       75M   0% /run/user/0
 </code> </code>
 +
  
 \\ \\
-===== netstat -i ===== +\\ 
-netstat -i is check error packet.+===== Network Details===== 
 +==== sar -n DEV ==== 
 +<code> 
 +~]# sar -n DEV 2 3 
 +Linux 3.10.0-229.el7.x86_64 (centos7)   01/15/18        _x86_64_        (2 CPU) 
 + 
 +00:44:43        IFACE   rxpck/  txpck/   rxkB/   txkB/  rxcmp/  txcmp/ rxmcst/s 
 +00:44:45       enp0s3      0.50      0.50      0.03      0.10      0.00      0.00      0.00 
 +00:44:45           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00 
 + 
 +00:44:45        IFACE   rxpck/  txpck/   rxkB/   txkB/  rxcmp/  txcmp/ rxmcst/s 
 +00:44:47    br-295e2a4e2c26      0.00      0.00      0.00      0.00      0.00      0.00      0.00 
 +00:44:47           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00 
 + 
 +00:44:47        IFACE   rxpck/  txpck/   rxkB/   txkB/  rxcmp/  txcmp/ rxmcst/s 
 +00:44:49       enp0s3      0.50      0.50      0.03      0.30      0.00      0.00      0.00 
 +00:44:49           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00 
 + 
 +Average:        IFACE   rxpck/  txpck/   rxkB/   txkB/  rxcmp/  txcmp/ rxmcst/s 
 +Average:       enp0s3      0.67      0.67      0.04      0.24      0.00      0.00      0.00 
 +Average:           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00 
 +</code> 
 + 
 +==== netstat-i.sh ==== 
 +netstat -i is check error packet with every interfaces.
  
 <sxh bash toolbar:false gutter:false> <sxh bash toolbar:false gutter:false>
Line 280: Line 289:
  
 \\ \\
-===== netstat -s =====+==== netstat-s.sh ====
  
 <sxh bash toolbar:false gutter:false> <sxh bash toolbar:false gutter:false>
Line 332: Line 341:
     0 send buffer errors     0 send buffer errors
 </code> </code>
 +
 +
 +\\
 +\\
 +===== Process Details=====
 +==== top.sh ====
 +<sxh bash toolbar:false gutter:false>
 +#!/bin/sh
 +#
 +# /etc/cron.d/performance
 +# * * * * * root /home/fasthandle/scripts/top.sh > /dev/null 2>&1
 +
 +LOGDIR=/var/log/performance
 +[ -d "$DIR" ] || mkdir $DIR
 +
 +NUM=1
 +while [ "${NUM}" -le 4 ]
 +do
 +    echo "##################################################" >> ${LOGDIR}/top.`date +%Y%m%d`
 +    top -b -n 1 >> ${LOGDIR}/top.`date +%Y%m%d`
 +    NUM=`expr ${NUM} + 1`
 +    sleep 15
 +done
 +</sxh>
 +
 +<code>
 +~]# top -b -n 1
 +top - 00:54:49 up 31 min,  1 user,  load average: 0.05, 0.03, 0.05
 +Tasks: 154 total,   2 running, 152 sleeping,   0 stopped,   0 zombie
 +%Cpu(s):  0.1 us,  0.1 sy,  0.0 ni, 99.5 id,  0.3 wa,  0.0 hi,  0.0 si,  0.0 st
 +KiB Mem :   759000 total,   250200 free,   244004 used,   264796 buff/cache
 +KiB Swap:   839676 total,   839676 free,        0 used.   389024 avail Mem
 +
 +  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 +    1 root      20     41116   3620   2388 S   0.0  0.5   0:00.76 systemd
 +    2 root      20              0      0 S   0.0  0.0   0:00.00 kthreadd
 +    3 root      20              0      0 S   0.0  0.0   0:00.01 ksoftirqd/0
 +    5 root       0 -20            0      0 S   0.0  0.0   0:00.00 kworker/0:0H
 +    6 root      20              0      0 S   0.0  0.0   0:00.05 kworker/u4:0
 +    7 root      rt              0      0 S   0.0  0.0   0:00.05 migration/0
 +    8 root      20              0      0 S   0.0  0.0   0:00.00 rcu_bh
 +    9 root      20              0      0 S   0.0  0.0   0:00.00 rcuob/0
 +   10 root      20              0      0 S   0.0  0.0   0:00.00 rcuob/1
 +...
 +</code>
 +
 +
 +\\
 +==== ps.sh ====
 +<sxh bash toolbar:false gutter:false>
 +#!/bin/bash
 +#
 +#/etc/cron.d/performance
 +#* * * * * root /home/fasthandle/scripts/ps.sh > /dev/null 2>&1
 +
 +LOGDIR=/var/log/performance
 +[ -d "$LOGDIR" ] || mkdir $LOGDIR
 +
 +NUM=1
 +while [ "${NUM}" -le 4 ]
 +do
 +    echo "`date` ##################################################" >> ${LOGDIR}/ps.`date +%Y%m%d`
 +    ps auxwf >> ${LOGDIR}/ps.`date +%Y%m%d`
 +    NUM=`expr ${NUM} + 1`
 +    sleep 15
 +done
 +
 +</sxh>
 +
 +<code>
 +~]# ps auxwf
 +USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
 +root          0.0  0.0      0     0 ?        S    00:33   0:00 [kthreadd]
 +root          0.0  0.0      0     0 ?        S    00:33   0:00  \_ [ksoftirqd/0]
 +root          0.0  0.0      0     0 ?        S<   00:33   0:00  \_ [kworker/0:0H]
 +root          0.0  0.0      0     0 ?        S    00:33   0:00  \_ [kworker/u4:0]
 +root          0.0  0.0      0     0 ?        S    00:33   0:00  \_ [migration/0]
 +root          0.0  0.0      0     0 ?        S    00:33   0:00  \_ [rcu_bh]
 +root          0.0  0.0      0     0 ?        S    00:33   0:00  \_ [rcuob/0]
 +root        10  0.0  0.0      0     0 ?        S    00:33   0:00  \_ [rcuob/1]
 +.............
 +abbr
 +.............
 +root       898  0.0  0.4  83020  3652 ?        Ss   00:33   0:00 /usr/sbin/sshd -D
 +root      2532  0.0  0.7 141764  5700 ?        Ss   00:34   0:00  \_ sshd: root@pts/0
 +root      2534  0.0  0.4 116448  3096 pts/0    Ss+  00:34   0:00  |   \_ -bash
 +root      2668  0.0  0.7 141764  5700 ?        Ss   00:41   0:00  \_ sshd: root@pts/1
 +root      2670  0.0  0.4 116448  3096 pts/1    Ss   00:41   0:00      \_ -bash
 +root      2839  0.0  0.2 139628  1764 pts/1    R+   00:55   0:00          \_ ps auxwf
 +root       910  0.0  1.5 379552 12068 ?        Ss   00:33   0:00 php-fpm: master process (/etc/php-fpm.conf)
 +nginx     1338  0.0  0.7 379552  5468 ?        S    00:33   0:00  \_ php-fpm: pool www
 +nginx     1339  0.0  0.7 379552  5468 ?        S    00:33   0:00  \_ php-fpm: pool www
 +nginx     1340  0.0  0.7 379552  5472 ?        S    00:33   0:00  \_ php-fpm: pool www
 +nginx     1341  0.0  0.7 379552  5472 ?        S    00:33   0:00  \_ php-fpm: pool www
 +nginx     1342  0.0  0.7 379552  5472 ?        S    00:33   0:00  \_ php-fpm: pool www
 +</code>
 +
 +
  
  
Line 338: Line 445:
 \\ \\
 \\ \\
-[[os:conf.html]]+[[os:set:index.html]]
  
 \\ \\


os/linux/set/performance/etc_cron.d_performance.html.txt · Last modified: 2018/02/04 23:24 by kurihara