Merge remote-tracking branch 'origin/develop' into ent-9662-second-round

This commit is contained in:
daniel 2023-03-09 20:00:32 +01:00
commit 9aa5d76963
36 changed files with 551 additions and 232 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.769-230308 Version: 7.0NG.769-230309
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.769-230308" pandora_version="7.0NG.769-230309"
echo "Test if you has the tools for to make the packages." echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1023,7 +1023,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.769'; use constant AGENT_VERSION => '7.0NG.769';
use constant AGENT_BUILD => '230308'; use constant AGENT_BUILD => '230309';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_agent_linux %define name pandorafms_agent_linux
%define version 7.0NG.769 %define version 7.0NG.769
%define release 230308 %define release 230309
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_agent_linux %define name pandorafms_agent_linux
%define version 7.0NG.769 %define version 7.0NG.769
%define release 230308 %define release 230309
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.769" PI_VERSION="7.0NG.769"
PI_BUILD="230308" PI_BUILD="230309"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{230308} {230309}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.769 Build 230308") #define PANDORA_VERSION ("7.0NG.769 Build 230309")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.769(Build 230308))" VALUE "ProductVersion", "(7.0NG.769(Build 230309))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.769-230308 Version: 7.0NG.769-230309
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.769-230308" pandora_version="7.0NG.769-230309"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -923,6 +923,12 @@ switch ($action) {
$selected_agent_group_filter = $es['agent_group_filter']; $selected_agent_group_filter = $es['agent_group_filter'];
$selected_module_group = $es['module_group']; $selected_module_group = $es['module_group'];
$search_module_name = $es['search_module_name'];
$tags = $es['tags'];
$alias = $es['alias'];
$description_switch = $es['description_switch'];
$last_status_change = $es['last_status_change'];
break; break;
case 'inventory': case 'inventory':
@ -3921,38 +3927,93 @@ $class = 'databox filters';
<?php <?php
$rows_select = []; $rows_select = [];
$rows_select[0] = __('Not assigned'); $rows_select[0] = __('Not assigned');
if ($is_metaconsole === false) {
$rows = db_get_all_rows_sql(
'SELECT * FROM tmodule_group ORDER BY name'
);
$rows = io_safe_output($rows);
if (empty($rows) === false) {
foreach ($rows as $module_group) {
$rows_select[$module_group['id_mg']] = $module_group['name'];
}
}
} else {
$rows_select = modules_get_modulegroups(); $rows_select = modules_get_modulegroups();
}
html_print_select($rows_select, 'modulegroup', $modulegroup, '', __($is_none), -1, true, false, true, '', false, 'width: 120px;'); html_print_select($rows_select, 'modulegroup', $modulegroup, '', __($is_none), -1, true, false, true, '', false, 'width: 120px;');
html_print_select( html_print_select(
$rows_select, $rows_select,
'module_group', 'module_group[]',
$selected_module_group, $selected_module_group,
'', '',
__('All'), '',
-1, '',
false,
false, false,
true, true,
true,
'', '',
false, false,
'width: 120px;' 'width: 200px;'
); );
?> ?>
</td> </td>
</tr> </tr>
<tr id="row_search_module_name" class="datos">
<td class="bolder">
<?php echo __('Search module name'); ?>
</td>
<td >
<?php
html_print_input_text('search_module_name', $search_module_name, '', 40, 100);
?>
</td>
</tr>
<tr id="row_tags" class="datos">
<td class="bolder">
<?php
echo __('Tags');
?>
</td>
<td>
<?php
$rows_select = [];
$rows_select = tags_get_user_tags();
html_print_select(
$rows_select,
'tags[]',
$tags,
'',
'',
'',
false,
true,
true,
'',
false,
'width: 200px;'
);
?>
</td>
</tr>
<tr id="row_alias" class="datos">
<td class="bolder">
<?php
echo __('Alias');
?>
</td>
<td><?php html_print_checkbox_switch('alias', 1, $alias); ?></td>
</tr>
<tr id="row_description_switch" class="datos">
<td class="bolder">
<?php
echo __('Description');
?>
</td>
<td><?php html_print_checkbox_switch('description_switch', 1, $description_switch); ?></td>
</tr>
<tr id="row_last_status_change" class="datos">
<td class="bolder">
<?php
echo __('Last status change');
?>
</td>
<td><?php html_print_checkbox_switch('last_status_change', 1, $last_status_change); ?></td>
</tr>
</tbody> </tbody>
</table> </table>
@ -6422,6 +6483,11 @@ function chooseType() {
$("#row_agent_group_filter").hide(); $("#row_agent_group_filter").hide();
$("#row_module_group_filter").hide(); $("#row_module_group_filter").hide();
$("#row_module_group_filter").hide(); $("#row_module_group_filter").hide();
$("#row_alias").hide();
$("#row_search_module_name").hide();
$("#row_description_switch").hide();
$("#row_last_status_change").hide();
$("#row_tags").hide();
$("#row_os").hide(); $("#row_os").hide();
$("#row_custom_field_filter").hide(); $("#row_custom_field_filter").hide();
$("#row_custom_field").hide(); $("#row_custom_field").hide();
@ -7048,7 +7114,6 @@ function chooseType() {
$("#row_agents_inventory_display_options").show(); $("#row_agents_inventory_display_options").show();
$("#row_agent_server_filter").show(); $("#row_agent_server_filter").show();
$("#row_agent_group_filter").show(); $("#row_agent_group_filter").show();
$("#row_group").show();
$("#row_os").show(); $("#row_os").show();
$("#row_custom_field").show(); $("#row_custom_field").show();
$("#row_custom_field_filter").show(); $("#row_custom_field_filter").show();
@ -7074,10 +7139,14 @@ function chooseType() {
break; break;
case 'modules_inventory': case 'modules_inventory':
$("#row_group").show();
$("#row_agent_server_filter").show(); $("#row_agent_server_filter").show();
$("#row_agent_group_filter").show(); $("#row_agent_group_filter").show();
$("#row_module_group_filter").show(); $("#row_module_group_filter").show();
$("#row_alias").show();
$("#row_search_module_name").show();
$("#row_description_switch").show();
$("#row_last_status_change").show();
$("#row_tags").show();
break; break;

View File

@ -2411,6 +2411,11 @@ switch ($action) {
$es['agent_server_filter'] = get_parameter('agent_server_filter'); $es['agent_server_filter'] = get_parameter('agent_server_filter');
$es['module_group'] = get_parameter('module_group'); $es['module_group'] = get_parameter('module_group');
$es['agent_group_filter'] = get_parameter('agent_group_filter'); $es['agent_group_filter'] = get_parameter('agent_group_filter');
$es['search_module_name'] = get_parameter('search_module_name');
$es['tags'] = get_parameter('tags');
$es['alias'] = get_parameter('alias', '');
$es['description_switch'] = get_parameter('description_switch', '');
$es['last_status_change'] = get_parameter('last_status_change', '');
$values['external_source'] = json_encode($es); $values['external_source'] = json_encode($es);
break; break;
@ -3199,6 +3204,11 @@ switch ($action) {
$es['agent_server_filter'] = get_parameter('agent_server_filter'); $es['agent_server_filter'] = get_parameter('agent_server_filter');
$es['module_group'] = get_parameter('module_group'); $es['module_group'] = get_parameter('module_group');
$es['agent_group_filter'] = get_parameter('agent_group_filter'); $es['agent_group_filter'] = get_parameter('agent_group_filter');
$es['search_module_name'] = get_parameter('search_module_name');
$es['tags'] = get_parameter('tags');
$es['alias'] = get_parameter('alias', '');
$es['description_switch'] = get_parameter('description_switch', '');
$es['last_status_change'] = get_parameter('last_status_change', '');
$values['external_source'] = json_encode($es); $values['external_source'] = json_encode($es);
break; break;

View File

@ -2862,7 +2862,7 @@ class ConsoleSupervisor
return; return;
} }
$sync = new PandoraFMS\Enterprise\Metaconsole\Synchronizer(); $sync = new PandoraFMS\Enterprise\Metaconsole\Synchronizer(true);
$counts = $sync->getQueues(true); $counts = $sync->getQueues(true);
if (count($counts) === 0) { if (count($counts) === 0) {
@ -2919,7 +2919,7 @@ class ConsoleSupervisor
return; return;
} }
$sync = new PandoraFMS\Enterprise\Metaconsole\Synchronizer(); $sync = new PandoraFMS\Enterprise\Metaconsole\Synchronizer(true);
$queues = $sync->getQueues(); $queues = $sync->getQueues();
if (count($queues) === 0) { if (count($queues) === 0) {
// Clean all. // Clean all.

View File

@ -84,7 +84,7 @@ class SatelliteCollection extends HTML
return; return;
} }
if ((int) $config['license_nms'] === 0) { if ((int) $config['license_nms'] === 1) {
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_NMS_VIOLATION, AUDIT_LOG_NMS_VIOLATION,
'Trying to access satellite collections' 'Trying to access satellite collections'

View File

@ -947,14 +947,26 @@ class SnmpConsole extends HTML
).'</a> '; ).'</a> ';
} }
$tmp->action .= '<a href="javascript: toggleVisibleExtendedInfo('.$tmp->id_trap.','.$count.');">'.html_print_image( $tmp->action .= '<a id="eye_'.$tmp->id_trap.'" data-show="show"
href="javascript: toggleVisibleExtendedInfo('.$tmp->id_trap.','.$count.');">'.html_print_image(
'images/see-details@svg.svg', 'images/see-details@svg.svg',
true, true,
[ [
'id' => 'img_'.$tmp->id_trap,
'alt' => __('Show more'), 'alt' => __('Show more'),
'title' => __('Show more'), 'title' => __('Show more'),
'class' => 'invert_filter main_menu_icon', 'class' => 'invert_filter main_menu_icon',
] ]
).' '.html_print_image(
'images/disable.svg',
true,
[
'id' => 'img_hide_'.$tmp->id_trap,
'alt' => __('Hide details'),
'title' => __('Hide details'),
'class' => 'invert_filter main_menu_icon',
'style' => 'display:none',
]
).'</a>'; ).'</a>';
if ($config['enterprise_installed']) { if ($config['enterprise_installed']) {
@ -1380,6 +1392,16 @@ class SnmpConsole extends HTML
* Show more information * Show more information
*/ */
function toggleVisibleExtendedInfo(id, position) { function toggleVisibleExtendedInfo(id, position) {
// Show all "Show more"
$('[id^=img_]').each(function() {
$(this).show();
});
// Hide all "Hide details"
$('[id^=img_hide_]').each(function() {
$(this).hide();
});
var status = $('#eye_'+id).attr('data-show');
if(status == "show"){
$('tr[id^=show_]').remove() $('tr[id^=show_]').remove()
$.ajax({ $.ajax({
method: 'get', method: 'get',
@ -1442,21 +1464,21 @@ class SnmpConsole extends HTML
} }
let labelType = '<td align="left" valign="top"><b><?php echo __('Type:'); ?></td>'; let labelType = '<td align="left" valign="top"><b><?php echo __('Type:'); ?></td>';
let variableType = `<td align="left">${desc_trap_type}</td>`; let variableType = `<td align="left" colspan="8">${desc_trap_type}</td>`;
tr.after(`<tr id="show_" role="row">${labelType}${variableType}</tr>`); tr.after(`<tr id="show_" role="row">${labelType}${variableType}</tr>`);
// Description. // Description.
if (trap['description']) { if (trap['description']) {
let labelDesc = '<td align="left" valign="top"><b><?php echo __('Description:'); ?></td>'; let labelDesc = '<td align="left" valign="top"><b><?php echo __('Description:'); ?></td>';
let variableDesc = `<td align="left">${trap['description']}</td>`; let variableDesc = `<td align="left" colspan="8">${trap['description']}</td>`;
tr.after(`<tr id="show_" role="row">${labelDesc}${variableDesc}</tr>`); tr.after(`<tr id="show_" role="row">${labelDesc}${variableDesc}</tr>`);
} }
// Enterprise String. // Enterprise String.
let labelOid = '<td align="left" valign="top"><b><?php echo __('Enterprise String:'); ?></td>'; let labelOid = '<td align="left" valign="top"><b><?php echo __('Enterprise String:'); ?></td>';
let variableOId = `<td align="left">${trap['oid']}</td>`; let variableOId = `<td align="left" colspan="8">${trap['oid']}</td>`;
tr.after(`<tr id="show_" role="row">${labelOid}${variableOId}</tr>`); tr.after(`<tr id="show_" role="row">${labelOid}${variableOId}</tr>`);
@ -1476,7 +1498,7 @@ class SnmpConsole extends HTML
const string = '<a href="'+new_url+'"><?php echo __('See more details'); ?></a>'; const string = '<a href="'+new_url+'"><?php echo __('See more details'); ?></a>';
variableBindings = `<td align="left">${string}</td>`; variableBindings = `<td align="left" colspan="8">${string}</td>`;
} else { } else {
labelBindings = '<td align="left" valign="top" width="15%"><b><?php echo __('Variable bindings:'); ?></b></td>'; labelBindings = '<td align="left" valign="top" width="15%"><b><?php echo __('Variable bindings:'); ?></b></td>';
const binding_vars = trap['oid_custom'].split("\t"); const binding_vars = trap['oid_custom'].split("\t");
@ -1484,7 +1506,7 @@ class SnmpConsole extends HTML
binding_vars.forEach(function(oid) { binding_vars.forEach(function(oid) {
string += oid+'<br/>'; string += oid+'<br/>';
}); });
variableBindings = `<td align="left">${string}</td>`; variableBindings = `<td align="left" colspan="8">${string}</td>`;
} }
tr.after(`<tr id="show_" role="row">${labelBindings}${variableBindings}</tr>`); tr.after(`<tr id="show_" role="row">${labelBindings}${variableBindings}</tr>`);
@ -1493,6 +1515,15 @@ class SnmpConsole extends HTML
console.error(e); console.error(e);
} }
}); });
$('#eye_'+id).attr('data-show', 'hide');
$('#img_'+id).hide();
$('#img_hide_'+id).show();
} else{
$('tr[id^=show_]').remove();
$('#eye_'+id).attr('data-show', 'show');
$('#img_'+id).show();
$('#img_hide_'+id).hide();
}
} }
$(document).ready(function() { $(document).ready(function() {

View File

@ -20,7 +20,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC230308'; $build_version = 'PC230309';
$pandora_version = 'v7.0NG.769'; $pandora_version = 'v7.0NG.769';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.

View File

@ -2624,9 +2624,10 @@ function reporting_agents_inventory($report, $content)
$custom_field_sql = ''; $custom_field_sql = '';
$search_sql = ''; $search_sql = '';
$sql_order_by = 'ORDER BY tagente.id_agente ASC';
if (empty(array_filter($es_agent_custom_fields)) === false) { if (empty(array_filter($es_agent_custom_fields)) === false) {
$custom_field_sql = 'INNER JOIN tagent_custom_data tacd ON tacd.id_agent = tagente.id_agente'; $custom_field_sql = 'LEFT JOIN tagent_custom_data tacd ON tacd.id_agent = tagente.id_agente';
if ($es_agent_custom_fields[0] != 0) { if ($es_agent_custom_fields[0] != 0) {
$custom_field_sql .= ' AND tacd.id_field IN ('.implode(',', $es_agent_custom_fields).')'; $custom_field_sql .= ' AND tacd.id_field IN ('.implode(',', $es_agent_custom_fields).')';
} }
@ -2660,6 +2661,12 @@ function reporting_agents_inventory($report, $content)
$user_groups_to_sql = implode(',', array_keys(users_get_groups())); $user_groups_to_sql = implode(',', array_keys(users_get_groups()));
if (array_search('alias', $es_agents_inventory_display_options) !== false) {
$sql_order_by = 'ORDER BY tagente.alias ASC';
} else if (array_search('direccion', $es_agents_inventory_display_options) !== false) {
$sql_order_by = 'ORDER BY tagente.direccion ASC';
}
$sql = sprintf( $sql = sprintf(
'SELECT DISTINCT(tagente.id_agente) AS id_agente, 'SELECT DISTINCT(tagente.id_agente) AS id_agente,
tagente.id_os, tagente.id_os,
@ -2675,12 +2682,12 @@ function reporting_agents_inventory($report, $content)
LEFT JOIN tagente_modulo tam LEFT JOIN tagente_modulo tam
ON tam.id_agente = tagente.id_agente ON tam.id_agente = tagente.id_agente
%s %s
WHERE (tagente.id_grupo IN (%s) OR tasg.id_group IN (%s)) WHERE (tagente.id_grupo IN (%s) OR tasg.id_group IN (%s))%s%s',
%s',
$custom_field_sql, $custom_field_sql,
$user_groups_to_sql, $user_groups_to_sql,
$user_groups_to_sql, $user_groups_to_sql,
$search_sql $search_sql,
$sql_order_by
); );
if (is_metaconsole()) { if (is_metaconsole()) {
@ -2812,11 +2819,16 @@ function reporting_modules_inventory($report, $content)
$search_sql = ''; $search_sql = '';
if (empty($es_agent_group_filter) === false) { if (empty($es_agent_group_filter) === false) {
$search_sql .= ' AND (ta.id_grupo = '.$es_agent_group_filter.' OR tasg.id_group = '.$es_agent_group_filter.')'; $search_sql .= '(ta.id_grupo = '.$es_agent_group_filter.' OR tasg.id_group = '.$es_agent_group_filter.')';
} }
if (empty($module_group) === false && $module_group > -1) { if (empty($module_group) === false && $module_group > -1) {
$search_sql .= ' AND tam.id_module_group = '.$module_group; $modules = implode(',', $module_group);
if ($search_sql !== '') {
$search_sql .= ' AND ';
}
$search_sql .= 'tam.id_module_group IN ('.$modules.')';
} }
$user_groups_to_sql = ''; $user_groups_to_sql = '';
@ -2826,25 +2838,80 @@ function reporting_modules_inventory($report, $content)
$user_groups = $user_groupsAR; $user_groups = $user_groupsAR;
$user_groups_to_sql = implode(',', array_keys($user_groups)); $user_groups_to_sql = implode(',', array_keys($user_groups));
$sql_alias = '';
$sql_order_by = 'ORDER BY tam.nombre ASC';
if ((int) $external_source['alias'] === 1) {
$sql_alias = " ta.alias,\n ";
$sql_order_by = 'ORDER BY ta.alias ASC, tam.nombre ASC';
}
$sql_description = '';
if ((int) $external_source['description_switch'] === 1) {
$sql_description = "\n tam.descripcion,";
}
$sql_last_status = '';
$sql_last_status_join = '';
if ((int) $external_source['last_status_change'] === 1) {
$sql_last_status = ",\n tae.last_status_change";
$sql_last_status_join = "\n LEFT JOIN tagente_estado tae";
$sql_last_status_join .= "\n ON tae.id_agente_modulo = tam.id_agente_modulo";
}
if (empty($external_source['search_module_name']) === false) {
if ($search_sql !== '') {
$search_sql .= ' AND ';
}
$search_sql .= "tam.nombre LIKE '%".$external_source['search_module_name']."%'";
}
$tags_condition = tags_get_user_tags();
$tags_imploded = implode(',', array_keys($tags_condition));
if (users_is_admin() === false) {
if ($search_sql !== '') {
$search_sql .= ' AND ';
}
$search_sql .= 'ttm.id_tag IN ('.$tags_imploded.')';
}
if (empty($external_source['tags']) === false) {
$external_tags_imploded = implode(',', $external_source['tags']);
if ($search_sql !== '') {
$search_sql .= ' AND ';
}
$search_sql .= 'ttm.id_tag IN ('.$external_tags_imploded.')';
}
$sql_where = '';
if (empty($search_sql) === false) {
$sql_where .= 'WHERE '.$search_sql;
}
$sql = sprintf( $sql = sprintf(
'SELECT tam.id_agente_modulo, 'SELECT DISTINCT(tam.id_agente_modulo),
tam.nombre, %s tam.id_agente_modulo,
tam.descripcion, tam.nombre,%s
tam.id_module_group, tam.id_module_group,
ttm.id_tag,
ta.id_grupo AS group_id, ta.id_grupo AS group_id,
tasg.id_group AS sec_group_id tasg.id_group AS sec_group_id%s
FROM tagente_modulo tam FROM tagente_modulo tam
INNER JOIN tagente ta INNER JOIN tagente ta
ON tam.id_agente = ta.id_agente ON tam.id_agente = ta.id_agente
LEFT JOIN tagent_secondary_group tasg LEFT JOIN tagent_secondary_group tasg
ON ta.id_agente = tasg.id_agent ON ta.id_agente = tasg.id_agent
LEFT JOIN ttag_module ttm LEFT JOIN ttag_module ttm
ON ttm.id_agente_modulo = tam.id_agente_modulo ON ttm.id_agente_modulo = tam.id_agente_modulo%s
WHERE (ta.id_grupo IN (%s) OR tasg.id_group IN (%s)) %s', %s
$user_groups_to_sql, %s',
$user_groups_to_sql, $sql_alias,
$search_sql $sql_description,
$sql_last_status,
$sql_last_status_join,
$sql_where,
$sql_order_by
); );
if (is_metaconsole()) { if (is_metaconsole()) {
@ -2870,6 +2937,23 @@ function reporting_modules_inventory($report, $content)
$agents = db_get_all_rows_sql($sql); $agents = db_get_all_rows_sql($sql);
foreach ($agents as $agent_key => $agent_value) {
$sql2 = 'SELECT tm.id_tag
FROM ttag_module tm
WHERE tm.id_agente_modulo = '.$agent_value['id_agente_modulo'];
$tags_rows = db_get_all_rows_sql($sql2);
$tags_ids = [];
foreach ($tags_rows as $tag_row) {
array_push($tags_ids, $tag_row['id_tag']);
}
$column_value = implode(',', $tags_ids);
$agents[$agent_key]['tags'] = $column_value;
$agents[$agent_key]['server_id'] = $server_id;
}
$return_data[$server_id] = $agents; $return_data[$server_id] = $agents;
if (is_metaconsole()) { if (is_metaconsole()) {
@ -2889,33 +2973,44 @@ function reporting_modules_inventory($report, $content)
$module_row_data = []; $module_row_data = [];
$i = 0;
foreach ($return['data'] as $row) { foreach ($return['data'] as $row) {
if (is_array($module_row_data[$row['id_agente_modulo']]) === false) { if (array_key_exists('alias', $row) === true) {
$module_row_data[$row['id_agente_modulo']]['nombre'] = $row['nombre']; $module_row_data[$i]['alias'] = $row['alias'];
$module_row_data[$row['id_agente_modulo']]['descripcion'] = $row['descripcion'];
$module_row_data[$row['id_agente_modulo']]['id_module_group'] = $row['id_module_group'];
$module_row_data[$row['id_agente_modulo']]['id_tag'] = [];
$module_row_data[$row['id_agente_modulo']]['group_id'] = [];
$module_row_data[$row['id_agente_modulo']]['sec_group_id'] = [];
} }
if (in_array($row['id_tag'], $module_row_data[$row['id_agente_modulo']]['id_tag']) === false if (array_key_exists('nombre', $row) === true) {
&& $row['id_tag'] !== null $module_row_data[$i]['nombre'] = $row['nombre'];
) {
$module_row_data[$row['id_agente_modulo']]['id_tag'][] = $row['id_tag'];
} }
if (in_array($row['group_id'], $module_row_data[$row['id_agente_modulo']]['group_id']) === false if (array_key_exists('descripcion', $row) === true) {
&& $row['group_id'] !== null $module_row_data[$i]['descripcion'] = $row['descripcion'];
) {
$module_row_data[$row['id_agente_modulo']]['group_id'][] = $row['group_id'];
} }
if (in_array($row['sec_group_id'], $module_row_data[$row['id_agente_modulo']]['sec_group_id']) === false $module_row_data[$i]['id_module_group'] = $row['id_module_group'];
&& $row['sec_group_id'] !== null $module_row_data[$i]['id_tag'] = [];
) { $module_row_data[$i]['group_id'] = [];
$module_row_data[$row['id_agente_modulo']]['sec_group_id'][] = $row['sec_group_id']; $module_row_data[$i]['sec_group_id'] = [];
if (array_key_exists('tags', $row) === true) {
$module_row_data[$i]['id_tag'][] = $row['tags'];
} }
if (array_key_exists('id_group', $row) === true) {
$module_row_data[$i]['group_id'][] = $row['group_id'];
}
if (array_key_exists('sec_group_id', $row) === true) {
$module_row_data[$i]['sec_group_id'][] = $row['sec_group_id'];
}
if (array_key_exists('last_status_change', $row) === true) {
$human_last_status_change = human_time_comparation($row['last_status_change']);
$module_row_data[$i]['last_status_change'] = $human_last_status_change;
}
$i++;
} }
$return['data'] = $module_row_data; $return['data'] = $module_row_data;

View File

@ -1557,6 +1557,57 @@ function reporting_html_agents_inventory($table, $item, $pdf=0)
$table1->head = []; $table1->head = [];
// Sort array columns.
$tmp_sort_array = [];
foreach ($item['data'] as $data_key => $data_value) {
if (array_key_exists('alias', $data_value) === true) {
$tmp_sort_array['alias'] = $data_value['alias'];
}
if (array_key_exists('direccion', $data_value) === true) {
$tmp_sort_array['direccion'] = $data_value['direccion'];
}
if (array_key_exists('id_os', $data_value) === true) {
$tmp_sort_array['id_os'] = $data_value['id_os'];
}
if (array_key_exists('agent_version', $data_value) === true) {
$tmp_sort_array['agent_version'] = $data_value['agent_version'];
}
if (array_key_exists('id_grupo', $data_value) === true) {
$tmp_sort_array['id_grupo'] = $data_value['id_grupo'];
}
if (array_key_exists('comentarios', $data_value) === true) {
$tmp_sort_array['comentarios'] = $data_value['comentarios'];
}
if (array_key_exists('url_address', $data_value) === true) {
$tmp_sort_array['url_address'] = $data_value['url_address'];
}
if (array_key_exists('remote', $data_value) === true) {
$tmp_sort_array['remote'] = $data_value['remote'];
}
if (array_key_exists('secondary_groups', $data_value) === true) {
$tmp_sort_array['secondary_groups'] = $data_value['secondary_groups'];
}
if (array_key_exists('custom_fields', $data_value) === true) {
$tmp_sort_array['custom_fields'] = $data_value['custom_fields'];
}
if (array_key_exists('estado', $data_value) === true) {
$tmp_sort_array['estado'] = $data_value['estado'];
}
unset($item['data'][$data_key]);
$item['data'][$data_key] = $tmp_sort_array;
}
foreach ($item['data'][0] as $field_key => $field_value) { foreach ($item['data'][0] as $field_key => $field_value) {
switch ($field_key) { switch ($field_key) {
case 'alias': case 'alias':
@ -1638,7 +1689,7 @@ function reporting_html_agents_inventory($table, $item, $pdf=0)
} else if ($data_field_key === 'estado') { } else if ($data_field_key === 'estado') {
$column_value = ($pdf === 0) ? ui_print_module_status((int) $data_field_value, true) : modules_get_modules_status((int) $data_field_value); $column_value = ($pdf === 0) ? ui_print_module_status((int) $data_field_value, true) : modules_get_modules_status((int) $data_field_value);
} else if ($data_field_key === 'id_grupo') { } else if ($data_field_key === 'id_grupo') {
$column_value = ui_print_group_icon((int) $data_field_value, true, 'groups_small', '', $show_link); $column_value = groups_get_name((int) $data_field_value);
} else if ($data_field_key === 'custom_fields') { } else if ($data_field_key === 'custom_fields') {
$custom_fields_value = []; $custom_fields_value = [];
@ -1654,7 +1705,7 @@ function reporting_html_agents_inventory($table, $item, $pdf=0)
if (is_array($data_field_value)) { if (is_array($data_field_value)) {
foreach ($data_field_value as $value) { foreach ($data_field_value as $value) {
$custom_fields_value[] = ui_print_group_icon((int) $value['id_group'], true, 'groups_small', '', $show_link); $custom_fields_value[] = groups_get_name((int) $value['id_group']);
} }
} }
@ -1711,19 +1762,50 @@ function reporting_html_modules_inventory($table, $item, $pdf=0)
$table1->style[0] = 'text-align: left;vertical-align: top;min-width: 100px;'; $table1->style[0] = 'text-align: left;vertical-align: top;min-width: 100px;';
$table1->style[1] = 'text-align: left;vertical-align: top;min-width: 100px;'; $table1->style[1] = 'text-align: left;vertical-align: top;min-width: 100px;';
$table1->style[2] = 'text-align: left;vertical-align: top; min-width: 100px'; $table1->style[2] = 'text-align: left;vertical-align: top;min-width: 100px;';
$table1->style[3] = 'text-align: left;vertical-align: top;min-width: 100px;'; $table1->style[3] = 'text-align: left;vertical-align: top;min-width: 100px;';
$table1->style[4] = 'text-align: left;vertical-align: top;min-width: 100px;'; $table1->style[4] = 'text-align: left;vertical-align: top;min-width: 100px;';
$table1->style[5] = 'text-align: left;vertical-align: top; min-width: 100px'; $table1->style[5] = 'text-align: left;vertical-align: top;min-width: 100px;';
$table1->style[6] = 'text-align: left;vertical-align: top;min-width: 100px;';
$table1->style[7] = 'text-align: left;vertical-align: top;min-width: 100px;';
$table1->head = []; $table1->head = [];
$first_index = array_key_first($item['data']);
foreach ($item['data'][$first_index] as $field_key => $field_value) {
switch ($field_key) {
case 'alias':
$table1->head[] = __('Alias');
break;
case 'nombre':
$table1->head[] = __('Name'); $table1->head[] = __('Name');
break;
case 'descripcion':
$table1->head[] = __('Description'); $table1->head[] = __('Description');
break;
case 'id_module_group':
$table1->head[] = __('Module group'); $table1->head[] = __('Module group');
break;
case 'id_tag':
$table1->head[] = __('Tags'); $table1->head[] = __('Tags');
break;
case 'group_id':
$table1->head[] = __('Agent group'); $table1->head[] = __('Agent group');
break;
case 'sec_group_id':
$table1->head[] = __('Agent secondary groups'); $table1->head[] = __('Agent secondary groups');
break;
case 'last_status_change':
$table1->head[] = __('Last status change');
}
}
$table1->headstyle[0] = 'text-align: left'; $table1->headstyle[0] = 'text-align: left';
$table1->headstyle[1] = 'text-align: left'; $table1->headstyle[1] = 'text-align: left';
@ -1731,15 +1813,20 @@ function reporting_html_modules_inventory($table, $item, $pdf=0)
$table1->headstyle[3] = 'text-align: left'; $table1->headstyle[3] = 'text-align: left';
$table1->headstyle[4] = 'text-align: left'; $table1->headstyle[4] = 'text-align: left';
$table1->headstyle[5] = 'text-align: left'; $table1->headstyle[5] = 'text-align: left';
$table1->headstyle[6] = 'text-align: left';
$table1->headstyle[7] = 'text-align: left';
$table1->data = []; $table1->data = [];
foreach ($item['data'] as $module_id => $module_data) { foreach ($item['data'] as $module_id => $module_data) {
unset($module_data['server_id']);
$row = []; $row = [];
$first_item = array_pop(array_reverse($module_data)); $first_item = array_pop(array_reverse($module_data));
foreach ($module_data as $data_field_key => $data_field_value) { foreach ($module_data as $data_field_key => $data_field_value) {
if ($data_field_key === 'nombre') { if ($data_field_key === 'alias') {
$column_value = $data_field_value;
} else if ($data_field_key === 'nombre') {
$column_value = $data_field_value; $column_value = $data_field_value;
} else if ($data_field_key === 'descripcion') { } else if ($data_field_key === 'descripcion') {
$column_value = $data_field_value; $column_value = $data_field_value;
@ -1752,6 +1839,19 @@ function reporting_html_modules_inventory($table, $item, $pdf=0)
$column_value = $module_group_name; $column_value = $module_group_name;
} else if ($data_field_key === 'id_tag') { } else if ($data_field_key === 'id_tag') {
if (empty($data_field_value[0]) === false) {
$sql = 'SELECT name
FROM ttag
WHERE id_tag IN ('.$data_field_value[0].')';
$tags_rows = db_get_all_rows_sql($sql);
$tags_names = [];
foreach ($tags_rows as $tag_row) {
array_push($tags_names, $tag_row['name']);
}
$column_value = implode('<br>', $tags_names);
} else {
$tags_names = array_map( $tags_names = array_map(
function ($tag_id) { function ($tag_id) {
return db_get_value('name', 'ttag', 'id_tag', $tag_id); return db_get_value('name', 'ttag', 'id_tag', $tag_id);
@ -1759,6 +1859,7 @@ function reporting_html_modules_inventory($table, $item, $pdf=0)
$data_field_value $data_field_value
); );
$column_value = implode('<br>', $tags_names); $column_value = implode('<br>', $tags_names);
}
} else if ($data_field_key === 'group_id') { } else if ($data_field_key === 'group_id') {
$column_value = groups_get_name($data_field_value[0]); $column_value = groups_get_name($data_field_value[0]);
} else if ($data_field_key === 'sec_group_id') { } else if ($data_field_key === 'sec_group_id') {
@ -1770,6 +1871,8 @@ function reporting_html_modules_inventory($table, $item, $pdf=0)
); );
$column_value = implode('<br>', $sec_groups_names); $column_value = implode('<br>', $sec_groups_names);
} else if ($data_field_key === 'last_status_change') {
$column_value = $data_field_value;
} }
$row[] = $column_value; $row[] = $column_value;

View File

@ -1048,7 +1048,7 @@ function tags_has_user_acl_tags($id_user=false)
* @param string Access flag where check what tags have the user * @param string Access flag where check what tags have the user
* @param bool returns 0 if the user has all the tags * @param bool returns 0 if the user has all the tags
* *
* @return string SQL condition for tagente_module * @return array Returns the user's Tags
*/ */
function tags_get_user_tags($id_user=false, $access='AR', $return_tag_any=false) function tags_get_user_tags($id_user=false, $access='AR', $return_tag_any=false)
{ {

View File

@ -110,6 +110,16 @@ function form_controls_massive_operations_agents(metaconsole) {
$("#id_group").trigger("change"); $("#id_group").trigger("change");
}); });
if (metaconsole == 1) {
$("#nodes").change(function() {
disabled = $("#disabled").val();
});
$("#id_group").change(function() {
disabled = $("#disabled").val();
});
}
var nodes; var nodes;
$("#nodes").change(function() { $("#nodes").change(function() {
nodes = $("#nodes").val(); nodes = $("#nodes").val();

View File

@ -58,7 +58,7 @@ body {
} }
a { a {
color: #dc8100; color: #dc8100 !important;
text-decoration: none; text-decoration: none;
} }

View File

@ -131,7 +131,7 @@
<div style='padding-bottom: 50px'> <div style='padding-bottom: 50px'>
<?php <?php
$version = '7.0NG.769'; $version = '7.0NG.769';
$build = '230308'; $build = '230309';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.769 %define version 7.0NG.769
%define release 230308 %define release 230309
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.769 %define version 7.0NG.769
%define release 230308 %define release 230309
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.769 %define version 7.0NG.769
%define release 230308 %define release 230309
%define httpd_name httpd %define httpd_name httpd
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name apache2 %define httpd_name apache2

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.769-230308 Version: 7.0NG.769-230309
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.769-230308" pandora_version="7.0NG.769-230309"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

@ -46,7 +46,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.769"; my $pandora_version = "7.0NG.769";
my $pandora_build = "230308"; my $pandora_build = "230309";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

@ -594,42 +594,43 @@ sub get_agent_status ($$$) {
# 2 -> AGENT_MODULE_STATUS_WARNING # 2 -> AGENT_MODULE_STATUS_WARNING
# 0 -> AGENT_MODULE_STATUS_NORMAL # 0 -> AGENT_MODULE_STATUS_NORMAL
my $module_status = 3; my $module_status = 4;
my $modules_async = 0; my $modules_async = 0;
foreach my $module (@modules) { foreach my $module (@modules) {
my $m_status = get_agentmodule_status($pa_config, $dbh, my $m_status = get_agentmodule_status($pa_config, $dbh,
$module->{'id_agente_modulo'}); $module->{'id_agente_modulo'});
#This is the order to check #This is the order to check
# AGENT_MODULE_STATUS_CRITICAL_ALERT
# AGENT_MODULE_STATUS_CRITICAL_BAD # AGENT_MODULE_STATUS_CRITICAL_BAD
# AGENT_MODULE_STATUS_WARNING # AGENT_MODULE_STATUS_WARNING
# AGENT_MODULE_STATUS_UNKNOWN # AGENT_MODULE_STATUS_UNKNOWN
# AGENT_MODULE_STATUS_NORMAL # AGENT_MODULE_STATUS_NORMAL
if ($m_status == 4) {
$module_status = 4; if ($m_status == MODULE_CRITICAL) {
$module_status = MODULE_CRITICAL;
} }
elsif ($module_status != 4) { elsif ($module_status != MODULE_CRITICAL) {
if ($m_status == 1) { if ($m_status == MODULE_WARNING) {
$module_status = 1; $module_status = MODULE_WARNING;
} }
elsif ($module_status != 1) { elsif ($module_status != MODULE_WARNING) {
if ($m_status == 2) { if ($m_status == MODULE_UNKNOWN) {
$module_status = 2; $module_status = MODULE_UNKNOWN;
} }
elsif ($module_status != 2) { elsif ($module_status != MODULE_UNKNOWN) {
if ($m_status == 3) { if ($m_status == MODULE_NORMAL) {
$module_status = 3; $module_status = MODULE_NORMAL;
} }
elsif ($module_status != 3) { elsif ($module_status != MODULE_NORMAL) {
if ($m_status == 0) { if($m_status == MODULE_NOTINIT) {
$module_status = 0; $module_status = MODULE_NOTINIT;
} }
} }
} }
} }
} }
my $module_type = get_db_value($dbh, 'SELECT id_tipo_modulo my $module_type = get_db_value($dbh, 'SELECT id_tipo_modulo
FROM tagente_modulo FROM tagente_modulo
WHERE id_agente_modulo = ?', $module->{'id_agente_modulo'}); WHERE id_agente_modulo = ?', $module->{'id_agente_modulo'});

View File

@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.769"; my $pandora_version = "7.0NG.769";
my $pandora_build = "230308"; my $pandora_build = "230309";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] ); our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.769 %define version 7.0NG.769
%define release 230308 %define release 230309
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.769 %define version 7.0NG.769
%define release 230308 %define release 230309
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -9,7 +9,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.769" PI_VERSION="7.0NG.769"
PI_BUILD="230308" PI_BUILD="230309"
MODE=$1 MODE=$1
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.769 Build 230308"; my $version = "7.0NG.769 Build 230309";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "7.0NG.769 Build 230308"; my $version = "7.0NG.769 Build 230309";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);