I am using the following code to get remote PC CPU percentage of usage witch is slow and loading the remote PC because of SSHing.
per=(subprocess.check_output('ssh root@192.168.32.218 nohup python psutilexe.py',stdin=None,stderr=subprocess.STDOUT,shell=True)).split(' ')
print 'CPU %=',float(per[0])
print 'MEM %=',float(per[1])
where psutilexe.py
is as follows:
import psutil
print psutil.cpu_percent(), psutil.virtual_memory()[2]
Would you please let me know if there is any alternate way to measure remote PC CPU % of usage using Python?