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
a7b4d1d4
Commit
a7b4d1d4
authored
3 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
check_cpu - Use 2nd update of top
parent
942799a7
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
check_cpu
+5
-2
5 additions, 2 deletions
check_cpu
with
5 additions
and
2 deletions
check_cpu
+
5
−
2
View file @
a7b4d1d4
...
...
@@ -13,6 +13,7 @@
# 2020-07-08 v1.2 <axel.hahn@iml.unibe.ch> FIX: set "ph." instead "ps."
# 2020-07-17 v1.3 <axel.hahn@iml.unibe.ch> use ph.require to check binaries
# 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
# ======================================================================
...
...
@@ -27,7 +28,7 @@ function showHelp(){
cat
<<
EOF
______________________________________________________________________
CHECK_CPU check cpu usage and cpu wait v1.
4
CHECK_CPU check cpu usage and cpu wait v1.
5
(c) Institute for Medical Education - Univerity of Bern
Licence: GNU GPL 3
...
...
@@ -90,7 +91,9 @@ typeset -i iCriticalWait=` ph.getValueWithParam 50 i "$@"`
# hi : time spent servicing hardware interrupts
# si : time spent servicing software interrupts
# st : time stolen from this vm by the hypervisor
top
-b
-n
1 |
head
-5
|
grep
"^
\%
Cpu"
>
$tmpfile
# top -b -n 1 | head -5 | grep "^\%Cpu" >$tmpfile
# FIX read cpu from 2nd output of top
top
-b
-n
2
-d
0.1 |
grep
-i
"^
\%
Cpu"
|
tail
-1
>
$tmpfile
cpuUser
=
`
awk
'{ print $2 }'
$tmpfile
`
cpuSystem
=
`
awk
'{ print $4 }'
$tmpfile
`
...
...
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