監(jiān)控服務(wù)器內(nèi)存使用率在python怎么實(shí)現(xiàn)?
提問人:楊紫紅發(fā)布時(shí)間:2020-11-24
memory = psutil.virtual_memory()
print memory.used
print memory.total
ab = float(memory.used)/float(memory.total)*100
print "%.2f%%"%ab
print psutil.swap_memory()
print memory.used
print memory.total
ab = float(memory.used)/float(memory.total)*100
print "%.2f%%"%ab
print psutil.swap_memory()
繼續(xù)查找其他問題的答案?
相關(guān)視頻回答
點(diǎn)擊加載更多評(píng)論>>