Ceph-mon process monitor: ensure to run the ceph cmd even if a specific

user must be use.
This commit is contained in:
gardouille 2015-09-01 11:45:12 +02:00
parent f80b164c7b
commit 857cb3c57e
1 changed files with 22 additions and 7 deletions

View File

@ -109,10 +109,8 @@ fi
### FI ZFS
### IF Ceph Monitor
#if [ $(command -v ceph-mon) ]; then
#ceph-mon is installed with the 'ceph' package
#so we can't just check if `ceph-mon` is available on a system
if [ $(command -v ceph) ]; then
# Ensure the host is define as a initial monitor
if (grep "mon_initial_members.*$(hostname)" /etc/ceph/*.conf > /dev/null); then
MSG=$(process_info "ceph-mon" '')
MSG=$(service_info "6789" "${MSG}")
@ -123,10 +121,27 @@ fi
### IF Ceph OSD
if [ $(command -v ceph) ]; then
if (ceph osd tree | grep "host $(hostname)" > /dev/null 2> /dev/null); then
MSG=$(process_info "ceph-osd" '')
MSG=$(service_info "6800 6801 6802" "${MSG}")
printf '%b' "\n${MSG}"
# If there is a specific user
if [ -f /etc/ceph/*.keyring ]; then
for keyring in "$(find /etc/ceph -type f -name *.keyring)"; do
CEPH_USERNAME=$(grep client ${keyring} | sed 's/^\[client.\(.*\)\]/\1/')
CEPH_OSD_OK=$(ceph osd tree --id ${CEPH_USERNAME} | grep -i -- "host $(hostname)" 2> /dev/null)
if [ "${CEPH_OSD_OK}" ]; then
MSG="${MAGENTA}+++ ${WHITEB}BEGIN - ${keyring}${MAGENTA} +++${RESET}\n"
MSG=$(process_info "ceph-osd" "${MSG}")
MSG=$(service_info "6800 6801 6802" "${MSG}")
MSG="${MSG}\n${MAGENTA}+++ ${WHITEB}END - ${keyring}${MAGENTA} +++${RESET}"
printf '%b' "\n${MSG}"
fi
done
# Use default Ceph user
else
CEPH_OSD_OK=$(ceph osd tree | grep -i -- "host $(hostname)" 2> /dev/null)
if [ ${CEPH_OSD_OK} ]; then
MSG=$(process_info "ceph-osd" '')
MSG=$(service_info "6800 6801 6802" "${MSG}")
printf '%b' "\n${MSG}"
fi
fi
fi
### FI Ceph OSD