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 [email protected] 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?
I would suggest taking look at Glances. It's written in python and can also be used for remote server monitoring:
https://github.com/nicolargo/glances
Using glances on remote server:
http://mylinuxbook.com/glances-an-all-in-one-system-monitoring-tool/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With