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

Merge branch 'custom-params-per-server' into 'master'

add hostnamme into CFGSTORAGE

See merge request !25
parents 0b96a58a 4ccadbc1
No related branches found
No related tags found
1 merge request!25add hostnamme into CFGSTORAGE
...@@ -14,10 +14,11 @@ ...@@ -14,10 +14,11 @@
# - UniBe network and group names - see hostCreate() # - 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-02-16 v0.2 ah add --cfg param
# 2022-03-04 v0.3 ah abort on http 5xx error # 2022-03-04 v0.3 ah abort on http 5xx error
# 2023-01-22 v0.4 ah fix _bStopOnError; some shellfixes # 2023-01-22 v0.4 ah fix _bStopOnError; some shellfixes
# 2023-02-17 v0.5 ah add hostnamme into CFGSTORAGE
# ====================================================================== # ======================================================================
tmpfile=/tmp/outcurl.tmp tmpfile=/tmp/outcurl.tmp
...@@ -91,7 +92,7 @@ typeset cfg_dryrun=false ...@@ -91,7 +92,7 @@ typeset cfg_dryrun=false
local MY_OSMajorVersion=$(ph.getOSMajor) local MY_OSMajorVersion=$(ph.getOSMajor)
fi fi
export CFGSTORAGE="directorhost" export CFGSTORAGE="${MY_NAME}-directorhost"
( (
$ch --flush $ch --flush
$ch --set object_name \"$MY_NAME\" $ch --set object_name \"$MY_NAME\"
...@@ -170,7 +171,7 @@ typeset cfg_dryrun=false ...@@ -170,7 +171,7 @@ typeset cfg_dryrun=false
# ............................................................ # ............................................................
# set $ch to store all object vars # set $ch to store all object vars
function _generateJsonForServicetemplate(){ function _generateJsonForServicetemplate(){
export CFGSTORAGE="service-${IDC_service__obj_name}" export CFGSTORAGE="${MY_NAME}-service-${IDC_service__obj_name}"
( (
$ch --flush $ch --flush
$ch --set object_name "\"${IDC_service__obj_name}\"" $ch --set object_name "\"${IDC_service__obj_name}\""
...@@ -202,7 +203,7 @@ typeset cfg_dryrun=false ...@@ -202,7 +203,7 @@ typeset cfg_dryrun=false
# ............................................................ # ............................................................
# set $ch to store all object vars # set $ch to store all object vars
function _generateJsonForSvclink(){ function _generateJsonForSvclink(){
export CFGSTORAGE="servicelink-${IDC_svcathost__obj_name}" export CFGSTORAGE="${MY_NAME}-servicelink-${IDC_svcathost__obj_name}"
( (
$ch --flush $ch --flush
$ch --set object_name "\"${IDC_svcathost__obj_name}\"" $ch --set object_name "\"${IDC_svcathost__obj_name}\""
...@@ -427,7 +428,7 @@ typeset cfg_dryrun=false ...@@ -427,7 +428,7 @@ typeset cfg_dryrun=false
# helper to create a base config for the current host # helper to create a base config for the current host
# UNUSED # UNUSED
function UNUSED_initHostdata(){ function UNUSED_initHostdata(){
export CFGSTORAGE="directorhost" export CFGSTORAGE="${MY_NAME}-directorhost"
( (
$ch --flush $ch --flush
$ch --set object_name \"$MY_NAME\" $ch --set object_name \"$MY_NAME\"
......
...@@ -18,11 +18,12 @@ ...@@ -18,11 +18,12 @@
# 2022-07-08 v0.11 ah check pipes in output and performance data # 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-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-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" _product="ICINGA PASSIVE CLIENT"
_version="0.12" _version="0.14"
_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'
...@@ -387,7 +388,7 @@ function processCheck(){ ...@@ -387,7 +388,7 @@ function processCheck(){
# --- send check result to Icinga # --- send check result to Icinga
# fields of the object # fields of the object
# https://icinga.com/docs/icinga2/latest/doc/12-icinga2-api/#process-check-result # 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)" outputAsText="$(cat $_outfile)"
# outputAsJson="$(jq -nR --arg data """${outputAsText}""" '$data')" # outputAsJson="$(jq -nR --arg data """${outputAsText}""" '$data')"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment