Last active
December 20, 2015 18:09
-
-
Save bageljp/6173799 to your computer and use it in GitHub Desktop.
サーバのリソースチェックスクリプト群。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DATE="`date +%Y%m%d`" | |
HOUR="`date +%H`" | |
DATETIME="${DATE}_${HOUR}`date +%M%S`" | |
OUT_DIR="/tmp/${DATE}/${HOUR}" | |
OUTPUT="${OUT_DIR}/`basename $0 .bash`_`hostname`_${DATETIME}" | |
CMD_TCPDUMP="/usr/sbin/tcpdump" | |
SLEEP=30 | |
CAP_IF="eth1" | |
[ ! -d ${OUT_DIR} ] && mkdir -p ${OUT_DIR} | |
#${CMD_TCPDUMP} -i ${CAP_IF} not port fs-qos -vvv -n -s 65535 -w ${OUTPUT} 2> /dev/null & | |
${CMD_TCPDUMP} -i ${CAP_IF} not port 38711 and not port fs-qos -vvv -n -s 65535 -w ${OUTPUT} 2> /dev/null & | |
PID=$! | |
sleep ${SLEEP} | |
kill ${PID} | |
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DATE="`date +%Y%m%d`" | |
HOUR="`date +%H`" | |
DATETIME="${DATE}_${HOUR}`date +%M%S`" | |
OUT_DIR="/usr/local/tlab/tmp/${DATE}/${HOUR}" | |
OUTPUT="${OUT_DIR}/`basename $0 .bash`_`hostname`_${DATETIME}" | |
COUNT=3 | |
SLEEP=10 | |
cnt=0 | |
[ ! -d ${OUT_DIR} ] && mkdir -p ${OUT_DIR} | |
while [ ${cnt} -lt ${COUNT} ]; do | |
echo "===== `date +'%Y%m%d %H%M%S'` START =====" >> ${OUTPUT} | |
cat /proc/diskstats | grep sd >> ${OUTPUT} | |
echo "===== `date +'%Y%m%d %H%M%S'` END =====" >> ${OUTPUT} | |
echo -e "\n\n\n" >> ${OUTPUT} | |
cnt=$((${cnt}+1)) | |
sleep ${SLEEP} | |
done | |
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DATE="`date +%Y%m%d`" | |
HOUR="`date +%H`" | |
DATETIME="${DATE}_${HOUR}`date +%M%S`" | |
OUT_DIR="/usr/local/tlab/tmp/${DATE}/${HOUR}" | |
OUTPUT="${OUT_DIR}/`basename $0 .bash`_`hostname`_${DATETIME}" | |
CMD_IOTOP="/usr/bin/iotop" | |
CMD_IOSTAT="/usr/bin/iostat" | |
COUNT=3 | |
SLEEP=10 | |
cnt=0 | |
[ ! -d ${OUT_DIR} ] && mkdir -p ${OUT_DIR} | |
while [ ${cnt} -lt ${COUNT} ]; do | |
echo "===== `date +'%Y%m%d %H%M%S'` START =====" >> ${OUTPUT} | |
${CMD_IOTOP} -bo -n 1 -k >> ${OUTPUT} | |
echo "===== `date +'%Y%m%d %H%M%S'` END =====" >> ${OUTPUT} | |
echo -e "\n\n\n" >> ${OUTPUT} | |
cnt=$((${cnt}+1)) | |
sleep ${SLEEP} | |
done | |
${CMD_IOSTAT} -kxt 3 10 >> ${OUTPUT} | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment