Memory Check: Check and Free memory on cluster's nodes


#1

Summary:

Check all nodes of the cluster to get current memory usage

# for node in $(asinfo -v "services" | tr -d "values is rqtdc\n" | \
tr ';' '\n' | cut -d: -f1 | sort); do echo $node; \
ssh root@$node "free -m"; ps -e -orss=,size=,args= | sort -b -n | \
tail -n 5; echo;echo; done

Sample Output:

10.65.18.101
total used free shared buffers cached
Mem: 48257 48031 226 0 94 33330
-/+ buffers/cache: 14605 33652
Swap: 24199 0 24199
4908 884 ntpd -u ntp:ntp -p /var/run/ntpd.pid -g
4920 3436 hald
7268 4244 /usr/bin/python /usr/bin/asmonitor
7524 4424 /usr/bin/python /usr/bin/asmonitor
29224892 13881320 /usr/bin/asd

Summary:

If memory is running low, free up some memory from cache

# for node in $(asinfo -v "services" | tr -d "values is rqtdc\n" | \
tr ';' '\n' | cut -d: -f1 | sort); do echo $node; \
ssh root@$node "free -m ; sync ; echo 3 | tee /proc/sys/vm/drop_caches; \
free -m"; ps -e -orss=,size=,args= | sort -b -n | tail -n 5; echo;echo; done

Sample Output:

10.65.18.101
total used free shared buffers cached
Mem: 48257 33106 15151 0 2 18923
-/+ buffers/cache: 14180 34077
Swap: 24199 0 24199
3
total used free shared buffers cached
Mem: 48257 33078 15178 0 0 18898
-/+ buffers/cache: 14179 34078
Swap: 24199 0 24199
4908 884 ntpd -u ntp:ntp -p /var/run/ntpd.pid -g
4920 3436 hald
7268 4244 /usr/bin/python /usr/bin/asmonitor
7524 4424 /usr/bin/python /usr/bin/asmonitor
29229404 13881320 /usr/bin/asd