def get_info(tag):
rss = 0
cpu = 0
vsz = 0
res = runcmd('ps axu |grep '+ tag + ' |grep -v grep')
reslist = res.split('\n')
for line in reslist:
if tag in line:
#print line.split()[4],line.split()[5]
rss += int(line.split()[5])
vsz += int(line.split()[4])
cpu += float(line.split()[2])
print rss,vsz,cpu
return rss,vsz,cpu
#函数的调用:
rss_qsumd,vsz_qsumd,cpu_qsumd = get_info('/var/ytt/bin/qsumd')
阅读(414) | 评论(0) | 转发(0) |