tacticalrmm/_modules/meshfix.py

19 lines
416 B
Python
Raw Normal View History

2019-10-22 22:22:36 +00:00
from __future__ import absolute_import
import psutil
2019-12-28 10:40:33 +00:00
2019-10-22 22:22:36 +00:00
def fixmesh():
2019-12-28 10:40:33 +00:00
mesh = [
p.info
for p in psutil.process_iter(attrs=["pid", "name"])
if "meshagent" in p.info["name"].lower()
]
2019-10-22 22:22:36 +00:00
if mesh:
try:
mesh_pid = mesh[0]["pid"]
x = psutil.Process(mesh_pid)
except Exception as e:
pass
else:
return x.cpu_percent(5)