Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
icinga-checks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
icinga-checks
Commits
fd40e9e1
Commit
fd40e9e1
authored
1 year ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
ceph osd: add help and param support; no tmpfile
parent
f27d95aa
Branches
Branches containing commit
No related tags found
1 merge request
!119
ceph osd: add help and param support; no tmpfile
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
check_ceph_osd
+55
-8
55 additions, 8 deletions
check_ceph_osd
with
55 additions
and
8 deletions
check_ceph_osd
+
55
−
8
View file @
fd40e9e1
...
...
@@ -7,7 +7,7 @@
# ----------------------------------------------------------------------
#
# REQUIREMENTS:
# -
ceph
# -
sudo permissions on ceph command
#
# SYNTAX:
# - check_ceph_status -w [count for warnming] -w [count for critical]
...
...
@@ -25,28 +25,77 @@
# 2020-03-05 v1.2 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions
# 2022-10-21 v1.3 <axel.hahn@unibe.ch> remove grep: warning: stray \ before white space
# 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
# ======================================================================
.
$(
dirname
$0
)
/inc_pluginfunctions
tmpfile
=
/tmp/ceph_status_output_
$$
self_APPNAME
=
$(
basename
$0
|
tr
[
:lower:]
[
:upper:]
)
self_APPVERSION
=
1.5
# column number in output where to find the up/ down info
iColUpDown
=
5
# ----------------------------------------------------------------------
# FUNCTIONS
# ----------------------------------------------------------------------
function
showHelp
(){
_self
=
$(
basename
$0
)
cat
<<
EOF
______________________________________________________________________
$self_APPNAME
v
$self_APPVERSION
(c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3
______________________________________________________________________
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:
$_self
[-w WARN_LIMIT] [-c CRITICAL_LIMIT]
OPTIONS:
-h or --help show this help.
-w VALUE warning level (default: 1)
-c VALUE critical level (default: 2)
EXAMPLE:
$_self
no parameters; normal usage to get the ceph osd status
$_self
-c 10
change to critical level if 10 osds are down.
EOF
}
# fetch lines of OSD entries only from output of ceph osd tree
# global string data output of command ceph osd tree
function
getOsd
(){
grep
"^ *[0-9]"
$tmpfile
grep
"^ *[0-9]"
<<<
"
$data
"
}
# ----------------------------------------------------------------------
# MAIN
# ----------------------------------------------------------------------
sudo
/bin/ceph osd tree
>
$tmpfile
2>&1
# --- check param -h
case
"
$1
"
in
"--help"
|
"-h"
)
showHelp
exit
0
;;
*
)
esac
data
=
$(
sudo
/bin/ceph osd tree 2>&1
)
if
[
$?
-ne
0
]
;
then
rm
-f
$tmpfile
ph.abort
"UNKNOWN: ceph is not available or no sudo permissions to execute ceph commands."
fi
...
...
@@ -70,9 +119,7 @@ else
fi
ph.status
"Check of available OSDs -
$iOsdTotal
OSDs total ..
$iOsdUp
up ..
$iOsdDown
down (Limits: warn at
$iWarnLimit
; critical
$iCriticalLimit
)"
cat
$tmpfile
rm
-f
$tmpfile
echo
"
$data
"
ph.perfadd
"osd-total"
"
${
iOsdTotal
}
"
""
""
0
${
iOsdTotal
}
ph.perfadd
"osd-up"
"
${
iOsdUp
}
"
""
""
0
${
iOsdTotal
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment