mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-10 13:11:32 +00:00
More quoting and tweaking re Baron's review.
This commit is contained in:
@@ -37,8 +37,8 @@ CMD_TCPDUMP=${CMD_TCPDUMP:-"tcpdump"}
|
||||
CMD_VMSTAT=${CMD_VMSTAT:-"vmstat"}
|
||||
|
||||
collect() {
|
||||
local d=$1 # directory to save results in
|
||||
local p=$2 # prefix for each result file
|
||||
local d="$1" # directory to save results in
|
||||
local p="$2" # prefix for each result file
|
||||
|
||||
# Get pidof mysqld; pidof doesn't exist on some systems. We try our best...
|
||||
local mysqld_pid=$(pidof -s mysqld);
|
||||
@@ -50,7 +50,7 @@ collect() {
|
||||
fi
|
||||
|
||||
# Get memory allocation info before anything else.
|
||||
if [ -x "$CMD_PMAP" -a "$mysqld_pid" ]; then
|
||||
if [ "$mysqld_pid" ]; then
|
||||
if $CMD_PMAP --help 2>&1 | grep -- -x >/dev/null 2>&1 ; then
|
||||
$CMD_PMAP -x $mysqld_pid > "$d/$p-pmap"
|
||||
else
|
||||
@@ -160,7 +160,7 @@ collect() {
|
||||
|
||||
local have_lock_waits_table=0
|
||||
$CMD_MYSQL $EXT_ARGV -e "SHOW TABLES FROM INFORMATION_SCHEMA" \
|
||||
| grep -qi "INNODB_LOCK_WAITS"
|
||||
| grep -i "INNODB_LOCK_WAITS" >/dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
have_lock_waits_table=1
|
||||
fi
|
||||
|
@@ -24,10 +24,10 @@
|
||||
set -u
|
||||
|
||||
disk_space() {
|
||||
local filesystem=${1:-"$PWD"}
|
||||
local filesystem="${1:-$PWD}"
|
||||
# Filesystem 1024-blocks Used Available Capacity Mounted on
|
||||
# /dev/disk0s2 118153176 94409664 23487512 81% /
|
||||
df -P -k $filesystem
|
||||
df -P -k "$filesystem"
|
||||
}
|
||||
|
||||
# Sub: check_disk_space
|
||||
@@ -44,18 +44,18 @@ disk_space() {
|
||||
# Returns:
|
||||
# 0 if there is/will be enough disk space, else 1.
|
||||
check_disk_space() {
|
||||
local file=$1
|
||||
local mb=${2:-"0"}
|
||||
local pc=${3:-"0"}
|
||||
local mb_margin=${4:-"0"}
|
||||
local file="$1"
|
||||
local mb="${2:-0}"
|
||||
local pc="${3:-0}"
|
||||
local mb_margin="${4:-0}"
|
||||
|
||||
# Convert MB to KB because the df output should be in 1k blocks.
|
||||
local kb=$(($mb * 1024))
|
||||
local kb_margin=$(($mb_margin * 1024))
|
||||
|
||||
local kb_used=$(cat $file | awk '/^\//{print $3}');
|
||||
local kb_free=$(cat $file | awk '/^\//{print $4}');
|
||||
local pc_used=$(cat $file | awk '/^\//{print $5}' | sed -e 's/%//g');
|
||||
local kb_used=$(cat "$file" | awk '/^\//{print $3}');
|
||||
local kb_free=$(cat "$file" | awk '/^\//{print $4}');
|
||||
local pc_used=$(cat "$file" | awk '/^\//{print $5}' | sed -e 's/%//g');
|
||||
|
||||
if [ "$kb_margin" -gt "0" ]; then
|
||||
local kb_total=$(($kb_used + $kb_free))
|
||||
|
@@ -20,6 +20,7 @@
|
||||
2011_12_05-opentables1
|
||||
2011_12_05-opentables2
|
||||
2011_12_05-output
|
||||
2011_12_05-pmap
|
||||
2011_12_05-processlist
|
||||
2011_12_05-procstat
|
||||
2011_12_05-procvmstat
|
||||
|
Reference in New Issue
Block a user