From 5c2f8c9299134933f1ec569c5e94c99b2e32509d Mon Sep 17 00:00:00 2001 From: Iris De Santis Date: Mon, 5 Aug 2024 14:58:38 +0200 Subject: [PATCH] She type on my safety till i stop concatenating on her string --- .vscode/settings.json | 3 ++- src/checks/check_boot_errors.py | 3 ++- src/checks/check_cpu_usage.py | 3 ++- src/main.py | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index e6e7934..0b49754 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,5 +7,6 @@ "**/.DS_Store": true, "**/Thumbs.db": true }, - "hide-files.files": [] + "hide-files.files": [], + "python.analysis.typeCheckingMode": "basic" } \ No newline at end of file diff --git a/src/checks/check_boot_errors.py b/src/checks/check_boot_errors.py index 6bb892e..f5629cf 100644 --- a/src/checks/check_boot_errors.py +++ b/src/checks/check_boot_errors.py @@ -7,4 +7,5 @@ def check_boot_errors(): result = subprocess.run(["dmesg"], capture_output=True, text=True) errors = result.stdout.lower().count("error") if errors > 30: - log_message("Last boot has had more than 30 errors,, :c (according to dmesg)" + environ.get("BOT_OWNER") + " please check the logs!") + bot_owner = environ.get("BOT_OWNER", "Unknown") + log_message(f"Last boot has had more than 30 errors,, :c (according to dmesg) {bot_owner} please check the logs!") diff --git a/src/checks/check_cpu_usage.py b/src/checks/check_cpu_usage.py index 4cc67a8..fc6fc58 100644 --- a/src/checks/check_cpu_usage.py +++ b/src/checks/check_cpu_usage.py @@ -14,7 +14,8 @@ def check_cpu_usage(): cpu_overload_start = datetime.now() elif (datetime.now() - cpu_overload_start).total_seconds() > 120: process_info = get_top_cpu_process() - log_message(f"CPU overloaded by {process_info} for more than 2 minutes,," + environ.get("BOT_OWNER") + " please do something!") + bot_owner = environ.get("BOT_OWNER", "Unknown") + log_message(f"CPU overloaded by {process_info} for more than 2 minutes,, {bot_owner} please do something!") cpu_overload_start = None # Reset else: cpu_overload_start = None # Reset if not overloaded diff --git a/src/main.py b/src/main.py index bbfaf66..6b4bda2 100644 --- a/src/main.py +++ b/src/main.py @@ -25,7 +25,8 @@ def main(): post_to_misskey("Performed system health check.") time.sleep(300) # Wait for 5 minutes before next check except KeyboardInterrupt: - log_message("Monitoring stopped by " + environ.get("BOT_OWNER") + " ,,") + bot_owner = environ.get("BOT_OWNER", "Unknown") + log_message(f"Monitoring stopped by {bot_owner} ,,") if __name__ == "__main__": main()