Merge branch '2248-5730-Añadir-elementos-a-la-vista-de-eventos3' into 'develop'

fix bug in metaconsole view events

See merge request artica/pandorafms!1638
This commit is contained in:
vgilc 2018-07-26 17:15:30 +02:00
commit 6bd1768335
2 changed files with 45 additions and 20 deletions

View File

@ -71,7 +71,7 @@ if ($fields_selected[0]!='') {
$result = __('Event Name');
break;
case 'id_agente':
$result = __('Agent name');
$result = __('Agent Name');
break;
case 'id_usuario':
$result = __('User');
@ -124,9 +124,10 @@ if ($fields_selected[0]!='') {
case 'data':
$result = __('Data');
break;
case 'module_status':
case 'module_status':
$result = __('Module Status');
break;
}
$result_selected[$field_selected] = $result;
}

View File

@ -723,15 +723,15 @@ function events_create_event ($event, $id_group, $id_agent, $status = 0,
event_type, criticity, id_agentmodule, id_alert_am,
critical_instructions, warning_instructions,
unknown_instructions, source, tags, custom_data,
server_id, id_extra)
server_id, id_extra, data, module_status)
VALUES (%d, %d, "%s", NOW(), %d, UNIX_TIMESTAMP(NOW()),
"%s", "%s", %d, %d, %d, "%s", "%s", "%s", "%s",
"%s", "%s", %d, "%s")',
"%s", "%s", %d, "%s", %d, %d)',
$id_agent, $id_group, $event, $status, $id_user,
$event_type, $priority, $id_agent_module, $id_aam,
$critical_instructions, $warning_instructions,
$unknown_instructions, $source, $tags, $custom_data,
$server_id, $id_extra);
$server_id, $id_extra, $data, $module_status);
break;
case "postgresql":
$sql = sprintf ('
@ -740,16 +740,16 @@ function events_create_event ($event, $id_group, $id_agent, $status = 0,
event_type, criticity, id_agentmodule, id_alert_am,
critical_instructions, warning_instructions,
unknown_instructions, source, tags, custom_data,
server_id, id_extra)
server_id, id_extra, data, module_status)
VALUES (%d, %d, "%s", NOW(), %d,
ceil(date_part(\'epoch\', CURRENT_TIMESTAMP)), "%s",
"%s", %d, %d, %d, "%s", "%s", "%s", "%s", "%s",
"%s", %d, "%s")',
"%s", %d, "%s", %d, %d)',
$id_agent, $id_group, $event, $status, $id_user,
$event_type, $priority, $id_agent_module, $id_aam,
$critical_instructions, $warning_instructions,
$unknown_instructions, $source, $tags, $custom_data,
$server_id, $id_extra);
$server_id, $id_extra, $data, $module_status);
break;
case "oracle":
$sql = sprintf ('
@ -758,15 +758,15 @@ function events_create_event ($event, $id_group, $id_agent, $status = 0,
event_type, criticity, id_agentmodule, id_alert_am,
critical_instructions, warning_instructions,
unknown_instructions, source, tags, custom_data,
server_id, id_extra)
server_id, id_extra, data, module_status)
VALUES (%d, %d, "%s", CURRENT_TIMESTAMP, %d, UNIX_TIMESTAMP,
"%s", "%s", %d, %d, %d, "%s", "%s", "%s", "%s",
"%s", "%s", %d, "%s")',
"%s", "%s", %d, "%s", %d, %d)',
$id_agent, $id_group, $event, $status, $id_user,
$event_type, $priority, $id_agent_module, $id_aam,
$critical_instructions, $warning_instructions,
$unknown_instructions, $source, $tags, $custom_data,
$server_id, $id_extra);
$server_id, $id_extra, $data, $module_status);
break;
}
}
@ -778,13 +778,13 @@ function events_create_event ($event, $id_group, $id_agent, $status = 0,
timestamp, estado, utimestamp, id_usuario,
event_type, criticity, id_agentmodule, id_alert_am,
critical_instructions, warning_instructions,
unknown_instructions, source, tags, custom_data, id_extra)
unknown_instructions, source, tags, custom_data, id_extra, data, module_status)
VALUES (%d, %d, "%s", NOW(), %d, UNIX_TIMESTAMP(NOW()),
"%s", "%s", %d, %d, %d, "%s", "%s", "%s", "%s", "%s", "%s", "%s")',
"%s", "%s", %d, %d, %d, "%s", "%s", "%s", "%s", "%s", "%s", "%s", %d, %d)',
$id_agent, $id_group, $event, $status, $id_user,
$event_type, $priority, $id_agent_module, $id_aam,
$critical_instructions, $warning_instructions,
$unknown_instructions, $source, $tags, $custom_data, $id_extra);
$unknown_instructions, $source, $tags, $custom_data, $id_extra, $data, $module_status);
break;
case "postgresql":
$sql = sprintf ('
@ -792,14 +792,14 @@ function events_create_event ($event, $id_group, $id_agent, $status = 0,
timestamp, estado, utimestamp, id_usuario,
event_type, criticity, id_agentmodule, id_alert_am,
critical_instructions, warning_instructions,
unknown_instructions, source, tags, custom_data, id_extra)
unknown_instructions, source, tags, custom_data, id_extra, data, module_status)
VALUES (%d, %d, "%s", NOW(), %d,
ceil(date_part(\'epoch\', CURRENT_TIMESTAMP)), "%s",
"%s", %d, %d, %d, "%s", "%s", "%s", "%s", "%s", "%s", "%s")',
"%s", %d, %d, %d, "%s", "%s", "%s", "%s", "%s", "%s", "%s", %d, %d)',
$id_agent, $id_group, $event, $status, $id_user,
$event_type, $priority, $id_agent_module, $id_aam,
$critical_instructions, $warning_instructions,
$unknown_instructions, $source, $tags, $custom_data, $id_extra);
$unknown_instructions, $source, $tags, $custom_data, $id_extra, $data, $module_status);
break;
case "oracle":
$sql = sprintf ("
@ -807,13 +807,13 @@ function events_create_event ($event, $id_group, $id_agent, $status = 0,
timestamp, estado, utimestamp, id_usuario,
event_type, criticity, id_agentmodule, id_alert_am,
critical_instructions, warning_instructions,
unknown_instructions, source, tags, custom_data, id_extra)
unknown_instructions, source, tags, custom_data, id_extra, data, module_status)
VALUES (%d, %d, '%s', CURRENT_TIMESTAMP, %d, UNIX_TIMESTAMP,
'%s', '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s')",
'%s', '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d)",
$id_agent, $id_group, $event, $status, $id_user,
$event_type, $priority, $id_agent_module, $id_aam,
$critical_instructions, $warning_instructions,
$unknown_instructions, $source, $tags, $custom_data, $id_extra);
$unknown_instructions, $source, $tags, $custom_data, $id_extra, $data, $module_status);
break;
}
}
@ -3705,6 +3705,16 @@ function events_list_events_grouped_agents($sql) {
$table->align[$i] = 'left';
$i++;
}
if (in_array('data', $show_fields)) {
$table->head[$i] = __('Data');
$table->align[$i] = 'left';
$i++;
}
if (in_array('module_status', $show_fields)) {
$table->head[$i] = __('Module status');
$table->align[$i] = 'left';
$i++;
}
if ($i != 0 && $allow_action) {
$table->head[$i] = __('Action');
$table->align[$i] = 'left';
@ -4104,6 +4114,20 @@ function events_list_events_grouped_agents($sql) {
$table->cellclass[count($table->data)][$i] = $myclass;
$i++;
}
if (in_array('data',$show_fields)) {
$data[$i] = $event["data"];
if($data[$i] %1 == 0)
$data[$i]= number_format($data[$i], 0);
else
$data[$i]= number_format($data[$i], 2);
$table->cellclass[count($table->data)][$i] = $myclass;
$i++;
}
if (in_array('module_status',$show_fields)) {
$data[$i] = modules_get_modules_status ($event["module_status"]);
$table->cellclass[count($table->data)][$i] = $myclass;
$i++;
}
if ($i != 0 && $allow_action) {
//Actions