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
288d9082
Commit
288d9082
authored
3 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
v1.7: show most consuming processes if usage is > nn %
parent
a24ba0fc
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
check_cpu
+12
-1
12 additions, 1 deletion
check_cpu
with
12 additions
and
1 deletion
check_cpu
+
12
−
1
View file @
288d9082
...
@@ -15,12 +15,15 @@
...
@@ -15,12 +15,15 @@
# 2021-02-10 v1.4 <axel.hahn@iml.unibe.ch> added critical io wait
# 2021-02-10 v1.4 <axel.hahn@iml.unibe.ch> added critical io wait
# 2021-10-28 v1.5 <axel.hahn@iml.unibe.ch> Use 2nd update of top
# 2021-10-28 v1.5 <axel.hahn@iml.unibe.ch> Use 2nd update of top
# 2021-12-10 v1.6 <axel.hahn@iml.unibe.ch> show processes with status D to find cpu waits
# 2021-12-10 v1.6 <axel.hahn@iml.unibe.ch> show processes with status D to find cpu waits
# 2022-03-09 v1.7 <axel.hahn@iml.unibe.ch> show most cpu intensive processes
# ======================================================================
# ======================================================================
.
`
dirname
$0
`
/inc_pluginfunctions
.
`
dirname
$0
`
/inc_pluginfunctions
tmpfile
=
/tmp/check_cpu_
$$
tmpfile
=
/tmp/check_cpu_
$$
iMinCpuUsageToShowProcesses
=
30
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# functions
# functions
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
...
@@ -29,7 +32,7 @@ function showHelp(){
...
@@ -29,7 +32,7 @@ function showHelp(){
cat
<<
EOF
cat
<<
EOF
______________________________________________________________________
______________________________________________________________________
CHECK_CPU check cpu usage and cpu wait v1.
6
CHECK_CPU check cpu usage and cpu wait v1.
7
(c) Institute for Medical Education - Univerity of Bern
(c) Institute for Medical Education - Univerity of Bern
Licence: GNU GPL 3
Licence: GNU GPL 3
...
@@ -135,6 +138,14 @@ echo "$plist" | grep "[0-9]" >/dev/null \
...
@@ -135,6 +138,14 @@ echo "$plist" | grep "[0-9]" >/dev/null \
&&
echo
"For analysis of cpu waits - processes with status D:"
\
&&
echo
"For analysis of cpu waits - processes with status D:"
\
&&
echo
"
$plist
"
&&
echo
"
$plist
"
# v1.7: show most consuming processes if usage is > nn %
typeset
-i
iUsed
=
$(
echo
$cpuNonIdle
|
cut
-f
1
-d
'.'
)
if
[
$iUsed
-gt
$iMinCpuUsageToShowProcesses
]
;
then
echo
echo
"CPU usage is higher
$iMinCpuUsageToShowProcesses
percent ... showing most consuming processes:"
ps aux |
head
-1
;
ps aux |
sort
-nrk
3,3 |
head
-n
5
fi
echo
"
echo
"
Limits: usage warn at
${
iWarnLimit
}
.. critical at
${
iCriticalLimit
}
.. io wait limit
${
iCriticalWait
}
Limits: usage warn at
${
iWarnLimit
}
.. critical at
${
iCriticalLimit
}
.. io wait limit
${
iCriticalWait
}
$sInfo
$sInfo
...
...
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