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
mysqlbinlog mysql-bin.000045 | \ | |
grep -i -e "^update" -e "^insert" -e "^delete" -e "^replace" -e "^alter" | \ | |
cut -c1-100 | tr '[A-Z]' '[a-z]' | \ | |
sed -e "s/\t/ /g;s/\`//g;s/(.*$//;s/ set .*$//;s/ as .*$//" | sed -e "s/ where .*$//" | \ | |
sort | uniq -c | sort -nr |
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
user="" | |
passwd="" | |
dbname="" | |
for table in `mysql -u$user -p$passwd $dbname -BNe 'show tables'; do | |
mysqldump -u$user -p$passwd --single-transaction $dbname $table |gzip > $table.sql.gz | |
done |
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
mysqladmin ext -i1 | awk ' | |
/Queries/{q=$4-qp;qp=$4} | |
/Threads_connected/{tc=$4} | |
/Threads_running/{printf "%5d %5d %5d\n", q, tc, $4}' |
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
for size in 256M 16G; do | |
for mode in seqwr seqrd rndrd rndwr rndrw; do | |
sysbench --test=fileio --file-num=1 --file-total-size=$size prepare | |
for threads in 1 4 8 16; do | |
echo PARAMS $size $mode $threads> sysbench-size-$size-mode-$mode-threads-$threads | |
sysbench --test=fileio --file-total-size=$size --file-test-mode=$mode\ | |
--max-time=60 --max-requests=10000000 --num-threads=$threads --init-rng=on\ | |
--file-num=1 --file-extra-flags=direct --file-fsync-freq=0 run \ | |
>> sysbench-size-$size-mode-$mode-threads-$threads 2>&1 | |
done |
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/sh | |
DATETIME=`date +%y%m%d.%H%M` | |
LOG_DIR="/var/log/monitor/" | |
INTERVAL=5 | |
COUNT=`expr 3600 \/ $INTERVAL` | |
LOG_FILE=${LOG_DIR}os.${DATETIME}.${INTERVAL}.txt | |
CSV_LOG_FILE=${LOG_DIR}os.${DATETIME}.${INTERVAL}.csv | |
MYSQL_LOG_FILE=${LOG_DIR}os.${DATETIME}.${INTERVAL}.csv |
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/sh | |
# | |
modprobe ipt_MASQUERADE | |
modprobe ip_conntrack_ftp | |
modprobe ip_nat_ftp | |
iptables -F | |
iptables -t nat -F | |
iptables -X | |
iptables -t nat -X | |
###########################INPUT键################################### |
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/sh | |
# set -x | |
# Shell script to monitor or watch the disk space | |
# It will send an email to $ADMIN, if the (free available) percentage of space is >= 90%. | |
# ------------------------------------------------------------------------- | |
# Set admin email so that you can get email. | |
ADMIN="root" | |
# set alert level 90% is default | |
ALERT=90 | |
# Exclude list of unwanted monitoring, if several partions then use "|" to separate the partitions. |
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
awk 'BEGIN {printf "%s\t%s\n", "Connect","TpmC"}; {if ($0 ~ /connection/){printf "%s\t", $2} ;if ($0 ~/[0-9].*TpmC/) {print $1}}' tpcc_result_file |
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
awk 'BEGIN {printf "%s%5s%15s%15s\n", "Connect","TPS","QPS","RT"}; {if ($0 ~ /threads:/){printf "%s\t", $4} ;if ($0 ~/transactions:/){sub(/\(/,"");printf "%s\t", $3};if($0~/requests:/){sub(/\(/,"");printf "%s\t",$4};if ($0~/avg:/){print $2}}' |
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/sh | |
# Any Failing Command Will Cause The Script To Stop | |
set -e | |
# Treat Unset Variables As Errors | |
set -u | |
NAGIOS_VERSION=3.5.0 | |
PLUGIN_VERSION=1.4.16 |
OlderNewer