From b8540af79293962a0fdbc72ecf8303abd3f65350 Mon Sep 17 00:00:00 2001 From: Blergo Date: Tue, 2 Jul 2024 20:53:33 +0100 Subject: [PATCH 1/8] changed from CPU % to load average --- command_handlers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/command_handlers.py b/command_handlers.py index bf51bea..0b203cb 100644 --- a/command_handlers.py +++ b/command_handlers.py @@ -102,9 +102,9 @@ def handle_stats_steps(sender_id, message, step, interface, bbs_nodes): send_message(response, sender_id, interface) update_user_state(sender_id, {'command': 'STATS', 'step': 2}) if choice == 1: - cpu = str(psutil.cpu_percent(interval=1, percpu=False)) + cpu = str(psutil.getloadavg()) ramu = str(psutil.virtual_memory().percent) - response = "CPU: " + cpu + "% Used\nRAM: " + ramu + "% Used" + response = "CPU: " + cpu + "\nRAM: " + ramu + "% Used" send_message(response, sender_id, interface) handle_stats_command(sender_id, interface) return From a377983e205708561e7859c4fb4648c564283e56 Mon Sep 17 00:00:00 2001 From: Blergo Date: Tue, 2 Jul 2024 20:57:19 +0100 Subject: [PATCH 2/8] more server stats stuff --- command_handlers.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/command_handlers.py b/command_handlers.py index 0b203cb..c8bbd67 100644 --- a/command_handlers.py +++ b/command_handlers.py @@ -102,9 +102,10 @@ def handle_stats_steps(sender_id, message, step, interface, bbs_nodes): send_message(response, sender_id, interface) update_user_state(sender_id, {'command': 'STATS', 'step': 2}) if choice == 1: - cpu = str(psutil.getloadavg()) + cpu = str(psutil.cpu_freq()) + la = str(psutil.getloadavg()) ramu = str(psutil.virtual_memory().percent) - response = "CPU: " + cpu + "\nRAM: " + ramu + "% Used" + response = "CPU: " + cpu + "\nLoad " la "\nRAM: " + ramu + "% Used" send_message(response, sender_id, interface) handle_stats_command(sender_id, interface) return From 25238f300729d88a2c3af90c7735900caae00889 Mon Sep 17 00:00:00 2001 From: Blergo Date: Tue, 2 Jul 2024 20:58:09 +0100 Subject: [PATCH 3/8] fixed last server stats stuff --- command_handlers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command_handlers.py b/command_handlers.py index c8bbd67..c2450a4 100644 --- a/command_handlers.py +++ b/command_handlers.py @@ -105,7 +105,7 @@ def handle_stats_steps(sender_id, message, step, interface, bbs_nodes): cpu = str(psutil.cpu_freq()) la = str(psutil.getloadavg()) ramu = str(psutil.virtual_memory().percent) - response = "CPU: " + cpu + "\nLoad " la "\nRAM: " + ramu + "% Used" + response = "CPU: " + cpu + "\nLoad " + la + "\nRAM: " + ramu + "% Used" send_message(response, sender_id, interface) handle_stats_command(sender_id, interface) return From b27b8b45799b70fdb37a40424432d3fa02cba6b8 Mon Sep 17 00:00:00 2001 From: Blergo Date: Tue, 2 Jul 2024 21:03:08 +0100 Subject: [PATCH 4/8] more server stats work --- command_handlers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/command_handlers.py b/command_handlers.py index c2450a4..6517897 100644 --- a/command_handlers.py +++ b/command_handlers.py @@ -102,10 +102,10 @@ def handle_stats_steps(sender_id, message, step, interface, bbs_nodes): send_message(response, sender_id, interface) update_user_state(sender_id, {'command': 'STATS', 'step': 2}) if choice == 1: - cpu = str(psutil.cpu_freq()) + cpu = str(psutil.cpu_freq().current) la = str(psutil.getloadavg()) ramu = str(psutil.virtual_memory().percent) - response = "CPU: " + cpu + "\nLoad " + la + "\nRAM: " + ramu + "% Used" + response = "CPU: " + cpu + "Mhz\nLoad " + la + "\nRAM: " + ramu + "% Used" send_message(response, sender_id, interface) handle_stats_command(sender_id, interface) return From 4641fb3c2dad797a26b890fbfd52a16d91b363ff Mon Sep 17 00:00:00 2001 From: Blergo Date: Tue, 2 Jul 2024 21:11:30 +0100 Subject: [PATCH 5/8] work on how load average is displayed --- command_handlers.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/command_handlers.py b/command_handlers.py index 6517897..534c011 100644 --- a/command_handlers.py +++ b/command_handlers.py @@ -103,9 +103,11 @@ def handle_stats_steps(sender_id, message, step, interface, bbs_nodes): update_user_state(sender_id, {'command': 'STATS', 'step': 2}) if choice == 1: cpu = str(psutil.cpu_freq().current) - la = str(psutil.getloadavg()) + la1 = str(psutil.getloadavg()[0]) + la2 = str(psutil.getloadavg()[1]) + la3 = str(psutil.getloadavg()[2]) ramu = str(psutil.virtual_memory().percent) - response = "CPU: " + cpu + "Mhz\nLoad " + la + "\nRAM: " + ramu + "% Used" + response = "CPU: " + cpu + "Mhz\nLoad " + la1 la2 la3 + "\nRAM: " + ramu + "% Used" send_message(response, sender_id, interface) handle_stats_command(sender_id, interface) return From 5673ebc5b5803e8599f1a396f6554611cc256892 Mon Sep 17 00:00:00 2001 From: Blergo Date: Tue, 2 Jul 2024 21:12:20 +0100 Subject: [PATCH 6/8] Load average fix --- command_handlers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command_handlers.py b/command_handlers.py index 534c011..6b614d3 100644 --- a/command_handlers.py +++ b/command_handlers.py @@ -107,7 +107,7 @@ def handle_stats_steps(sender_id, message, step, interface, bbs_nodes): la2 = str(psutil.getloadavg()[1]) la3 = str(psutil.getloadavg()[2]) ramu = str(psutil.virtual_memory().percent) - response = "CPU: " + cpu + "Mhz\nLoad " + la1 la2 la3 + "\nRAM: " + ramu + "% Used" + response = "CPU: " + cpu + "Mhz\nLoad " + la1 + la2 + la3 + "\nRAM: " + ramu + "% Used" send_message(response, sender_id, interface) handle_stats_command(sender_id, interface) return From 60f9f8d9090dadbffd64381031f072cd50673ae4 Mon Sep 17 00:00:00 2001 From: Blergo Date: Tue, 2 Jul 2024 21:14:43 +0100 Subject: [PATCH 7/8] server stat formatting --- command_handlers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command_handlers.py b/command_handlers.py index 6b614d3..3954d9d 100644 --- a/command_handlers.py +++ b/command_handlers.py @@ -107,7 +107,7 @@ def handle_stats_steps(sender_id, message, step, interface, bbs_nodes): la2 = str(psutil.getloadavg()[1]) la3 = str(psutil.getloadavg()[2]) ramu = str(psutil.virtual_memory().percent) - response = "CPU: " + cpu + "Mhz\nLoad " + la1 + la2 + la3 + "\nRAM: " + ramu + "% Used" + response = "CPU: " + cpu + "Mhz\nLoad " + la1 + ", " + la2 + ", " + la3 + "\nRAM: " + ramu + "% Used" send_message(response, sender_id, interface) handle_stats_command(sender_id, interface) return From 2395bf2f766c18700038aaf876df10b41085fece Mon Sep 17 00:00:00 2001 From: Blergo Date: Tue, 2 Jul 2024 21:15:11 +0100 Subject: [PATCH 8/8] server stat formatting --- command_handlers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command_handlers.py b/command_handlers.py index 3954d9d..1025ae7 100644 --- a/command_handlers.py +++ b/command_handlers.py @@ -107,7 +107,7 @@ def handle_stats_steps(sender_id, message, step, interface, bbs_nodes): la2 = str(psutil.getloadavg()[1]) la3 = str(psutil.getloadavg()[2]) ramu = str(psutil.virtual_memory().percent) - response = "CPU: " + cpu + "Mhz\nLoad " + la1 + ", " + la2 + ", " + la3 + "\nRAM: " + ramu + "% Used" + response = "CPU: " + cpu + "Mhz\nLoad: " + la1 + ", " + la2 + ", " + la3 + "\nRAM: " + ramu + "% Used" send_message(response, sender_id, interface) handle_stats_command(sender_id, interface) return