diff options
author | Kyomotoi <kyomotoiowo@gmail.com> | 2021-07-31 16:16:47 +0800 |
---|---|---|
committer | Kyomotoi <kyomotoiowo@gmail.com> | 2021-07-31 16:16:47 +0800 |
commit | 336eb9d9e98b0bee952c27a50820dbdb350bcc03 (patch) | |
tree | 718d5349232bce0d06cc901707bdd8f478c43314 /ATRI/plugins/status/data_source.py | |
parent | c485985d3be687d17168512de44ea7b744fea7cc (diff) | |
download | ATRI-336eb9d9e98b0bee952c27a50820dbdb350bcc03.tar.gz ATRI-336eb9d9e98b0bee952c27a50820dbdb350bcc03.tar.bz2 ATRI-336eb9d9e98b0bee952c27a50820dbdb350bcc03.zip |
🔥🚚✨
- 移除:laugh.txt,需要时再拉取
- 移动控制台文件至plugins/console目录下
- 新增:
- 和管理贴贴w
- 正式的可视化前端单页
Diffstat (limited to 'ATRI/plugins/status/data_source.py')
-rw-r--r-- | ATRI/plugins/status/data_source.py | 11 |
1 files changed, 6 insertions, 5 deletions
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 |