diff --git a/check_ceph_diskfree b/check_ceph_diskfree index ce3f84787a245a701a40cda0c4e65b7d2e296a81..28ab2ef099f81e1efe410e7ac30ab51f9eb4f954 100755 --- a/check_ceph_diskfree +++ b/check_ceph_diskfree @@ -21,11 +21,12 @@ # 2023-05-09 v1.3 <axel.hahn@unibe.ch> add help # 2023-06-19 v1.4 <axel.hahn@unibe.ch> no more tmpfile # 2023-07-27 v1.5 <axel.hahn@unibe.ch> update help page +# 2023-10-20 v1.6 <axel.hahn@unibe.ch> harden sudo command execution # ====================================================================== . $(dirname $0)/inc_pluginfunctions -export self_APPVERSION=1.5 +export self_APPVERSION=1.6 typeset -i iWarning=0 typeset -i iCritical=0 @@ -68,7 +69,7 @@ typeset -i iWarnLimit=$( ph.getValueWithParam 70 w "$@") typeset -i iCriticalLimit=$( ph.getValueWithParam 90 c "$@") -if ! data=$( sudo /bin/ceph df 2>&1 ) +if ! data=$( sudo -n /bin/ceph df 2>&1 ) then echo "$data" ph.abort "UNKNOWN: ceph is not available or no sudo permissions to execute ceph commands." diff --git a/check_ceph_io b/check_ceph_io index 36d5a074a1350816054576e92b763ccb93598a7a..bb1e89bd0e458018d897d799ad430556da802456 100755 --- a/check_ceph_io +++ b/check_ceph_io @@ -19,11 +19,12 @@ # 2023-05-10 v1.2 <axel.hahn@unibe.ch> add tests # 2023-05-11 v1.3 <axel.hahn@unibe.ch> handle ceph status without io data in output # 2023-07-27 v1.4 <axel.hahn@unibe.ch> update help page +# 2023-10-20 v1.5 <axel.hahn@unibe.ch> harden sudo command execution # ====================================================================== . $(dirname $0)/inc_pluginfunctions -export self_APPVERSION=1.4 +export self_APPVERSION=1.5 function showHelp(){ local _self; _self=$(basename $0) @@ -87,7 +88,7 @@ else ph.require ceph # --- get output of ceph - if ! CEPHOUT=$( sudo ceph status 2>&1 ); then + if ! CEPHOUT=$( sudo -n ceph status 2>&1 ); then ph.setStatus "unknown" ph.status "no data" echo "There is no output from 'sudo ceph status'." diff --git a/check_ceph_osd b/check_ceph_osd index e1224a016d1678b5d7aa4a22066b6a00bdaf76ff..4838b58f1fb70985dff26e2f75721bc37f1b8460 100755 --- a/check_ceph_osd +++ b/check_ceph_osd @@ -27,11 +27,12 @@ # 2023-04-24 v1.4 <axel.hahn@unibe.ch> update for newer ceph versions # 2023-06-19 v1.5 <axel.hahn@unibe.ch> add help and param support; no more tmpfile # 2023-07-27 v1.6 <axel.hahn@unibe.ch> shorten ceph exec; show output on error; shell fixes +# 2023-10-20 v1.7 <axel.hahn@unibe.ch> harden sudo command execution # ====================================================================== . $(dirname $0)/inc_pluginfunctions -export self_APPVERSION=1.6 +export self_APPVERSION=1.7 # column number in output where to find the up/ down info iColUpDown=5 @@ -87,7 +88,7 @@ case "$1" in *) esac -if ! data=$( sudo /bin/ceph osd tree 2>&1 ); then +if ! data=$( sudo -n /bin/ceph osd tree 2>&1 ); then echo "$data" ph.abort "UNKNOWN: ceph is not available or no sudo permissions to execute ceph commands." fi diff --git a/check_ceph_status b/check_ceph_status index 61fc8a53faf7f39e2baf248d79a1d05d15d9b6d0..33b567e7b8954cfd85ee1372b3cbab559f878e76 100755 --- a/check_ceph_status +++ b/check_ceph_status @@ -21,11 +21,12 @@ # 2023-04-24 v1.4 <axel.hahn@unibe.ch> update for newer ceph versions # 2023-06-19 v1.5 <axel.hahn@unibe.ch> add help and param support; no more tmpfile # 2023-07-27 v1.6 <axel.hahn@unibe.ch> update help page +# 2023-10-20 v1.7 <axel.hahn@unibe.ch> harden sudo command execution # ====================================================================== . $(dirname $0)/inc_pluginfunctions -export self_APPVERSION=1.6 +export self_APPVERSION=1.7 initfile="/tmp/ceph-status-not-ok-start-$USER" @@ -45,14 +46,7 @@ line="__________________________________________________________________________ function showHelp(){ local _self; _self=$(basename $0) cat <<EOF -______________________________________________________________________ - -$self_APPNAME -v$self_APPVERSION - -(c) Institute for Medical Education - University of Bern -Licence: GNU GPL 3 -______________________________________________________________________ +$( ph.showImlHelpHeader ) Show ceph health status. The state of the check switches to warning if HEALTH_WARN was detected @@ -72,7 +66,7 @@ EOF } function readCephStatus(){ - if ! data=$( sudo /bin/ceph status 2>&1 ); then + if ! data=$( sudo -n /bin/ceph status 2>&1 ); then echo "$data" ph.abort "UNKNOWN: ceph is not available or no sudo permissions to execute ceph commands." fi diff --git a/docs/20_Checks/check_ceph_diskfree.md b/docs/20_Checks/check_ceph_diskfree.md index e1425b6748a3bbacb72aaeba14f567cea88d85ba..f07c47cf9e7cb2a2abd7c22fdc1585f0923bc768 100644 --- a/docs/20_Checks/check_ceph_diskfree.md +++ b/docs/20_Checks/check_ceph_diskfree.md @@ -20,7 +20,7 @@ $ check_ceph_diskfree -h ______________________________________________________________________ CHECK_CEPH_DISKFREE -v1.4 +v1.6 (c) Institute for Medical Education - University of Bern Licence: GNU GPL 3 diff --git a/docs/20_Checks/check_ceph_io.md b/docs/20_Checks/check_ceph_io.md index 9eed61977977ff5c3498dc26b0bdfc15e2aaa38a..9153fbd62fab551051fa3b1bacc86c5420eec8b7 100644 --- a/docs/20_Checks/check_ceph_io.md +++ b/docs/20_Checks/check_ceph_io.md @@ -18,33 +18,35 @@ icingaclient ALL=(ALL) NOPASSWD: /bin/ceph ```txt ______________________________________________________________________ -CHECK_CEPH_IO -v1.3 +CHECK_CEPH_OSD +v1.7 (c) Institute for Medical Education - University of Bern Licence: GNU GPL 3 + +https://os-docs.iml.unibe.ch/icinga-checks/Checks/check_ceph_osd.html ______________________________________________________________________ -Show cheph IO as read and written bytes per second. +Show cheph osd status: how many OSDs exist and how many are up/ down. This check sends performance data. +On your cluster you might want to increase the values for warning and +critical level. + SYNTAX: -check_ceph_io +check_ceph_osd [-w WARN_LIMIT] [-c CRITICAL_LIMIT] OPTIONS: -h or --help show this help. - -t [STRING] test a value; for debugging purposes - Without a string internally stored values will be tested + -w VALUE warning level (default: 1) + -c VALUE critical level (default: 2) EXAMPLE: -check_ceph_io - no parameters; normal usage to get the ceph io data - -check_ceph_io -t - Run a few builtin tests +check_ceph_osd + no parameters; normal usage to get the ceph osd status -check_ceph_io -t " client: 255 B/s rd, 0 op/s rd, 0 op/s wr" - Test a given string +check_ceph_osd -c 10 + change to critical level if 10 osds are down. ``` diff --git a/docs/20_Checks/check_ceph_status.md b/docs/20_Checks/check_ceph_status.md index 65ad237cf39ce8ff9e714deae7c5fb27bd8d2d95..abce980d43e84c3e90e291b6f1f7c8975c87805f 100644 --- a/docs/20_Checks/check_ceph_status.md +++ b/docs/20_Checks/check_ceph_status.md @@ -9,16 +9,22 @@ It switches the state in dependency of the HEALTH_* value. * `ceph` binary and sudo permission on it to get the information +```txt +icingaclient ALL=(ALL) NOPASSWD: /bin/ceph +``` + ## Syntax ```txt ______________________________________________________________________ -CHECK_CEPH_STATUS -v1.5 +CHECK_CEPH_STATUS +v1.7 (c) Institute for Medical Education - University of Bern Licence: GNU GPL 3 + +https://os-docs.iml.unibe.ch/icinga-checks/Checks/check_ceph_status.html ______________________________________________________________________ Show ceph health status. @@ -27,6 +33,8 @@ and is error of other HEALTH values than HEALTH_WARN or HEALTH_OK. In the output is the complete output of the command "ceph status". +If degraded objects are found it shows the progress of repair process. + SYNTAX: check_ceph_status