[项目] server.scripts.mem_sub.py(LOAMAW v1.0)

import subprocess

def script_mem_size(sname):
    mem_size_out = subprocess.check_output('ansible -m shell -a \'free\' %s | grep -i mem | awk \'{print $2}\''%sname, shell=True)
    return(mem_size_out)

def script_mem_usage(sname):
    mem_usage_out = subprocess.check_output('ansible -m shell -a \'free\' %s | grep -i mem | awk \'{print $3}\''%sname, shell=True)
    return(mem_usage_out)

def script_mem_idleness(sname):
    mem_idleness_out = subprocess.check_output('ansible -m shell -a \'free\' %s | grep -i mem | awk \'{print $4}\''%sname, shell=True)
    return(mem_idleness_out)