diff --git a/pandora_console/include/class/Tree.class.php b/pandora_console/include/class/Tree.class.php index fc02023b3e..96ced52e6f 100644 --- a/pandora_console/include/class/Tree.class.php +++ b/pandora_console/include/class/Tree.class.php @@ -303,18 +303,23 @@ class Tree $this->filter['statusModule'] = -1; } + $filter_status = ''; + if ((int) $this->filter['statusModule'] !== -1 && ($this->type === 'module' || $this->type === 'module_group' || $this->type === 'tag')) { + $filter_status = ' AND tae.estado = '.$this->filter['statusModule']; + } + $show_init_condition = ($this->filter['show_not_init_agents']) ? '' : ' AND ta.notinit_count <> ta.total_count'; if ($this->getEmptyModuleFilterStatus()) { - return $show_init_condition; + return $show_init_condition.$filter_status; } if ((int) $this->filter['statusModule'] === 6) { - return ' AND (ta.warning_count > 0 OR ta.critical_count > 0)'; + return ' AND (ta.warning_count > 0 OR ta.critical_count > 0)'.$filter_status; } if ($this->filter['statusModule'] === 'fired') { - return ' AND ta.fired_count > 0'; + return ' AND ta.fired_count > 0'.$filter_status; } $field_filter = modules_get_counter_by_states($this->filter['statusModule']); @@ -322,7 +327,7 @@ class Tree return ' AND 1=0'; } - return "AND ta.$field_filter > 0".$show_init_condition; + return "AND ta.$field_filter > 0".$show_init_condition.$filter_status; } diff --git a/pandora_console/include/class/TreeModule.class.php b/pandora_console/include/class/TreeModule.class.php index 46253643a5..94710bfe19 100644 --- a/pandora_console/include/class/TreeModule.class.php +++ b/pandora_console/include/class/TreeModule.class.php @@ -28,9 +28,8 @@ class TreeModule extends Tree $this->L1fieldNameSql = 'tam.nombre'; $this->L1inner = ''; $this->L1orderByFinal = 'name'; - $this->L1innerInside = 'INNER JOIN tagente_modulo tam - ON ta.id_agente = tam.id_agente'; - + $this->L1innerInside = 'INNER JOIN tagente_modulo tam ON ta.id_agente = tam.id_agente + INNER JOIN tagente_estado tae ON tae.id_agente_modulo = tam.id_agente_modulo'; $this->L2condition = "AND tam.nombre = '".$this->symbol2name($this->rootID)."'"; } diff --git a/pandora_console/include/class/TreeModuleGroup.class.php b/pandora_console/include/class/TreeModuleGroup.class.php index 77f4b364c4..47dba241ac 100644 --- a/pandora_console/include/class/TreeModuleGroup.class.php +++ b/pandora_console/include/class/TreeModuleGroup.class.php @@ -31,8 +31,8 @@ class TreeModuleGroup extends Tree 'tmg.id_mg AS id', ]; $this->L1inner = 'INNER JOIN tmodule_group tmg ON tmg.id_mg = x2.g'; - $this->L1innerInside = 'INNER JOIN tagente_modulo tam - ON ta.id_agente = tam.id_agente'; + $this->L1innerInside = 'INNER JOIN tagente_modulo tam ON ta.id_agente = tam.id_agente + INNER JOIN tagente_estado tae ON tae.id_agente_modulo = tam.id_agente_modulo'; $this->L1orderByFinal = 'tmg.name'; $this->L2condition = 'AND tam.id_module_group = '.$this->rootID; diff --git a/pandora_console/include/class/TreeTag.class.php b/pandora_console/include/class/TreeTag.class.php index d2d748c903..16e2358c0e 100644 --- a/pandora_console/include/class/TreeTag.class.php +++ b/pandora_console/include/class/TreeTag.class.php @@ -29,6 +29,8 @@ class TreeTag extends Tree $this->L1innerInside = ' INNER JOIN tagente_modulo tam ON ta.id_agente = tam.id_agente + INNER JOIN tagente_estado tae + ON tae.id_agente_modulo = tam.id_agente_modulo INNER JOIN ttag_module ttm ON ttm.id_agente_modulo = tam.id_agente_modulo ';