fixed errors in agent/module
This commit is contained in:
parent
4a6cdf822d
commit
65047c23a5
|
@ -218,25 +218,23 @@ function mainAgentsModules() {
|
||||||
|
|
||||||
if($agents_id[0] != -1){
|
if($agents_id[0] != -1){
|
||||||
$agents = $agents_id;
|
$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 {
|
else {
|
||||||
$agents = '';
|
$agents = '';
|
||||||
$agents = agents_get_group_agents($group_id,array('disabled' => 0));
|
$agents = agents_get_group_agents($group_id,array('disabled' => 0));
|
||||||
$agents = array_keys($agents);
|
$agents = array_keys($agents);
|
||||||
|
}
|
||||||
|
|
||||||
$filter_module_group = array('disabled' => 0);
|
$filter_module_group = array('disabled' => 0);
|
||||||
|
|
||||||
if ($modulegroup > 0) {
|
if ($modulegroup > 0) {
|
||||||
$filter_module_group['id_module_group'] = $modulegroup;
|
$filter_module_group['id_module_group'] = $modulegroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
$count = 0;
|
$count = 0;
|
||||||
foreach ($agents as $agent) {
|
foreach ($agents as $agent) {
|
||||||
$module = agents_get_modules($agent, false,
|
$module = agents_get_modules($agent, false,
|
||||||
$filter_module_group, true, false);
|
$filter_module_group, true, true);
|
||||||
if ($module == false) {
|
if ($module == false) {
|
||||||
unset($agents[$count]);
|
unset($agents[$count]);
|
||||||
}
|
}
|
||||||
|
@ -244,9 +242,28 @@ function mainAgentsModules() {
|
||||||
}
|
}
|
||||||
$total_pagination = count($agents);
|
$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,
|
$all_modules = agents_get_modules($agents, false,
|
||||||
$filter_module_group, true, false);
|
$filter_module_group, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$modules_by_name = array();
|
$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']."'>" .
|
<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;') .
|
ui_print_truncate_text(io_safe_output($agent['nombre']), 'agent_size_text_small', true, true, true, '...', 'font-size:10px; font-weight: bold;') .
|
||||||
"</a></td>";
|
"</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;
|
$nmodules = 0;
|
||||||
|
|
||||||
|
@ -408,6 +425,7 @@ function mainAgentsModules() {
|
||||||
}
|
}
|
||||||
|
|
||||||
$match = false;
|
$match = false;
|
||||||
|
|
||||||
foreach ($module['id'] as $module_id) {
|
foreach ($module['id'] as $module_id) {
|
||||||
if (!$match && array_key_exists($module_id,$agent_modules)) {
|
if (!$match && array_key_exists($module_id,$agent_modules)) {
|
||||||
$status = modules_get_agentmodule_status($module_id);
|
$status = modules_get_agentmodule_status($module_id);
|
||||||
|
@ -438,9 +456,14 @@ function mainAgentsModules() {
|
||||||
case AGENT_MODULE_STATUS_UNKNOWN:
|
case AGENT_MODULE_STATUS_UNKNOWN:
|
||||||
ui_print_status_image ('module_unknown.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px'));
|
ui_print_status_image ('module_unknown.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px'));
|
||||||
break;
|
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'));
|
ui_print_status_image ('module_alertsfired.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px'));
|
||||||
break;
|
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 '</a>';
|
||||||
echo "</td>";
|
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_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_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_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 "</table>";
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
|
|
||||||
|
@ -563,7 +587,7 @@ extensions_add_main_function('mainAgentsModules');
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#id_agents2").change (function(){
|
$("#id_agents2").click (function(){
|
||||||
selection_agent_module();
|
selection_agent_module();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -591,7 +615,6 @@ extensions_add_main_function('mainAgentsModules');
|
||||||
});
|
});
|
||||||
|
|
||||||
selection_agent_module();
|
selection_agent_module();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function selection_agent_module() {
|
function selection_agent_module() {
|
||||||
|
|
|
@ -1403,7 +1403,9 @@ function reporting_html_agent_module($table, $item) {
|
||||||
$row['agent_name']),
|
$row['agent_name']),
|
||||||
true, array('width' => '20px', 'height' => '20px'));
|
true, array('width' => '20px', 'height' => '20px'));
|
||||||
break;
|
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(
|
$table_data .= ui_print_status_image(
|
||||||
'module_alertsfired.png',
|
'module_alertsfired.png',
|
||||||
__("%s in %s : ALERTS FIRED",
|
__("%s in %s : ALERTS FIRED",
|
||||||
|
@ -1411,6 +1413,14 @@ function reporting_html_agent_module($table, $item) {
|
||||||
$row['agent_name']),
|
$row['agent_name']),
|
||||||
true, array('width' => '20px', 'height' => '20px'));
|
true, array('width' => '20px', 'height' => '20px'));
|
||||||
break;
|
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>";
|
$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_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_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_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 .= "</table>";
|
||||||
$table_data .= "</div>";
|
$table_data .= "</div>";
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ if (is_ajax ()) {
|
||||||
$id_group = (int) get_parameter('id_module_group');
|
$id_group = (int) get_parameter('id_module_group');
|
||||||
$id_agents = get_parameter('id_agents');
|
$id_agents = get_parameter('id_agents');
|
||||||
$selection = get_parameter('selection');
|
$selection = get_parameter('selection');
|
||||||
if(!isset($id_agents)){
|
if(isset($id_agents)){
|
||||||
$agents = implode(",", $id_agents);
|
$agents = implode(",", $id_agents);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue