Merge branch '267-vista-agente-modulo-con-filtros-no-visualiza-datos-open' into 'develop'
fixed errors in agent/module See merge request !175
This commit is contained in:
commit
5c32d0ba95
|
@ -218,35 +218,52 @@ function mainAgentsModules() {
|
|||
|
||||
if($agents_id[0] != -1){
|
||||
$agents = $agents_id;
|
||||
$all_modules = array();
|
||||
$total_pagination = count($agents);
|
||||
foreach ($modules_selected as $key => $value) {
|
||||
$all_modules[$value] = io_safe_output(modules_get_agentmodule_name($value));
|
||||
}
|
||||
}
|
||||
else {
|
||||
$agents = '';
|
||||
$agents = agents_get_group_agents($group_id,array('disabled' => 0));
|
||||
$agents = array_keys($agents);
|
||||
$filter_module_group = array('disabled' => 0);
|
||||
|
||||
if ($modulegroup > 0) {
|
||||
$filter_module_group['id_module_group'] = $modulegroup;
|
||||
}
|
||||
$count = 0;
|
||||
foreach ($agents as $agent) {
|
||||
$module = agents_get_modules($agent, false,
|
||||
$filter_module_group, true, false);
|
||||
if ($module == false) {
|
||||
unset($agents[$count]);
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
$total_pagination = count($agents);
|
||||
}
|
||||
|
||||
$filter_module_group = array('disabled' => 0);
|
||||
|
||||
if ($modulegroup > 0) {
|
||||
$filter_module_group['id_module_group'] = $modulegroup;
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
foreach ($agents as $agent) {
|
||||
$module = agents_get_modules($agent, false,
|
||||
$filter_module_group, true, true);
|
||||
if ($module == false) {
|
||||
unset($agents[$count]);
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
$total_pagination = count($agents);
|
||||
|
||||
if($agents_id[0] != -1){
|
||||
$all_modules = array();
|
||||
foreach ($modules_selected as $key => $value) {
|
||||
//$all_modules[$value] = io_safe_output(modules_get_agentmodule_name($value));
|
||||
$name = modules_get_agentmodule_name($value);
|
||||
$sql = "SELECT id_agente_modulo
|
||||
FROM tagente_modulo
|
||||
WHERE nombre = '". $name ."';";
|
||||
|
||||
$result_sql = db_get_all_rows_sql($sql);
|
||||
|
||||
if(is_array($result_sql)){
|
||||
foreach ($result_sql as $key => $value) {
|
||||
$all_modules[$value['id_agente_modulo']] = io_safe_output($name);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else{
|
||||
$all_modules = agents_get_modules($agents, false,
|
||||
$filter_module_group, true, false);
|
||||
$filter_module_group, true, true);
|
||||
}
|
||||
|
||||
$modules_by_name = array();
|
||||
|
@ -396,7 +413,7 @@ function mainAgentsModules() {
|
|||
<a class='$rowcolor' href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$agent['id_agente']."'>" .
|
||||
ui_print_truncate_text(io_safe_output($agent['nombre']), 'agent_size_text_small', true, true, true, '...', 'font-size:10px; font-weight: bold;') .
|
||||
"</a></td>";
|
||||
$agent_modules = agents_get_modules($agent['id_agente'], false, $filter_module_group, true, false);
|
||||
$agent_modules = agents_get_modules($agent['id_agente'], false, $filter_module_group, true, true);
|
||||
|
||||
$nmodules = 0;
|
||||
|
||||
|
@ -408,6 +425,7 @@ function mainAgentsModules() {
|
|||
}
|
||||
|
||||
$match = false;
|
||||
|
||||
foreach ($module['id'] as $module_id) {
|
||||
if (!$match && array_key_exists($module_id,$agent_modules)) {
|
||||
$status = modules_get_agentmodule_status($module_id);
|
||||
|
@ -438,9 +456,14 @@ function mainAgentsModules() {
|
|||
case AGENT_MODULE_STATUS_UNKNOWN:
|
||||
ui_print_status_image ('module_unknown.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px'));
|
||||
break;
|
||||
case 4:
|
||||
case AGENT_MODULE_STATUS_NORMAL_ALERT:
|
||||
case AGENT_MODULE_STATUS_WARNING_ALERT:
|
||||
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
|
||||
ui_print_status_image ('module_alertsfired.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px'));
|
||||
break;
|
||||
case 4:
|
||||
ui_print_status_image ('module_no_data.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px'));
|
||||
break;
|
||||
}
|
||||
echo '</a>';
|
||||
echo "</td>";
|
||||
|
@ -467,6 +490,7 @@ function mainAgentsModules() {
|
|||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_WARNING . ";'></div></td><td>" . __("Yellow cell when the module has a warning status") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_NORMAL . ";'></div></td><td>" . __("Green cell when the module has a normal status") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_UNKNOWN . ";'></div></td><td>" . __("Grey cell when the module has an unknown status") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_NOTINIT . ";'></div></td><td>" . __("Cell turns grey when the module is in 'not initialize' status") . "</td></tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
|
||||
|
@ -563,7 +587,7 @@ extensions_add_main_function('mainAgentsModules');
|
|||
);
|
||||
});
|
||||
|
||||
$("#id_agents2").change (function(){
|
||||
$("#id_agents2").click (function(){
|
||||
selection_agent_module();
|
||||
});
|
||||
|
||||
|
@ -591,7 +615,6 @@ extensions_add_main_function('mainAgentsModules');
|
|||
});
|
||||
|
||||
selection_agent_module();
|
||||
|
||||
});
|
||||
|
||||
function selection_agent_module() {
|
||||
|
@ -614,6 +637,6 @@ extensions_add_main_function('mainAgentsModules');
|
|||
}
|
||||
},
|
||||
"json"
|
||||
);
|
||||
);
|
||||
}
|
||||
</script>
|
|
@ -1403,7 +1403,9 @@ function reporting_html_agent_module($table, $item) {
|
|||
$row['agent_name']),
|
||||
true, array('width' => '20px', 'height' => '20px'));
|
||||
break;
|
||||
case AGENT_STATUS_ALERT_FIRED:
|
||||
case AGENT_MODULE_STATUS_NORMAL_ALERT:
|
||||
case AGENT_MODULE_STATUS_WARNING_ALERT:
|
||||
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
|
||||
$table_data .= ui_print_status_image(
|
||||
'module_alertsfired.png',
|
||||
__("%s in %s : ALERTS FIRED",
|
||||
|
@ -1411,6 +1413,14 @@ function reporting_html_agent_module($table, $item) {
|
|||
$row['agent_name']),
|
||||
true, array('width' => '20px', 'height' => '20px'));
|
||||
break;
|
||||
case 4:
|
||||
$table_data .= ui_print_status_image(
|
||||
'module_no_data.png',
|
||||
__("%s in %s : Not initialize",
|
||||
$module_name,
|
||||
$row['agent_name']),
|
||||
true, array('width' => '20px', 'height' => '20px'));
|
||||
break;
|
||||
}
|
||||
$table_data .= "</td>";
|
||||
}
|
||||
|
@ -1429,6 +1439,7 @@ function reporting_html_agent_module($table, $item) {
|
|||
$table_data .= "<tr><td class='legend_square_simple'><div style='background-color: " . COL_WARNING . ";'></div></td><td>" . __("Yellow cell when the module has a warning status") . "</td></tr>";
|
||||
$table_data .= "<tr><td class='legend_square_simple'><div style='background-color: " . COL_NORMAL . ";'></div></td><td>" . __("Green cell when the module has a normal status") . "</td></tr>";
|
||||
$table_data .= "<tr><td class='legend_square_simple'><div style='background-color: " . COL_UNKNOWN . ";'></div></td><td>" . __("Grey cell when the module has an unknown status") . "</td></tr>";
|
||||
$table_data .= "<tr><td class='legend_square_simple'><div style='background-color: " . COL_NOTINIT . ";'></div></td><td>" . __("Cell turns grey when the module is in 'not initialize' status") . "</td></tr>";
|
||||
$table_data .= "</table>";
|
||||
$table_data .= "</div>";
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ if (is_ajax ()) {
|
|||
$id_group = (int) get_parameter('id_module_group');
|
||||
$id_agents = get_parameter('id_agents');
|
||||
$selection = get_parameter('selection');
|
||||
if(!isset($id_agents)){
|
||||
if(isset($id_agents)){
|
||||
$agents = implode(",", $id_agents);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue