Select Git revision
check_requirements.md
-
Hahn Axel (hahn) authoredHahn Axel (hahn) authored
check_ceph_status 1.35 KiB
#!/bin/bash
# ======================================================================
#
# Icinga/ Nagios Check
# CEPH STATUS / HEALTH
#
# ----------------------------------------------------------------------
#
# REQUIREMENTS:
# - ceph
#
# SYNTAX:
# - check_ceph_status
# No parameter required
#
# ----------------------------------------------------------------------
# 2020-03-04 v1.0 <axel.hahn@iml.unibe.ch>
# 2020-03-05 v1.1 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions
# ======================================================================
. `dirname $0`/inc_pluginfunctions
tmpfile=/tmp/ceph_status_output_$$
# ----------------------------------------------------------------------
# MAIN
# ----------------------------------------------------------------------
sudo /bin/ceph health > $tmpfile 2>&1
grep "HEALTH_" $tmpfile >/dev/null
if [ $? -ne 0 ]; then
rm -f $tmpfile
ph.abort "UNKNOWN: ceph is not available or no sudo permissions to execute ceph commands."
fi
grep "HEALTH_OK" $tmpfile >/dev/null
if [ $? -eq 0 ]; then
ph.setStatus "ok"
else
grep "HEALTH_WARN" $tmpfile >/dev/null
if [ $? -eq 0 ]; then
ph.setStatus "warning"
else
ph.setStatus "critical"
fi
fi
ph.status "Ceph status is `cat $tmpfile`"
echo
sudo /bin/ceph status
rm -f $tmpfile
ph.exit
# ----------------------------------------------------------------------