#!/bin/bash
# memory percent stats
#/proc/meminfo
#useage squeue free-cache-buffer-swap
memory_use () {
memory_used=`head -2 /proc/meminfo | awk 'NR==1{t=$2}NR==2{f=$2;print((t-f)/t*100 "%")}'`
memory_cache=`head -5 /proc/meminfo | awk 'NR==1{t=$2}NR==5{c=$2;print(c/t*100)}'`
memory_buffer=`head -4 /proc/meminfo | awk 'NR==1{t=$2}NR==4{b=$2;print(b/t*100)}'`
echo -e "memory_used:$memory_used butter:$memory_buffer cache;$memory_cache"
}
memory_use