Merge branch 'ent-11951-anadir-nombre-de-servidor-en-la-lista-de-servidores' into 'develop'

Added name and master server column to servers view

See merge request artica/pandorafms!6613
This commit is contained in:
Rafael Ameijeiras 2023-11-27 10:41:03 +00:00
commit b58714d769
2 changed files with 84 additions and 54 deletions

View File

@ -64,32 +64,33 @@ $table->style = [];
// $table->style[0] = 'font-weight: bold'; // $table->style[0] = 'font-weight: bold';
$table->align = []; $table->align = [];
$table->align[1] = 'center'; $table->align[1] = 'center';
$table->align[3] = 'center'; $table->align[4] = 'center';
$table->align[8] = 'right'; $table->align[9] = 'right';
$table->headstyle[1] = 'text-align:center'; $table->headstyle[1] = 'text-align:center';
$table->headstyle[3] = 'text-align:center'; $table->headstyle[4] = 'text-align:center';
$table->headstyle[8] = 'text-align:right;width: 120px;'; $table->headstyle[9] = 'text-align:right;width: 120px;';
$table->titleclass = 'tabletitle'; $table->titleclass = 'tabletitle';
$table->titlestyle = 'text-transform:uppercase;'; $table->titlestyle = 'text-transform:uppercase;';
$table->style[6] = 'display: flex;align-items: center;'; $table->style[7] = 'display: flex;align-items: center;';
$table->head = []; $table->head = [];
$table->head[0] = __('Name'); $table->head[0] = __('Name');
$table->head[1] = __('Status'); $table->head[1] = __('Status');
$table->head[2] = __('Type'); $table->head[2] = __('Type');
$table->head[3] = __('Version'); $table->head[3] = __('Master');
$table->head[4] = __('Modules'); $table->head[4] = __('Version');
$table->head[5] = __('Lag').ui_print_help_tip(__('Avg. Delay(sec)/Modules delayed'), true); $table->head[5] = __('Modules');
$table->head[6] = __('T/Q').ui_print_help_tip(__('Threads / Queued modules currently'), true); $table->head[6] = __('Lag').ui_print_help_tip(__('Avg. Delay(sec)/Modules delayed'), true);
$table->head[7] = __('T/Q').ui_print_help_tip(__('Threads / Queued modules currently'), true);
// This will have a column of data such as "6 hours". // This will have a column of data such as "6 hours".
$table->head[7] = __('Updated'); $table->head[8] = __('Updated');
// Only Pandora Administrator can delete servers. // Only Pandora Administrator can delete servers.
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) { if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
$table->head[8] = '<span title="Operations">'.__('Op.').'</span>'; $table->head[9] = '<span title="Operations">'.__('Op.').'</span>';
} }
$table->data = []; $table->data = [];
@ -143,9 +144,11 @@ foreach ($servers as $server) {
} }
// Type. // Type.
$data[2] = '<span class="nowrap">'.$server['img']; $data[2] = '<span class="nowrap">'.$server['img'].'&nbsp;&nbsp;&nbsp;&nbsp;'.$server['name'];
if ($server['master'] == $master) { if ($server['master'] == $master) {
$data[2] .= ui_print_help_tip(__('This is a master server'), true); $data[3] .= __('Yes', true);
} else {
$data[3] .= __('-');
} }
if ((int) $server['exec_proxy'] === 1) { if ((int) $server['exec_proxy'] === 1) {
@ -157,27 +160,27 @@ foreach ($servers as $server) {
case 'event': case 'event':
case 'autoprovision': case 'autoprovision':
case 'migration': case 'migration':
$data[3] = $server['version']; $data[4] = $server['version'];
$data[4] = __('N/A');
$data[5] = __('N/A'); $data[5] = __('N/A');
$data[6] = __('N/A');
break; break;
case 'export': case 'export':
$data[3] = $server['version']; $data[4] = $server['version'];
$data[4] = $server['modules'].' '.__('of').' '.$server['modules_total']; $data[5] = $server['modules'].' '.__('of').' '.$server['modules_total'];
$data[5] = __('N/A'); $data[6] = __('N/A');
break; break;
default: default:
$data[3] = $server['version']; $data[4] = $server['version'];
$data[4] = $server['modules'].' '.__('of').' '.$server['modules_total']; $data[5] = $server['modules'].' '.__('of').' '.$server['modules_total'];
$data[5] = '<span class="nowrap">'.$server['lag_txt'].'</span>'; $data[6] = '<span class="nowrap">'.$server['lag_txt'].'</span>';
break; break;
} }
$data[6] = ''; $data[7] = '';
if ($server['queued_modules'] > 500) { if ($server['queued_modules'] > 500) {
$data[6] .= '<div class="inline"><a onclick="show_dialog();" >'.html_print_image( $data[7] .= '<div class="inline"><a onclick="show_dialog();" >'.html_print_image(
'images/info-warning.svg', 'images/info-warning.svg',
true, true,
[ [
@ -189,9 +192,9 @@ foreach ($servers as $server) {
).'</a></div>&nbsp;&nbsp;'; ).'</a></div>&nbsp;&nbsp;';
} }
$data[6] .= $server['threads'].' : '.$server['queued_modules']; $data[7] .= $server['threads'].' : '.$server['queued_modules'];
$data[7] = ui_print_timestamp($server['keepalive'], true); $data[8] = ui_print_timestamp($server['keepalive'], true);
if ($server['type'] === 'data') { if ($server['type'] === 'data') {
$ext = '_server'; $ext = '_server';
@ -208,11 +211,11 @@ foreach ($servers as $server) {
// Only Pandora Administrator can delete servers. // Only Pandora Administrator can delete servers.
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) { if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
$data[8] = ''; $data[9] = '';
if ($server['type'] === 'recon') { if ($server['type'] === 'recon') {
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist').'">'; $data[9] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist').'">';
$data[8] .= html_print_image( $data[9] .= html_print_image(
'images/snmp-trap@svg.svg', 'images/snmp-trap@svg.svg',
true, true,
[ [
@ -221,12 +224,12 @@ foreach ($servers as $server) {
] ]
); );
$data[8] .= '</a>'; $data[9] .= '</a>';
} }
if ($server['type'] === 'data') { if ($server['type'] === 'data') {
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_counts='.$server['id_server']).'">'; $data[9] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_counts='.$server['id_server']).'">';
$data[8] .= html_print_image( $data[9] .= html_print_image(
'images/force@svg.svg', 'images/force@svg.svg',
true, true,
[ [
@ -234,10 +237,10 @@ foreach ($servers as $server) {
'class' => 'main_menu_icon invert_filter', 'class' => 'main_menu_icon invert_filter',
] ]
); );
$data[8] .= '</a>'; $data[9] .= '</a>';
} else if ($server['type'] === 'enterprise snmp') { } else if ($server['type'] === 'enterprise snmp') {
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_snmp_enterprise='.$server['id_server']).'">'; $data[9] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_snmp_enterprise='.$server['id_server']).'">';
$data[8] .= html_print_image( $data[9] .= html_print_image(
'images/force@svg.svg', 'images/force@svg.svg',
true, true,
[ [
@ -245,12 +248,12 @@ foreach ($servers as $server) {
'class' => 'main_menu_icon invert_filter', 'class' => 'main_menu_icon invert_filter',
] ]
); );
$data[8] .= '</a>'; $data[9] .= '</a>';
} }
if ($server['type'] === 'event' && (bool) check_acl($config['id_user'], 0, 'LM') === true) { if ($server['type'] === 'event' && (bool) check_acl($config['id_user'], 0, 'LM') === true) {
$data[8] .= '<a class="open-alerts-list-modal" href="">'; $data[9] .= '<a class="open-alerts-list-modal" href="">';
$data[8] .= html_print_image( $data[9] .= html_print_image(
'images/alert@svg.svg', 'images/alert@svg.svg',
true, true,
[ [
@ -258,11 +261,11 @@ foreach ($servers as $server) {
'class' => 'main_menu_icon invert_filter', 'class' => 'main_menu_icon invert_filter',
] ]
); );
$data[8] .= '</a>'; $data[9] .= '</a>';
} }
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server='.$server['id_server']).'">'; $data[9] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server='.$server['id_server']).'">';
$data[8] .= html_print_image( $data[9] .= html_print_image(
'images/edit.svg', 'images/edit.svg',
true, true,
[ [
@ -270,11 +273,11 @@ foreach ($servers as $server) {
'class' => 'main_menu_icon invert_filter', 'class' => 'main_menu_icon invert_filter',
] ]
); );
$data[8] .= '</a>'; $data[9] .= '</a>';
if (($names_servers[$safe_server_name] === true) && ($ext === '_server' || $server['type'] === 'enterprise satellite')) { if (($names_servers[$safe_server_name] === true) && ($ext === '_server' || $server['type'] === 'enterprise satellite')) {
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext.'&tab=agent_editor').'">'; $data[9] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext.'&tab=agent_editor').'">';
$data[8] .= html_print_image( $data[9] .= html_print_image(
'images/agents@svg.svg', 'images/agents@svg.svg',
true, true,
[ [
@ -282,10 +285,10 @@ foreach ($servers as $server) {
'class' => 'main_menu_icon invert_filter', 'class' => 'main_menu_icon invert_filter',
] ]
); );
$data[8] .= '</a>'; $data[9] .= '</a>';
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext).'">'; $data[9] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext).'">';
$data[8] .= html_print_image( $data[9] .= html_print_image(
'images/remote-configuration@svg.svg', 'images/remote-configuration@svg.svg',
true, true,
[ [
@ -293,12 +296,12 @@ foreach ($servers as $server) {
'class' => 'main_menu_icon invert_filter', 'class' => 'main_menu_icon invert_filter',
] ]
); );
$data[8] .= '</a>'; $data[9] .= '</a>';
$names_servers[$safe_server_name] = false; $names_servers[$safe_server_name] = false;
} }
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_del='.$server['id_server'].'&amp;delete=1').'">'; $data[9] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_del='.$server['id_server'].'&amp;delete=1').'">';
$data[8] .= html_print_image( $data[9] .= html_print_image(
'images/delete.svg', 'images/delete.svg',
true, true,
[ [
@ -307,14 +310,14 @@ foreach ($servers as $server) {
'class' => 'main_menu_icon invert_filter', 'class' => 'main_menu_icon invert_filter',
] ]
); );
$data[8] .= '</a>'; $data[9] .= '</a>';
} }
if ($tiny) { if ($tiny) {
unset($data[4]); unset($data[5]);
unset($data[6]);
unset($data[7]); unset($data[7]);
unset($data[8]); unset($data[8]);
unset($data[9]);
} }
$ext = ''; $ext = '';
@ -323,10 +326,10 @@ foreach ($servers as $server) {
} }
if ($tiny) { if ($tiny) {
unset($table->head[4]); unset($table->head[5]);
unset($table->head[6]);
unset($table->head[7]); unset($table->head[7]);
unset($table->head[8]); unset($table->head[8]);
unset($table->head[9]);
} }
if ($tiny) { if ($tiny) {

View File

@ -665,6 +665,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
); );
$server['type'] = 'data'; $server['type'] = 'data';
$id_modulo = 1; $id_modulo = 1;
$server['name'] = __('Data server');
break; break;
case SERVER_TYPE_NETWORK: case SERVER_TYPE_NETWORK:
@ -678,6 +679,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
); );
$server['type'] = 'network'; $server['type'] = 'network';
$id_modulo = 2; $id_modulo = 2;
$server['name'] = __('Network server');
break; break;
case SERVER_TYPE_SNMP: case SERVER_TYPE_SNMP:
@ -691,6 +693,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
); );
$server['type'] = 'snmp'; $server['type'] = 'snmp';
$id_modulo = 0; $id_modulo = 0;
$server['name'] = __('SNMP Trap server');
break; break;
case SERVER_TYPE_DISCOVERY: case SERVER_TYPE_DISCOVERY:
@ -704,6 +707,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
); );
$server['type'] = 'recon'; $server['type'] = 'recon';
$id_modulo = 0; $id_modulo = 0;
$server['name'] = __('Discovery server');
break; break;
case SERVER_TYPE_PLUGIN: case SERVER_TYPE_PLUGIN:
@ -717,6 +721,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
); );
$server['type'] = 'plugin'; $server['type'] = 'plugin';
$id_modulo = 4; $id_modulo = 4;
$server['name'] = __('Plugin server');
break; break;
case SERVER_TYPE_PREDICTION: case SERVER_TYPE_PREDICTION:
@ -730,6 +735,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
); );
$server['type'] = 'prediction'; $server['type'] = 'prediction';
$id_modulo = 5; $id_modulo = 5;
$server['name'] = __('Prediction server');
break; break;
case SERVER_TYPE_WMI: case SERVER_TYPE_WMI:
@ -743,6 +749,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
); );
$server['type'] = 'wmi'; $server['type'] = 'wmi';
$id_modulo = 6; $id_modulo = 6;
$server['name'] = __('WMI server');
break; break;
case SERVER_TYPE_EXPORT: case SERVER_TYPE_EXPORT:
@ -756,6 +763,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
); );
$server['type'] = 'export'; $server['type'] = 'export';
$id_modulo = 0; $id_modulo = 0;
$server['name'] = __('Export server');
break; break;
case SERVER_TYPE_INVENTORY: case SERVER_TYPE_INVENTORY:
@ -769,6 +777,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
); );
$server['type'] = 'inventory'; $server['type'] = 'inventory';
$id_modulo = 0; $id_modulo = 0;
$server['name'] = __('Inventory server');
break; break;
case SERVER_TYPE_WEB: case SERVER_TYPE_WEB:
@ -782,6 +791,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
); );
$server['type'] = 'web'; $server['type'] = 'web';
$id_modulo = 0; $id_modulo = 0;
$server['name'] = __('Web server');
break; break;
case SERVER_TYPE_EVENT: case SERVER_TYPE_EVENT:
@ -795,6 +805,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
); );
$server['type'] = 'event'; $server['type'] = 'event';
$id_modulo = 2; $id_modulo = 2;
$server['name'] = __('Event server');
break; break;
case SERVER_TYPE_CORRELATION: case SERVER_TYPE_CORRELATION:
@ -808,6 +819,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
); );
$server['type'] = 'correlation'; $server['type'] = 'correlation';
$id_modulo = 0; $id_modulo = 0;
$server['name'] = __('Correlation server');
break; break;
case SERVER_TYPE_ENTERPRISE_ICMP: case SERVER_TYPE_ENTERPRISE_ICMP:
@ -821,6 +833,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
); );
$server['type'] = 'enterprise icmp'; $server['type'] = 'enterprise icmp';
$id_modulo = 2; $id_modulo = 2;
$server['name'] = __('Enterprise ICMP server');
break; break;
case SERVER_TYPE_ENTERPRISE_SNMP: case SERVER_TYPE_ENTERPRISE_SNMP:
@ -834,6 +847,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
); );
$server['type'] = 'enterprise snmp'; $server['type'] = 'enterprise snmp';
$id_modulo = 2; $id_modulo = 2;
$server['name'] = __('Enterprise SNMP server');
break; break;
case SERVER_TYPE_ENTERPRISE_SATELLITE: case SERVER_TYPE_ENTERPRISE_SATELLITE:
@ -847,6 +861,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
); );
$server['type'] = 'enterprise satellite'; $server['type'] = 'enterprise satellite';
$id_modulo = 0; $id_modulo = 0;
$server['name'] = __('Enterprise Satellite server');
break; break;
case SERVER_TYPE_ENTERPRISE_TRANSACTIONAL: case SERVER_TYPE_ENTERPRISE_TRANSACTIONAL:
@ -860,6 +875,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
); );
$server['type'] = 'enterprise transactional'; $server['type'] = 'enterprise transactional';
$id_modulo = 0; $id_modulo = 0;
$server['name'] = __('Enterprise Transactional server');
break; break;
case SERVER_TYPE_MAINFRAME: case SERVER_TYPE_MAINFRAME:
@ -873,6 +889,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
); );
$server['type'] = 'mainframe'; $server['type'] = 'mainframe';
$id_modulo = 0; $id_modulo = 0;
$server['name'] = __('Mainframe server');
break; break;
case SERVER_TYPE_SYNC: case SERVER_TYPE_SYNC:
@ -886,6 +903,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
); );
$server['type'] = 'sync'; $server['type'] = 'sync';
$id_modulo = 0; $id_modulo = 0;
$server['name'] = __('Sync server');
break; break;
case SERVER_TYPE_WUX: case SERVER_TYPE_WUX:
@ -899,6 +917,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
); );
$server['type'] = 'wux'; $server['type'] = 'wux';
$id_modulo = 0; $id_modulo = 0;
$server['name'] = __('Wux server');
break; break;
case SERVER_TYPE_SYSLOG: case SERVER_TYPE_SYSLOG:
@ -912,6 +931,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
); );
$server['type'] = 'syslog'; $server['type'] = 'syslog';
$id_modulo = 0; $id_modulo = 0;
$server['name'] = __('Syslog server');
break; break;
case SERVER_TYPE_NCM: case SERVER_TYPE_NCM:
@ -925,6 +945,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
); );
$server['type'] = 'ncm'; $server['type'] = 'ncm';
$id_modulo = 0; $id_modulo = 0;
$server['name'] = __('NCM server');
break; break;
case SERVER_TYPE_AUTOPROVISION: case SERVER_TYPE_AUTOPROVISION:
@ -938,6 +959,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
); );
$server['type'] = 'autoprovision'; $server['type'] = 'autoprovision';
$id_modulo = 0; $id_modulo = 0;
$server['name'] = __('Autoprovision server');
break; break;
case SERVER_TYPE_MIGRATION: case SERVER_TYPE_MIGRATION:
@ -951,6 +973,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
); );
$server['type'] = 'migration'; $server['type'] = 'migration';
$id_modulo = 0; $id_modulo = 0;
$server['name'] = __('Migration server');
break; break;
case SERVER_TYPE_ALERT: case SERVER_TYPE_ALERT:
@ -964,6 +987,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
); );
$server['type'] = 'alert'; $server['type'] = 'alert';
$id_modulo = 0; $id_modulo = 0;
$server['name'] = __('Alert server');
break; break;
case SERVER_TYPE_NETFLOW: case SERVER_TYPE_NETFLOW:
@ -977,6 +1001,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
); );
$server['type'] = 'netflow'; $server['type'] = 'netflow';
$id_modulo = 0; $id_modulo = 0;
$server['name'] = __('Netflow server');
break; break;
case SERVER_TYPE_LOG: case SERVER_TYPE_LOG:
@ -990,6 +1015,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
); );
$server['type'] = 'log'; $server['type'] = 'log';
$id_modulo = 0; $id_modulo = 0;
$server['name'] = __('Log server');
break; break;
case SERVER_TYPE_MADE: case SERVER_TYPE_MADE:
@ -1003,6 +1029,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
); );
$server['type'] = 'made'; $server['type'] = 'made';
$id_modulo = 0; $id_modulo = 0;
$server['name'] = __('MADE server');
break; break;
default: default: