Skip to content

Instantly share code, notes, and snippets.

@mr-stringer
Last active May 1, 2020 13:20
Show Gist options
  • Select an option

  • Save mr-stringer/868025e98b42a5dede79cac40016dd0d to your computer and use it in GitHub Desktop.

Select an option

Save mr-stringer/868025e98b42a5dede79cac40016dd0d to your computer and use it in GitHub Desktop.
The the resident memory of non HANA processes, useful for setting the GAL
#!/bin/bash
#
# Script to figure out the non-HANA resident memory high watermark so that
# the GAL can be correctly configured
# Number of passes (minutes) to run the script for, suggest 24 hours 1440
Passes=1440
Sleep=60
HighWaterMark=0
HighWaterMarkDate=''
SapUser="hanadm" # <- Set this to your <SID>adm <- doesn't work in multi-SID or high-isolation MDC yet.
GrepString=$(echo "${SapUser}.*hdbnameserver|${SapUser}.*hdbindexserver|${SapUser}.*hdbcompileserver|${SapUser}.*hdbpreprocessor|${SapUser}.*hdbxsengine|${SapUser}.*hdbwebdispatcher|${SapUser}.*hdbrsutil")
for i in $(eval echo "{1..$Passes}")
do
Current=$(ps -eo user,rss,cmd | sed 1d | grep -Ev "${GrepString}" | awk '{print $2}' | paste -sd+ | bc)
#echo 'ps -eo user,rss,cmd | sed 1d | grep -Ev ${GrepString} | awk '{print $2}' | paste -sd+ | bc'
if [[ Current > $HighWaterMark ]]
then
HighWaterMark=${Current}
HighWaterMarkDate=$(date)
fi
sleep $Sleep
done
printf "Highest recorded RSS = %'dMiB @ %s\n" $(echo "${HighWaterMark}/1024"|bc) "$(echo $HighWaterMarkDate)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment