diff options
author | Lint Action <[email protected]> | 2021-07-31 08:17:46 +0000 |
---|---|---|
committer | Lint Action <[email protected]> | 2021-07-31 08:17:46 +0000 |
commit | 36d26d1dc61c36b4601aaf75e148060c5bcb98a7 (patch) | |
tree | 3b466c4b0db4b9e160c5390a1d1c7ddb0322660f /ATRI/plugins/status/data_source.py | |
parent | 336eb9d9e98b0bee952c27a50820dbdb350bcc03 (diff) | |
download | ATRI-36d26d1dc61c36b4601aaf75e148060c5bcb98a7.tar.gz ATRI-36d26d1dc61c36b4601aaf75e148060c5bcb98a7.tar.bz2 ATRI-36d26d1dc61c36b4601aaf75e148060c5bcb98a7.zip |
:rotating_light: 自动进行代码格式化
Diffstat (limited to 'ATRI/plugins/status/data_source.py')
-rw-r--r-- | ATRI/plugins/status/data_source.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/ATRI/plugins/status/data_source.py b/ATRI/plugins/status/data_source.py index c353313..189f568 100644 --- a/ATRI/plugins/status/data_source.py +++ b/ATRI/plugins/status/data_source.py @@ -14,14 +14,13 @@ __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("开始检查资源消耗...") @@ -31,7 +30,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( @@ -40,7 +39,7 @@ class IsSurvive(Service): ) except GetStatusError: raise GetStatusError("Failed to get status.") - + msg = "アトリは、高性能ですから!" if cpu > 90: # type: ignore msg = "咱感觉有些头晕..." @@ -57,7 +56,7 @@ class IsSurvive(Service): else: log.info("资源占用正常") is_ok = True - + msg0 = ( "Self status:\n" f"* CPU: {cpu}%\n" @@ -67,5 +66,5 @@ class IsSurvive(Service): f"* netRECV: {inteRECV}MB\n" f"* Runtime: {up_time}\n" ) + msg - + return msg0, is_ok |