From 268f591379fd90d52eac329fabbaf7181e6305cf Mon Sep 17 00:00:00 2001 From: Jonny Lai Date: Mon, 24 Oct 2016 19:20:48 +0800 Subject: [PATCH] convert the memory unit for mapping zabbix-server --- bin/memory-check.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/memory-check.sh b/bin/memory-check.sh index ef02031..bb4e83e 100644 --- a/bin/memory-check.sh +++ b/bin/memory-check.sh @@ -5,12 +5,18 @@ # Filename: memory-check.sh # Modified: 2016-10-24 13:05 # Description: Monitoring memory usage of specific process. +# +# The RSS (resident set size) is mean memory used in KB, not B, +# so we need to `* 1024` for mapping zabbix-server. +# # Reference: # # 1. Total memory used by Python process? | Stack Overflow # - http://stackoverflow.com/a/40173829/686105 +# 2. linux - ps aux output meaning | Super User +# - http://superuser.com/a/117921/205255 # # =========================================================== PROCESS_NAME="$1" -ps aux | grep $PROCESS_NAME | awk '{ sum=sum+$6 }; END { print sum }' +ps aux | grep $PROCESS_NAME | awk '{ sum=sum+$6 }; END { print sum*1024 }'