FastHandle is fast operation tools for infrastructure configurations and tests.
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
scripts:cron-for-performance.html [2017/11/29 01:32] kurihara |
— (current) | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | [[os: | ||
| - | ====== Performance survey of seconds interval on Cron ====== | ||
| - | |||
| - | \\ | ||
| - | {{INLINETOC}} | ||
| - | \\ | ||
| - | |||
| - | ===== / | ||
| - | <sxh bash toolbar: | ||
| - | ===== / | ||
| - | <sxh bash toolbar: | ||
| - | SHELLDIR=/ | ||
| - | LOGDIR=/ | ||
| - | |||
| - | 0 0 * * * root ${SHELLDIR}/ | ||
| - | 0 0 * * * root ${SHELLDIR}/ | ||
| - | 0 0 * * * root ${SHELLDIR}/ | ||
| - | * * * * * root ${SHELLDIR}/ | ||
| - | * * * * * root ${SHELLDIR}/ | ||
| - | |||
| - | 5 0 * * * root find ${LOGDIR} -type f -name " | ||
| - | 10 0 * * * root gzip ${LOGDIR}/ | ||
| - | </ | ||
| - | |||
| - | </ | ||
| - | |||
| - | \\ | ||
| - | ===== vmstat.sh ===== | ||
| - | **memory, swap, io, system, cpu** | ||
| - | |||
| - | <sxh bash toolbar: | ||
| - | #!/bin/sh | ||
| - | #0 0 * * * / | ||
| - | # daily about 60M | ||
| - | |||
| - | DIR=/ | ||
| - | [ -d " | ||
| - | |||
| - | # 86400sec = 1day = 24h x 60m x 60s | ||
| - | vmstat 1 86400 | awk ' | ||
| - | |||
| - | find ${DIR} -type f -name " | ||
| - | </ | ||
| - | |||
| - | |||
| - | ==Output Example== | ||
| - | < | ||
| - | # vmstat 1 3 | awk ' | ||
| - | 17/11/29 00:18:29 procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- | ||
| - | 17/11/29 00: | ||
| - | 17/11/29 00: | ||
| - | 17/11/29 00: | ||
| - | 17/11/29 00: | ||
| - | </ | ||
| - | |||
| - | \\ | ||
| - | ===== mpstat.sh===== | ||
| - | **CPU** | ||
| - | <sxh bash toolbar: | ||
| - | #!/bin/sh | ||
| - | #0 0 * * * / | ||
| - | |||
| - | DIR=/ | ||
| - | [ -d " | ||
| - | |||
| - | # 86400sec = 1day = 24h x 60m x 60s | ||
| - | mpstat 1 86400 >> ${DIR}/ | ||
| - | |||
| - | find ${DIR} -type f -name " | ||
| - | </ | ||
| - | |||
| - | ==Output Example== | ||
| - | < | ||
| - | # mpstat -P ALL 1 3 | ||
| - | Linux 3.10.0-229.el7.x86_64 (centos7) | ||
| - | |||
| - | 00: | ||
| - | 00: | ||
| - | 00: | ||
| - | 00: | ||
| - | |||
| - | 00: | ||
| - | 00: | ||
| - | 00: | ||
| - | 00: | ||
| - | |||
| - | 00: | ||
| - | 00: | ||
| - | 00: | ||
| - | 00: | ||
| - | |||
| - | Average: | ||
| - | Average: | ||
| - | Average: | ||
| - | Average: | ||
| - | </ | ||
| - | \\ | ||
| - | ===== iostat.sh ===== | ||
| - | **IO** | ||
| - | <sxh bash toolbar: | ||
| - | #!/bin/sh | ||
| - | #0 0 * * * / | ||
| - | # daily about 10M | ||
| - | |||
| - | DIR=/ | ||
| - | [ -d " | ||
| - | |||
| - | # 86400sec = 1day = 24h x 60m x 60s | ||
| - | #iostat -xtm 1 86400 >> ${DIR}/ | ||
| - | iostat -xtm 10 8640 >> ${DIR}/ | ||
| - | |||
| - | find ${DIR} -type f -name " | ||
| - | </ | ||
| - | |||
| - | ==Output Example== | ||
| - | < | ||
| - | # iostat -xtm 1 2 | ||
| - | Linux 3.10.0-229.el7.x86_64 (centos7) | ||
| - | |||
| - | 11/29/17 00:20:58 | ||
| - | avg-cpu: | ||
| - | | ||
| - | |||
| - | Device: | ||
| - | sda | ||
| - | dm-0 0.00 | ||
| - | dm-1 0.00 | ||
| - | dm-2 0.00 | ||
| - | dm-3 0.00 | ||
| - | |||
| - | 11/29/17 00:20:59 | ||
| - | avg-cpu: | ||
| - | | ||
| - | |||
| - | Device: | ||
| - | sda | ||
| - | dm-0 0.00 | ||
| - | dm-1 0.00 | ||
| - | dm-2 0.00 | ||
| - | dm-3 0.00 | ||
| - | |||
| - | </ | ||
| - | |||
| - | \\ | ||
| - | ===== ps.sh ===== | ||
| - | <sxh bash toolbar: | ||
| - | #!/bin/sh | ||
| - | #* * * * * / | ||
| - | |||
| - | DIR=/ | ||
| - | [ -d " | ||
| - | |||
| - | date >> ${DIR}/ | ||
| - | ps auxwf >> ${DIR}/ | ||
| - | |||
| - | find ${DIR} -type f -name " | ||
| - | </ | ||
| - | |||
| - | \\ | ||
| - | ===== top.sh ===== | ||
| - | <sxh bash toolbar: | ||
| - | #!/bin/sh | ||
| - | #* * * * * / | ||
| - | |||
| - | DIR=/ | ||
| - | [ -d " | ||
| - | |||
| - | top -b -n 4 -d 15 >> ${DIR}/ | ||
| - | |||
| - | find ${DIR} -type f -name " | ||
| - | </ | ||
| - | |||
| - | |||
| - | |||
| - | \\ | ||
| - | ===== df.sh ===== | ||
| - | |||
| - | <sxh bash toolbar: | ||
| - | #!/bin/sh | ||
| - | #* * * * * / | ||
| - | |||
| - | DIR=/ | ||
| - | [ -d " | ||
| - | |||
| - | NUM=1 | ||
| - | while [ " | ||
| - | do | ||
| - | df -h | awk ' | ||
| - | NUM=`expr ${NUM} + 1` | ||
| - | sleep 10 | ||
| - | done | ||
| - | |||
| - | find ${DIR} -type f -name " | ||
| - | </ | ||
| - | |||
| - | |||
| - | \\ | ||
| - | \\ | ||
| - | [[os: | ||
| - | |||
| - | \\ | ||
| - | <WRAP box 90%> | ||
| - | [[: | ||
| - | <catlist ..: -noAddPageButton -noHead -sortAscending> | ||
| - | </ | ||
My Sites
SNS
Copyright (c) 2025 FastHandle - IT Operations Examples All Rights Reserved.