mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-11 21:51:21 +00:00
More fixes:
- pt-mysql-summary's --read-samples shouldn't need an active connection - Bunch of pt-summary bugs, particularly several relating to disks.
This commit is contained in:
@@ -1036,7 +1036,7 @@ parse_mysqld_instances () {
|
||||
echo " ===== ========================== ==== === ======"
|
||||
|
||||
grep '/mysqld ' "$file" | while read line; do
|
||||
local pid=$(echo "$line" | awk '{print $2;}')
|
||||
local pid=$(echo "$line" | awk '{print $1;}')
|
||||
for word in ${line}; do
|
||||
if echo "${word}" | grep -- "--socket=" > /dev/null; then
|
||||
socket="$(echo "${word}" | cut -d= -f2)"
|
||||
@@ -2260,7 +2260,9 @@ if [ "${0##*/}" = "$TOOL" ] \
|
||||
fi
|
||||
|
||||
# Check if mysql and mysqldump are there, otherwise bail out early.
|
||||
check_mysql
|
||||
# But don't if they passed in --read-samples, since we don't need
|
||||
# a connection then.
|
||||
[ "$OPT_READ_SAMPLES" ] || check_mysql
|
||||
|
||||
main "$@"
|
||||
fi
|
||||
|
@@ -13,6 +13,13 @@ TOOL="pt-summary"
|
||||
POSIXLY_CORRECT=1
|
||||
export POSIXLY_CORRECT
|
||||
|
||||
# Begin by setting the $PATH to include some common locations that are not
|
||||
# always in the $PATH, including the "sbin" locations, and some common
|
||||
# locations for proprietary management software, such as RAID controllers.
|
||||
export PATH="${PATH}:/usr/local/bin:/usr/bin:/bin:/usr/libexec"
|
||||
export PATH="${PATH}:/usr/local/sbin:/usr/sbin:/sbin"
|
||||
export PATH="${PATH}:/usr/StorMan/:/opt/MegaRAID/MegaCli/";
|
||||
|
||||
# ###########################################################################
|
||||
# log_warn_die package
|
||||
# This package is a copy without comments from the original. The original
|
||||
@@ -856,7 +863,7 @@ linux_exclusive_collection () { local PTFUNCNAME=linux_exclusive_collection;
|
||||
echo "dirtystatus $(awk '/vm.dirty_bytes/{print $3}' "$data_dir/sysctl"), $(awk '/vm.dirty_background_bytes/{print $3}' "$data_dir/sysctl")" >> "$data_dir/summary"
|
||||
fi
|
||||
|
||||
schedulers_and_queue_size "$data_dir/summary" "$data_dir/partitioning"
|
||||
schedulers_and_queue_size "$data_dir/summary" > "$data_dir/partitioning"
|
||||
|
||||
for file in dentry-state file-nr inode-nr; do
|
||||
echo "${file} $(cat /proc/sys/fs/${file} 2>&1)" >> "$data_dir/summary"
|
||||
@@ -1103,15 +1110,14 @@ find_raid_controller_lspci () { local PTFUNCNAME=find_raid_controller_lspci;
|
||||
|
||||
schedulers_and_queue_size () { local PTFUNCNAME=schedulers_and_queue_size;
|
||||
local file="$1"
|
||||
local disk_partitioning_file="$2"
|
||||
|
||||
local disks="$(ls /sys/block/ | grep -v -e ram -e loop -e 'fd[0-9]')"
|
||||
echo "disks $disks" >> "$file"
|
||||
echo "" > "$disk_partitioning_file"
|
||||
local disks="$(ls /sys/block/ | grep -v -e ram -e loop -e 'fd[0-9]' | xargs echo)"
|
||||
echo "internal::disks $disks" >> "$file"
|
||||
|
||||
for disk in $disks; do
|
||||
if [ -e "/sys/block/${disk}/queue/scheduler" ]; then
|
||||
echo "internal::${disk} $(cat /sys/block/${disk}/queue/scheduler | grep -o '\[.*\]') $(cat /sys/block/${disk}/queue/nr_requests)" >> "$file"
|
||||
fdisk -l "/dev/${disk}" >> "$disk_partitioning_file" 2>/dev/null
|
||||
fdisk -l "/dev/${disk}" 2>/dev/null
|
||||
fi
|
||||
done
|
||||
}
|
||||
@@ -1135,7 +1141,7 @@ top_processes () { local PTFUNCNAME=top_processes;
|
||||
|
||||
notable_processes_info () { local PTFUNCNAME=notable_processes_info;
|
||||
local format="%5s %+2d %s\n"
|
||||
local sshd_pid=$(_pidof "/usr/sbin/sshd")
|
||||
local sshd_pid=$(ps -eo pid,args | awk '$2 ~ /\/usr\/sbin\/sshd/ { print $1; exit }')
|
||||
|
||||
echo " PID OOM COMMAND"
|
||||
|
||||
@@ -1506,7 +1512,7 @@ parse_filesystems () { local PTFUNCNAME=parse_filesystems;
|
||||
parse_fdisk () { local PTFUNCNAME=parse_fdisk;
|
||||
local file="$1"
|
||||
|
||||
[ -e "$file" ] || return
|
||||
[ -e "$file" -a -s "$file" ] || return
|
||||
|
||||
awk '
|
||||
BEGIN {
|
||||
@@ -1972,9 +1978,10 @@ report_system_summary () { local PTFUNCNAME=report_system_summary;
|
||||
if [ "${platform}" = "Linux" ]; then
|
||||
|
||||
section "Disk_Schedulers_And_Queue_Size"
|
||||
local disks="$( get_var disks "$data_dir/summary" )"
|
||||
for disk in ${disks}; do
|
||||
name_val "${disk}" "$( get_var "internal::${disk}" "$data_dir/summary" )"
|
||||
local disks="$( get_var "internal::disks" "$data_dir/summary" )"
|
||||
for disk in $disks; do
|
||||
local scheduler="$( get_var "internal::${disk}" "$data_dir/summary" )"
|
||||
name_val "${disk}" "${scheduler:-"UNREADABLE"}"
|
||||
done
|
||||
|
||||
section "Disk_Partioning"
|
||||
@@ -2063,13 +2070,6 @@ main () { local PTFUNCNAME=main;
|
||||
|
||||
_d "Starting $0 $RAN_WITH"
|
||||
|
||||
# Begin by setting the $PATH to include some common locations that are not
|
||||
# always in the $PATH, including the "sbin" locations, and some common
|
||||
# locations for proprietary management software, such as RAID controllers.
|
||||
export PATH="${PATH}:/usr/local/bin:/usr/bin:/bin:/usr/libexec"
|
||||
export PATH="${PATH}:/usr/local/sbin:/usr/sbin:/sbin"
|
||||
export PATH="${PATH}:/usr/StorMan/:/opt/MegaRAID/MegaCli/";
|
||||
|
||||
# Set up temporary files.
|
||||
mk_tmpdir
|
||||
|
||||
|
@@ -147,7 +147,7 @@ linux_exclusive_collection () { local PTFUNCNAME=linux_exclusive_collection;
|
||||
echo "dirtystatus $(awk '/vm.dirty_bytes/{print $3}' "$data_dir/sysctl"), $(awk '/vm.dirty_background_bytes/{print $3}' "$data_dir/sysctl")" >> "$data_dir/summary"
|
||||
fi
|
||||
|
||||
schedulers_and_queue_size "$data_dir/summary" "$data_dir/partitioning"
|
||||
schedulers_and_queue_size "$data_dir/summary" > "$data_dir/partitioning"
|
||||
|
||||
for file in dentry-state file-nr inode-nr; do
|
||||
echo "${file} $(cat /proc/sys/fs/${file} 2>&1)" >> "$data_dir/summary"
|
||||
@@ -417,15 +417,14 @@ find_raid_controller_lspci () { local PTFUNCNAME=find_raid_controller_lspci;
|
||||
|
||||
schedulers_and_queue_size () { local PTFUNCNAME=schedulers_and_queue_size;
|
||||
local file="$1"
|
||||
local disk_partitioning_file="$2"
|
||||
|
||||
local disks="$(ls /sys/block/ | grep -v -e ram -e loop -e 'fd[0-9]')"
|
||||
echo "disks $disks" >> "$file"
|
||||
echo "" > "$disk_partitioning_file"
|
||||
local disks="$(ls /sys/block/ | grep -v -e ram -e loop -e 'fd[0-9]' | xargs echo)"
|
||||
echo "internal::disks $disks" >> "$file"
|
||||
|
||||
for disk in $disks; do
|
||||
if [ -e "/sys/block/${disk}/queue/scheduler" ]; then
|
||||
echo "internal::${disk} $(cat /sys/block/${disk}/queue/scheduler | grep -o '\[.*\]') $(cat /sys/block/${disk}/queue/nr_requests)" >> "$file"
|
||||
fdisk -l "/dev/${disk}" >> "$disk_partitioning_file" 2>/dev/null
|
||||
fdisk -l "/dev/${disk}" 2>/dev/null
|
||||
fi
|
||||
done
|
||||
}
|
||||
@@ -449,7 +448,7 @@ top_processes () { local PTFUNCNAME=top_processes;
|
||||
|
||||
notable_processes_info () { local PTFUNCNAME=notable_processes_info;
|
||||
local format="%5s %+2d %s\n"
|
||||
local sshd_pid=$(_pidof "/usr/sbin/sshd")
|
||||
local sshd_pid=$(ps -eo pid,args | awk '$2 ~ /\/usr\/sbin\/sshd/ { print $1; exit }')
|
||||
|
||||
echo " PID OOM COMMAND"
|
||||
|
||||
|
@@ -114,7 +114,7 @@ parse_mysqld_instances () {
|
||||
echo " ===== ========================== ==== === ======"
|
||||
|
||||
grep '/mysqld ' "$file" | while read line; do
|
||||
local pid=$(echo "$line" | awk '{print $2;}')
|
||||
local pid=$(echo "$line" | awk '{print $1;}')
|
||||
for word in ${line}; do
|
||||
# Some grep doesn't have -o, so I have to pull out the words I want by
|
||||
# looking at each word
|
||||
|
@@ -384,7 +384,7 @@ parse_filesystems () { local PTFUNCNAME=parse_filesystems;
|
||||
parse_fdisk () { local PTFUNCNAME=parse_fdisk;
|
||||
local file="$1"
|
||||
|
||||
[ -e "$file" ] || return
|
||||
[ -e "$file" -a -s "$file" ] || return
|
||||
|
||||
awk '
|
||||
BEGIN {
|
||||
@@ -922,9 +922,10 @@ report_system_summary () { local PTFUNCNAME=report_system_summary;
|
||||
if [ "${platform}" = "Linux" ]; then
|
||||
|
||||
section "Disk_Schedulers_And_Queue_Size"
|
||||
local disks="$( get_var disks "$data_dir/summary" )"
|
||||
for disk in ${disks}; do
|
||||
name_val "${disk}" "$( get_var "internal::${disk}" "$data_dir/summary" )"
|
||||
local disks="$( get_var "internal::disks" "$data_dir/summary" )"
|
||||
for disk in $disks; do
|
||||
local scheduler="$( get_var "internal::${disk}" "$data_dir/summary" )"
|
||||
name_val "${disk}" "${scheduler:-"UNREADABLE"}"
|
||||
done
|
||||
|
||||
section "Disk_Partioning"
|
||||
|
@@ -1364,6 +1364,7 @@ Architecture | CPU = 32-bit, OS = 32-bit
|
||||
udev 995M 1% devtmpfs rw,mode=0755 /dev
|
||||
# Disk Schedulers And Queue Size #############################
|
||||
sda | [cfq] 128
|
||||
sdb | [cfq] 128
|
||||
# Disk Partioning ############################################
|
||||
Device Type Start End Size
|
||||
============ ==== ========== ========== ==================
|
||||
@@ -1383,7 +1384,7 @@ dentry-state | 78471 67588 45 0 0 0
|
||||
file-nr | 9248 0 203574
|
||||
inode-nr | 70996 10387
|
||||
# LVM Volumes ################################################
|
||||
No volume groups found
|
||||
No volume groups found
|
||||
# RAID Controller ############################################
|
||||
Controller | No RAID controller detected
|
||||
# Network Config #############################################
|
||||
@@ -1432,6 +1433,7 @@ No volume groups found
|
||||
EOF
|
||||
|
||||
report_system_summary "$samples/Linux/001" | tail -n +3 > "$TMPDIR/got"
|
||||
cp "$TMPDIR/got" yadda.txt
|
||||
no_diff "$TMPDIR/got" "$TMPDIR/expected" "report_system_summary works with samples from Linux (Ubuntu)"
|
||||
|
||||
report_system_summary "$samples/Linux/002" | tail -n +3 > "$TMPDIR/got"
|
||||
|
@@ -15,8 +15,7 @@ rss 1233723392
|
||||
swappiness 60
|
||||
dirtypolicy 20, 10
|
||||
raid_controller No RAID controller detected
|
||||
disks sda
|
||||
sdb
|
||||
internal::disks sda sdb
|
||||
internal::sda [cfq] 128
|
||||
internal::sdb [cfq] 128
|
||||
dentry-state 78471 67588 45 0 0 0
|
||||
|
@@ -11,11 +11,7 @@ raid_controller No RAID controller detected
|
||||
threading NPTL 2.5
|
||||
getenforce No SELinux detected
|
||||
swappiness
|
||||
disks dm-0
|
||||
dm-1
|
||||
hda
|
||||
hdc
|
||||
md0
|
||||
internal::disks dm-0 dm-1 hda hdc md0
|
||||
internal::hda [cfq] 128
|
||||
internal::hdc [cfq] 128
|
||||
dentry-state 9392 7451 45 0 0 0
|
||||
|
@@ -11,11 +11,7 @@ raid_controller No RAID controller detected
|
||||
threading NPTL 2.5
|
||||
getenforce No SELinux detected
|
||||
swappiness
|
||||
disks dm-0
|
||||
dm-1
|
||||
hda
|
||||
hdc
|
||||
md0
|
||||
internal::disks dm-0 dm-1 hda hdc md0
|
||||
internal::hda [cfq] 128
|
||||
internal::hdc [cfq] 128
|
||||
dentry-state 9175 7239 45 0 0 0
|
||||
|
@@ -29,7 +29,11 @@ Architecture | CPU = 32-bit, OS = 32-bit
|
||||
/dev/mapper/VolGroup00-LogVol00 5.7G 20% ext3 rw /
|
||||
tmpfs 506M 0% tmpfs rw /dev/shm
|
||||
# Disk Schedulers And Queue Size #############################
|
||||
dm-0 |
|
||||
dm-0 | UNREADABLE
|
||||
dm-1 | UNREADABLE
|
||||
hda | [cfq] 128
|
||||
hdc | [cfq] 128
|
||||
md0 | UNREADABLE
|
||||
# Disk Partioning ############################################
|
||||
Device Type Start End Size
|
||||
============ ==== ========== ========== ==================
|
||||
|
@@ -29,7 +29,11 @@ Architecture | CPU = 32-bit, OS = 32-bit
|
||||
/dev/mapper/VolGroup00-LogVol00 5.7G 20% ext3 rw /
|
||||
tmpfs 506M 0% tmpfs rw /dev/shm
|
||||
# Disk Schedulers And Queue Size #############################
|
||||
dm-0 |
|
||||
dm-0 | UNREADABLE
|
||||
dm-1 | UNREADABLE
|
||||
hda | [cfq] 128
|
||||
hdc | [cfq] 128
|
||||
md0 | UNREADABLE
|
||||
# Disk Partioning ############################################
|
||||
Device Type Start End Size
|
||||
============ ==== ========== ========== ==================
|
||||
|
Reference in New Issue
Block a user