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
93271f92
Commit
93271f92
authored
2 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Plain Diff
Merge branch 'cpu-fix-pipe' into 'master'
fix: replace pipe See merge request
!39
parents
7fc2acfb
40e2a0b1
No related branches found
No related tags found
1 merge request
!39
fix: replace pipe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
check_cpu
+5
-4
5 additions, 4 deletions
check_cpu
with
5 additions
and
4 deletions
check_cpu
+
5
−
4
View file @
93271f92
...
@@ -20,13 +20,14 @@
...
@@ -20,13 +20,14 @@
# 2022-03-22 v1.9 <axel.hahn@iml.unibe.ch> fix syntax error on 100% idle
# 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
# 2022-04-14 v1.10 <axel.hahn@iml.unibe.ch> show consuming cpu processes with top and ps
# 2022-08-29 v1.11 <axel.hahn@iml.unibe.ch> replace pipe to prevent start of metrics section
# 2022-08-29 v1.11 <axel.hahn@iml.unibe.ch> replace pipe to prevent start of metrics section
# 2022-08-29 v1.12 <axel.hahn@iml.unibe.ch> fix: replace pipe
# ======================================================================
# ======================================================================
.
$(
dirname
$0
)
/inc_pluginfunctions
.
$(
dirname
$0
)
/inc_pluginfunctions
self_APPNAME
=
$(
basename
$0
|
tr
[
:lower:]
[
:upper:]
)
self_APPNAME
=
$(
basename
$0
|
tr
[
:lower:]
[
:upper:]
)
self_APPVERSION
=
1.1
1
self_APPVERSION
=
1.1
2
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# functions
# functions
...
@@ -153,10 +154,10 @@ ph.status "CPU-USAGE [%] ${cpuNonIdle} ... user: ${cpuUser} - system: ${cpuSyste
...
@@ -153,10 +154,10 @@ ph.status "CPU-USAGE [%] ${cpuNonIdle} ... user: ${cpuUser} - system: ${cpuSyste
plist
=
$(
ps aux |
awk
'$8 ~ /(D|STAT)/ { print $0 }'
)
plist
=
$(
ps aux |
awk
'$8 ~ /(D|STAT)/ { print $0 }'
)
# replace pipe to prevent start of metrics section
# replace pipe to prevent start of metrics section
echo
"
$plist
"
|
tr
'|'
':'
|
grep
"[0-9]"
>
/dev/null
\
echo
"
$plist
"
|
grep
"[0-9]"
>
/dev/null
\
&&
echo
\
&&
echo
\
&&
echo
"For analysis of cpu waits - processes with status D:"
\
&&
echo
"For analysis of cpu waits - processes with status D:"
\
&&
echo
"
$plist
"
&&
echo
"
$plist
"
|
tr
'|'
':'
# v1.7: show most consuming processes if usage is > nn %
# v1.7: show most consuming processes if usage is > nn %
typeset
-i
iUsed
=
$(
echo
$cpuNonIdle
|
cut
-f
1
-d
'.'
)
typeset
-i
iUsed
=
$(
echo
$cpuNonIdle
|
cut
-f
1
-d
'.'
)
...
@@ -170,7 +171,7 @@ if [ $iUsed -gt $iMinCpuUsageToShowProcesses ]; then
...
@@ -170,7 +171,7 @@ if [ $iUsed -gt $iMinCpuUsageToShowProcesses ]; then
echo
"
$topout
"
|
sed
-n
"
${
iStart
}
,
${
iEnd
}
p"
|
tr
'|'
':'
echo
"
$topout
"
|
sed
-n
"
${
iStart
}
,
${
iEnd
}
p"
|
tr
'|'
':'
echo
echo
echo
"output of ps:"
echo
"output of ps:"
ps aux |
head
-1
;
ps aux |
sort
-nrk
3,3 |
head
-n
5
ps aux |
head
-1
;
ps aux |
sort
-nrk
3,3 |
head
-n
5
|
tr
'|'
':'
echo
echo
fi
fi
...
...
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