RC1 event viewer v2

This commit is contained in:
fbsanchez 2019-06-18 16:07:53 +02:00
parent a1f004fdec
commit d290b91b28
4 changed files with 48 additions and 11 deletions

View File

@ -114,13 +114,11 @@ $fields_available['server_name'] = __('Server Name');
$fields_available['data'] = __('Data'); $fields_available['data'] = __('Data');
$fields_available['module_status'] = __('Module Status'); $fields_available['module_status'] = __('Module Status');
// remove fields already selected // Remove fields already selected.
foreach ($fields_available as $key => $available) { foreach ($fields_available as $key => $available) {
foreach ($result_selected as $selected) { if (isset($result_selected[$key])) {
if ($selected == $available) {
unset($fields_available[$key]); unset($fields_available[$key]);
} }
}
} }
$table->data[0][0] = '<b>'.__('Fields available').'</b>'; $table->data[0][0] = '<b>'.__('Fields available').'</b>';

View File

@ -972,10 +972,11 @@ function events_get_all(
} }
// Module search. // Module search.
$agentmodule_join = 'LEFT JOIN tagente_modulo am ON te.id_agentmodule = am.id_agente_modulo';
if (is_metaconsole()) {
$agentmodule_join = ''; $agentmodule_join = '';
if (!empty($filter['module_search'])) { } else if (!empty($filter['module_search'])) {
$agentmodule_join = 'INNER JOIN tagente_modulo am $agentmodule_join = 'INNER JOIN tagente_modulo am ON te.id_agentmodule = am.id_agente_modulo';
ON te.id_agentmodule = am.id_agente_modulo';
$sql_filters[] = sprintf( $sql_filters[] = sprintf(
' AND am.nombre = "%s" ', ' AND am.nombre = "%s" ',
$filter['module_search'] $filter['module_search']

View File

@ -4700,6 +4700,7 @@ input:checked + .p-slider:before {
height: 27px; height: 27px;
cursor: pointer; cursor: pointer;
border-radius: 5px; border-radius: 5px;
z-index: 10;
} }
#top_btn:hover { #top_btn:hover {

View File

@ -130,7 +130,7 @@ if (is_ajax()) {
'te.evento', 'te.evento',
'te.utimestamp', 'te.utimestamp',
'te.event_type', 'te.event_type',
'te.id_agentmodule', 'am.nombre as id_agentmodule',
'te.id_alert_am', 'te.id_alert_am',
'te.criticity', 'te.criticity',
'te.user_comment', 'te.user_comment',
@ -141,7 +141,7 @@ if (is_ajax()) {
'te.warning_instructions', 'te.warning_instructions',
'te.unknown_instructions', 'te.unknown_instructions',
'te.owner_user', 'te.owner_user',
'te.ack_utimestamp', 'if(te.ack_utimestamp > 0, from_unixtime(te.ack_utimestamp),"") as ack_utimestamp',
'te.custom_data', 'te.custom_data',
'te.data', 'te.data',
'te.module_status', 'te.module_status',
@ -1511,6 +1511,43 @@ function process_datatables_item(item) {
item.event_type = '<div class="criticity" style="background: '; item.event_type = '<div class="criticity" style="background: ';
item.event_type += color + '">' + text + "</div>"; item.event_type += color + '">' + text + "</div>";
/* Module status */
/* Event severity prepared */
var color = "<?php echo COL_UNKNOWN; ?>";
var text = "<?php echo __('UNKNOWN'); ?>";
switch (item.module_status) {
case "<?php echo AGENT_MODULE_STATUS_NORMAL; ?>":
text = "<?php echo __('NORMAL'); ?>";
color = "<?php echo COL_NORMAL; ?>";
break;
case "<?php echo AGENT_MODULE_STATUS_CRITICAL_BAD; ?>":
text = "<?php echo __('CRITICAL'); ?>";
color = "<?php echo COL_CRITICAL; ?>";
break;
case "<?php echo AGENT_MODULE_STATUS_NO_DATA; ?>":
text = "<?php echo __('NOT INIT'); ?>";
color = "<?php echo COL_NOTINIT; ?>";
break;
case "<?php echo AGENT_MODULE_STATUS_CRITICAL_ALERT; ?>":
case "<?php echo AGENT_MODULE_STATUS_NORMAL_ALERT; ?>":
case "<?php echo AGENT_MODULE_STATUS_WARNING_ALERT; ?>":
text = "<?php echo __('ALERT'); ?>";
color = "<?php echo COL_ALERTFIRED; ?>";
break;
case "<?php echo AGENT_MODULE_STATUS_WARNING; ?>":
text = "<?php echo __('WARNING'); ?>";
color = "<?php echo COL_WARNING; ?>";
break;
}
item.module_status = '<div class="criticity" style="background: ';
item.module_status += color + '">' + text + "</div>";
/* Agent name link */ /* Agent name link */
if (item.id_agente > 0) { if (item.id_agente > 0) {
item.agent_name = '<a href="<?php echo ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='); ?>' +item.id_agente+'">' + item.agent_name + '</a>'; item.agent_name = '<a href="<?php echo ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='); ?>' +item.id_agente+'">' + item.agent_name + '</a>';