convert the memory unit for mapping zabbix-server

This commit is contained in:
Jonny Lai 2016-10-24 19:20:48 +08:00
parent 9ce60691d7
commit 268f591379
No known key found for this signature in database
GPG Key ID: FBB6918B261FF774

View File

@ -5,12 +5,18 @@
# Filename: memory-check.sh # Filename: memory-check.sh
# Modified: 2016-10-24 13:05 # Modified: 2016-10-24 13:05
# Description: Monitoring memory usage of specific process. # 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: # Reference:
# #
# 1. Total memory used by Python process? | Stack Overflow # 1. Total memory used by Python process? | Stack Overflow
# - http://stackoverflow.com/a/40173829/686105 # - http://stackoverflow.com/a/40173829/686105
# 2. linux - ps aux output meaning | Super User
# - http://superuser.com/a/117921/205255
# #
# =========================================================== # ===========================================================
PROCESS_NAME="$1" 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 }'