Skip to content

Commit 8734458

Browse files
johannakatenbougalis
authored andcommitted
add the getInfoRippled.sh support script:
The script can be used to quickly and easily retrieve information to assess the health of a rippled server
1 parent bdbb3ca commit 8734458

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed

bin/getInfoRippled.sh

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#!/usr/bin/env bash
2+
3+
rippled_exe=/opt/ripple/bin/rippled
4+
conf_file=/etc/opt/ripple/rippled.cfg
5+
6+
while getopts ":e:c:" opt; do
7+
case $opt in
8+
e)
9+
rippled_exe=${OPTARG}
10+
;;
11+
c)
12+
conf_file=${OPTARG}
13+
;;
14+
\?)
15+
echo "Invalid option: -$OPTARG"
16+
esac
17+
done
18+
19+
tmp_loc=$(mktemp -d --tmpdir ripple_info.XXXX)
20+
cd /tmp
21+
chmod 751 ripple_info.*
22+
cd ~
23+
echo ${tmp_loc}
24+
25+
cleaned_conf=${tmp_loc}/cleaned_rippled_cfg.txt
26+
27+
if [[ -f ${conf_file} ]]
28+
then
29+
db=$(sed -r -e 's/\<s[a-zA-Z0-9]{28}\>/secretsecretsecretsecretmaybe/g' ${conf_file} |\
30+
awk -v OUT_FILE=${cleaned_conf} '
31+
BEGIN {skip=0; db_path="";print > OUT_FILE}
32+
/^\[validation_seed\]/ {skip=1; next}
33+
/^\[node_seed\]/ {skip=1; next}
34+
/^\[.*\]/ {skip=0}
35+
skip==1 {next}
36+
save==1 {save=0;db_path=$0}
37+
/^\[database_path\]/ {save=1}
38+
{print >> OUT_FILE}
39+
END {print db_path}
40+
')
41+
fi
42+
43+
echo "database_path: ${db}"
44+
df ${db} > ${tmp_loc}/db_path_df.txt
45+
echo
46+
47+
# Send output from this script to a log file
48+
## this captures any messages
49+
## or errors from the script itself
50+
51+
log_file=${tmp_loc}/get_info.log
52+
exec 3>&1 1>>${log_file} 2>&1
53+
54+
## Send all stdout files to /tmp
55+
56+
if [[ -x ${rippled_exe} ]]
57+
then
58+
pgrep rippled && \
59+
${rippled_exe} --conf ${conf_file} \
60+
-- server_info > ${tmp_loc}/server_info.txt
61+
fi
62+
63+
df -h > ${tmp_loc}/free_disk_space.txt
64+
cat /proc/meminfo > ${tmp_loc}/amount_mem.txt
65+
cat /proc/swaps > ${tmp_loc}/swap_space.txt
66+
ulimit -a > ${tmp_loc}/reported_current_limits.txt
67+
68+
for dev_path in $(df | awk '$1 ~ /^\/dev\// {print $1}'); do
69+
# strip numbers from end and remove '/dev/'
70+
dev=$(basename ${dev_path%%[0-9]})
71+
if [[ "$(cat /sys/block/${dev}/queue/rotational)" = 0 ]]
72+
then
73+
echo "${dev} : SSD" >> ${tmp_loc}/is_ssd.txt
74+
else
75+
echo "${dev} : NO SSD" >> ${tmp_loc}/is_ssd.txt
76+
fi
77+
done
78+
79+
pushd ${tmp_loc}
80+
tar -czvf info-package.tar.gz *.txt *.log
81+
popd
82+
83+
echo "Use the following command on your local machine to download from your rippled instance: scp <remote_rippled_username>@<remote_host>:${tmp_loc}/info-package.tar.gz <path/to/local_machine/directory>"| tee /dev/fd/3
84+

0 commit comments

Comments
 (0)