Skip to content
Snippets Groups Projects
Commit 288d9082 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

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
...@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment