diff --git a/director-cli.sh b/director-cli.sh index 2858ebe5f1c26f1f77ccc46eeed35566a55c4a05..9cd527751325b983b123e7c73ffc2e2fa31bcd74 100755 --- a/director-cli.sh +++ b/director-cli.sh @@ -14,10 +14,11 @@ # - UniBe network and group names - see hostCreate() # # ---------------------------------------------------------------------- -# ah = axel.hahn@iml.unibe.ch +# ah = axel.hahn@unibe.ch # 2022-02-16 v0.2 ah add --cfg param # 2022-03-04 v0.3 ah abort on http 5xx error # 2023-01-22 v0.4 ah fix _bStopOnError; some shellfixes +# 2023-02-17 v0.5 ah add hostnamme into CFGSTORAGE # ====================================================================== tmpfile=/tmp/outcurl.tmp @@ -91,7 +92,7 @@ typeset cfg_dryrun=false local MY_OSMajorVersion=$(ph.getOSMajor) fi - export CFGSTORAGE="directorhost" + export CFGSTORAGE="${MY_NAME}-directorhost" ( $ch --flush $ch --set object_name \"$MY_NAME\" @@ -170,7 +171,7 @@ typeset cfg_dryrun=false # ............................................................ # set $ch to store all object vars function _generateJsonForServicetemplate(){ - export CFGSTORAGE="service-${IDC_service__obj_name}" + export CFGSTORAGE="${MY_NAME}-service-${IDC_service__obj_name}" ( $ch --flush $ch --set object_name "\"${IDC_service__obj_name}\"" @@ -202,7 +203,7 @@ typeset cfg_dryrun=false # ............................................................ # set $ch to store all object vars function _generateJsonForSvclink(){ - export CFGSTORAGE="servicelink-${IDC_svcathost__obj_name}" + export CFGSTORAGE="${MY_NAME}-servicelink-${IDC_svcathost__obj_name}" ( $ch --flush $ch --set object_name "\"${IDC_svcathost__obj_name}\"" @@ -427,7 +428,7 @@ typeset cfg_dryrun=false # helper to create a base config for the current host # UNUSED function UNUSED_initHostdata(){ - export CFGSTORAGE="directorhost" + export CFGSTORAGE="${MY_NAME}-directorhost" ( $ch --flush $ch --set object_name \"$MY_NAME\" diff --git a/icinga-cli.sh b/icinga-cli.sh index 9681d1361270b28494e6923dccb61d1dc4cb56de..39865b550261b046b1bc4fa471b553e1436477ab 100755 --- a/icinga-cli.sh +++ b/icinga-cli.sh @@ -18,11 +18,12 @@ # 2022-07-08 v0.11 ah check pipes in output and performance data # 2023-01-30 v0.12 ah remove pipes with sed remove the pipe before performancedata # 2023-02-13 v0.13 ah rename myHost to MY_NAME (like in director_cli) +# 2023-02-17 v0.14 ah add hostnamme into CFGSTORAGE # ====================================================================== _product="ICINGA PASSIVE CLIENT" -_version="0.12" +_version="0.14" _license="GNU GPL 3.0" _copyright='(c) 2020 Institute for Medical Education * University of Bern' @@ -387,7 +388,7 @@ function processCheck(){ # --- send check result to Icinga # fields of the object # https://icinga.com/docs/icinga2/latest/doc/12-icinga2-api/#process-check-result - export CFGSTORAGE="${checkName}output" + export CFGSTORAGE="${MY_NAME}-${checkName}output" outputAsText="$(cat $_outfile)" # outputAsJson="$(jq -nR --arg data """${outputAsText}""" '$data')"