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

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

View File

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

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.738 %define version 7.0NG.738
%define release 190902 %define release 190904
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.738" PI_VERSION="7.0NG.738"
PI_BUILD="190902" PI_BUILD="190904"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{190902} {190904}
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.738(Build 190902)") #define PANDORA_VERSION ("7.0NG.738(Build 190904)")
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.738(Build 190902))" VALUE "ProductVersion", "(7.0NG.738(Build 190904))"
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.738-190902 Version: 7.0NG.738-190904
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.738-190902" pandora_version="7.0NG.738-190904"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

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

View File

@ -100,7 +100,15 @@ if ($update_filter > -2) {
'filter' => $filter, 'filter' => $filter,
'unified_filters_id' => $new_unified_id, '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); $result = db_process_sql_insert('tsnmp_filter', $values);
}
} else { } else {
for ($i = 0; $i < $index_post; $i++) { for ($i = 0; $i < $index_post; $i++) {
$filter = get_parameter('filter_'.$i); $filter = get_parameter('filter_'.$i);
@ -109,12 +117,28 @@ if ($update_filter > -2) {
'filter' => $filter, 'filter' => $filter,
'unified_filters_id' => $new_unified_id, 'unified_filters_id' => $new_unified_id,
]; ];
$result = db_process_sql_insert('tsnmp_filter', $values); 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) { 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 { } else {
ui_print_success_message(__('Successfully created')); ui_print_success_message(__('Successfully created'));
} }
@ -215,8 +239,10 @@ 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'); $result_unified = db_get_all_rows_sql('SELECT DISTINCT(unified_filters_id) FROM tsnmp_filter ORDER BY unified_filters_id ASC');
$aglomerate_result = []; $aglomerate_result = [];
foreach ($result_unified as $res) { if (is_array($result_unified) === true) {
$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'); 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 = new stdClass();
@ -282,7 +308,8 @@ if ($edit_filter > -2) {
?> ?>
<script type="text/javascript"> <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']; ?>"; var homeurl = "<?php echo $config['homeurl']; ?>";
$(document).ready (function () { $(document).ready (function () {

View File

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

View File

@ -30,19 +30,21 @@ if ($php_version_array[0] < 7) {
$tab = get_parameter('tab', 'online'); $tab = get_parameter('tab', 'online');
$buttons = [ $buttons['setup'] = [
'setup' => [ 'active' => ($tab == 'setup') ? true : false,
'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>',
'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, '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>', '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' => [ }
'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>', $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'); $id_action = (int) get_parameter('id_action');
$actions = alerts_get_alert_agent_module_actions($id_alert); $actions = alerts_get_alert_agent_module_actions($id_alert);
$action_opction = db_get_row( $action_option = db_get_row(
'talert_template_module_actions', 'talert_template_module_actions',
'id_alert_template_module', 'id',
$id_alert $id_action
); );
$data .= '<form id="update_action-'.$alert['id'].'" method="post">'; $data .= '<form id="update_action-'.$alert['id'].'" method="post">';
@ -242,7 +242,7 @@ if ($show_update_action_menu) {
$data .= '<td class="datos">'; $data .= '<td class="datos">';
$data .= html_print_input_text( $data .= html_print_input_text(
'fires_min_ajax', 'fires_min_ajax',
$action_opction['fires_min'], $action_option['fires_min'],
'', '',
4, 4,
10, 10,
@ -251,7 +251,7 @@ if ($show_update_action_menu) {
$data .= ' '.__('to').' '; $data .= ' '.__('to').' ';
$data .= html_print_input_text( $data .= html_print_input_text(
'fires_max_ajax', 'fires_max_ajax',
$action_opction['fires_max'], $action_option['fires_max'],
'', '',
4, 4,
10, 10,
@ -266,7 +266,7 @@ if ($show_update_action_menu) {
$data .= '<td class="datos2">'; $data .= '<td class="datos2">';
$data .= html_print_input_text( $data .= html_print_input_text(
'module_action_threshold_ajax', 'module_action_threshold_ajax',
$action_opction['module_action_threshold'], $action_option['module_action_threshold'],
'', '',
4, 4,
10, 10,

View File

@ -1151,7 +1151,12 @@ if (check_login()) {
} }
$server_name = ''; $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) { if ($module['estado'] == 3) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -45,7 +45,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.738"; my $pandora_version = "7.0NG.738";
my $pandora_build = "190902"; my $pandora_build = "190904";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

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

View File

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

View File

@ -32,7 +32,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.738"; my $pandora_version = "7.0NG.738";
my $pandora_build = "190902"; my $pandora_build = "190904";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] ); our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

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

View File

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

View File

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

View File

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