fix bug in metaconsole view events
This commit is contained in:
parent
ab900f1e54
commit
4b23824eb4
|
@ -65,13 +65,13 @@ if ($fields_selected[0]!='') {
|
|||
foreach ($fields_selected as $field_selected) {
|
||||
switch ($field_selected) {
|
||||
case 'id_evento':
|
||||
$result = __('Event id');
|
||||
$result = __('Event Id');
|
||||
break;
|
||||
case 'evento':
|
||||
$result = __('Event name');
|
||||
$result = __('Event Name');
|
||||
break;
|
||||
case 'id_agente':
|
||||
$result = __('Agent name');
|
||||
$result = __('Agent Name');
|
||||
break;
|
||||
case 'id_usuario':
|
||||
$result = __('User');
|
||||
|
@ -86,10 +86,10 @@ if ($fields_selected[0]!='') {
|
|||
$result = __('Timestamp');
|
||||
break;
|
||||
case 'event_type':
|
||||
$result = __('Event type');
|
||||
$result = __('Event Type');
|
||||
break;
|
||||
case 'id_agentmodule':
|
||||
$result = __('Agent module');
|
||||
$result = __('Module Name');
|
||||
break;
|
||||
case 'id_alert_am':
|
||||
$result = __('Alert');
|
||||
|
@ -107,7 +107,7 @@ if ($fields_selected[0]!='') {
|
|||
$result = __('Source');
|
||||
break;
|
||||
case 'id_extra':
|
||||
$result = __('Extra id');
|
||||
$result = __('Extra Id');
|
||||
break;
|
||||
case 'owner_user':
|
||||
$result = __('Owner');
|
||||
|
@ -119,14 +119,15 @@ if ($fields_selected[0]!='') {
|
|||
$result = __('Instructions');
|
||||
break;
|
||||
case 'server_name':
|
||||
$result = __('Server name');
|
||||
$result = __('Server Name');
|
||||
break;
|
||||
case 'data':
|
||||
$result = __('Data');
|
||||
case 'module_status':
|
||||
$result = __('Module status');
|
||||
break;
|
||||
case 'module_status':
|
||||
$result = __('Module Status');
|
||||
break;
|
||||
|
||||
}
|
||||
$result_selected[$field_selected] = $result;
|
||||
}
|
||||
|
@ -155,27 +156,27 @@ $table->data = array();
|
|||
|
||||
$fields_available = array();
|
||||
|
||||
$fields_available['id_evento'] = __('Event id');
|
||||
$fields_available['evento'] = __('Event name');
|
||||
$fields_available['id_agente'] = __('Agent name');
|
||||
$fields_available['id_evento'] = __('Event Id');
|
||||
$fields_available['evento'] = __('Event Name');
|
||||
$fields_available['id_agente'] = __('Agent Name');
|
||||
$fields_available['id_usuario'] = __('User');
|
||||
$fields_available['id_grupo'] = __('Group');
|
||||
$fields_available['estado'] = __('Status');
|
||||
$fields_available['timestamp'] = __('Timestamp');
|
||||
$fields_available['event_type'] = __('Event type');
|
||||
$fields_available['id_agentmodule'] = __('Agent module');
|
||||
$fields_available['event_type'] = __('Event Type');
|
||||
$fields_available['id_agentmodule'] = __('Module Name');
|
||||
$fields_available['id_alert_am'] = __('Alert');
|
||||
$fields_available['criticity'] = __('Severity');
|
||||
$fields_available['user_comment'] = __('Comment');
|
||||
$fields_available['tags'] = __('Tags');
|
||||
$fields_available['source'] = __('Source');
|
||||
$fields_available['id_extra'] = __('Extra id');
|
||||
$fields_available['id_extra'] = __('Extra Id');
|
||||
$fields_available['owner_user'] = __('Owner');
|
||||
$fields_available['ack_utimestamp'] = __('ACK Timestamp');
|
||||
$fields_available['instructions'] = __('Instructions');
|
||||
$fields_available['server_name'] = __('Server name');
|
||||
$fields_available['server_name'] = __('Server Name');
|
||||
$fields_available['data'] = __('Data');
|
||||
$fields_available['module_status'] = __('Module status');
|
||||
$fields_available['module_status'] = __('Module Status');
|
||||
|
||||
//remove fields already selected
|
||||
foreach ($fields_available as $key=>$available) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -158,7 +158,7 @@ else {
|
|||
$i++;
|
||||
}
|
||||
if (in_array('id_agente', $show_fields)) {
|
||||
$table->head[$i] = __('Agent name');
|
||||
$table->head[$i] = __('Agent Name');
|
||||
$table->align[$i] = 'left';
|
||||
$table->style[$i] = 'max-width: 350px; word-break: break-all;';
|
||||
$i++;
|
||||
|
@ -188,14 +188,14 @@ else {
|
|||
$i++;
|
||||
}
|
||||
if (in_array('event_type', $show_fields)) {
|
||||
$table->head[$i] = __('Event type');
|
||||
$table->head[$i] = __('Event Type');
|
||||
$table->align[$i] = 'left';
|
||||
|
||||
$table->style[$i] = 'min-width: 85px;';
|
||||
$i++;
|
||||
}
|
||||
if (in_array('id_agentmodule', $show_fields)) {
|
||||
$table->head[$i] = __('Agent Module');
|
||||
$table->head[$i] = __('Module Name');
|
||||
$table->align[$i] = 'left';
|
||||
|
||||
$i++;
|
||||
|
@ -256,7 +256,7 @@ else {
|
|||
$i++;
|
||||
}
|
||||
if (in_array('module_status', $show_fields)) {
|
||||
$table->head[$i] = __('Module status');
|
||||
$table->head[$i] = __('Module Status');
|
||||
$table->align[$i] = 'left';
|
||||
|
||||
$i++;
|
||||
|
@ -677,8 +677,12 @@ else {
|
|||
}
|
||||
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++;
|
||||
$i++;
|
||||
}
|
||||
if (in_array('module_status',$show_fields)) {
|
||||
$data[$i] = modules_get_modules_status ($event["module_status"]);
|
||||
|
|
Loading…
Reference in New Issue