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

addparam --cfg

parent a279fee8
No related branches found
No related tags found
1 merge request!2Add param for cfgfile
......@@ -13,12 +13,11 @@
# - use puppet facts
# - UniBe network and group names - see hostCreate()
#
# ----------------------------------------------------------------------
# ah = axel.hahn@iml.unibe.ch
# 2022-02-16 v0.2 ah add --cfg param
# ======================================================================
. `dirname $0`/inc_getconfig.sh
. `dirname $0`/inc_functions.sh
. `dirname $0`/inc/rest-api-client.sh
tmpfile=/tmp/outcurl.tmp
tmpfile2=/tmp/outcurl2.tmp
......@@ -733,6 +732,10 @@ Director actions
Other parameters
--cfg CONFIGFILE
load a costom config file; default: ./inc_getconfig.sh
This must be the 1st parameter to be processed.
--debug
enable debug output.
......@@ -761,24 +764,33 @@ echo
echo "##### DIRECTOR HELPER $MY_NAME - $MY_IP"
echo
if [ "$1" = "--cfg" ] && [ -n "$2" ]; then
echo "INFO: loading custom config [$2]..."
. "${2}"
shift 2
else
. "$( dirname $0 )/inc_getconfig.sh"
fi
. `dirname $0`/inc_functions.sh
. `dirname $0`/inc/rest-api-client.sh
if [ $# -eq 0 ]; then
showHelp
exit 0
fi
cd `dirname $0`
ls ./`basename $0` >/dev/null || exit 1
_initVars
# ensure that ./inc_getconfig.sh was loaded
if [ -z "${dir_cfg}" ]; then
echo ERROR: Client is not installed/ configured yet on this machine.
exit 1
fi
if [ $# -eq 0 ]; then
showHelp
exit 0
fi
while [ $# -gt 0 ];
do
case "$1" in
......
......@@ -12,21 +12,21 @@
# ah = axel.hahn@iml.unibe.ch
# 2021-03-.. init
# 2022-01-11 v0.7 ah shellcheck
# 2022-02-16 v0.8 ah add --cfg param
# ======================================================================
_product="ICINGA PASSIVE CLIENT"
_version="0.7"
_version="0.8"
_license="GNU GPL 3.0"
_copyright='(c) 2020 Institute for Medical Education * University of Bern'
typeset -i debug=0
# source config ...
. "$( dirname $0 )/inc_getconfig.sh"
# . "$( dirname $0 )/inc_getconfig.sh"
. "$( dirname $0 )/inc_functions.sh"
. "$( dirname $0 )/inc/rest-api-client.sh"
# where to find check scripts ... first directory wins
# dir_plugins="/opt/imlmonitor/client/plugins/ /usr/lib64/nagios/plugins"
......@@ -451,13 +451,16 @@ A new local check will be added to Icinga while running it the first time.
GENERAL PARAMETERS
--cfg CONFIGFILE
load a costom config file; default: ./inc_getconfig.sh
This must be the 1st parameter to be processed.
--help or -h or -?
show this help and abort.
--version or -v
show the version abd abort
SERVICE ACTIONS
--list
......@@ -538,6 +541,20 @@ ________________________________________________________________________________
EOBANNER
if [ "$1" = "--cfg" ] && [ -n "$2" ]; then
echo "INFO: loading custom config [$2]..."
. "${2}"
shift 2
else
. "$( dirname $0 )/inc_getconfig.sh"
fi
. "$( dirname $0 )/inc_functions.sh"
. "$( dirname $0 )/inc/rest-api-client.sh"
if [ $# -eq 0 ]; then
showHelp
exit 0
fi
if [ -z "${dir_cfg}" ]; then
echo ERROR: $_product is not installed/ configured yet on this machine.
......@@ -548,10 +565,7 @@ icingaHostMustExist
touch ${logfile}
if [ $# -eq 0 ]; then
showHelp
exit 0
fi
while [ $# -gt 0 ];
do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment