diff --git a/check_memory b/check_memory index 7ebf17de343ff8b1edeacd8fc5d3fc72ac60e486..fe3f5673587412afb6b676108e52abd9f62b4805 100755 --- a/check_memory +++ b/check_memory @@ -22,11 +22,13 @@ # 2020-07-08 v1.3 <axel.hahn@iml.unibe.ch> FIX: set "ph." instead "ps." # 2020-07-16 v1.4 <axel.hahn@iml.unibe.ch> FIX: add unit MB in the performance data (see #3939) # 2021-03-24 v1.5 <axel.hahn@iml.unibe.ch> increase Swap critical limit 5 --> 50 +# 2022-03-09 v1.6 <axel.hahn@iml.unibe.ch> show most ram intensive processes # ====================================================================== . `dirname $0`/inc_pluginfunctions +iMinRamUsageToShowProcesses=30 # ---------------------------------------------------------------------- # FUNCTIONS @@ -105,6 +107,13 @@ echo cat /proc/meminfo | egrep "^(Mem|Cache|Buffers|Swap|Slab|SReclaimable)" +# v1.6: show most consuming processes if usage is > nn % +if [ $ramUsage -gt $iMinRamUsageToShowProcesses ]; then + echo + echo "RAM usage is higher $iMinRamUsageToShowProcesses percent ... showing most consuming processes:" + ps aux | head -1; ps aux | sort -nrk 3,3 | head -n 5 +fi + # --- performance data ph.perfadd "memory-total" "${ramTotal}MB" "" "" 0 ${ramTotal} ph.perfadd "memory-used" "${ramUsed}MB" "" "" 0 ${ramTotal}