diff --git a/check_deployment b/check_deployment new file mode 100755 index 0000000000000000000000000000000000000000..692499b21d3a0621e8fba2aa6cae5420f5bfc1c1 --- /dev/null +++ b/check_deployment @@ -0,0 +1,74 @@ +#!/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 + +# ----------------------------------------------------------------------