Skip to content
Snippets Groups Projects
Commit 76c2d434 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

add template for checks

parent 366d5ae2
Branches
No related tags found
No related merge requests found
#!/bin/bash
# ======================================================================
#
# Check !!!describe what it does!!!
#
# ----------------------------------------------------------------------
# 202n-nn-nn v0.0 <name@unibe.ch> initial version
# ======================================================================
. `dirname $0`/inc_pluginfunctions
# ----------------------------------------------------------------------
# functions
# ----------------------------------------------------------------------
function showHelp(){
cat <<EOF
______________________________________________________________________
CHECK_XYZ !!! add a short description
(c) Institute for Medical Education - Univerity of Bern
Licence: GNU GPL 3
______________________________________________________________________
!!! Add some information what the check does.
!!! add / remove params in syntax, options and example
SYNTAX:
`basename $0` [-w WARN_LIMIT] [-c CRITICAL_LIMIT]
OPTIONS:
-w VALUE cpu usage warning level (default: 75)
-c VALUE cpu usage critical level (default: 90)
-h or --help show this help.
PARAMETERS:
None.
EXAMPLE:
`basename $0` -w 60 -c 80
EOF
}
# ----------------------------------------------------------------------
# MAIN
# ----------------------------------------------------------------------
# --- check param -h
case "$1" in
"--help"|"-h")
showHelp
exit 0
;;
*)
esac
# --- check required tools
# !!! add needed tools here
# ph.require bc top
# set default / override from command line params
typeset -i iWarnLimit=` ph.getValueWithParam 75 w "$@"`
typeset -i iCriticalLimit=` ph.getValueWithParam 90 c "$@"`
# !!! add some logic for a check and fetch values from some output
# !!! set status
# ph.setStatusByLimit $iMyvalue $iWarnLimit $iCriticalLimit
# or with a condition:
# ph.setStatus warning
# ph.setStatus critical
# !!! generate output
# ph.status "my check sends value $iMyValue"
# --- performance data usage
# !!! add counters if Icinga must show a chart
# ph.perfadd "checkname-countername" "${iMyValue}" $iWarnLimit $iCriticalLimit 0 100
# ph.exit
# ----------------------------------------------------------------------
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment