Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
icinga-passive-client
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Open Source
icinga-passive-client
Commits
a7c8b284
Commit
a7c8b284
authored
3 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
addparam --cfg
parent
a279fee8
No related branches found
No related tags found
1 merge request
!2
Add param for cfgfile
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
director-cli.sh
+23
-11
23 additions, 11 deletions
director-cli.sh
icinga-cli.sh
+23
-9
23 additions, 9 deletions
icinga-cli.sh
with
46 additions
and
20 deletions
director-cli.sh
+
23
−
11
View file @
a7c8b284
...
@@ -13,12 +13,11 @@
...
@@ -13,12 +13,11 @@
# - use puppet facts
# - use puppet facts
# - UniBe network and group names - see hostCreate()
# - 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
tmpfile
=
/tmp/outcurl.tmp
tmpfile2
=
/tmp/outcurl2.tmp
tmpfile2
=
/tmp/outcurl2.tmp
...
@@ -733,6 +732,10 @@ Director actions
...
@@ -733,6 +732,10 @@ Director actions
Other parameters
Other parameters
--cfg CONFIGFILE
load a costom config file; default: ./inc_getconfig.sh
This must be the 1st parameter to be processed.
--debug
--debug
enable debug output.
enable debug output.
...
@@ -761,24 +764,33 @@ echo
...
@@ -761,24 +764,33 @@ echo
echo
"##### DIRECTOR HELPER
$MY_NAME
-
$MY_IP
"
echo
"##### DIRECTOR HELPER
$MY_NAME
-
$MY_IP
"
echo
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
`
cd
`
dirname
$0
`
ls
./
`
basename
$0
`
>
/dev/null
||
exit
1
ls
./
`
basename
$0
`
>
/dev/null
||
exit
1
_initVars
_initVars
# ensure that ./inc_getconfig.sh was loaded
# ensure that ./inc_getconfig.sh was loaded
if
[
-z
"
${
dir_cfg
}
"
]
;
then
if
[
-z
"
${
dir_cfg
}
"
]
;
then
echo
ERROR: Client is not installed/ configured yet on this machine.
echo
ERROR: Client is not installed/ configured yet on this machine.
exit
1
exit
1
fi
fi
if
[
$#
-eq
0
]
;
then
showHelp
exit
0
fi
while
[
$#
-gt
0
]
;
while
[
$#
-gt
0
]
;
do
do
case
"
$1
"
in
case
"
$1
"
in
...
...
This diff is collapsed.
Click to expand it.
icinga-cli.sh
+
23
−
9
View file @
a7c8b284
...
@@ -12,21 +12,21 @@
...
@@ -12,21 +12,21 @@
# ah = axel.hahn@iml.unibe.ch
# ah = axel.hahn@iml.unibe.ch
# 2021-03-.. init
# 2021-03-.. init
# 2022-01-11 v0.7 ah shellcheck
# 2022-01-11 v0.7 ah shellcheck
# 2022-02-16 v0.8 ah add --cfg param
# ======================================================================
# ======================================================================
_product
=
"ICINGA PASSIVE CLIENT"
_product
=
"ICINGA PASSIVE CLIENT"
_version
=
"0.
7
"
_version
=
"0.
8
"
_license
=
"GNU GPL 3.0"
_license
=
"GNU GPL 3.0"
_copyright
=
'(c) 2020 Institute for Medical Education * University of Bern'
_copyright
=
'(c) 2020 Institute for Medical Education * University of Bern'
typeset
-i
debug
=
0
typeset
-i
debug
=
0
# source config ...
# 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
# where to find check scripts ... first directory wins
# dir_plugins="/opt/imlmonitor/client/plugins/ /usr/lib64/nagios/plugins"
# 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.
...
@@ -451,13 +451,16 @@ A new local check will be added to Icinga while running it the first time.
GENERAL PARAMETERS
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 -?
--help or -h or -?
show this help and abort.
show this help and abort.
--version or -v
--version or -v
show the version abd abort
show the version abd abort
SERVICE ACTIONS
SERVICE ACTIONS
--list
--list
...
@@ -538,6 +541,20 @@ ________________________________________________________________________________
...
@@ -538,6 +541,20 @@ ________________________________________________________________________________
EOBANNER
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
if
[
-z
"
${
dir_cfg
}
"
]
;
then
echo
ERROR:
$_product
is not installed/ configured yet on this machine.
echo
ERROR:
$_product
is not installed/ configured yet on this machine.
...
@@ -548,10 +565,7 @@ icingaHostMustExist
...
@@ -548,10 +565,7 @@ icingaHostMustExist
touch
${
logfile
}
touch
${
logfile
}
if
[
$#
-eq
0
]
;
then
showHelp
exit
0
fi
while
[
$#
-gt
0
]
;
while
[
$#
-gt
0
]
;
do
do
...
...
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