blob: fe2ef6c5042f84fba5b83f9626e0dfd02ece5228 [file] [log] [blame]
Alexdcb792f2021-10-04 14:24:21 -05001#!/bin/bash
2echo "Collecting Ceph cluster data."
3
4if [ "$#" -lt 2 ]; then echo "Usage: ./ceph_collect.sh <CUSTOMER> <CLUSTERNAME>"; exit; fi
5export CUSTOMER=$1
6export CLUSTERNAME=$2
7
8if ! which ceph >/dev/null; then echo "ERROR: This script must be run on a ceph monitor or admin node"; exit; fi
9
10DATE=`date "+%Y-%m-%d"`
11DIRNAME="CephCollectData.$CUSTOMER.$CLUSTERNAME.$DATE"
12ARCHNAME=$DIRNAME".tar.gz"
13mkdir $DIRNAME
14cd $DIRNAME
15
16echo "Collecting CRUSH map"
17ceph osd getcrushmap -o crush.bin
18crushtool -d crush.bin -o crushmap.txt
19crushtool -i crush.bin --dump > crushmap.json
20rm crush.bin
21
22echo "Collecting ceph osd crush dump"
23ceph osd crush dump >crushdump.json
24
25echo "Collecting cluster status"
26ceph -s -f json -o ceph_s.json
27echo "Collecting health detail"
28ceph -f json health detail -o ceph_healt_detail.json
29echo "Collecting monmap"
30ceph mon dump -f json -o monmap.json
31echo "Collecting ceph df"
32ceph df -f json -o ceph_df.json
33echo "Collecting ceph osd df"
34ceph osd df -f json -o ceph_osd_df.json
35echo "Collecting ceph osd dump"
36ceph osd dump -f json -o ceph_osd_dump.json
37echo "Collecting rados df"
38rados df -f json >rados_df.json
39echo "Collecting ceph report"
40ceph report -o ceph_report.json
41echo "Collecting auth data anonymized"
42ceph auth list -f json |sed 's/AQ[^=]*==/KEY/g' > ceph_auth_ls.json
43echo "Collecting ceph pg dump"
44ceph pg dump -f json -o ceph_pg_dump.json
45echo "Collecting health metrics"
46mkdir ceph-health
47IFS=$'\n'; for device in `ceph device ls|grep -v DEVICE`; do osd=$(echo $device|awk '{print $3}'); dev=$(echo $device|awk '{print $1}'); ceph device get-health-metrics $dev >ceph-health/$osd-$dev.json ; done
48echo "Collecting ceph osd perf"
49for i in {0..9}; do echo $i; ceph osd perf -f json -o ceph_osd_perf_$i.json; sleep 4; done
50echo "Collecting ceph running configuration"
51ceph config dump -f json >ceph_config_dump.json
52
53tar czf "../"$ARCHNAME *
54