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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Open Source
icinga-passive-client
Commits
7144be7c
Commit
7144be7c
authored
3 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
abort on http 5xx error
parent
6770ec69
No related branches found
No related tags found
1 merge request
!4
abort on http 5xx error
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
director-cli.sh
+5
-0
5 additions, 0 deletions
director-cli.sh
icinga-cli.sh
+6
-1
6 additions, 1 deletion
icinga-cli.sh
inc_functions.sh
+4
-0
4 additions, 0 deletions
inc_functions.sh
with
15 additions
and
1 deletion
director-cli.sh
+
5
−
0
View file @
7144be7c
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# ah = axel.hahn@iml.unibe.ch
# ah = axel.hahn@iml.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
# ======================================================================
# ======================================================================
tmpfile
=
/tmp/outcurl.tmp
tmpfile
=
/tmp/outcurl.tmp
...
@@ -365,6 +366,10 @@ typeset cfg_dryrun=false
...
@@ -365,6 +366,10 @@ typeset cfg_dryrun=false
if
[
${
_paramDryrun
}
=
false
]
;
then
if
[
${
_paramDryrun
}
=
false
]
;
then
_wd
">>>>>
$_paramAction
$_paramObj
[
${
_object_name
}
] >>
$_sMethod
$_sUrl
$_jsondata
"
_wd
">>>>>
$_paramAction
$_paramObj
[
${
_object_name
}
] >>
$_sMethod
$_sUrl
$_jsondata
"
http.makeRequest
"
$_sMethod
"
"
$_sUrl
"
"
$_jsondata
"
http.makeRequest
"
$_sMethod
"
"
$_sUrl
"
"
$_jsondata
"
if
http.isServerError
>
/dev/null
;
then
echo
"CRITICAL ERROR: Director API request failed with a server error
$_sMethod
$_sUrl
"
exit
1
fi
if
[
$_bShowResponse
=
true
]
;
then
if
[
$_bShowResponse
=
true
]
;
then
http.getResponseHeader
http.getResponseHeader
http.getResponse
http.getResponse
...
...
This diff is collapsed.
Click to expand it.
icinga-cli.sh
+
6
−
1
View file @
7144be7c
...
@@ -13,11 +13,12 @@
...
@@ -13,11 +13,12 @@
# 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
# 2022-02-16 v0.8 ah add --cfg param
# 2022-03-04 v0.9 ah abort on http 5xx error
# ======================================================================
# ======================================================================
_product
=
"ICINGA PASSIVE CLIENT"
_product
=
"ICINGA PASSIVE CLIENT"
_version
=
"0.
8
"
_version
=
"0.
9
"
_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'
...
@@ -248,6 +249,10 @@ function icingaHost(){
...
@@ -248,6 +249,10 @@ function icingaHost(){
http.setCacheTtl
$_iRefreshCache
http.setCacheTtl
$_iRefreshCache
http.setCacheFile
$_localCache
http.setCacheFile
$_localCache
http.makeRequest GET
$_apiRequest
http.makeRequest GET
$_apiRequest
if
http.isServerError
>
/dev/null
;
then
echo
"CRITICAL ERROR: Icinga2 API request failed with a server error GET
$_apiRequest
"
exit
1
fi
# set return code of GET action
# set return code of GET action
http.isOk
>
/dev/null
http.isOk
>
/dev/null
...
...
This diff is collapsed.
Click to expand it.
inc_functions.sh
+
4
−
0
View file @
7144be7c
...
@@ -232,6 +232,10 @@ function _getIpPrivate(){
...
@@ -232,6 +232,10 @@ function _getIpPrivate(){
function
_APIcall
(){
function
_APIcall
(){
http.makeRequest
"
$1
"
"
$2
"
"
$3
"
http.makeRequest
"
$1
"
"
$2
"
"
$3
"
if
http.isServerError
>
/dev/null
;
then
echo
"CRITICAL ERROR: API request failed with a server error
$1
$2
"
exit
1
fi
http.getResponseHeader
http.getResponseHeader
http.getResponse
http.getResponse
...
...
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