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

user must be use.
This commit is contained in:
Jeremy Gardais 2015-09-01 11:44:03 +02:00
parent f7337fd9d8
commit 736a22dfef
1 changed files with 22 additions and 7 deletions

View File

@ -109,10 +109,8 @@ fi
### FI ZFS ### FI ZFS
### IF Ceph Monitor ### 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 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 if (grep "mon_initial_members.*$(hostname)" /etc/ceph/*.conf > /dev/null); then
MSG=$(process_info "ceph-mon" '') MSG=$(process_info "ceph-mon" '')
MSG=$(service_info "6789" "${MSG}") MSG=$(service_info "6789" "${MSG}")
@ -123,12 +121,29 @@ fi
### IF Ceph OSD ### IF Ceph OSD
if [ $(command -v ceph) ]; then if [ $(command -v ceph) ]; then
if (ceph osd tree | grep "host $(hostname)" > /dev/null 2> /dev/null); then # 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=$(process_info "ceph-osd" '')
MSG=$(service_info "6800 6801 6802" "${MSG}") MSG=$(service_info "6800 6801 6802" "${MSG}")
printf '%b' "\n${MSG}" printf '%b' "\n${MSG}"
fi fi
fi fi
fi
### FI Ceph OSD ### FI Ceph OSD
### IF PUPPETMASTER ### IF PUPPETMASTER