2012-01-23 Koichiro Kikuchi <koichiro@rworks.jp>

* include/functions_servers.php: Exclude modules which belong to
	  disabled agent from server performance and lag calculation.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5399 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
koichirok 2012-01-23 08:05:35 +00:00
parent e38ba81e97
commit 50d778c2d1
2 changed files with 32 additions and 12 deletions

View File

@ -1,3 +1,8 @@
2012-01-23 Koichiro Kikuchi <koichiro@rworks.jp>
* include/functions_servers.php: Exclude modules which belong to
disabled agent from server performance and lag calculation.
2012-01-20 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_api.php: Modified get_all_agents function.

View File

@ -78,18 +78,20 @@ function servers_get_performance () {
if ($config["realtimestats"] == 1){
$data["total_remote_modules"] = db_get_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo)
FROM tagente_modulo, tagente_estado
FROM tagente_modulo, tagente_estado, tagente
WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
AND tagente_modulo.id_modulo != 1 AND disabled = 0 AND utimestamp > 0");
AND tagente_modulo.id_modulo != 1 AND tagente_modulo.disabled = 0 AND utimestamp > 0
AND tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente");
}
else {
$data["total_remote_modules"] = db_get_sql ("SELECT SUM(my_modules) FROM tserver WHERE server_type != 0");
}
$data["avg_interval_remote_modules"] = db_get_sql ("SELECT AVG(module_interval)
FROM tagente_modulo, tagente_estado
FROM tagente_modulo, tagente_estado, tagente
WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
AND disabled = 0 AND id_modulo != 1 AND module_interval > 0 AND utimestamp > 0");
AND tagente_modulo.disabled = 0 AND id_modulo != 1 AND module_interval > 0 AND utimestamp > 0
AND tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente");
if ($data["avg_interval_remote_modules"] == 0)
$data["remote_modules_rate"] = 0;
@ -99,9 +101,10 @@ function servers_get_performance () {
// For local modules (ignoring local modules with custom invervals for simplicity).
if ($config["realtimestats"] == 1){
$data["total_local_modules"] = db_get_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo)
FROM tagente_modulo, tagente_estado
FROM tagente_modulo, tagente_estado, tagente
WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
AND id_modulo = 1 AND disabled = 0 AND utimestamp > 0");
AND id_modulo = 1 AND tagente_modulo.disabled = 0 AND utimestamp > 0
AND tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente");
}
else {
$data["total_local_modules"] = db_get_sql ("SELECT SUM(my_modules) FROM tserver WHERE server_type = 0");
@ -267,8 +270,10 @@ function servers_get_info ($id_server = -1) {
if ($server["server_type"] != 0) {
switch ($config["dbtype"]) {
case "mysql":
$result = db_get_row_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS lag FROM tagente_estado, tagente_modulo
$result = db_get_row_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS lag FROM tagente_estado, tagente_modulo, tagente
WHERE utimestamp > 0
AND tagente.disabled = 0
AND tagente.id_agente = tagente_estado.id_agente
AND tagente_modulo.disabled = 0
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
AND current_interval > 0
@ -277,8 +282,10 @@ function servers_get_info ($id_server = -1) {
AND (UNIX_TIMESTAMP() - utimestamp) > current_interval");
break;
case "postgresql":
$result = db_get_row_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, AVG(ceil(date_part('epoch', CURRENT_TIMESTAMP)) - utimestamp - current_interval) AS lag FROM tagente_estado, tagente_modulo
$result = db_get_row_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, AVG(ceil(date_part('epoch', CURRENT_TIMESTAMP)) - utimestamp - current_interval) AS lag FROM tagente_estado, tagente_modulo, tagente
WHERE utimestamp > 0
AND tagente.disabled = 0
AND tagente.id_agente = tagente_estado.id_agente
AND tagente_modulo.disabled = 0
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
AND current_interval > 0
@ -287,8 +294,10 @@ function servers_get_info ($id_server = -1) {
AND (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - utimestamp) > current_interval");
break;
case "oracle":
$result = db_get_row_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, AVG(ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) - utimestamp - current_interval) AS lag FROM tagente_estado, tagente_modulo
$result = db_get_row_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, AVG(ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) - utimestamp - current_interval) AS lag FROM tagente_estado, tagente_modulo, tagente
WHERE utimestamp > 0
AND tagente.disabled = 0
AND tagente.id_agente = tagente_estado.id_agente
AND tagente_modulo.disabled = 0
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
AND current_interval > 0
@ -302,8 +311,10 @@ function servers_get_info ($id_server = -1) {
// Local/Dataserver server LAG calculation:
switch ($config["dbtype"]) {
case "mysql":
$result = db_get_row_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS lag FROM tagente_estado, tagente_modulo
$result = db_get_row_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS lag FROM tagente_estado, tagente_modulo, tagente
WHERE utimestamp > 0
AND tagente.disabled = 0
AND tagente.id_agente = tagente_estado.id_agente
AND tagente_modulo.disabled = 0
AND tagente_modulo.id_tipo_modulo < 5
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
@ -313,8 +324,10 @@ function servers_get_info ($id_server = -1) {
AND (UNIX_TIMESTAMP() - utimestamp) > (current_interval * 1.1)");
break;
case "postgresql":
$result = db_get_row_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, AVG(ceil(date_part('epoch', CURRENT_TIMESTAMP)) - utimestamp - current_interval) AS lag FROM tagente_estado, tagente_modulo
$result = db_get_row_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, AVG(ceil(date_part('epoch', CURRENT_TIMESTAMP)) - utimestamp - current_interval) AS lag FROM tagente_estado, tagente_modulo, tagente
WHERE utimestamp > 0
AND tagente.disabled = 0
AND tagente.id_agente = tagente_estado.id_agente
AND tagente_modulo.disabled = 0
AND tagente_modulo.id_tipo_modulo < 5
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
@ -324,8 +337,10 @@ function servers_get_info ($id_server = -1) {
AND (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - utimestamp) > (current_interval * 1.1)");
break;
case "oracle":
$result = db_get_row_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, AVG(ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) - utimestamp - current_interval) AS lag FROM tagente_estado, tagente_modulo
$result = db_get_row_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, AVG(ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) - utimestamp - current_interval) AS lag FROM tagente_estado, tagente_modulo, tagente
WHERE utimestamp > 0
AND tagente.disabled = 0
AND tagente.id_agente = tagente_estado.id_agente
AND tagente_modulo.disabled = 0
AND tagente_modulo.id_tipo_modulo < 5
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo