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
Version: 7.0NG.769-230308
Version: 7.0NG.769-230309
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# 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."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1023,7 +1023,7 @@ my $Sem = undef;
my $ThreadSem = undef;
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
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

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

View File

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

View File

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

View File

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

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#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_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
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"
END
END

View File

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

View File

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

View File

@ -923,6 +923,12 @@ switch ($action) {
$selected_agent_group_filter = $es['agent_group_filter'];
$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;
case 'inventory':
@ -3921,38 +3927,93 @@ $class = 'databox filters';
<?php
$rows_select = [];
$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,
'module_group',
'module_group[]',
$selected_module_group,
'',
__('All'),
-1,
false,
'',
'',
false,
true,
true,
'',
false,
'width: 120px;'
'width: 200px;'
);
?>
</td>
</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>
</table>
@ -6422,6 +6483,11 @@ function chooseType() {
$("#row_agent_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_custom_field_filter").hide();
$("#row_custom_field").hide();
@ -7048,7 +7114,6 @@ function chooseType() {
$("#row_agents_inventory_display_options").show();
$("#row_agent_server_filter").show();
$("#row_agent_group_filter").show();
$("#row_group").show();
$("#row_os").show();
$("#row_custom_field").show();
$("#row_custom_field_filter").show();
@ -7074,10 +7139,14 @@ function chooseType() {
break;
case 'modules_inventory':
$("#row_group").show();
$("#row_agent_server_filter").show();
$("#row_agent_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;

View File

@ -2411,6 +2411,11 @@ switch ($action) {
$es['agent_server_filter'] = get_parameter('agent_server_filter');
$es['module_group'] = get_parameter('module_group');
$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);
break;
@ -3199,6 +3204,11 @@ switch ($action) {
$es['agent_server_filter'] = get_parameter('agent_server_filter');
$es['module_group'] = get_parameter('module_group');
$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);
break;

View File

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

View File

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

View File

@ -947,14 +947,26 @@ class SnmpConsole extends HTML
).'</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',
true,
[
'id' => 'img_'.$tmp->id_trap,
'alt' => __('Show more'),
'title' => __('Show more'),
'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>';
if ($config['enterprise_installed']) {
@ -1380,119 +1392,138 @@ class SnmpConsole extends HTML
* Show more information
*/
function toggleVisibleExtendedInfo(id, position) {
$('tr[id^=show_]').remove()
$.ajax({
method: 'get',
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
data: {
page: 'operation/snmpconsole/snmp_view',
method: 'showInfo',
id: id,
group_by : $('#filter_group_by').val(),
alert: $('#filter_alert').val(),
severity: $('#filter_severity').val(),
search: $('#text-filter_free_search').val(),
status: $('#filter_status').val(),
hours_ago: $('#text-filter_hours_ago').val(),
trap_type: $('#filter_trap_type').val()
},
datatype: "json",
success: function(data) {
let trap = JSON.parse(data);
var tr = $('#snmp_console tr').eq(position+1);
// Count.
if ($('#filter_group_by').val() == 1) {
let labelCount = '<td align="left" valign="top"><b><?php echo __('Count:'); ?></b></br><b><?php echo __('First trap:'); ?></b></br><b><?php echo __('Last trap:'); ?></td>';
let variableCount = `<td align="left" valign="top" style="line-height: 16pt">${trap['count']}</br>${trap['first']}</br>${trap['last']}</td>`;
tr.after(`<tr id="show_" role="row">${labelCount}${variableCount}</tr>`);
}
// Type.
desc_trap_type = "<?php echo __('Other'); ?>";
switch (trap['type']) {
case -1:
desc_trap_type = "<?php echo __('None'); ?>";
break;
case 0:
desc_trap_type = "<?php echo __('Cold start (0)'); ?>";
break;
case 1:
desc_trap_type = "<?php echo __('Warm start (1)'); ?>";
break;
case 2:
desc_trap_type = "<?php echo __('Link down (2)'); ?>";
break;
case 3:
desc_trap_type = "<?php echo __('Link up (3)'); ?>";
break;
case 4:
desc_trap_type = "<?php echo __('Authentication failure (4)'); ?>";
break;
default:
desc_trap_type = "<?php echo __('Other'); ?>";
break;
}
let labelType = '<td align="left" valign="top"><b><?php echo __('Type:'); ?></td>';
let variableType = `<td align="left">${desc_trap_type}</td>`;
tr.after(`<tr id="show_" role="row">${labelType}${variableType}</tr>`);
// Description.
if (trap['description']) {
let labelDesc = '<td align="left" valign="top"><b><?php echo __('Description:'); ?></td>';
let variableDesc = `<td align="left">${trap['description']}</td>`;
tr.after(`<tr id="show_" role="row">${labelDesc}${variableDesc}</tr>`);
}
// Enterprise String.
let labelOid = '<td align="left" valign="top"><b><?php echo __('Enterprise String:'); ?></td>';
let variableOId = `<td align="left">${trap['oid']}</td>`;
tr.after(`<tr id="show_" role="row">${labelOid}${variableOId}</tr>`);
// Variable bindings.
let labelBindings = '';
let variableBindings = '';
if ($('#filter_group_by').val() == 1) {
labelBindings = '<td align="left" valign="top" width="15%"><b><?php echo __('Variable bindings:'); ?></b></td>';
let new_url = 'index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view';
new_url += '&filter_severity='+$('#filter_severity').val();
new_url += '&filter_status='+$('#filter_status').val();
new_url += '&filter_alert='+$('#filter_alert').val();
new_url += '&filter_group_by=0&filter_free_search='+$('#text-filter_free_search').val();
new_url += '&filter_hours_ago='+$('#text-filter_hours_ago').val();
new_url += '&filter_trap_type='+$('#filter_trap_type').val();
const string = '<a href="'+new_url+'"><?php echo __('See more details'); ?></a>';
variableBindings = `<td align="left">${string}</td>`;
} else {
labelBindings = '<td align="left" valign="top" width="15%"><b><?php echo __('Variable bindings:'); ?></b></td>';
const binding_vars = trap['oid_custom'].split("\t");
let string = '';
binding_vars.forEach(function(oid) {
string += oid+'<br/>';
});
variableBindings = `<td align="left">${string}</td>`;
}
tr.after(`<tr id="show_" role="row">${labelBindings}${variableBindings}</tr>`);
},
error: function(e) {
console.error(e);
}
// 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()
$.ajax({
method: 'get',
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
data: {
page: 'operation/snmpconsole/snmp_view',
method: 'showInfo',
id: id,
group_by : $('#filter_group_by').val(),
alert: $('#filter_alert').val(),
severity: $('#filter_severity').val(),
search: $('#text-filter_free_search').val(),
status: $('#filter_status').val(),
hours_ago: $('#text-filter_hours_ago').val(),
trap_type: $('#filter_trap_type').val()
},
datatype: "json",
success: function(data) {
let trap = JSON.parse(data);
var tr = $('#snmp_console tr').eq(position+1);
// Count.
if ($('#filter_group_by').val() == 1) {
let labelCount = '<td align="left" valign="top"><b><?php echo __('Count:'); ?></b></br><b><?php echo __('First trap:'); ?></b></br><b><?php echo __('Last trap:'); ?></td>';
let variableCount = `<td align="left" valign="top" style="line-height: 16pt">${trap['count']}</br>${trap['first']}</br>${trap['last']}</td>`;
tr.after(`<tr id="show_" role="row">${labelCount}${variableCount}</tr>`);
}
// Type.
desc_trap_type = "<?php echo __('Other'); ?>";
switch (trap['type']) {
case -1:
desc_trap_type = "<?php echo __('None'); ?>";
break;
case 0:
desc_trap_type = "<?php echo __('Cold start (0)'); ?>";
break;
case 1:
desc_trap_type = "<?php echo __('Warm start (1)'); ?>";
break;
case 2:
desc_trap_type = "<?php echo __('Link down (2)'); ?>";
break;
case 3:
desc_trap_type = "<?php echo __('Link up (3)'); ?>";
break;
case 4:
desc_trap_type = "<?php echo __('Authentication failure (4)'); ?>";
break;
default:
desc_trap_type = "<?php echo __('Other'); ?>";
break;
}
let labelType = '<td align="left" valign="top"><b><?php echo __('Type:'); ?></td>';
let variableType = `<td align="left" colspan="8">${desc_trap_type}</td>`;
tr.after(`<tr id="show_" role="row">${labelType}${variableType}</tr>`);
// Description.
if (trap['description']) {
let labelDesc = '<td align="left" valign="top"><b><?php echo __('Description:'); ?></td>';
let variableDesc = `<td align="left" colspan="8">${trap['description']}</td>`;
tr.after(`<tr id="show_" role="row">${labelDesc}${variableDesc}</tr>`);
}
// Enterprise String.
let labelOid = '<td align="left" valign="top"><b><?php echo __('Enterprise String:'); ?></td>';
let variableOId = `<td align="left" colspan="8">${trap['oid']}</td>`;
tr.after(`<tr id="show_" role="row">${labelOid}${variableOId}</tr>`);
// Variable bindings.
let labelBindings = '';
let variableBindings = '';
if ($('#filter_group_by').val() == 1) {
labelBindings = '<td align="left" valign="top" width="15%"><b><?php echo __('Variable bindings:'); ?></b></td>';
let new_url = 'index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view';
new_url += '&filter_severity='+$('#filter_severity').val();
new_url += '&filter_status='+$('#filter_status').val();
new_url += '&filter_alert='+$('#filter_alert').val();
new_url += '&filter_group_by=0&filter_free_search='+$('#text-filter_free_search').val();
new_url += '&filter_hours_ago='+$('#text-filter_hours_ago').val();
new_url += '&filter_trap_type='+$('#filter_trap_type').val();
const string = '<a href="'+new_url+'"><?php echo __('See more details'); ?></a>';
variableBindings = `<td align="left" colspan="8">${string}</td>`;
} else {
labelBindings = '<td align="left" valign="top" width="15%"><b><?php echo __('Variable bindings:'); ?></b></td>';
const binding_vars = trap['oid_custom'].split("\t");
let string = '';
binding_vars.forEach(function(oid) {
string += oid+'<br/>';
});
variableBindings = `<td align="left" colspan="8">${string}</td>`;
}
tr.after(`<tr id="show_" role="row">${labelBindings}${variableBindings}</tr>`);
},
error: function(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() {

View File

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

View File

@ -2624,9 +2624,10 @@ function reporting_agents_inventory($report, $content)
$custom_field_sql = '';
$search_sql = '';
$sql_order_by = 'ORDER BY tagente.id_agente ASC';
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) {
$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()));
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(
'SELECT DISTINCT(tagente.id_agente) AS id_agente,
tagente.id_os,
@ -2675,12 +2682,12 @@ function reporting_agents_inventory($report, $content)
LEFT JOIN tagente_modulo tam
ON tam.id_agente = tagente.id_agente
%s
WHERE (tagente.id_grupo IN (%s) OR tasg.id_group IN (%s))
%s',
WHERE (tagente.id_grupo IN (%s) OR tasg.id_group IN (%s))%s%s',
$custom_field_sql,
$user_groups_to_sql,
$user_groups_to_sql,
$search_sql
$search_sql,
$sql_order_by
);
if (is_metaconsole()) {
@ -2812,11 +2819,16 @@ function reporting_modules_inventory($report, $content)
$search_sql = '';
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) {
$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 = '';
@ -2826,25 +2838,80 @@ function reporting_modules_inventory($report, $content)
$user_groups = $user_groupsAR;
$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(
'SELECT tam.id_agente_modulo,
tam.nombre,
tam.descripcion,
'SELECT DISTINCT(tam.id_agente_modulo),
%s tam.id_agente_modulo,
tam.nombre,%s
tam.id_module_group,
ttm.id_tag,
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
INNER JOIN tagente ta
ON tam.id_agente = ta.id_agente
LEFT JOIN tagent_secondary_group tasg
ON ta.id_agente = tasg.id_agent
LEFT JOIN ttag_module ttm
ON ttm.id_agente_modulo = tam.id_agente_modulo
WHERE (ta.id_grupo IN (%s) OR tasg.id_group IN (%s)) %s',
$user_groups_to_sql,
$user_groups_to_sql,
$search_sql
ON ttm.id_agente_modulo = tam.id_agente_modulo%s
%s
%s',
$sql_alias,
$sql_description,
$sql_last_status,
$sql_last_status_join,
$sql_where,
$sql_order_by
);
if (is_metaconsole()) {
@ -2870,6 +2937,23 @@ function reporting_modules_inventory($report, $content)
$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;
if (is_metaconsole()) {
@ -2889,33 +2973,44 @@ function reporting_modules_inventory($report, $content)
$module_row_data = [];
$i = 0;
foreach ($return['data'] as $row) {
if (is_array($module_row_data[$row['id_agente_modulo']]) === false) {
$module_row_data[$row['id_agente_modulo']]['nombre'] = $row['nombre'];
$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 (array_key_exists('alias', $row) === true) {
$module_row_data[$i]['alias'] = $row['alias'];
}
if (in_array($row['id_tag'], $module_row_data[$row['id_agente_modulo']]['id_tag']) === false
&& $row['id_tag'] !== null
) {
$module_row_data[$row['id_agente_modulo']]['id_tag'][] = $row['id_tag'];
if (array_key_exists('nombre', $row) === true) {
$module_row_data[$i]['nombre'] = $row['nombre'];
}
if (in_array($row['group_id'], $module_row_data[$row['id_agente_modulo']]['group_id']) === false
&& $row['group_id'] !== null
) {
$module_row_data[$row['id_agente_modulo']]['group_id'][] = $row['group_id'];
if (array_key_exists('descripcion', $row) === true) {
$module_row_data[$i]['descripcion'] = $row['descripcion'];
}
if (in_array($row['sec_group_id'], $module_row_data[$row['id_agente_modulo']]['sec_group_id']) === false
&& $row['sec_group_id'] !== null
) {
$module_row_data[$row['id_agente_modulo']]['sec_group_id'][] = $row['sec_group_id'];
$module_row_data[$i]['id_module_group'] = $row['id_module_group'];
$module_row_data[$i]['id_tag'] = [];
$module_row_data[$i]['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;

View File

@ -1557,6 +1557,57 @@ function reporting_html_agents_inventory($table, $item, $pdf=0)
$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) {
switch ($field_key) {
case 'alias':
@ -1638,7 +1689,7 @@ function reporting_html_agents_inventory($table, $item, $pdf=0)
} 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);
} 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') {
$custom_fields_value = [];
@ -1654,7 +1705,7 @@ function reporting_html_agents_inventory($table, $item, $pdf=0)
if (is_array($data_field_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[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[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 = [];
$first_index = array_key_first($item['data']);
$table1->head[] = __('Name');
$table1->head[] = __('Description');
$table1->head[] = __('Module group');
$table1->head[] = __('Tags');
$table1->head[] = __('Agent group');
$table1->head[] = __('Agent secondary groups');
foreach ($item['data'][$first_index] as $field_key => $field_value) {
switch ($field_key) {
case 'alias':
$table1->head[] = __('Alias');
break;
case 'nombre':
$table1->head[] = __('Name');
break;
case 'descripcion':
$table1->head[] = __('Description');
break;
case 'id_module_group':
$table1->head[] = __('Module group');
break;
case 'id_tag':
$table1->head[] = __('Tags');
break;
case 'group_id':
$table1->head[] = __('Agent group');
break;
case 'sec_group_id':
$table1->head[] = __('Agent secondary groups');
break;
case 'last_status_change':
$table1->head[] = __('Last status change');
}
}
$table1->headstyle[0] = '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[4] = 'text-align: left';
$table1->headstyle[5] = 'text-align: left';
$table1->headstyle[6] = 'text-align: left';
$table1->headstyle[7] = 'text-align: left';
$table1->data = [];
foreach ($item['data'] as $module_id => $module_data) {
unset($module_data['server_id']);
$row = [];
$first_item = array_pop(array_reverse($module_data));
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;
} else if ($data_field_key === 'descripcion') {
$column_value = $data_field_value;
@ -1752,13 +1839,27 @@ function reporting_html_modules_inventory($table, $item, $pdf=0)
$column_value = $module_group_name;
} else if ($data_field_key === 'id_tag') {
$tags_names = array_map(
function ($tag_id) {
return db_get_value('name', 'ttag', 'id_tag', $tag_id);
},
$data_field_value
);
$column_value = implode('<br>', $tags_names);
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(
function ($tag_id) {
return db_get_value('name', 'ttag', 'id_tag', $tag_id);
},
$data_field_value
);
$column_value = implode('<br>', $tags_names);
}
} else if ($data_field_key === 'group_id') {
$column_value = groups_get_name($data_field_value[0]);
} 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);
} else if ($data_field_key === 'last_status_change') {
$column_value = $data_field_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 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)
{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -594,42 +594,43 @@ sub get_agent_status ($$$) {
# 2 -> AGENT_MODULE_STATUS_WARNING
# 0 -> AGENT_MODULE_STATUS_NORMAL
my $module_status = 3;
my $module_status = 4;
my $modules_async = 0;
foreach my $module (@modules) {
my $m_status = get_agentmodule_status($pa_config, $dbh,
$module->{'id_agente_modulo'});
#This is the order to check
# AGENT_MODULE_STATUS_CRITICAL_ALERT
# AGENT_MODULE_STATUS_CRITICAL_BAD
# AGENT_MODULE_STATUS_WARNING
# AGENT_MODULE_STATUS_UNKNOWN
# AGENT_MODULE_STATUS_NORMAL
if ($m_status == 4) {
$module_status = 4;
if ($m_status == MODULE_CRITICAL) {
$module_status = MODULE_CRITICAL;
}
elsif ($module_status != 4) {
if ($m_status == 1) {
$module_status = 1;
elsif ($module_status != MODULE_CRITICAL) {
if ($m_status == MODULE_WARNING) {
$module_status = MODULE_WARNING;
}
elsif ($module_status != 1) {
if ($m_status == 2) {
$module_status = 2;
elsif ($module_status != MODULE_WARNING) {
if ($m_status == MODULE_UNKNOWN) {
$module_status = MODULE_UNKNOWN;
}
elsif ($module_status != 2) {
if ($m_status == 3) {
$module_status = 3;
elsif ($module_status != MODULE_UNKNOWN) {
if ($m_status == MODULE_NORMAL) {
$module_status = MODULE_NORMAL;
}
elsif ($module_status != 3) {
if ($m_status == 0) {
$module_status = 0;
elsif ($module_status != MODULE_NORMAL) {
if($m_status == MODULE_NOTINIT) {
$module_status = MODULE_NOTINIT;
}
}
}
}
}
my $module_type = get_db_value($dbh, 'SELECT id_tipo_modulo
FROM tagente_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
my $pandora_version = "7.0NG.769";
my $pandora_build = "230308";
my $pandora_build = "230309";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

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

View File

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

View File

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

View File

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

View File

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