From 32b4df0c2d5def6b8ed5acf2793a66e7cc69e700 Mon Sep 17 00:00:00 2001 From: GABRI Mate Date: Fri, 8 Feb 2013 12:17:02 +0100 Subject: [PATCH] added ceph_capacity and ceph_osd --- plugins/ceph/ceph_capacity | 62 ++++++++++++++++++++++++++++++++++++++ plugins/ceph/ceph_osd | 49 ++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100755 plugins/ceph/ceph_capacity create mode 100755 plugins/ceph/ceph_osd diff --git a/plugins/ceph/ceph_capacity b/plugins/ceph/ceph_capacity new file mode 100755 index 00000000..0133a193 --- /dev/null +++ b/plugins/ceph/ceph_capacity @@ -0,0 +1,62 @@ +#!/bin/sh + +: << =cut + +=head1 NAME + +ceph_capacity - Shows ceph total storage capacity, used raw space and used data space + +=head1 CONFIGURATION + +[ceph_capacity] +env.warning_level Used raw space percentage above warning alert should be issued +env.critical_level Used raw space percentage above critical alert should be issued + +=head1 AUTHOR + +Mate Gabri + +=head1 LICENSE + +GPLv2 + +=head1 MAGICK MARKERS + + #%# family=auto + #%# capabilities=autoconf + +=cut + +if [ "$1" = "autoconf" ]; then + echo yes + exit 0 +fi + +WARNING_LEVEL=${warning_level:-"80"} +CRITICAL_LEVEL=${critical_level:-"90"} + +if [ "$1" = "config" ]; then + + echo 'graph_title CEPH capacity' + echo 'graph_category ceph' + echo 'graph_vlabel GB' + echo 'graph_info CEPH cluster capacity' + echo 'graph_args --base 1000 -l 0' + + CAPACITY=$(ceph -s | grep pgmap | cut -d ';' -f 2 | cut -d ',' -f 3 | cut -d '/' -f 2 | awk '{ print $1 }') + WARNING=$(echo "scale=2;$CAPACITY * ($WARNING_LEVEL/100)" | bc -l | cut -d '.' -f 1) + CRITICAL=$(echo "scale=2;$CAPACITY * ($CRITICAL_LEVEL/100)" | bc -l | cut -d '.' -f 1) + echo "capacity.label Capacity" + echo "used.label Raw used" + echo "used.draw AREA" + echo "used.warning $WARNING" + echo "used.critical $CRITICAL" + echo "data.label Data" + echo "data.draw AREA" + + exit 0 +fi + +echo "capacity.value $(ceph -s | grep pgmap | cut -d ';' -f 2 | cut -d ',' -f 3 | cut -d '/' -f 2 | awk '{ print $1 }')" +echo "used.value $(ceph -s | grep pgmap | cut -d ';' -f 2 | cut -d ',' -f 2 | awk '{ print $1 }')" +echo "data.value $(ceph -s | grep pgmap | cut -d ';' -f 2 | cut -d ',' -f 1 | awk '{ print $1 }')" diff --git a/plugins/ceph/ceph_osd b/plugins/ceph/ceph_osd new file mode 100755 index 00000000..02879f2e --- /dev/null +++ b/plugins/ceph/ceph_osd @@ -0,0 +1,49 @@ +#!/bin/sh + +: << =cut + +=head1 NAME + +ceph_osd - Shows ceph OSD states (total configured, up and in) + +=head1 AUTHOR + +Mate Gabri + +=head1 LICENSE + +GPLv2 + +=head1 MAGICK MARKERS + + #%# family=auto + #%# capabilities=autoconf + +=cut + +if [ "$1" = "autoconf" ]; then + echo yes + exit 0 +fi + + +if [ "$1" = "config" ]; then + + echo 'graph_title CEPH OSDs' + echo 'graph_category ceph' + echo 'graph_vlabel nr' + echo 'graph_info CEPH OSD up/down status' + echo 'graph_scale no' + echo 'graph_args --base 1000 -l 0' + + echo "osds.label OSDs" + echo "up.label Up" + echo "in.label In" + echo "in.draw AREA" + + exit 0 +fi + +echo "osds.value $(ceph -s | grep osdmap | awk '{ print $3 }')" +echo "up.value $(ceph -s | grep osdmap | awk '{ print $5 }')" +echo "in.value $(ceph -s | grep osdmap | awk '{ print $7 }')"