Add Ceph monitoring.
This commit is contained in:
parent
2b7a9c6ab1
commit
07664430de
|
@ -20,7 +20,7 @@ WHITEB='\033[1;37m'
|
|||
RESET='\033[0m'
|
||||
|
||||
|
||||
printf '%b' "${MAGENTA}++++++++++++++++++++: ${WHITE}Disk Usage${MAGENTA} :+++++++++++++++++++++${RESET}"
|
||||
printf '%b' "${MAGENTA}++++++++++++++++++++: ${WHITE}Disk Usage${RESET} ${MAGENTA}:+++++++++++++++++++++${RESET}"
|
||||
# Root partition
|
||||
# Replace by rootfs in few kernel version
|
||||
DISK_USAGE=$(df | grep -m1 "/$" | awk '{print $5}')
|
||||
|
@ -37,7 +37,7 @@ done
|
|||
|
||||
### IF ZFS
|
||||
if [ $(which zpool) ]; then
|
||||
printf '%b' "${MAGENTA}+++++++++++++++++++ ${WHITEB}ZFS${RESET} ${WHITE}Partitions${MAGENTA} :++++++++++++++++++${RESET}"
|
||||
printf '%b' "\n${MAGENTA}+++++++++++++++++++ ${WHITEB}ZFS${RESET} ${WHITE}Partitions${RESET} ${MAGENTA}:++++++++++++++++++${RESET}"
|
||||
NUMBER_PART=$(df -T | grep zfs | wc -l)
|
||||
LINE=1
|
||||
|
||||
|
@ -51,6 +51,44 @@ if [ $(which zpool) ]; then
|
|||
fi
|
||||
### FI ZFS
|
||||
|
||||
### IF CEPH
|
||||
# First, test if a keyring file exists
|
||||
if [ -f /etc/ceph/*.keyring ]; then
|
||||
printf '%b' "\n${MAGENTA}++++++++++++++++++++++++ ${WHITEB}Ceph${RESET} ${MAGENTA}:++++++++++++++++++++++++${RESET}"
|
||||
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')
|
||||
|
||||
# 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 -- 'health_ok')
|
||||
|
||||
# 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}+ ${CEPH_COLOR}${CEPH_HEALTH}"
|
||||
fi
|
||||
### FI CEPH
|
||||
|
||||
|
||||
printf '%b' "${RESET}\n"
|
||||
|
||||
|
|
Loading…
Reference in New Issue