Skip to content

Add --fast option to skip top and iostat. #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 20 additions & 13 deletions mdiag/mdiag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
# limitations under the License.


version="2.0.4"
revdate="2017-03-01"
version="2.0.5"
revdate="2020-01-06"

PATH="$PATH${PATH+:}/usr/sbin:/sbin:/usr/bin:/bin"

Expand Down Expand Up @@ -199,17 +199,19 @@ function _main {
section ps runcommand ps -eLFww

# Dynamic/monitoring info
section top
runcommands
COLUMNS=512 top -b -d 1 -n 30 -c | sed -e 's/ *$//g'
endruncommands
endsection
section top_threads
runcommands
COLUMNS=512 top -b -d 1 -n 30 -c -H | sed -e 's/ *$//g'
endruncommands
endsection
section iostat runcommand iostat -xtm 1 120
if [ "$fast" != "y" ]; then
section top
runcommands
COLUMNS=512 top -b -d 1 -n 30 -c | sed -e 's/ *$//g'
endruncommands
endsection
section top_threads
runcommands
COLUMNS=512 top -b -d 1 -n 30 -c -H | sed -e 's/ *$//g'
endruncommands
endsection
section iostat runcommand iostat -xtm 1 120
fi

# Mongo process info
mongo_pids="`pgrep mongo`"
Expand Down Expand Up @@ -506,6 +508,7 @@ function _showhelp {
echo " --txt, --text Output in legacy plain text format"
echo " --json Output in JSON format"
echo " --answer [ynqd] At prompts, answer \"yes\", \"no\", \"quit\" or the default"
echo " --fast Skip checks that take a long time"
echo " --help, -h Show this help"
echo " --version, -v Show the mdiag.sh version"
echo ""
Expand All @@ -521,6 +524,7 @@ function _user_error_fatal {

function _set_defaults {
outputformat=json
fast=n
inhibit_new_version_check=n
inhibit_version_update=n
ref=""
Expand Down Expand Up @@ -557,6 +561,9 @@ function _parse_cmdline {
;;
esac
;;
--fast)
fast=y
;;
--inhibit-new-version-check)
inhibit_new_version_check=y
;;
Expand Down