Merge remote-tracking branch 'origin/develop' into ent-7074-Command-Center

This commit is contained in:
Daniel Barbero Martin 2021-03-11 09:00:36 +01:00
commit e1151b1830
36 changed files with 197 additions and 52 deletions

View File

@ -71,7 +71,7 @@ check_pre_pandora () {
check_repo_connection () { check_repo_connection () {
execute_cmd "ping -c 2 8.8.8.8" "Checking internet connection" execute_cmd "ping -c 2 8.8.8.8" "Checking internet connection"
execute_cmd "ping -c 2 firefly.artica.es" "Checking Community repo" execute_cmd "ping -c 2 firefly.artica.es" "Checking Community repo"
execute_cmd "ping -c 2 support.artica.es" "Checking Enterprise repo" execute_cmd "ping -c 2 support.pandorafms.com" "Checking Enterprise repo"
} }
check_root_permissions () { check_root_permissions () {

View File

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

@ -1016,7 +1016,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.752'; use constant AGENT_VERSION => '7.0NG.752';
use constant AGENT_BUILD => '210310'; use constant AGENT_BUILD => '210311';
# 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.752 %define version 7.0NG.752
%define release 210310 %define release 210311
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.752 %define version 7.0NG.752
%define release 210310 %define release 210311
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.752" PI_VERSION="7.0NG.752"
PI_BUILD="210310" PI_BUILD="210311"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

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

View File

@ -146,8 +146,8 @@ if (isset($config['custom_support_url'])) {
echo '<li>'.__('Support').'</li>'; echo '<li>'.__('Support').'</li>';
} }
} else if (!$custom_conf_enabled) { } else if (!$custom_conf_enabled) {
echo '<li id="li_margin_left"><a href="https://support.artica.es" target="_blank"><img src="'.$support_logo.'" alt="support"></a></li>'; echo '<li id="li_margin_left"><a href="https://support.pandorafms.com" target="_blank"><img src="'.$support_logo.'" alt="support"></a></li>';
echo '<li><a href="https://support.artica.es" target="_blank">'.__('Docs').'</li>'; echo '<li><a href="https://support.pandorafms.com" target="_blank">'.__('Docs').'</li>';
} }
echo '</ul></div>'; echo '</ul></div>';

View File

@ -222,9 +222,9 @@ if (! isset($id_agente)) {
} }
$multiple_delete = (bool) get_parameter('multiple_delete'); $module_action = (string) get_parameter('module_action');
if ($multiple_delete) { if ($module_action === 'delete') {
$id_agent_modules_delete = (array) get_parameter('id_delete'); $id_agent_modules_delete = (array) get_parameter('id_delete');
$count_correct_delete_modules = 0; $count_correct_delete_modules = 0;
@ -400,23 +400,63 @@ if ($multiple_delete) {
if ($count_correct_delete_modules == 0) { if ($count_correct_delete_modules == 0) {
ui_print_error_message( ui_print_error_message(
sprintf( sprintf(
__('There was a problem deleting %s modules, none deleted.'), __('There was a problem completing the operation. Applied to 0/%d modules.'),
$count_modules_to_delete $count_modules_to_delete
) )
); );
} else { } else {
if ($count_correct_delete_modules == $count_modules_to_delete) { if ($count_correct_delete_modules == $count_modules_to_delete) {
ui_print_success_message(__('All Modules deleted succesfully')); ui_print_success_message(__('Operation finished successfully.'));
} else { } else {
ui_print_error_message( ui_print_error_message(
sprintf( sprintf(
__('There was a problem only deleted %s modules of %s total.'), __('There was a problem completing the operation. Applied to %d/%d modules.'),
count_correct_delete_modules, $count_correct_delete_modules,
$count_modules_to_delete $count_modules_to_delete
) )
); );
} }
} }
} else if ($module_action === 'disable') {
$id_agent_modules_disable = (array) get_parameter('id_delete');
$count_correct_delete_modules = 0;
$updated_count = 0;
foreach ($id_agent_modules_disable as $id_agent_module_disable) {
$sql = sprintf(
'UPDATE tagente_modulo
SET disabled = 1
WHERE id_agente_modulo = %d',
$id_agent_module_disable
);
if (db_process_sql($sql)) {
$updated_count++;
}
}
$count_modules_to_disable = count($id_agent_modules_disable);
if ($updated_count === 0) {
ui_print_error_message(
sprintf(
__('There was a problem completing the operation. Applied to 0/%d modules.'),
$count_modules_to_disable
)
);
} else {
if ($updated_count == $count_modules_to_disable) {
ui_print_success_message(__('Operation finished successfully.'));
} else {
ui_print_error_message(
sprintf(
__('There was a problem completing the operation. Applied to %d/%d modules.'),
$updated_count,
$count_modules_to_disable
)
);
}
}
} }
@ -845,6 +885,9 @@ foreach ($modules as $module) {
'id_delete[]', 'id_delete[]',
$module['id_agente_modulo'], $module['id_agente_modulo'],
false, false,
true,
false,
'',
true true
); );
} }
@ -1123,12 +1166,29 @@ html_print_table($table);
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) { if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
echo '<div class="action-buttons" style="width: '.$table->width.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_input_hidden('multiple_delete', 1);
html_print_submit_button( html_print_input_hidden('submit_modules_action', 1);
__('Delete'),
'multiple_delete', html_print_select(
[
'disable' => 'Disable selected modules',
'delete' => 'Delete selected modules',
],
'module_action',
'',
'',
'',
0,
false, false,
'class="sub delete"' false,
false
);
html_print_submit_button(
__('Execute action'),
'submit_modules_action',
false,
'class="sub next"'
); );
echo '</div>'; echo '</div>';
echo '</form>'; echo '</form>';

View File

@ -28,6 +28,12 @@ if (! check_acl($config['id_user'], 0, 'LM')) {
exit; exit;
} }
if (!check_acl($config['id_user'], 0, 'PM') && !is_user_admin($config['id_user'])) {
echo "<div id='message_permissions' title='".__('Permissions warning')."' style='display:none;'>";
echo "<p style='text-align: center;font-weight: bold;'>".__('Command management is limited to administrator users or user profiles with permissions over Pandora FMS management').'</p>';
echo '</div>';
}
if (is_metaconsole()) { if (is_metaconsole()) {
$sec = 'advanced'; $sec = 'advanced';
} else { } else {
@ -558,7 +564,7 @@ foreach ($commands as $command) {
$data['name'] = '<span style="font-size: 7.5pt">'; $data['name'] = '<span style="font-size: 7.5pt">';
// (IMPORTANT, DO NOT CHANGE!) only users with permissions over "All" group have access to edition of commands belonging to "All" group. // (IMPORTANT, DO NOT CHANGE!) only users with permissions over "All" group have access to edition of commands belonging to "All" group.
if (!$command['internal'] && check_acl_restricted_all($config['id_user'], $command['id_group'], 'LM')) { if (!$command['internal'] && check_acl_restricted_all($config['id_user'], $command['id_group'], 'PM')) {
$data['name'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&id='.$command['id'].'&pure='.$pure.'">'.$command['name'].'</a>'; $data['name'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&id='.$command['id'].'&pure='.$pure.'">'.$command['name'].'</a>';
} else { } else {
$data['name'] .= $command['name']; $data['name'] .= $command['name'];
@ -584,7 +590,7 @@ foreach ($commands as $command) {
$table->cellclass[]['action'] = 'action_buttons'; $table->cellclass[]['action'] = 'action_buttons';
// (IMPORTANT, DO NOT CHANGE!) only users with permissions over "All" group have access to edition of commands belonging to "All" group. // (IMPORTANT, DO NOT CHANGE!) only users with permissions over "All" group have access to edition of commands belonging to "All" group.
if ($is_central_policies_on_node === false && !$command['internal'] && check_acl_restricted_all($config['id_user'], $command['id_group'], 'LM')) { if ($is_central_policies_on_node === false && !$command['internal'] && check_acl_restricted_all($config['id_user'], $command['id_group'], 'PM')) {
$data['action'] = '<span style="display: inline-flex">'; $data['action'] = '<span style="display: inline-flex">';
$data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&amp;copy_command=1&id='.$command['id'].'&pure='.$pure.'" $data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&amp;copy_command=1&id='.$command['id'].'&pure='.$pure.'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/copy.png', true).'</a>'; onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/copy.png', true).'</a>';
@ -602,7 +608,7 @@ if (count($table->data) > 0) {
ui_print_info_message(['no_close' => true, 'message' => __('No alert commands configured') ]); ui_print_info_message(['no_close' => true, 'message' => __('No alert commands configured') ]);
} }
if ($is_central_policies_on_node === false) { if ($is_central_policies_on_node === false && check_acl_restricted_all($config['id_user'], $command['id_group'], 'PM')) {
echo '<div class="action-buttons" style="width: '.$table->width.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&pure='.$pure.'">'; echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&pure='.$pure.'">';
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"'); html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
@ -612,3 +618,26 @@ if ($is_central_policies_on_node === false) {
} }
enterprise_hook('close_meta_frame'); enterprise_hook('close_meta_frame');
?>
<script type="text/javascript">
$(document).ready(function () {
dialog_message("#message_permissions");
});
function dialog_message(message) {
$(message)
.css("display", "inline")
.dialog({
modal: true,
width: "400px",
buttons: {
Close: function() {
$(this).dialog("close");
}
}
});
}
</script>

View File

@ -21,7 +21,7 @@ check_login();
enterprise_hook('open_meta_frame'); enterprise_hook('open_meta_frame');
if (! check_acl($config['id_user'], 0, 'LM')) { if (! check_acl($config['id_user'], 0, 'PM')) {
db_pandora_audit( db_pandora_audit(
'ACL Violation', 'ACL Violation',
'Trying to access Alert Management' 'Trying to access Alert Management'
@ -51,7 +51,7 @@ if (is_metaconsole() === true) {
if ($id > 0) { if ($id > 0) {
$alert = alerts_get_alert_command($id); $alert = alerts_get_alert_command($id);
if ($alert['internal'] || !check_acl_restricted_all($config['id_user'], $alert['id_group'], 'LM')) { if ($alert['internal'] || !check_acl_restricted_all($config['id_user'], $alert['id_group'], 'PM')) {
db_pandora_audit('ACL Violation', 'Trying to access Alert Management'); db_pandora_audit('ACL Violation', 'Trying to access Alert Management');
include 'general/noaccess.php'; include 'general/noaccess.php';
exit; exit;

View File

@ -606,7 +606,7 @@ class DiscoveryTaskList extends HTML
if (check_acl($config['id_user'], 0, 'AW')) { if (check_acl($config['id_user'], 0, 'AW')) {
$data[0] = '<span class="link" onclick="force_task(\''; $data[0] = '<span class="link" onclick="force_task(\'';
$data[0] .= ui_get_full_url( $data[0] .= ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&server_id='.$id_server.'&force='.$task['id_rt'] 'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&server_id='.$task['id_recon_server'].'&force='.$task['id_rt']
); );
$data[0] .= '\''; $data[0] .= '\'';
if ($task['type'] == DISCOVERY_HOSTDEVICES) { if ($task['type'] == DISCOVERY_HOSTDEVICES) {

View File

@ -55,9 +55,15 @@ if ($save_custom_graph) {
if ($print_custom_graph) { if ($print_custom_graph) {
ob_clean(); ob_clean();
$width_value = (int) get_parameter('width', CHART_DEFAULT_WIDTH);
if ($width_value === -1) {
$width_value = '';
}
$params = [ $params = [
'period' => (int) get_parameter('period', SECONDS_5MINUTES), 'period' => (int) get_parameter('period', SECONDS_5MINUTES),
'width' => (int) get_parameter('width', CHART_DEFAULT_WIDTH), 'width' => $width_value,
'height' => (int) get_parameter('height', CHART_DEFAULT_HEIGHT), 'height' => (int) get_parameter('height', CHART_DEFAULT_HEIGHT),
'unit_name' => get_parameter('unit_list', []), 'unit_name' => get_parameter('unit_list', []),
'date' => (int) get_parameter('date', time()), 'date' => (int) get_parameter('date', time()),

View File

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

View File

@ -3910,6 +3910,18 @@ function series_type_graph_array($data, $show_elements_graph)
$name_legend = $show_elements_graph['labels'][$value['agent_module_id']][$label_interfaces[$value['agent_module_id']]].': '; $name_legend = $show_elements_graph['labels'][$value['agent_module_id']][$label_interfaces[$value['agent_module_id']]].': ';
} else if (is_array($show_elements_graph['labels'][$value['agent_module_id']]) === true) { } else if (is_array($show_elements_graph['labels'][$value['agent_module_id']]) === true) {
$name_legend = 'Avg: '; $name_legend = 'Avg: ';
if (array_key_exists('agent_alias', $value)
&& array_key_exists('module_name', $value)
&& array_key_exists('unit', $value)
) {
$name_legend .= $value['agent_alias'];
$name_legend .= ' / ';
$name_legend .= $value['module_name'];
$name_legend .= ' / ';
$name_legend .= __('Unit ').' ';
$name_legend .= $value['unit'].': ';
}
} else { } else {
$name_legend = $show_elements_graph['labels'][$value['agent_module_id']].': '; $name_legend = $show_elements_graph['labels'][$value['agent_module_id']].': ';
} }

View File

@ -2224,7 +2224,7 @@ function config_process_config()
} }
if (!isset($config['custom_support_url'])) { if (!isset($config['custom_support_url'])) {
config_update_value('custom_support_url', 'https://support.artica.es'); config_update_value('custom_support_url', 'https://support.pandorafms.com');
} }
if (!isset($config['rb_product_name'])) { if (!isset($config['rb_product_name'])) {
@ -2240,7 +2240,7 @@ function config_process_config()
} }
if (!isset($config['meta_custom_support_url'])) { if (!isset($config['meta_custom_support_url'])) {
config_update_value('meta_custom_support_url', 'https://support.artica.es'); config_update_value('meta_custom_support_url', 'https://support.pandorafms.com');
} }
if (!isset($config['meta_custom_logo'])) { if (!isset($config['meta_custom_logo'])) {

View File

@ -1391,7 +1391,7 @@ function snmp_browser_create_modules_snmp(
'min_ff_event_critical' => 0, 'min_ff_event_critical' => 0,
'ff_type' => 0, 'ff_type' => 0,
'each_ff' => 0, 'each_ff' => 0,
'ip_target' => $target_ip, 'ip_target' => '',
'configuration_data' => '', 'configuration_data' => '',
'history_data' => 1, 'history_data' => 1,
]; ];

View File

@ -129,7 +129,7 @@
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '7.0NG.752'; $version = '7.0NG.752';
$build = '210310'; $build = '210311';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);
@ -909,7 +909,7 @@ function install_step4()
// $config["custom_title2_login_alt"] = "NEXT GENERATION"; // $config["custom_title2_login_alt"] = "NEXT GENERATION";
// $config["rb_product_name_alt"] = "Pandora FMS"; // $config["rb_product_name_alt"] = "Pandora FMS";
// $config["custom_docs_url_alt"] = "http://wiki.pandorafms.com/"; // $config["custom_docs_url_alt"] = "http://wiki.pandorafms.com/";
// $config["custom_support_url_alt"] = "https://support.artica.es"; // $config["custom_support_url_alt"] = "https://support.pandorafms.com";
@ -1026,7 +1026,7 @@ function install_step4()
// $config["custom_title2_login_alt"] = "NEXT GENERATION"; // $config["custom_title2_login_alt"] = "NEXT GENERATION";
// $config["rb_product_name_alt"] = "Pandora FMS"; // $config["rb_product_name_alt"] = "Pandora FMS";
// $config["custom_docs_url_alt"] = "http://wiki.pandorafms.com/"; // $config["custom_docs_url_alt"] = "http://wiki.pandorafms.com/";
// $config["custom_support_url_alt"] = "https://support.artica.es"; // $config["custom_support_url_alt"] = "https://support.pandorafms.com";
/* /*
----------Attention-------------------- ----------Attention--------------------

View File

@ -516,7 +516,7 @@ echo "<div style='width: ".$table->width."; text-align: right;'>";
$container.html($errorMessage.html()); $container.html($errorMessage.html());
} }
requestCustomGraph(0, width, height, period, stacked, date, modules) requestCustomGraph(0, -1, height, period, stacked, date, modules)
.done(handleSuccess) .done(handleSuccess)
.fail(handleError); .fail(handleError);
} }

View File

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

View File

@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.752"; my $pandora_version = "7.0NG.752";
my $pandora_build = "210310"; my $pandora_build = "210311";
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.752 %define version 7.0NG.752
%define release 210310 %define release 210311
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.752 %define version 7.0NG.752
%define release 210310 %define release 210311
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

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

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.752 PS210310"; my $version = "7.0NG.752 PS210311";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;
@ -1055,6 +1055,9 @@ sub pandoradb_main ($$$) {
# Move SNMP modules back to the Enterprise server # Move SNMP modules back to the Enterprise server
enterprise_hook("claim_back_snmp_modules", [$dbh, $conf]); enterprise_hook("claim_back_snmp_modules", [$dbh, $conf]);
# Check if there are discovery tasks with wrong id_recon_server
pandora_check_forgotten_discovery_tasks ($conf, $dbh);
# Recalculating dynamic intervals. # Recalculating dynamic intervals.
enterprise_hook("update_min_max", [$dbh, $conf]); enterprise_hook("update_min_max", [$dbh, $conf]);
@ -1064,6 +1067,41 @@ sub pandoradb_main ($$$) {
log_message ('', "Ending at ". strftime ("%Y-%m-%d %H:%M:%S", localtime()) . "\n"); log_message ('', "Ending at ". strftime ("%Y-%m-%d %H:%M:%S", localtime()) . "\n");
} }
###############################################################################
# Check for discovery tasks configured with servers down
###############################################################################
sub pandora_check_forgotten_discovery_tasks {
my ($conf, $dbh) = @_;
log_message ('FORGOTTEN DISCOVERY TASKS', "Check for discovery tasks bound to inactive servers.");
my @discovery_tasks = get_db_rows ($dbh, 'SELECT id_rt, id_recon_server, name FROM trecon_task');
my $discovery_tasks_count = @discovery_tasks;
# End of the check (this server has not discovery tasks!).
if ($discovery_tasks_count eq 0) {
log_message('FORGOTTEN DISCOVERY TASKS', 'There are not defined discovery tasks. Skipping.');
return;
}
my $master_server = get_db_value ($dbh, 'SELECT id_server FROM tserver WHERE server_type = ? AND status != -1', DISCOVERYSERVER);
# Goes through all the tasks to check if any have the server down.
foreach my $task (@discovery_tasks) {
if ($task->{'id_recon_server'} ne $master_server) {
my $this_server_status = get_db_value ($dbh, 'SELECT status FROM tserver WHERE id_server = ?', $task->{'id_recon_server'});
if (!defined($this_server_status) || $this_server_status eq -1) {
my $updated_task = db_process_update ($dbh, 'trecon_task', { 'id_recon_server' => $master_server }, { 'id_rt' => $task->{'id_rt'} });
log_message('FORGOTTEN DISCOVERY TASKS', 'Updated discovery task '.$task->{'name'});
}
}
}
log_message('FORGOTTEN DISCOVERY TASKS', 'Step ended');
}
# Init # Init
pandora_init_pdb(\%conf); pandora_init_pdb(\%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.752 PS210310"; my $version = "7.0NG.752 PS210311";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);