Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
icinga-checks
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
IML Open Source
icinga-checks
Commits
dbf53866
Commit
dbf53866
authored
1 year ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
added debug infos
parent
6404bee9
Branches
Branches containing commit
No related tags found
1 merge request
!233
Docker checks: remove emoji icons; handle "null" in license info; show rootless or not
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
inc_dockerfunctions.sh
+19
-1
19 additions, 1 deletion
inc_dockerfunctions.sh
with
19 additions
and
1 deletion
inc_dockerfunctions.sh
+
19
−
1
View file @
dbf53866
...
...
@@ -17,6 +17,9 @@
.
$(
dirname
$0
)
/inc_pluginfunctions
_is_docker_rootless
=
0
_is_docker_detected
=
0
# ----------------------------------------------------------------------
# FUNCTIONS
# ----------------------------------------------------------------------
...
...
@@ -32,19 +35,33 @@ function _filterJson(){
# param string json data
# param string jq filter
function
_getString
(){
_filterJson
"
$1
"
"
$2
"
|
tr
-d
'"'
_filterJson
"
$1
"
"
$2
"
|
tr
-d
'"'
|
sed
"s#^null
\$
##"
}
# if DOCKER_HOST is not set we try to detect the user running "containerd"
# create an env var DOCKER_HOST="unix:///run/user/<ID>/docker.sock"
function
_detectDockerenv
(){
local
dockeruid
=
if
[
-z
"
$DOCKER_HOST
"
]
;
then
_is_docker_detected
=
1
dockeruid
=
$(
ps
-ef
|
grep
containerd |
grep
-Eo
"/run/user/([0-9]*)/"
|
head
-1
|
cut
-f
4
-d
'/'
)
test
-n
"
$dockeruid
"
&&
export
DOCKER_HOST
=
"unix:///run/user/
$dockeruid
/docker.sock"
# Don't abort - it is allowed that the variable DOCKER_HOST is missing
fi
if
grep
"/run/user/[0-9]*"
<<<
"
$DOCKER_HOST
"
>
/dev/null
;
then
_is_docker_rootless
=
1
fi
}
# show some debug infos to be shown if needed.
function
_debugInfos
(){
echo
echo
"DEBUG INFOS:"
echo
"DOCKER_HOST =
$DOCKER_HOST
"
test
"
$_is_docker_detected
"
-eq
0
&&
echo
"It was set in the environment."
test
"
$_is_docker_detected
"
-eq
1
&&
echo
"It was detected from process list."
echo
}
# detect error after dicker command. It stops if
# - no content was fetched
# - content contains key "ServerErrors"
...
...
@@ -57,6 +74,7 @@ function _detectDockererror(){
ph.exit
fi
local
sSrvErrror
;
sSrvErrror
=
$(
_filterJson
"
$data
"
".ServerErrors"
)
if
[
"
$sSrvErrror
"
!=
"null"
]
;
then
ph.setStatus unknown
...
...
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