mirror of
https://github.com/percona/percona-toolkit.git
synced 2026-04-17 01:01:39 +08:00
Suppress ls output when it fails. Handle missing diskstats and vmstat. Shorten synopsis.
This commit is contained in:
27
bin/pt-sift
27
bin/pt-sift
@@ -59,7 +59,11 @@ rm_tmpdir() {
|
|||||||
# ###########################################################################
|
# ###########################################################################
|
||||||
|
|
||||||
TOOL="pt-sift"
|
TOOL="pt-sift"
|
||||||
|
if [ -d "/var/lib/pt-stalk" ]; then
|
||||||
|
BASEDIR="/var/lib/pt-stalk"
|
||||||
|
else
|
||||||
BASEDIR="$PWD"
|
BASEDIR="$PWD"
|
||||||
|
fi
|
||||||
PREFIX=""
|
PREFIX=""
|
||||||
|
|
||||||
# ###########################################################################
|
# ###########################################################################
|
||||||
@@ -150,7 +154,7 @@ main() {
|
|||||||
# there is no PREFIX yet. NOTE: we rely on the "-df" files here.
|
# there is no PREFIX yet. NOTE: we rely on the "-df" files here.
|
||||||
(
|
(
|
||||||
cd "$BASEDIR"
|
cd "$BASEDIR"
|
||||||
ls *-df | cut -d- -f1 | sort > "$PT_TMPDIR/pt-sift.prefixes"
|
ls *-df 2>/dev/null | cut -d- -f1 | sort > "$PT_TMPDIR/pt-sift.prefixes"
|
||||||
)
|
)
|
||||||
if [ ! -s "$PT_TMPDIR/pt-sift.prefixes" ]; then
|
if [ ! -s "$PT_TMPDIR/pt-sift.prefixes" ]; then
|
||||||
echo "Error: There are no pt-stalk files in $BASEDIR" >&2
|
echo "Error: There are no pt-stalk files in $BASEDIR" >&2
|
||||||
@@ -206,6 +210,7 @@ main() {
|
|||||||
# Format a brief report: busiest device's disk stats, CPU stats
|
# Format a brief report: busiest device's disk stats, CPU stats
|
||||||
DEFAULT)
|
DEFAULT)
|
||||||
echo "--diskstats--"
|
echo "--diskstats--"
|
||||||
|
if [ -f "${BASEDIR}/${PREFIX}-diskstats" ]; then
|
||||||
|
|
||||||
$PR_diskstats --group-by disk "${BASEDIR}/${PREFIX}-diskstats" \
|
$PR_diskstats --group-by disk "${BASEDIR}/${PREFIX}-diskstats" \
|
||||||
| awk '
|
| awk '
|
||||||
@@ -256,8 +261,12 @@ main() {
|
|||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
echo
|
echo
|
||||||
|
else
|
||||||
|
echo " No diskstats file exists"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "--vmstat--"
|
echo "--vmstat--"
|
||||||
|
if [ -f "${BASEDIR}/${PREFIX}-vmstat" ]; then
|
||||||
tail -n 3 "${BASEDIR}/${PREFIX}-vmstat-overall" | $PR_align
|
tail -n 3 "${BASEDIR}/${PREFIX}-vmstat-overall" | $PR_align
|
||||||
|
|
||||||
# Figure out which column is 'wa' and print this, similar to the
|
# Figure out which column is 'wa' and print this, similar to the
|
||||||
@@ -280,6 +289,9 @@ main() {
|
|||||||
}
|
}
|
||||||
}" "${BASEDIR}/${PREFIX}-vmstat"
|
}" "${BASEDIR}/${PREFIX}-vmstat"
|
||||||
echo
|
echo
|
||||||
|
else
|
||||||
|
echo " No vmstat file exists"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "--innodb--"
|
echo "--innodb--"
|
||||||
awk '
|
awk '
|
||||||
@@ -594,13 +606,12 @@ pt-sift - Browses files created by pt-stalk.
|
|||||||
Usage: pt-sift FILE|PREFIX|DIRECTORY
|
Usage: pt-sift FILE|PREFIX|DIRECTORY
|
||||||
|
|
||||||
pt-sift browses files created by L<pt-stalk>. If no options are given,
|
pt-sift browses files created by L<pt-stalk>. If no options are given,
|
||||||
the tool browses all pt-stalk files in the current working directory.
|
the tool browses all pt-stalk files in C</var/lib/pt-stalk> if that directory
|
||||||
Specify a DIRECTORY to browse all files in that directory. Specify
|
exists, else the current working directory is used. If a FILE is given,
|
||||||
a FILE to browse all files with the same prefix in that file's directory.
|
the tool browses files with the same prefix in the given file's directory.
|
||||||
Specify a PREFIX to browse all files in the current working directory
|
If a PREFIX is given, the tool browses files in C</var/lib/pt-stalk>
|
||||||
with that prefix. Prefixes are timestamps like C<2012_07_23_14_27_11>.
|
(or the current working directory) with the same prefix. If a DIRECTORY
|
||||||
The tool prompts for a prefix if more than is found, else the only available
|
is given, the tool browses all pt-stalk files in it.
|
||||||
prefix is used by default.
|
|
||||||
|
|
||||||
=head1 RISKS
|
=head1 RISKS
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user