Fix non dataserver lag calculation
This commit is contained in:
parent
f4c94e2a86
commit
afb537422e
|
@ -5628,16 +5628,26 @@ sub pandora_server_statistics ($$) {
|
|||
# Non-dataserver LAG calculation:
|
||||
if ($server->{"server_type"} != DATASERVER){
|
||||
|
||||
$lag_row = get_db_single_row ($dbh, "SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS lag
|
||||
FROM tagente_estado, tagente_modulo
|
||||
WHERE utimestamp > 0
|
||||
AND tagente_modulo.disabled = 0
|
||||
AND tagente_modulo.id_tipo_modulo < 5
|
||||
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
||||
AND current_interval > 0
|
||||
AND (UNIX_TIMESTAMP() - utimestamp) < ( current_interval * 10)
|
||||
AND running_by = ?
|
||||
AND (UNIX_TIMESTAMP() - utimestamp) > (current_interval * 1.1)", $server->{"id_server"});
|
||||
$lag_row = get_db_single_row ($dbh,
|
||||
"SELECT COUNT(tam.id_agente_modulo) AS module_lag, AVG(UNIX_TIMESTAMP() - tae.last_execution_try - tae.current_interval) AS lag
|
||||
FROM (
|
||||
SELECT tagente_estado.last_execution_try, tagente_estado.current_interval, tagente_estado.id_agente_modulo
|
||||
FROM tagente_estado
|
||||
WHERE tagente_estado.current_interval > 0
|
||||
AND tagente_estado.last_execution_try > 0
|
||||
AND tagente_estado.running_by = ?
|
||||
) tae
|
||||
JOIN (
|
||||
SELECT tagente_modulo.id_agente_modulo, tagente_modulo.flag
|
||||
FROM tagente_modulo LEFT JOIN tagente
|
||||
ON tagente_modulo.id_agente = tagente.id_agente
|
||||
WHERE tagente.disabled = 0
|
||||
AND tagente_modulo.disabled = 0
|
||||
AND tagente_modulo.id_tipo_modulo < 5
|
||||
) tam
|
||||
ON tae.id_agente_modulo = tam.id_agente_modulo
|
||||
WHERE (UNIX_TIMESTAMP() - tae.last_execution_try) < ( tae.current_interval * 10)
|
||||
AND (tam.flag = 1 OR (UNIX_TIMESTAMP() - tae.last_execution_try) > tae.current_interval);", $server->{"id_server"});
|
||||
}
|
||||
# Dataserver LAG calculation:
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue