| | |
| | | self.send_response({"code": 1, "msg": str(e)}, client_id, request_id) |
| | | |
| | | def OnGetEnvInfo(self, client_id, request_id, data): |
| | | print("OnGetEnvInfo", client_id, request_id) |
| | | try: |
| | | fdata = {} |
| | | try: |
| | |
| | | fdata["redis_async_task_count"] = redis_manager.RedisUtils.get_async_task_count() |
| | | except: |
| | | pass |
| | | |
| | | print("获取CPU与内存使用情况开始") |
| | | # 获取CPU与内存适用情况 |
| | | memory_info = psutil.virtual_memory() |
| | | cpu_percent = psutil.cpu_percent(interval=1) |
| | | fdata["device"] = {"cpu": cpu_percent, "memery": memory_info.percent} |
| | | result = {"code": 0, "data": fdata, "msg": ""} |
| | | print("获取CPU与内存使用情况结束") |
| | | self.send_response(result, client_id, request_id) |
| | | except Exception as e: |
| | | self.send_response({"code": 1, "msg": str(e)}, client_id, request_id) |