* (#4) The ceph health monitoring now take the available ceph id to run the command.
This commit is contained in:
parent
c604db82cb
commit
b0bcbb780c
|
@ -11,7 +11,7 @@
|
|||
* (#3) Correct ((LINE++)) -> BASH with LINE=$((LINE+1)) -> SH
|
||||
* (#4) Add monitoring for Ceph Monitor (process and port).
|
||||
* (#4) Add monitoring for Ceph OSD (process and few ports).
|
||||
* (#4) Add a basic monitoring for Ceph health (default username).
|
||||
* (#4) Add a monitoring for Ceph health. It take the available ceph id to run the command.
|
||||
|
||||
---------------------------------------
|
||||
|
||||
|
|
|
@ -52,16 +52,40 @@ fi
|
|||
### FI ZFS
|
||||
|
||||
### IF CEPH
|
||||
if [ -f /etc/ceph/ceph.conf ]; then
|
||||
# First, test if a keyring file exists
|
||||
if [ -f /etc/ceph/*.keyring ]; then
|
||||
printf '%b' "\n${MAGENTA}++++++++++++++++++++++++ ${WHITEB}Ceph${RESET} ${MAGENTA}:++++++++++++++++++++++++${RESET}"
|
||||
HEALTH=$(ceph health)
|
||||
for keyring in "$(find /etc/ceph -type f -name *.keyring)"; do
|
||||
CEPH_USERNAME=$(grep client ${keyring} | sed 's/^\[client.\(.*\)\]/\1/')
|
||||
CEPH_HEALTH=$(ceph health --id ${CEPH_USERNAME})
|
||||
CEPH_HEALTH_OK=$(ceph health --id ${CEPH_USERNAME} | grep -i -- 'ok')
|
||||
|
||||
if [ $? ]; then
|
||||
printf '%b' "\n${MAGENTA}+ ${GREEN}${HEALTH}"
|
||||
# Test health to determine the color to use
|
||||
if [ ${CEPH_HEALTH_OK} ]; then
|
||||
CEPH_COLOR=${GREEN}
|
||||
else
|
||||
CEPH_COLOR=${RED}
|
||||
fi
|
||||
|
||||
# Print
|
||||
printf '%b' "\n${MAGENTA}+ ${WHITEB}${keyring}: ${CEPH_COLOR}${CEPH_HEALTH}"
|
||||
done
|
||||
|
||||
# Else use default
|
||||
elif [ -f /etc/ceph/ceph.conf ]; then
|
||||
printf '%b' "\n${MAGENTA}++++++++++++++++++++++++ ${WHITEB}Ceph${RESET} ${MAGENTA}:++++++++++++++++++++++++${RESET}"
|
||||
CEPH_HEALTH=$(ceph health)
|
||||
CEPH_HEALTH_OK=$(ceph health | grep -i -- 'ok')
|
||||
|
||||
# Test health to determine the color to use
|
||||
if [ ${CEPH_HEALTH_OK} ]; then
|
||||
CEPH_COLOR=${GREEN}
|
||||
else
|
||||
printf '%b' "\n${MAGENTA}+ ${REDB}${HEALTH}"
|
||||
CEPH_COLOR=${RED}
|
||||
fi
|
||||
|
||||
# Print
|
||||
printf '%b' "\n${MAGENTA}+ ${CEPH_COLOR}${CEPH_HEALTH}"
|
||||
fi
|
||||
### FI CEPH
|
||||
|
||||
|
|
Loading…
Reference in New Issue