From b71317cf198eace1e5b2a19c46fa7025c2ace0af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Su=C3=A1rez?= Date: Mon, 22 Apr 2024 11:09:32 -0600 Subject: [PATCH 1/2] Fix on Real Time Graphs --- pandora_console/extensions/realtime_graphs/ajax.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pandora_console/extensions/realtime_graphs/ajax.php b/pandora_console/extensions/realtime_graphs/ajax.php index 1482540f91..8212d0c9f2 100644 --- a/pandora_console/extensions/realtime_graphs/ajax.php +++ b/pandora_console/extensions/realtime_graphs/ajax.php @@ -27,7 +27,7 @@ switch ($graph) { if ($os == 'windows') { $data = exec('wmic cpu get loadpercentage|find /I /V "Loadpercentage" | findstr /r "[0-9]" '); } else { - $data = exec("top -bn 2 -d 0.01 | grep '^Cpu' | tail -n 1 | awk '{ print $2+$4+$6 }'"); + $data = exec("top -bn 2 -d 0.01 | grep 'Cpu' | tail -n 1 | awk '{ print $2+$4+$6 }'"); } break; @@ -55,7 +55,8 @@ switch ($graph) { if ($os == 'windows') { $data = exec('(FOR /F "skip=2 tokens=2 delims=\," %P IN (\'typeperf "\\Process(httpd)\\% processor time" -sc 1\') DO @echo %P)|find /V /I "..."'); } else { - $data = exec("ps aux | grep apache2 | grep -v safe | grep -v grep | awk '{ sum+=$3 } END { print sum }'"); + $apache = exec("ps aux | grep apache2 | grep -v safe | grep -v grep && echo 1 || echo 0") == 1 ? "apache2" : "apache"; + $data = exec("ps aux | grep $apache | grep -v safe | grep -v grep | awk '{ sum+=$3 } END { print sum }'"); } break; From c03aa633585c81a903dde4715e9b6cc1355508cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Su=C3=A1rez?= Date: Mon, 22 Apr 2024 11:21:49 -0600 Subject: [PATCH 2/2] Sum server_loads --- pandora_console/extensions/realtime_graphs/ajax.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/extensions/realtime_graphs/ajax.php b/pandora_console/extensions/realtime_graphs/ajax.php index 8212d0c9f2..f6dcfc508d 100644 --- a/pandora_console/extensions/realtime_graphs/ajax.php +++ b/pandora_console/extensions/realtime_graphs/ajax.php @@ -64,7 +64,7 @@ switch ($graph) { if ($os == 'windows') { $data = exec('(FOR /F "skip=2 tokens=2 delims=\," %P IN (\'typeperf "\\Process(pandora_server)\\% processor time" -sc 1\') DO @echo %P)|find /V /I "..."'); } else { - $data = exec("ps aux | grep pandora_server | grep -v grep | awk '{ print $3 }'"); + $data = exec("ps aux | grep pandora_server | grep -v grep | awk '{ sum+=$3 } END { print sum }'"); } break;