-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_troubleshooting_data.sh
executable file
·155 lines (146 loc) · 4.13 KB
/
get_troubleshooting_data.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#!/bin/bash
access_key=''
secret_key=''
gateway='objects.dreamhost.com'
result_path=`pwd`"/troubleshooting_data";
mkdir -p ${result_path};
rm -rf ${result_path}/*
PS3="What type of problem are you having? "
options="general monitor object_storage_daemon meta_data_server placement_groups radosgw exit"
function dump_data {
command=$1
filename=${1// /_}
filename=${filename}".txt"
echo "Command: $1";
eval "$1" > $result_path/$filename;
}
function dump_osdmap {
echo "Command: ceph osd getmap -o ./troubleshooting_data/osd_map"
ceph osd getmap -o ./troubleshooting_data/osd_map
}
function dump_radosgw_log {
if [[ -f '/var/log/ceph/radosgw.log' ]]; then
echo "Command: cp /var/log/ceph/radosgw.log ${result_path}/radosgw.log";
cp "/var/log/ceph/radosgw.log" "${result_path}/radosgw.log";
fi
}
function build_archive {
echo;
echo "Building archive of troubleshooting data."
tar zcvf troubleshooting_data.tar.gz ./troubleshooting_data && echo "Archive has been built \"troubleshooting_data.tar.gz\" in current directory."
}
function upload_archive {
echo;
if [[ ! -z $access_key && ! -z $secret_key ]]; then
echo "Uploading archive."
eval "./troubleshooting_uploader.py --filename troubleshooting_data.tar.gz --access_key ${access_key} --secret_key ${secret_key} --gateway ${gateway}"
fi
}
select option in $options;
do
case $option in
"exit")
echo "Bye.";
break
;;
"monitor")
echo "You selected monitor problems.";
echo ""
echo "We are now dumping copies of the following items to: ${result_path}";
echo ""
dump_data "ceph status"
dump_data "ceph auth list"
dump_data "ceph mon dump"
build_archive
upload_archive
break
;;
"object_storage_daemon")
echo "You selected OSD problems.";
echo ""
echo "We are now dumping copies of the following items to: ${result_path}";
echo ""
dump_data "ceph status"
dump_data "ceph auth list"
dump_data "ceph osd dump"
dump_data "ceph osd tree"
dump_data "ceph pg dump"
dump_data "dmesg"
dump_osdmap
build_archive
upload_archive
break
;;
"meta_data_server")
echo "You selected MDS problems.";
echo ""
echo "We are now dumping copies of the following items to: ${result_path}";
echo ""
dump_data "ceph status"
dump_data "ceph auth list"
dump_data "ceph mds dump"
dump_data "ceph pg dump"
dump_data "dmesg"
dump_osdmap
build_archive
upload_archive
break
;;
"placement_groups")
echo "You selected pg problems.";
echo ""
echo "We are now dumping copies of the following items to: ${result_path}";
echo ""
dump_data "ceph status"
dump_data "ceph auth list"
dump_data "ceph pg dump"
dump_data "ceph osd tree"
dump_data "dmesg"
dump_osdmap
build_archive
upload_archive
break
;;
"radosgw")
echo "You selected rados gateway problems.";
echo ""
echo "We are now dumping copies of the following items to: ${result_path}";
echo ""
dump_data "ceph status"
dump_data "ceph auth list"
dump_data "ceph pg dump"
dump_data "ceph osd tree"
dump_data "radosgw-admin usage show --show-log-entries=false"
dump_data "dmesg"
dump_osdmap
dump_radosgw_log
build_archive
upload_archive
break
;;
"general")
echo "You selected general problems.";
echo ""
echo "We are now dumping copies of the following items to: ${result_path}";
echo ""
dump_data "ceph status"
dump_data "ceph auth list"
dump_data "ceph mon dump"
dump_data "ceph osd dump"
dump_data "ceph mds dump"
dump_data "ceph pg dump"
dump_data "ceph osd tree"
dump_data "ceph quorum_status"
dump_data "rbd list"
dump_data "radosgw-admin usage show --show-log-entries=false"
dump_data "dmesg"
dump_osdmap
dump_radosgw_log
build_archive
upload_archive
break
;;
*)
echo "$option is an unknown options.";
esac
done;