Merge branch 'develop' into ent-11579-vista-de-inventario-no-muestra-nada-filtrando-por-un-modulo-p-e-software

This commit is contained in:
miguel angel rasteu 2023-06-20 09:13:55 +02:00
commit 841d724276
42 changed files with 142 additions and 49 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.771-230615
Version: 7.0NG.771-230620
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.771-230615"
pandora_version="7.0NG.771-230620"
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.771';
use constant AGENT_BUILD => '230615';
use constant AGENT_BUILD => '230620';
# 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.771
%define release 230615
%define release 230620
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.771
%define release 230615
%define release 230620
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.771"
PI_BUILD="230615"
PI_BUILD="230620"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{230615}
{230620}
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.771 Build 230615")
#define PANDORA_VERSION ("7.0NG.771 Build 230620")
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.771(Build 230615))"
VALUE "ProductVersion", "(7.0NG.771(Build 230620))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.771-230615
Version: 7.0NG.771-230620
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.771-230615"
pandora_version="7.0NG.771-230620"
package_pear=0
package_pandora=1

View File

@ -31,7 +31,7 @@ check_login();
global $config;
if (users_is_admin() === false) {
if (check_acl($config['id_user'], 0, 'UM') !== 1) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access massive edit users'

View File

@ -70,16 +70,13 @@ $options_agents = [
];
if (check_acl($config['id_user'], 0, 'UM')) {
$options_users['edit_users'] = __('Edit users in bulk');
if (is_metaconsole() === false) {
$options_users = [
'add_profiles' => __('Bulk profile add'),
'delete_profiles' => __('Bulk profile delete'),
];
}
if (users_is_admin() === true) {
$options_users['edit_users'] = __('Edit users in bulk');
}
} else {
$options_users = [];
}

View File

@ -6776,6 +6776,8 @@ function chooseType() {
$("#row_dyn_height").show();
$("#row_servers").show();
$("#row_historical_db_check").show();
$("#sql_example").hide();
$("#sql_entry").show();
break;
case 'url':

View File

@ -2198,10 +2198,6 @@ switch ($action) {
);
if ($values['treport_custom_sql_id'] == 0) {
$sql = get_parameter('sql', '');
if ($sql !== '') {
$good_format = db_validate_sql($sql);
}
$values['external_source'] = $sql;
}
@ -2218,6 +2214,28 @@ switch ($action) {
} else {
$values['server_name'] = get_parameter('combo_server');
}
if ($sql !== '') {
if ($values['server_name'] === 'all') {
$servers_connection = metaconsole_get_connections();
foreach ($servers_connection as $key => $s) {
$good_format = db_validate_sql($sql, $s['server_name']);
}
// Reconnected in nodo if exist.
if ($server_id !== 0) {
$connection = metaconsole_get_connection_by_id(
$server_id
);
metaconsole_connect($connection);
}
} else if ($server_id === 0) {
// Connect with node if not exist conexion.
$good_format = db_validate_sql($sql, (is_metaconsole() === true) ? $values['server_name'] : false);
} else {
$good_format = db_validate_sql($sql);
}
}
} else if ($values['type'] == 'url') {
$values['external_source'] = get_parameter('url');
} else if ($values['type'] == 'event_report_group') {
@ -2965,7 +2983,25 @@ switch ($action) {
}
if ($sql !== '') {
$good_format = db_validate_sql($sql, (is_metaconsole() === true) ? $values['server_name'] : false);
if ($values['server_name'] === 'all') {
$servers_connection = metaconsole_get_connections();
foreach ($servers_connection as $key => $s) {
$good_format = db_validate_sql($sql, $s['server_name']);
}
// Reconnected in nodo if exist.
if ($server_id !== 0) {
$connection = metaconsole_get_connection_by_id(
$server_id
);
metaconsole_connect($connection);
}
} else if ($server_id === 0) {
// Connect with node if not exist conexion.
$good_format = db_validate_sql($sql, (is_metaconsole() === true) ? $values['server_name'] : false);
} else {
$good_format = db_validate_sql($sql);
}
}
} else if ($values['type'] == 'url') {
$values['external_source'] = get_parameter('url');

View File

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

View File

@ -4253,7 +4253,9 @@ function reporting_group_report($report, $content)
$data_node = reporting_groups_nodes($content);
$count_events += $data_node['count_events'];
foreach ($data_node['group_stats'] as $key => $value) {
$group_stats[$key] += $value;
if (array_key_exists($key, $group_stats)) {
$group_stats[$key] += $value;
}
}
if (is_metaconsole() === true) {

View File

@ -654,6 +654,18 @@ function snmp_browser_print_oid(
);
}
if (isset($_POST['print_copy_oid'])) {
// Hidden by default.
$output .= html_print_button(
__('Use this OID'),
'use_iod',
false,
'use_oid()',
'class="sub add invisible"',
true
);
}
// Select agent modal.
$output .= snmp_browser_print_create_modules(true);
@ -1134,6 +1146,14 @@ function snmp_browser_print_container(
false,
'id_agent_module'
);
$output .= html_print_input_hidden(
'is_policy_agent',
1,
true,
false,
false,
'is_policy_agent'
);
$output .= html_print_table($table, true);
$output .= html_print_div(
[

View File

@ -7,6 +7,10 @@ function snmpBrowse() {
// Hide the data div
hideOIDData();
$("#button-srcbutton")
.find("div")
.addClass("rotation");
// Reset previous searches
$("#search_results").css("display", "none");
$("#hidden-search_count").val(-1);
@ -258,7 +262,7 @@ function snmpGet(oid) {
var ajax_url = $("#hidden-ajax_url").val();
var server_to_exec = $("#server_to_exec").val();
var target_port = $("#target_port").val();
var print_create_agent_module = true;
var is_policy_or_agent = $("#is_policy_agent").val();
// Check for a custom action
var custom_action = $("#hidden-custom_action").val();
@ -283,7 +287,11 @@ function snmpGet(oid) {
params["custom_action"] = custom_action;
params["page"] = "include/ajax/snmp_browser.ajax";
params["target_port"] = target_port;
params["print_create_agent_module"] = print_create_agent_module;
if (typeof is_policy_or_agent !== "undefined") {
params["print_copy_oid"] = 1;
} else {
params["print_create_agent_module"] = 1;
}
// SNMP get!
jQuery.ajax({

View File

@ -143,6 +143,9 @@ class BlockHistogram extends Widget
$widgetId
);
// Include.
include_once $config['homedir'].'/include/functions_reporting.php';
// Width.
$this->width = $width;

View File

@ -170,6 +170,9 @@ class GroupedMeterGraphs extends Widget
$widgetId
);
// Include.
include_once $config['homedir'].'/include/functions_reporting.php';
// Width.
$this->width = $width;

View File

@ -351,7 +351,7 @@ class GraphModuleHistogramWidget extends Widget
'agent_id' => $values['agentId'],
'metaconsole_id' => $values['metaconsoleId'],
'style' => 'width: inherit;',
'filter_modules' => (users_access_to_agent($values['agentId']) === false) ? [$values['moduleId']] : [],
'filter_modules' => (users_access_to_agent($values['agentId'], 'AR', false, is_metaconsole()) === false) ? [$values['moduleId']] : [],
'nothing' => __('None'),
'nothing_value' => 0,
],

View File

@ -133,6 +133,7 @@ class OsQuickReportWidget extends Widget
// Includes.
enterprise_include_once('/include/functions_services.php');
enterprise_include_once('/include/functions_servicemap.php');
include_once $config['homedir'].'/include/functions_os.php';
// WARNING: Do not edit. This chunk must be in the constructor.
parent::__construct(

View File

@ -1865,6 +1865,10 @@ class Item extends CachedModel
$save = array_merge($dataModelEncode, $dataEncode);
if (!empty($save['label'])) {
$save['label'] = io_safe_output(io_safe_input(str_replace("'", "\'", $save['label'])));
}
$result = \db_process_sql_update(
'tlayout_data',
$save,

View File

@ -90,11 +90,11 @@ final class Label extends Item
// Default values.
if (isset($values['width']) === false) {
$values['width'] = 10;
$values['width'] = 50;
}
if (isset($values['height']) === false) {
$values['height'] = 10;
$values['height'] = 50;
}
return $values;

View File

@ -12240,3 +12240,8 @@ div.parent_graph > p.legend_background > table > tbody > tr {
.toggle-traffic-graph {
margin: 0px !important;
}
div#visual-console-container * {
font-size: unset;
line-height: unset;
}

View File

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

View File

@ -73,7 +73,8 @@ if ($config['pure']) {
}
// Control from managent polices.
if ($_POST['type'] !== 'networkserver') {
$type = get_parameter('type', false);
if (empty($type) === false && $type !== 'networkserver') {
// Header.
ui_print_standard_header(
__('SNMP Browser'),
@ -745,9 +746,20 @@ function show_add_module() {
});
}
}
],
],
});
}
}
function use_oid() {
$("#text-snmp_oid").val($("#hidden-snmp_oid").val());
$("#snmp_data").empty();
$("#snmp_data").css("display", "none");
$(".forced_title_layer").css("display", "none");
$("#snmp_browser_container").dialog("close");
}
</script>

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.771
%define release 230615
%define release 230620
# 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.771
%define release 230615
%define release 230620
# 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.771
%define release 230615
%define release 230620
%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.771-230615
Version: 7.0NG.771-230620
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.771-230615"
pandora_version="7.0NG.771-230620"
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.771";
my $pandora_build = "230615";
my $pandora_build = "230620";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -1025,7 +1025,6 @@ sub pandora_execute_alert {
# Check the action threshold (template_action_threshold takes precedence over action_threshold)
my $threshold = 0;
my $recovered = 0;
$action->{'last_execution'} = 0 unless defined ($action->{'last_execution'});
$action->{'recovered'} = 0 unless defined ($action->{'recovered'});
@ -1047,11 +1046,11 @@ sub pandora_execute_alert {
if($alert_mode == RECOVERED_ALERT) {
# Reset action thresholds and set recovered
if (defined ($alert->{'id_template_module'})) {
db_do($dbh, 'UPDATE talert_template_module_actions SET recovered = 1 WHERE id_alert_template_module = ?', $alert->{'id_template_module'});
db_do($dbh, 'UPDATE talert_template_module_actions SET recovered = 1 WHERE id = ?', $action->{'id_alert_templ_module_actions'});
}
} else {
# Action executed again, set recovered to 0.
db_do($dbh, 'UPDATE talert_template_module_actions SET recovered = 0 WHERE id_alert_template_module = ?', $alert->{'id_template_module'});
db_do($dbh, 'UPDATE talert_template_module_actions SET recovered = 0 WHERE id = ?', $action->{'id_alert_templ_module_actions'});
}
} else {
if($alert_mode == RECOVERED_ALERT) {
@ -1970,7 +1969,7 @@ sub pandora_execute_action ($$$$$$$$$;$$) {
}
# Update action last execution date
if (defined ($action->{'last_execution'}) && defined ($action->{'id_alert_templ_module_actions'})) {
if ($alert_mode != RECOVERED_ALERT && defined ($action->{'last_execution'}) && defined ($action->{'id_alert_templ_module_actions'})) {
db_do ($dbh, 'UPDATE talert_template_module_actions SET last_execution = ?
WHERE id = ?', int(time ()), $action->{'id_alert_templ_module_actions'});
}
@ -3701,6 +3700,7 @@ sub pandora_create_module_from_hash ($$$) {
delete $parameters->{'query_key_field'};
delete $parameters->{'name_oid'};
delete $parameters->{'module_type'};
delete $parameters->{'target_ip'};
if (defined $parameters->{'id_os'}) {
delete $parameters->{'id_os'};

View File

@ -432,7 +432,7 @@ sub PandoraFMS::Recon::Base::guess_os($$;$) {
my $return = `"$self->{pa_config}->{nmap}" -sSU -T5 -F -O --osscan-limit $device 2>$DEVNULL`;
return OS_OTHER if ($? != 0);
my $str_os;
if ($return =~ /Aggressive OS guesses:(.*?)(?>\(\d+%\),)|^OS details:(.*?)\(.*\)*$/mi) {
if ($return =~ /Aggressive OS guesses:(.*?)(?>\(\d+%\),)|^OS details:(.*?)$/mi) {
if(defined($1) && $1 ne "") {
$str_os = $1;
} else {

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.771";
my $pandora_build = "230615";
my $pandora_build = "230620";
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.771
%define release 230615
%define release 230620
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.771
%define release 230615
%define release 230620
Summary: Pandora FMS Server
Name: %{name}

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.771"
PI_BUILD="230615"
PI_BUILD="230620"
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.771 Build 230615";
my $version = "7.0NG.771 Build 230620";
# 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.771 Build 230615";
my $version = "7.0NG.771 Build 230620";
# save program name for logging
my $progname = basename($0);