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
7fcd5f2d
Commit
7fcd5f2d
authored
1 year ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
add --target option
parent
af9ce687
Branches
Branches containing commit
No related tags found
1 merge request
!241
Docker checks
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
check_docker_info
+17
-5
17 additions, 5 deletions
check_docker_info
with
17 additions
and
5 deletions
check_docker_info
+
17
−
5
View file @
7fcd5f2d
...
...
@@ -6,6 +6,7 @@
# requirements:
# - docker
# - sudo permissions on docker command
# - jq
#
# ----------------------------------------------------------------------
# Cli docs:
...
...
@@ -15,13 +16,14 @@
# 2024-01-22 v1.1 <axel.hahn@unibe.ch> detect DOCKER; use sudo; add debug
# 2024-01-23 v1.2 <axel.hahn@unibe.ch> Show a list of docker containers; add path
# 2024-01-24 v1.3 <axel.hahn@unibe.ch> remove emoji icons; handle "null" in license info; show rootless or not
# 2024-01-29 v1.4 <axel.hahn@unibe.ch> add --target option
# ======================================================================
.
$(
dirname
$0
)
/inc_pluginfunctions
.
$(
dirname
$0
)
/inc_dockerfunctions.sh
self_APPVERSION
=
1.
3
self_APPVERSION
=
1.
4
# ----------------------------------------------------------------------
# FUNCTIONS
...
...
@@ -50,11 +52,20 @@ USAGE:
$_self
[OPTIONS]
OPTIONS:
General:
-h, --help this help
-c, --containers Flag: Show containers (slow)
-e, --errors Flag: Show containers on error only (slow)
-d, --debug Debug; Flag: show all docker system infos
Connect to docker:
-p, --path Custom directory for docker binary
-t, --target Custom docker target; value for DOCKER_HOST
Needed only if Docker does not run on a unix socket or
multiple users run a rootless docker daemon.
Flags:
-c, --containers Flag: Show containers (slow)
-e, --errors Flag: Show containers on error only (slow)
EXAMPLES:
$_self
...
...
@@ -95,7 +106,8 @@ while [[ "$#" -gt 0 ]]; do case $1 in
PATH
=
"
$2
:
$PATH
"
;
fi
shift
;
shift
;;
*
)
echo
"ERROR: Unknown parameter:
$1
"
;
showHelp
;
exit
1
;
-t
|
--target
)
export
DOCKER_HOST
=
"
$2
"
;
shift
;
shift
;;
*
)
echo
"ERROR: Unknown parameter:
$1
"
;
_showHelp
;
exit
1
;
esac
;
done
...
...
@@ -107,7 +119,7 @@ _detectDockerenv
# --- get data
data
=
$(
sudo
-n
--preserve-env
docker system info
--format
'{{ json . }}'
)
_detectDockererror
"
$data
"
_detectDockererror
"
$data
"
1
typeset
-i
iCTotal
;
iCTotal
=
$(
_getString
"
$data
"
".Containers"
)
...
...
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