All of lore.kernel.org
 help / color / mirror / Atom feed
* Ceph status Icinga/NAGIOS plugin
@ 2012-07-23 12:40 Pascal de Bruijn | Unilogic B.V.
  0 siblings, 0 replies; only message in thread
From: Pascal de Bruijn | Unilogic B.V. @ 2012-07-23 12:40 UTC (permalink / raw)
  To: ceph-devel

Hi,

We use Icinga to monitor most of our infrastructure, and thus wanted to
monitor our Ceph cluster using that as well.

We created a simple check_ceph_status script which is executed locally
on all of our MONs/MDSes via NRPE.

It seems there are other efforts in this area as well, but we needed
something that was fairly simple and would work straight away.

What the script does is
 - execute ceph status
 - look for the first line with HEALTH_ on it
 - remove HEALTH_ and everything that precedes it from that line
 - replace WARN and ERR with WARNING and ERROR respectively
 - Depending on the first few remaining characters on the line we 
   generate an exit code (OK #0 / WARNING #1 / ERROR #2)
 - If all else fails exit with a UNKNOWN exit code (#3)

The actual script is attached below. Feel free to do with it whatever
you like.

Regards,
Pascal de Bruijn
Unilogic B.V.

========================================================================

#!/bin/bash
#
# Ceph status Icinga plugin
#
# Copyright (c) 2012 Unilogic B.V.
#                    Pascal de Bruijn
#
# This script isn't /bin/dash compatible as it
# uses /bin/bash specific syntax for clarity
#

CEPH_STATUS=$(ceph status | grep 'HEALTH_' | head -n 1 | sed 's#.*HEALTH_##' | sed 's#WARN#WARNING#' | sed 's#ERR#ERROR#')

echo "${CEPH_STATUS}"

if [[ "${CEPH_STATUS:0:2}" == "OK" ]]; then
  exit 0
fi

if [[ "${CEPH_STATUS:0:7}" == "WARNING" ]]; then
  exit 1
fi

if [[ "${CEPH_STATUS:0:5}" == "ERROR" ]]; then
  exit 2
fi

# if no OK, WARNING or ERROR status has been detected we exit with an UNKNOWN status code
exit 3




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-07-23 12:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-23 12:40 Ceph status Icinga/NAGIOS plugin Pascal de Bruijn | Unilogic B.V.

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.