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
e75eb71b
Commit
e75eb71b
authored
3 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
show consuming cpu processes with top and ps
parent
243997dd
No related branches found
No related tags found
1 merge request
!16
show consuming cpu processes with top and ps
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
check_cpu
+10
-1
10 additions, 1 deletion
check_cpu
with
10 additions
and
1 deletion
check_cpu
+
10
−
1
View file @
e75eb71b
...
...
@@ -18,6 +18,7 @@
# 2022-03-09 v1.7 <axel.hahn@iml.unibe.ch> show most cpu intensive processes
# 2022-03-10 v1.8 <axel.hahn@iml.unibe.ch> add cli param -p; update help
# 2022-03-22 v1.9 <axel.hahn@iml.unibe.ch> fix syntax error on 100% idle
# 2022-04-14 v1.10 <axel.hahn@iml.unibe.ch> show consuming cpu processes with top and ps
# ======================================================================
...
...
@@ -155,8 +156,16 @@ echo "$plist" | grep "[0-9]" >/dev/null \
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:"
echo
"CPU usage is higher
$iMinCpuUsageToShowProcesses
percent ... showing most consuming processes"
echo
"output of top :"
topout
=
$(
top
-b
-n
1
-d
0.1
)
typeset
-i
iStart
=
$(
echo
"
$topout
"
|
grep
-n
"PID.*USER"
|
cut
-f
1
-d
':'
)
typeset
-i
iEnd
=
$iStart
+5
echo
"
$topout
"
|
sed
-n
"
${
iStart
}
,
${
iEnd
}
p"
echo
echo
"output of ps:"
ps aux |
head
-1
;
ps aux |
sort
-nrk
3,3 |
head
-n
5
echo
fi
echo
"
...
...
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