FastHandle - IT Operations Examples

FastHandle is fast operation tools for infrastructure configurations and tests.

User Tools

Site Tools


scripts:cron-for-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
scripts:cron-for-performance.html [2017/11/29 00:19]
kurihara
— (current)
Line 1: Line 1:
-[[os:info.html|]] 
-====== Performance survey of seconds interval on Cron ====== 
- 
-\\ 
-{{INLINETOC}} 
-\\ 
- 
-===== vmstat.sh(memory, swap, io, system, cpu) ===== 
- 
-<sxh bash toolbar:false gutter:false> 
-#!/bin/sh 
-#0 0 * * * /home/fasthandle/scripts/vmstat.sh > /dev/null 2>&1 
-# daily about 60M 
- 
-DIR=/var/log/performance 
-[ -d "$DIR" ] || mkdir $DIR 
- 
-# 86400sec = 1day = 24h x 60m x 60s 
-vmstat 1 86400 | awk '{print strftime("%y/%m/%d %H:%M:%S"), $0} { system(":") }' >> ${DIR}/vmstat.`date +%Y%m%d` 
- 
-find ${DIR} -type f -name "vmstat*"  -mtime +30  -exec rm -rf {} \; 
-</sxh> 
- 
- 
-==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.sh (cpu) ===== 
-<sxh bash toolbar:false gutter:false> 
-#!/bin/sh 
-#0 0 * * * /home/fasthandle/scripts/mpstat.sh > /dev/null 2>&1 
-  
-DIR=/var/log/performance 
-[ -d "$DIR" ] || mkdir $DIR 
- 
-# 86400sec = 1day = 24h x 60m x 60s 
-mpstat 1 86400 >> ${DIR}/mpstat.`date +%Y%m%d` 
-  
-find ${DIR} -type f -name "mpstat*"  -mtime +30  -exec rm -rf {} \; 
-</sxh> 
- 
-==Output Example== 
-<code> 
-# mpstat -P ALL 1 3 
-Linux 3.10.0-229.el7.x86_64 (centos7)   11/29/17        _x86_64_        (2 CPU) 
- 
-00:17:23     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle 
-00:17:24     all    0.00    0.00    0.00    0.50    0.00    0.00    0.00    0.00    0.00   99.50 
-00:17:24          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 
-00:17:24          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 
- 
-00:17:24     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle 
-00:17:25     all    0.00    0.00    0.50    0.00    0.00    0.00    0.00    0.00    0.00   99.50 
-00:17:25          0.00    0.00    0.00    0.00    0.00    1.00    0.00    0.00    0.00   99.00 
-00:17:25          0.00    0.00    0.00    1.00    0.00    0.00    0.00    0.00    0.00   99.00 
- 
-00:17:25     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle 
-00:17:26     all    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 
-00:17:26          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 
-00:17:26          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 
- 
-Average:     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle 
-Average:     all    0.00    0.00    0.17    0.17    0.00    0.00    0.00    0.00    0.00   99.66 
-Average:          0.00    0.00    0.00    0.00    0.00    0.33    0.00    0.00    0.00   99.67 
-Average:          0.00    0.00    0.00    0.34    0.00    0.00    0.00    0.00    0.00   99.66 
-</code> 
-\\ 
-===== iostat.sh (io) ===== 
-<sxh bash toolbar:false gutter:false> 
-#!/bin/sh 
-#0 0 * * * /home/fasthandle/scripts/iostat.sh > /dev/null 2>&1 
-# daily about 10M 
- 
-DIR=/var/log/performance 
-[ -d "$DIR" ] || mkdir $DIR 
- 
-# 86400sec = 1day = 24h x 60m x 60s 
-#iostat -xtm 1 86400 >> ${DIR}/iostat.`date +%Y%m%d` 
-iostat -xtm 10 8640 >> ${DIR}/iostat.`date +%Y%m%d` 
- 
-find ${DIR} -type f -name "iostat*"  -mtime +30  -exec rm -rf {} \; 
-</sxh> 
- 
-\\ 
-===== ps.sh ===== 
-<sxh bash toolbar:false gutter:false> 
-#!/bin/sh 
-#* * * * * /home/fasthandle/scripts/ps.sh > /dev/null 2>&1 
- 
-DIR=/var/log/performance 
-[ -d "$DIR" ] || mkdir $DIR 
- 
-date >> ${DIR}/ps.`date +%Y%m%d` 
-ps auxwf >> ${DIR}/ps.`date +%Y%m%d` 
- 
-find ${DIR} -type f -name "ps*"  -mtime +30  -exec rm -rf {} \; 
-</sxh> 
- 
-\\ 
-===== top.sh ===== 
-<sxh bash toolbar:false gutter:false> 
-#!/bin/sh 
-#* * * * * /home/fasthandle/scripts/top.sh > /dev/null 2>&1 
- 
-DIR=/var/log/performance 
-[ -d "$DIR" ] || mkdir $DIR 
- 
-top -b -n 4 -d 15 >> ${DIR}/top.`date +%Y%m%d` 
- 
-find ${DIR} -type f -name "top*"  -mtime +30  -exec rm -rf {} \; 
-</sxh> 
- 
- 
- 
-\\ 
-===== df.sh ===== 
- 
-<sxh bash toolbar:false gutter:false> 
-#!/bin/sh 
-#* * * * * /home/fasthandle/scripts/df-h.sh > /dev/null 2>&1 
- 
-DIR=/var/log/performance 
-[ -d "$DIR" ] || mkdir $DIR 
- 
-NUM=1 
-while [ "${NUM}" -le 6 ] 
-do 
-    df -h | awk '{print strftime("%y/%m/%d %H:%M:%S"), $0}' >> ${DIR}/df.`date +%Y%m%d` 
-    NUM=`expr ${NUM} + 1` 
-    sleep 10 
-done 
- 
-find ${DIR} -type f -name "df*"  -mtime +30  -exec rm -rf {} \; 
-</sxh> 
- 
- 
-\\ 
-\\ 
-[[os:info.html|]] 
- 
-\\ 
-<WRAP box 90%> 
-[[:index.html#OS Management|Top#OS Management]] 
-<catlist ..: -noAddPageButton -noHead -sortAscending> 
-</WRAP> 
  


scripts/cron-for-performance.html.1511882349.txt.gz · Last modified: 2017/11/29 00:19 by kurihara