summaryrefslogtreecommitdiff
path: root/src/multi-dump.sh
diff options
context:
space:
mode:
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>2010-11-18 20:57:15 -0800
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>2010-11-18 20:57:15 -0800
commit9cab522e71d003b328bb3ce2fd0698f52fb8f91f (patch)
tree04ccffc184dbc0fb4111d8940d21b03ae31de81c /src/multi-dump.sh
parent6e2b594b3329cb08bf54cd325776b236f2e6c4f1 (diff)
downloadceph-9cab522e71d003b328bb3ce2fd0698f52fb8f91f.tar.gz
Add multi-dump.sh
This is a debug tool that can dump out Ceph information at various epochs. For instance, it can show how the OSDmap changed over time. Signed-off-by: Colin McCabe <colinm@hq.newdream.net>
Diffstat (limited to 'src/multi-dump.sh')
-rwxr-xr-xsrc/multi-dump.sh79
1 files changed, 79 insertions, 0 deletions
diff --git a/src/multi-dump.sh b/src/multi-dump.sh
new file mode 100755
index 00000000000..f3cf67e706d
--- /dev/null
+++ b/src/multi-dump.sh
@@ -0,0 +1,79 @@
+#!/bin/bash
+
+#
+# multi-dump.sh
+#
+# Dumps interesting information about the Ceph cluster at a series of epochs.
+#
+
+### Functions
+usage() {
+ echo <<EOF
+multi-dump.sh: dumps out ceph maps
+
+-e <start-epoch> What epoch to end with.
+-h This help message
+-s <start-epoch> What epoch to start with. Defaults to 1.
+-t <osdmap> What type of map to dump. Defaults to osdmap.
+EOF
+}
+
+cleanup() {
+ [ -n ${TEMPDIR} ] && rm -rf "${TEMPDIR}"
+}
+
+die() {
+ echo $@
+ exit 1
+}
+
+dump_osdmap() {
+ for v in `seq $START_EPOCH $END_EPOCH`; do
+ ./ceph osd getmap $v -o $TEMPDIR/$v >> $TEMPDIR/cephtool-out \
+ || die "cephtool failed to dump epoch $v"
+ done
+ for v in `seq $START_EPOCH $END_EPOCH`; do
+ echo "************** $v **************"
+ ./osdmaptool --print $TEMPDIR/$v \
+ || die "osdmaptool failed to print epoch $v"
+ done
+}
+
+### Setup
+trap cleanup INT TERM EXIT
+TEMPDIR=`mktemp -d`
+MYDIR=`dirname $0`
+MYDIR=`readlink -f $MYDIR`
+MAP_TYPE=osdmap
+cd $MYDIR
+
+### Parse arguments
+START_EPOCH=1
+END_EPOCH=0
+
+while getopts "e:hs:t:" flag; do
+case $flag in
+ e) END_EPOCH=$OPTARG;;
+
+ h) usage
+ exit 0
+ ;;
+
+ s) START_EPOCH=$OPTARG;;
+
+ t) MAP_TYPE=$OPTARG;;
+
+ *) usage
+ exit 1;;
+esac
+done
+[ $END_EPOCH -eq 0 ] && die "You must supply an end epoch with -e"
+
+### Dump maps
+case $MAP_TYPE in
+ "osdmap") dump_osdmap;;
+
+ *) die "sorry, don't know how to handle MAP_TYPE '$MAP_TYPE'"
+esac
+
+exit 0