From 325b0a758ac2e30e1aae3448fc50d79341eca726 Mon Sep 17 00:00:00 2001 From: Calvo Date: Tue, 31 Oct 2023 11:33:48 +0100 Subject: [PATCH 1/3] Added name and master server column to servers view --- .../godmode/servers/servers.build_table.php | 111 +++++++++--------- 1 file changed, 57 insertions(+), 54 deletions(-) diff --git a/pandora_console/godmode/servers/servers.build_table.php b/pandora_console/godmode/servers/servers.build_table.php index 101a99d955..80b9ff9c6b 100644 --- a/pandora_console/godmode/servers/servers.build_table.php +++ b/pandora_console/godmode/servers/servers.build_table.php @@ -64,32 +64,33 @@ $table->style = []; // $table->style[0] = 'font-weight: bold'; $table->align = []; $table->align[1] = 'center'; -$table->align[3] = 'center'; -$table->align[8] = 'right'; +$table->align[4] = 'center'; +$table->align[9] = 'right'; $table->headstyle[1] = 'text-align:center'; -$table->headstyle[3] = 'text-align:center'; -$table->headstyle[8] = 'text-align:right;width: 120px;'; +$table->headstyle[4] = 'text-align:center'; +$table->headstyle[9] = 'text-align:right;width: 120px;'; $table->titleclass = 'tabletitle'; $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[0] = __('Name'); $table->head[1] = __('Status'); $table->head[2] = __('Type'); -$table->head[3] = __('Version'); -$table->head[4] = __('Modules'); -$table->head[5] = __('Lag').ui_print_help_tip(__('Avg. Delay(sec)/Modules delayed'), true); -$table->head[6] = __('T/Q').ui_print_help_tip(__('Threads / Queued modules currently'), true); +$table->head[3] = __('Master'); +$table->head[4] = __('Version'); +$table->head[5] = __('Modules'); +$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". -$table->head[7] = __('Updated'); +$table->head[8] = __('Updated'); // Only Pandora Administrator can delete servers. if ((bool) check_acl($config['id_user'], 0, 'PM') === true) { - $table->head[8] = ''.__('Op.').''; + $table->head[9] = ''.__('Op.').''; } $table->data = []; @@ -143,9 +144,11 @@ foreach ($servers as $server) { } // Type. - $data[2] = ''.$server['img']; + $data[2] = ''.$server['img'].' '.ucfirst($server['type']).' server'; 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) { @@ -157,27 +160,27 @@ foreach ($servers as $server) { case 'event': case 'autoprovision': case 'migration': - $data[3] = $server['version']; - $data[4] = __('N/A'); + $data[4] = $server['version']; $data[5] = __('N/A'); + $data[6] = __('N/A'); break; case 'export': - $data[3] = $server['version']; - $data[4] = $server['modules'].' '.__('of').' '.$server['modules_total']; - $data[5] = __('N/A'); + $data[4] = $server['version']; + $data[5] = $server['modules'].' '.__('of').' '.$server['modules_total']; + $data[6] = __('N/A'); break; default: - $data[3] = $server['version']; - $data[4] = $server['modules'].' '.__('of').' '.$server['modules_total']; - $data[5] = ''.$server['lag_txt'].''; + $data[4] = $server['version']; + $data[5] = $server['modules'].' '.__('of').' '.$server['modules_total']; + $data[6] = ''.$server['lag_txt'].''; break; } - $data[6] = ''; + $data[7] = ''; if ($server['queued_modules'] > 500) { - $data[6] .= '
'.html_print_image( + $data[7] .= '  '; } - $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') { $ext = '_server'; @@ -208,11 +211,11 @@ foreach ($servers as $server) { // Only Pandora Administrator can delete servers. if ((bool) check_acl($config['id_user'], 0, 'PM') === true) { - $data[8] = ''; + $data[9] = ''; if ($server['type'] === 'recon') { - $data[8] .= ''; - $data[8] .= html_print_image( + $data[9] .= ''; + $data[9] .= html_print_image( 'images/snmp-trap@svg.svg', true, [ @@ -221,12 +224,12 @@ foreach ($servers as $server) { ] ); - $data[8] .= ''; + $data[9] .= ''; } if ($server['type'] === 'data') { - $data[8] .= ''; - $data[8] .= html_print_image( + $data[9] .= ''; + $data[9] .= html_print_image( 'images/force@svg.svg', true, [ @@ -234,10 +237,10 @@ foreach ($servers as $server) { 'class' => 'main_menu_icon invert_filter', ] ); - $data[8] .= ''; + $data[9] .= ''; } else if ($server['type'] === 'enterprise snmp') { - $data[8] .= ''; - $data[8] .= html_print_image( + $data[9] .= ''; + $data[9] .= html_print_image( 'images/force@svg.svg', true, [ @@ -245,12 +248,12 @@ foreach ($servers as $server) { 'class' => 'main_menu_icon invert_filter', ] ); - $data[8] .= ''; + $data[9] .= ''; } if ($server['type'] === 'event' && (bool) check_acl($config['id_user'], 0, 'LM') === true) { - $data[8] .= ''; - $data[8] .= html_print_image( + $data[9] .= ''; + $data[9] .= html_print_image( 'images/alert@svg.svg', true, [ @@ -258,11 +261,11 @@ foreach ($servers as $server) { 'class' => 'main_menu_icon invert_filter', ] ); - $data[8] .= ''; + $data[9] .= ''; } - $data[8] .= ''; - $data[8] .= html_print_image( + $data[9] .= ''; + $data[9] .= html_print_image( 'images/edit.svg', true, [ @@ -270,11 +273,11 @@ foreach ($servers as $server) { 'class' => 'main_menu_icon invert_filter', ] ); - $data[8] .= ''; + $data[9] .= ''; if (($names_servers[$safe_server_name] === true) && ($ext === '_server' || $server['type'] === 'enterprise satellite')) { - $data[8] .= ''; - $data[8] .= html_print_image( + $data[9] .= ''; + $data[9] .= html_print_image( 'images/agents@svg.svg', true, [ @@ -282,10 +285,10 @@ foreach ($servers as $server) { 'class' => 'main_menu_icon invert_filter', ] ); - $data[8] .= ''; + $data[9] .= ''; - $data[8] .= ''; - $data[8] .= html_print_image( + $data[9] .= ''; + $data[9] .= html_print_image( 'images/remote-configuration@svg.svg', true, [ @@ -293,12 +296,12 @@ foreach ($servers as $server) { 'class' => 'main_menu_icon invert_filter', ] ); - $data[8] .= ''; + $data[9] .= ''; $names_servers[$safe_server_name] = false; } - $data[8] .= ''; - $data[8] .= html_print_image( + $data[9] .= ''; + $data[9] .= html_print_image( 'images/delete.svg', true, [ @@ -307,14 +310,14 @@ foreach ($servers as $server) { 'class' => 'main_menu_icon invert_filter', ] ); - $data[8] .= ''; + $data[9] .= ''; } if ($tiny) { - unset($data[4]); - unset($data[6]); + unset($data[5]); unset($data[7]); unset($data[8]); + unset($data[9]); } $ext = ''; @@ -323,10 +326,10 @@ foreach ($servers as $server) { } if ($tiny) { - unset($table->head[4]); - unset($table->head[6]); + unset($table->head[5]); unset($table->head[7]); unset($table->head[8]); + unset($table->head[9]); } if ($tiny) { From 0eea4788bf0126820c378c82ec8e52ddaaca056f Mon Sep 17 00:00:00 2001 From: Calvo Date: Fri, 17 Nov 2023 13:24:44 +0100 Subject: [PATCH 2/3] Added blankspaces in server view --- pandora_console/godmode/servers/servers.build_table.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/godmode/servers/servers.build_table.php b/pandora_console/godmode/servers/servers.build_table.php index 80b9ff9c6b..f482883786 100644 --- a/pandora_console/godmode/servers/servers.build_table.php +++ b/pandora_console/godmode/servers/servers.build_table.php @@ -144,7 +144,7 @@ foreach ($servers as $server) { } // Type. - $data[2] = ''.$server['img'].' '.ucfirst($server['type']).' server'; + $data[2] = ''.$server['img'].'    '.ucfirst($server['type']).' server'; if ($server['master'] == $master) { $data[3] .= __('Yes', true); } else { From 50406748bf211618fe14bf19e7c382cb2752c149 Mon Sep 17 00:00:00 2001 From: Calvo Date: Mon, 20 Nov 2023 12:04:25 +0100 Subject: [PATCH 3/3] Fix server names uppercases on server list --- .../godmode/servers/servers.build_table.php | 2 +- pandora_console/include/functions_servers.php | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/pandora_console/godmode/servers/servers.build_table.php b/pandora_console/godmode/servers/servers.build_table.php index f482883786..95b831b86c 100644 --- a/pandora_console/godmode/servers/servers.build_table.php +++ b/pandora_console/godmode/servers/servers.build_table.php @@ -144,7 +144,7 @@ foreach ($servers as $server) { } // Type. - $data[2] = ''.$server['img'].'    '.ucfirst($server['type']).' server'; + $data[2] = ''.$server['img'].'    '.$server['name']; if ($server['master'] == $master) { $data[3] .= __('Yes', true); } else { diff --git a/pandora_console/include/functions_servers.php b/pandora_console/include/functions_servers.php index 75e034ce3c..ff6fab73c6 100644 --- a/pandora_console/include/functions_servers.php +++ b/pandora_console/include/functions_servers.php @@ -665,6 +665,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1) ); $server['type'] = 'data'; $id_modulo = 1; + $server['name'] = __('Data server'); break; case SERVER_TYPE_NETWORK: @@ -678,6 +679,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1) ); $server['type'] = 'network'; $id_modulo = 2; + $server['name'] = __('Network server'); break; case SERVER_TYPE_SNMP: @@ -691,6 +693,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1) ); $server['type'] = 'snmp'; $id_modulo = 0; + $server['name'] = __('SNMP Trap server'); break; case SERVER_TYPE_DISCOVERY: @@ -704,6 +707,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1) ); $server['type'] = 'recon'; $id_modulo = 0; + $server['name'] = __('Discovery server'); break; case SERVER_TYPE_PLUGIN: @@ -717,6 +721,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1) ); $server['type'] = 'plugin'; $id_modulo = 4; + $server['name'] = __('Plugin server'); break; case SERVER_TYPE_PREDICTION: @@ -730,6 +735,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1) ); $server['type'] = 'prediction'; $id_modulo = 5; + $server['name'] = __('Prediction server'); break; case SERVER_TYPE_WMI: @@ -743,6 +749,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1) ); $server['type'] = 'wmi'; $id_modulo = 6; + $server['name'] = __('WMI server'); break; case SERVER_TYPE_EXPORT: @@ -756,6 +763,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1) ); $server['type'] = 'export'; $id_modulo = 0; + $server['name'] = __('Export server'); break; case SERVER_TYPE_INVENTORY: @@ -769,6 +777,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1) ); $server['type'] = 'inventory'; $id_modulo = 0; + $server['name'] = __('Inventory server'); break; case SERVER_TYPE_WEB: @@ -782,6 +791,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1) ); $server['type'] = 'web'; $id_modulo = 0; + $server['name'] = __('Web server'); break; case SERVER_TYPE_EVENT: @@ -795,6 +805,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1) ); $server['type'] = 'event'; $id_modulo = 2; + $server['name'] = __('Event server'); break; case SERVER_TYPE_CORRELATION: @@ -808,6 +819,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1) ); $server['type'] = 'correlation'; $id_modulo = 0; + $server['name'] = __('Correlation server'); break; case SERVER_TYPE_ENTERPRISE_ICMP: @@ -821,6 +833,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1) ); $server['type'] = 'enterprise icmp'; $id_modulo = 2; + $server['name'] = __('Enterprise ICMP server'); break; case SERVER_TYPE_ENTERPRISE_SNMP: @@ -834,6 +847,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1) ); $server['type'] = 'enterprise snmp'; $id_modulo = 2; + $server['name'] = __('Enterprise SNMP server'); break; case SERVER_TYPE_ENTERPRISE_SATELLITE: @@ -847,6 +861,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1) ); $server['type'] = 'enterprise satellite'; $id_modulo = 0; + $server['name'] = __('Enterprise Satellite server'); break; case SERVER_TYPE_ENTERPRISE_TRANSACTIONAL: @@ -860,6 +875,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1) ); $server['type'] = 'enterprise transactional'; $id_modulo = 0; + $server['name'] = __('Enterprise Transactional server'); break; case SERVER_TYPE_MAINFRAME: @@ -873,6 +889,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1) ); $server['type'] = 'mainframe'; $id_modulo = 0; + $server['name'] = __('Mainframe server'); break; case SERVER_TYPE_SYNC: @@ -886,6 +903,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1) ); $server['type'] = 'sync'; $id_modulo = 0; + $server['name'] = __('Sync server'); break; case SERVER_TYPE_WUX: @@ -899,6 +917,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1) ); $server['type'] = 'wux'; $id_modulo = 0; + $server['name'] = __('Wux server'); break; case SERVER_TYPE_SYSLOG: @@ -912,6 +931,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1) ); $server['type'] = 'syslog'; $id_modulo = 0; + $server['name'] = __('Syslog server'); break; case SERVER_TYPE_NCM: @@ -925,6 +945,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1) ); $server['type'] = 'ncm'; $id_modulo = 0; + $server['name'] = __('NCM server'); break; case SERVER_TYPE_AUTOPROVISION: @@ -938,6 +959,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1) ); $server['type'] = 'autoprovision'; $id_modulo = 0; + $server['name'] = __('Autoprovision server'); break; case SERVER_TYPE_MIGRATION: @@ -951,6 +973,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1) ); $server['type'] = 'migration'; $id_modulo = 0; + $server['name'] = __('Migration server'); break; case SERVER_TYPE_ALERT: @@ -964,6 +987,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1) ); $server['type'] = 'alert'; $id_modulo = 0; + $server['name'] = __('Alert server'); break; case SERVER_TYPE_NETFLOW: @@ -977,6 +1001,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1) ); $server['type'] = 'netflow'; $id_modulo = 0; + $server['name'] = __('Netflow server'); break; case SERVER_TYPE_LOG: @@ -990,6 +1015,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1) ); $server['type'] = 'log'; $id_modulo = 0; + $server['name'] = __('Log server'); break; case SERVER_TYPE_MADE: @@ -1003,6 +1029,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1) ); $server['type'] = 'made'; $id_modulo = 0; + $server['name'] = __('MADE server'); break; default: