Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nagios-plugin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Le Filament
nagios-plugin
Commits
3ce24d6e
Commit
3ce24d6e
authored
3 years ago
by
Théo - Le Filament
Browse files
Options
Downloads
Patches
Plain Diff
improve output format of check_docker
parent
460bbf01
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
check_docker.sh
+7
-7
7 additions, 7 deletions
check_docker.sh
with
7 additions
and
7 deletions
check_docker.sh
+
7
−
7
View file @
3ce24d6e
...
@@ -63,11 +63,11 @@ mem_scale=";${mem_threshold_warning};${mem_threshold_critical};0;100"
...
@@ -63,11 +63,11 @@ mem_scale=";${mem_threshold_warning};${mem_threshold_critical};0;100"
# Running containers.
# Running containers.
for
container
in
${
running_containers
}
;
do
for
container
in
${
running_containers
}
;
do
output+
=
"
OK:
${
container
}
status is running"
output+
=
"OK:
${
container
}
status is running
\n
"
done
done
# Not running containers.
# Not running containers.
for
container
in
${
not_running_containers
}
;
do
for
container
in
${
not_running_containers
}
;
do
output+
=
"
NOK:
${
container
}
status is not running"
output+
=
"NOK:
${
container
}
status is not running
\n
"
done
done
# CPU and memory statistics for running containers.
# CPU and memory statistics for running containers.
...
@@ -80,12 +80,12 @@ for container_stats in ${running_containers_stats}; do
...
@@ -80,12 +80,12 @@ for container_stats in ${running_containers_stats}; do
status
=
'OK'
status
=
'OK'
[[
${
cpu
%.*
}
-ge
$cpu_threshold_warning
]]
&&
status
=
'WARNING'
[[
${
cpu
%.*
}
-ge
$cpu_threshold_warning
]]
&&
status
=
'WARNING'
[[
${
cpu
%.*
}
-ge
$cpu_threshold_critical
]]
&&
status
=
'CRITICAL'
[[
${
cpu
%.*
}
-ge
$cpu_threshold_critical
]]
&&
status
=
'CRITICAL'
output+
=
"
${
status
}
:
${
name
}
cpu is
${
cpu
}
%"
output+
=
"
${
status
}
:
${
name
}
cpu is
${
cpu
}
%
\n
"
status
=
'OK'
status
=
'OK'
[[
${
mem
%.*
}
-ge
$mem_threshold_warning
]]
&&
status
=
'WARNING'
[[
${
mem
%.*
}
-ge
$mem_threshold_warning
]]
&&
status
=
'WARNING'
[[
${
mem
%.*
}
-ge
$mem_threshold_critical
]]
&&
status
=
'CRITICAL'
[[
${
mem
%.*
}
-ge
$mem_threshold_critical
]]
&&
status
=
'CRITICAL'
output+
=
"
${
status
}
:
${
name
}
memory is
${
mem
}
%"
output+
=
"
${
status
}
:
${
name
}
memory is
${
mem
}
%
\n
"
perf+
=
"
${
name
}
_cpu=
${
cpu
}
%
${
cpu_scale
}
"
perf+
=
"
${
name
}
_cpu=
${
cpu
}
%
${
cpu_scale
}
"
perf+
=
"
${
name
}
_mem=
${
mem
}
%
${
mem_scale
}
"
perf+
=
"
${
name
}
_mem=
${
mem
}
%
${
mem_scale
}
"
...
@@ -99,5 +99,5 @@ grep --quiet 'WARNING:' <(echo $output) && exit_code=1
...
@@ -99,5 +99,5 @@ grep --quiet 'WARNING:' <(echo $output) && exit_code=1
grep
--quiet
'NOK:\|CRITICAL:'
<
(
echo
$output
)
&&
exit_code
=
2
grep
--quiet
'NOK:\|CRITICAL:'
<
(
echo
$output
)
&&
exit_code
=
2
# Plugin output.
# Plugin output.
echo
"
${
output
#
'
'
}
|
${
perf
#
' '
}
"
echo
"
${
output
%
'\n
'
}
|
${
perf
%
' '
}
"
exit
$exit_code
exit
$exit_code
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