Merge remote-tracking branch 'origin/develop' into ent-4190-mejoras-para-el-menu-de-gestionar-ha

This commit is contained in:
fbsanchez 2019-09-04 12:07:56 +02:00
commit d0e6f0dbae
35 changed files with 152 additions and 75 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.738-190902
Version: 7.0NG.738-190904
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.738-190902"
pandora_version="7.0NG.738-190904"
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

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

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.738
%define release 190902
%define release 190904
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.738
%define release 190902
%define release 190904
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.738"
PI_BUILD="190902"
PI_BUILD="190904"
OS_NAME=`uname -s`
FORCE=0

View File

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

View File

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

View File

@ -1559,8 +1559,14 @@ if ($update_module) {
foreach ($plugin_parameter_split as $key => $value) {
if ($key == 1) {
if ($http_user) {
$values['plugin_parameter'] .= 'http_auth_user '.$http_user.'
';
}
if ($http_pass) {
$values['plugin_parameter'] .= 'http_auth_pass '.$http_pass.'
';
}
$values['plugin_parameter'] .= $value.'
';
} else {
$values['plugin_parameter'] .= $value.'
';
@ -1757,8 +1763,14 @@ if ($create_module) {
foreach ($plugin_parameter_split as $key => $value) {
if ($key == 1) {
if ($http_user) {
$values['plugin_parameter'] .= 'http_auth_user '.$http_user.'
';
}
if ($http_pass) {
$values['plugin_parameter'] .= 'http_auth_pass '.$http_pass.'
';
}
$values['plugin_parameter'] .= $value.'
';
} else {
$values['plugin_parameter'] .= $value.'
';

View File

@ -100,7 +100,15 @@ if ($update_filter > -2) {
'filter' => $filter,
'unified_filters_id' => $new_unified_id,
];
if ($values['description'] == '') {
$result = false;
$msg = __('Description is empty');
} else if ($values['filter'] == '') {
$result = false;
$msg = __('Filter is empty');
} else {
$result = db_process_sql_insert('tsnmp_filter', $values);
}
} else {
for ($i = 0; $i < $index_post; $i++) {
$filter = get_parameter('filter_'.$i);
@ -109,12 +117,28 @@ if ($update_filter > -2) {
'filter' => $filter,
'unified_filters_id' => $new_unified_id,
];
if ($values['filter'] != '' && $values['description'] != '') {
$result = db_process_sql_insert('tsnmp_filter', $values);
}
}
if ($result === null) {
if ($values['description'] != '') {
$result = false;
$msg = __('Filters are empty');
} else {
$result = false;
$msg = __('Description is empty');
}
}
}
if ($result === false) {
ui_print_error_message(__('There was a problem creating the filter'));
if (!isset($msg)) {
$msg = __('There was a problem creating the filter');
}
ui_print_error_message($msg);
} else {
ui_print_success_message(__('Successfully created'));
}
@ -215,9 +239,11 @@ if ($edit_filter > -2) {
$result_unified = db_get_all_rows_sql('SELECT DISTINCT(unified_filters_id) FROM tsnmp_filter ORDER BY unified_filters_id ASC');
$aglomerate_result = [];
if (is_array($result_unified) === true) {
foreach ($result_unified as $res) {
$aglomerate_result[$res['unified_filters_id']] = db_get_all_rows_sql('SELECT * FROM tsnmp_filter WHERE unified_filters_id = '.$res['unified_filters_id'].' ORDER BY id_snmp_filter ASC');
}
}
$table = new stdClass();
$table->data = [];
@ -282,7 +308,8 @@ if ($edit_filter > -2) {
?>
<script type="text/javascript">
var id = "<?php echo $index; ?>";
// +1 because there is already a defined 'filter' field.
var id = parseInt("<?php echo $index; ?>")+1;
var homeurl = "<?php echo $config['homeurl']; ?>";
$(document).ready (function () {

View File

@ -31,6 +31,11 @@ global $config;
check_login();
if (!enterprise_installed()) {
include 'general/noaccess.php';
exit;
}
if (! check_acl($config['id_user'], 0, 'PM')
&& ! is_user_admin($config['id_user'])
) {

View File

@ -30,19 +30,21 @@ if ($php_version_array[0] < 7) {
$tab = get_parameter('tab', 'online');
$buttons = [
'setup' => [
$buttons['setup'] = [
'active' => ($tab == 'setup') ? true : false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=setup">'.html_print_image('images/gm_setup.png', true, ['title' => __('Options')]).'</a>',
],
'offline' => [
];
if (enterprise_installed()) {
$buttons['offline'] = [
'active' => ($tab == 'offline') ? true : false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=offline">'.html_print_image('images/box.png', true, ['title' => __('Offline update manager')]).'</a>',
],
'online' => [
];
}
$buttons['online'] = [
'active' => ($tab == 'online') ? true : false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online">'.html_print_image('images/op_gis.png', true, ['title' => __('Online update manager')]).'</a>',
],
];

View File

@ -159,10 +159,10 @@ if ($show_update_action_menu) {
$id_action = (int) get_parameter('id_action');
$actions = alerts_get_alert_agent_module_actions($id_alert);
$action_opction = db_get_row(
$action_option = db_get_row(
'talert_template_module_actions',
'id_alert_template_module',
$id_alert
'id',
$id_action
);
$data .= '<form id="update_action-'.$alert['id'].'" method="post">';
@ -242,7 +242,7 @@ if ($show_update_action_menu) {
$data .= '<td class="datos">';
$data .= html_print_input_text(
'fires_min_ajax',
$action_opction['fires_min'],
$action_option['fires_min'],
'',
4,
10,
@ -251,7 +251,7 @@ if ($show_update_action_menu) {
$data .= ' '.__('to').' ';
$data .= html_print_input_text(
'fires_max_ajax',
$action_opction['fires_max'],
$action_option['fires_max'],
'',
4,
10,
@ -266,7 +266,7 @@ if ($show_update_action_menu) {
$data .= '<td class="datos2">';
$data .= html_print_input_text(
'module_action_threshold_ajax',
$action_opction['module_action_threshold'],
$action_option['module_action_threshold'],
'',
4,
10,

View File

@ -1151,7 +1151,12 @@ if (check_login()) {
}
$server_name = '';
$data[8] .= "<a href='javascript: ".'show_module_detail_dialog('.$module['id_agente_modulo'].', '.$id_agente.', "'.$server_name.'", '.(0).', '.SECONDS_1DAY.', " '.modules_get_agentmodule_name($module['id_agente_modulo'])."\")'>".html_print_image('images/binary.png', true, ['border' => '0', 'alt' => '']).'</a>';
$modules_get_agentmodule_name = modules_get_agentmodule_name($module['id_agente_modulo']);
// Escape the double quotes that may have the name of the module.
$modules_get_agentmodule_name = str_replace('&quot;', '\"', $modules_get_agentmodule_name);
$data[8] .= "<a href='javascript: ".'show_module_detail_dialog('.$module['id_agente_modulo'].', '.$id_agente.', "'.$server_name.'", '.(0).', '.SECONDS_1DAY.', " '.$modules_get_agentmodule_name."\")'>".html_print_image('images/binary.png', true, ['border' => '0', 'alt' => '']).'</a>';
}
if ($module['estado'] == 3) {

View File

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

View File

@ -3100,7 +3100,7 @@ function reporting_historical_data($report, $content)
$return['type'] = 'historical_data';
$period = $content['period'];
$date_limit = (time() - $period);
$date_limit = ($report['datetime'] - $period);
if (empty($content['name'])) {
$content['name'] = __('Historical data');
}
@ -3169,7 +3169,7 @@ function reporting_historical_data($report, $content)
FROM tagente_datos_string
WHERE id_agente_modulo ='.$content['id_agent_module'].'
AND utimestamp >'.$date_limit.'
AND utimestamp <='.time(),
AND utimestamp <='.$report['datetime'],
true
);
break;
@ -3180,7 +3180,7 @@ function reporting_historical_data($report, $content)
FROM tagente_datos
WHERE id_agente_modulo ='.$content['id_agent_module'].'
AND utimestamp >'.$date_limit.'
AND utimestamp <='.time(),
AND utimestamp <='.$report['datetime'],
true
);
break;

View File

@ -129,7 +129,7 @@
<div style='height: 10px'>
<?php
$version = '7.0NG.738';
$build = '190902';
$build = '190904';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -244,6 +244,7 @@ $htmlForm = '<form method="post" action="index.php?sec=estado&sec2=operation/age
$htmlForm .= html_print_table($table, true);
$htmlForm .= html_print_input_hidden('filter', 1, true);
$htmlForm .= '<div class="action-buttons" style="width: '.$table->width.'">';
if (check_acl($config['id_user'], 0, 'RW') || check_acl($config['id_user'], 0, 'RM')) {
$htmlForm .= html_print_button(
__('Save as custom graph'),
'save_custom_graph',
@ -251,7 +252,10 @@ $htmlForm .= html_print_button(
'',
'class="sub add" style=""',
true
).'&nbsp;&nbsp;'.html_print_submit_button(__('Filter'), 'filter_button', false, 'class="sub upd" style=""', true);
);
}
$htmlForm .= '&nbsp;&nbsp;'.html_print_submit_button(__('Filter'), 'filter_button', false, 'class="sub upd" style=""', true);
$htmlForm .= '</div>';
$htmlForm .= '</form>';

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.738
%define release 190902
%define release 190904
# 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.738
%define release 190902
%define release 190904
# 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.738
%define release 190902
%define release 190904
%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.738-190902
Version: 7.0NG.738-190904
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.738-190902"
pandora_version="7.0NG.738-190904"
package_cpan=0
package_pandora=1

View File

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

View File

@ -1205,13 +1205,13 @@ sub pandora_execute_action ($$$$$$$$$;$) {
# Address
$field1 = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module);
$field1 = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module, $alert);
# Subject
$field2 = subst_alert_macros ($field2, \%macros, $pa_config, $dbh, $agent, $module);
$field2 = subst_alert_macros ($field2, \%macros, $pa_config, $dbh, $agent, $module, $alert);
# Message
$field3 = subst_alert_macros ($field3, \%macros, $pa_config, $dbh, $agent, $module);
$field3 = subst_alert_macros ($field3, \%macros, $pa_config, $dbh, $agent, $module, $alert);
# Content
$field4 = subst_alert_macros ($field4, \%macros, $pa_config, $dbh, $agent, $module);
$field4 = subst_alert_macros ($field4, \%macros, $pa_config, $dbh, $agent, $module, $alert);
if($field4 eq ""){
$field4 = "text/html";
@ -3943,8 +3943,8 @@ sub pandora_evaluate_snmp_alerts ($$$$$$$$$) {
##########################################################################
# Search string for macros and substitutes them with their values.
##########################################################################
sub subst_alert_macros ($$;$$$$) {
my ($string, $macros, $pa_config, $dbh, $agent, $module) = @_;
sub subst_alert_macros ($$;$$$$$) {
my ($string, $macros, $pa_config, $dbh, $agent, $module, $alert) = @_;
my $macro_regexp = join('|', keys %{$macros});
@ -3952,14 +3952,14 @@ sub subst_alert_macros ($$;$$$$) {
if (defined($string) && $string =~ m/^(?:(")(?:.*)"|(')(?:.*)')$/) {
my $quote = $1 ? $1 : $2;
$subst_func = sub {
my $macro = on_demand_macro($pa_config, $dbh, shift, $macros, $agent, $module);
my $macro = on_demand_macro($pa_config, $dbh, shift, $macros, $agent, $module,$alert);
$macro =~ s/'/'\\''/g; # close, escape, open
return decode_entities($quote . "'" . $macro . "'" . $quote); # close, quote, open
};
}
else {
$subst_func = sub {
my $macro = on_demand_macro($pa_config, $dbh, shift, $macros, $agent, $module);
my $macro = on_demand_macro($pa_config, $dbh, shift, $macros, $agent, $module, $alert);
return decode_entities($macro);
};
}
@ -3993,8 +3993,8 @@ sub subst_column_macros ($$;$$$$) {
##########################################################################
# Load macros that access the database on demand.
##########################################################################
sub on_demand_macro($$$$$$) {
my ($pa_config, $dbh, $macro, $macros, $agent, $module) = @_;
sub on_demand_macro($$$$$$;$) {
my ($pa_config, $dbh, $macro, $macros, $agent, $module,$alert) = @_;
# Static macro.
return $macros->{$macro} if (defined($macros->{$macro}));
@ -4010,7 +4010,7 @@ sub on_demand_macro($$$$$$) {
} elsif ($macro eq '_moduletags_') {
return (defined ($module)) ? pandora_get_module_url_tags ($pa_config, $dbh, $module->{'id_agente_modulo'}) : '';
} elsif ($macro eq '_policy_') {
return (defined ($module)) ? enterprise_hook('get_policy_name', [$dbh, $module->{'id_policy_module'}]) : '';
return (defined ($alert)) ? enterprise_hook('get_policy_name_policy_alerts_id', [$dbh, $alert->{'id_policy_alerts'}]) : '';
} elsif ($macro eq '_email_tag_') {
return (defined ($module)) ? pandora_get_module_email_tags ($pa_config, $dbh, $module->{'id_agente_modulo'}) : '';
} elsif ($macro eq '_phone_tag_') {

View File

@ -58,6 +58,7 @@ my %Agents :shared;
my $Sem :shared;
my $TaskSem :shared;
my $AgentSem :shared;
my $XMLinSem :shared;
########################################################################################
# Data Server class constructor.
@ -74,6 +75,7 @@ sub new ($$;$) {
$Sem = Thread::Semaphore->new;
$TaskSem = Thread::Semaphore->new (0);
$AgentSem = Thread::Semaphore->new (1);
$XMLinSem = Thread::Semaphore->new (1);
# Call the constructor of the parent class
my $self = $class->SUPER::new($config, DATASERVER, \&PandoraFMS::DataServer::data_producer, \&PandoraFMS::DataServer::data_consumer, $dbh);
@ -175,6 +177,7 @@ sub data_consumer ($$) {
my $agent_name = $1;
my $file_name = $pa_config->{'incomingdir'};
my $xml_err;
my $error;
# Fix path
$file_name .= "/" unless (substr ($file_name, -1, 1) eq '/');
@ -191,18 +194,37 @@ sub data_consumer ($$) {
for (0..1) {
eval {
local $SIG{__DIE__};
threads->yield;
# XML::SAX::ExpatXS is not thread safe.
if ($XML::Simple::PREFERRED_PARSER eq 'XML::SAX::ExpatXS') {
$XMLinSem->down();
}
$xml_data = XMLin ($file_name, forcearray => 'module');
if ($XML::Simple::PREFERRED_PARSER eq 'XML::SAX::ExpatXS') {
$XMLinSem->up();
}
};
# Invalid XML
if ($@ || ref($xml_data) ne 'HASH') {
if ($@) {
$error = 1;
if ($XML::Simple::PREFERRED_PARSER eq 'XML::SAX::ExpatXS') {
$XMLinSem->up();
}
}
if ($error || ref($xml_data) ne 'HASH') {
if ($@) {
$xml_err = $@;
} else {
$xml_err = "Invalid XML format.";
}
logger($pa_config, "Failed to parse $file_name $xml_err", 3);
sleep (2);
next;
}

View File

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

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.738
%define release 190902
%define release 190904
Summary: Pandora FMS Server
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.738
%define release 190902
%define release 190904
Summary: Pandora FMS Server
Name: %{name}

View File

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

View File

@ -34,7 +34,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.738 PS190902";
my $version = "7.0NG.738 PS190904";
# 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.738 PS190902";
my $version = "7.0NG.738 PS190904";
# save program name for logging
my $progname = basename($0);