From 336eb9d9e98b0bee952c27a50820dbdb350bcc03 Mon Sep 17 00:00:00 2001 From: Kyomotoi Date: Sat, 31 Jul 2021 16:16:47 +0800 Subject: =?UTF-8?q?=F0=9F=94=A5=F0=9F=9A=9A=E2=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除:laugh.txt,需要时再拉取 - 移动控制台文件至plugins/console目录下 - 新增: - 和管理贴贴w - 正式的可视化前端单页 --- ATRI/plugins/status/data_source.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'ATRI/plugins/status/data_source.py') diff --git a/ATRI/plugins/status/data_source.py b/ATRI/plugins/status/data_source.py index 189f568..c353313 100644 --- a/ATRI/plugins/status/data_source.py +++ b/ATRI/plugins/status/data_source.py @@ -14,13 +14,14 @@ __doc__ = """ class IsSurvive(Service): + def __init__(self): Service.__init__(self, "状态", __doc__, rule=is_in_service("状态")) @staticmethod def ping() -> str: return "I'm fine." - + @staticmethod def get_status(): log.info("开始检查资源消耗...") @@ -30,7 +31,7 @@ class IsSurvive(Service): disk = psutil.disk_usage("/").percent inteSENT = psutil.net_io_counters().bytes_sent / 1000000 # type: ignore inteRECV = psutil.net_io_counters().bytes_recv / 1000000 # type: ignore - + now = time.time() boot = psutil.boot_time() up_time = str( @@ -39,7 +40,7 @@ class IsSurvive(Service): ) except GetStatusError: raise GetStatusError("Failed to get status.") - + msg = "アトリは、高性能ですから!" if cpu > 90: # type: ignore msg = "咱感觉有些头晕..." @@ -56,7 +57,7 @@ class IsSurvive(Service): else: log.info("资源占用正常") is_ok = True - + msg0 = ( "Self status:\n" f"* CPU: {cpu}%\n" @@ -66,5 +67,5 @@ class IsSurvive(Service): f"* netRECV: {inteRECV}MB\n" f"* Runtime: {up_time}\n" ) + msg - + return msg0, is_ok -- cgit v1.2.3