Skip to content
Snippets Groups Projects

add deployment check

Merged Hahn Axel (hahn) requested to merge 6877_check_iml_deployment into master
1 file
+ 74
0
Compare changes
  • Side-by-side
  • Inline
check_deployment 0 → 100755
+ 74
0
#!/bin/bash
# ======================================================================
#
# NAGIOS CLIENT CHECK :: check deployment
#
# ----------------------------------------------------------------------
# 2023-12-14 v0.1 first lines
# ======================================================================
. $( dirname $0 )/inc_pluginfunctions
export self_APPVERSION=0.1
sInstalldir=/opt/imldeployment-installer
# ----------------------------------------------------------------------
# FUNCTIONS
# ----------------------------------------------------------------------
function showHelp(){
local _self; _self=$(basename $0)
cat <<EOF
$( ph.showImlHelpHeader )
Show status of rollouts with IML deployment client on this system.
See https://os-docs.iml.unibe.ch/imldeployment-client/
SYNTAX:
$_self [-d DIRECTORY]
OPTIONS:
-h or --help show this help.
-d or --dir set installation dir of iml deployment to find its check skript
default: ${sInstalldir}
EXAMPLE:
$_self -d /home/deployuser/imlbackup
set a custom directory und run the backup check
EOF
}
# --- check param -h
while [[ "$#" -gt 0 ]]; do case $1 in
-h|--help) showHelp; exit 0;;
-d|--dir) sInstalldir=$2; shift ;shift;;
*) echo "ERROR: Unknown parameter: $1"; showHelp; exit 1;
esac; done
sChecker=$sInstalldir/check_deployment.sh
if [ ! -x $sChecker ]; then
ph.abort "$sChecker not found - maybe deployment is not installed here. Use param -d to set the install directory."
fi
result=$( $sChecker )
rc=$?
if [ $rc -eq 0 ]; then
if echo "$result" | grep "^UNKNOWN" 2>/dev/null
then
ph.setStatus "unknown"
else
ph.setStatus "ok"
fi
else
ph.setStatus "critical"
fi
echo "$result"
ph.exit
# ----------------------------------------------------------------------
Loading