Merge remote-tracking branch 'origin/develop' into ent-11642-comprobacion-de-la-estructura-de-la-base-de-datos-en-772-lts
This commit is contained in:
commit
7fe8bfc096
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.775-240122
|
||||
Version: 7.0NG.775-240123
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.775-240122"
|
||||
pandora_version="7.0NG.775-240123"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -1039,7 +1039,7 @@ my $Sem = undef;
|
|||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.775';
|
||||
use constant AGENT_BUILD => '240122';
|
||||
use constant AGENT_BUILD => '240123';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.775
|
||||
%define release 240122
|
||||
%define release 240123
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
%define name pandorafms_agent_linux_bin
|
||||
%define source_name pandorafms_agent_linux
|
||||
%define version 7.0NG.775
|
||||
%define release 240122
|
||||
%define release 240123
|
||||
%define debug_package %{nil}
|
||||
|
||||
Summary: Pandora FMS Linux agent, binary version
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
%define name pandorafms_agent_linux_bin
|
||||
%define source_name pandorafms_agent_linux
|
||||
%define version 7.0NG.775
|
||||
%define release 240122
|
||||
%define release 240123
|
||||
%define debug_package %{nil}
|
||||
|
||||
Summary: Pandora FMS Linux agent, binary version
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
%define name pandorafms_agent_linux_bin
|
||||
%define source_name pandorafms_agent_linux
|
||||
%define version 7.0NG.775
|
||||
%define release 240122
|
||||
%define release 240123
|
||||
|
||||
Summary: Pandora FMS Linux agent, binary version
|
||||
Name: %{name}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.775
|
||||
%define release 240122
|
||||
%define release 240123
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.775"
|
||||
PI_BUILD="240122"
|
||||
PI_BUILD="240123"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{240122}
|
||||
{240123}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.775 Build 240122")
|
||||
#define PANDORA_VERSION ("7.0NG.775 Build 240123")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Pandora FMS"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.775(Build 240122))"
|
||||
VALUE "ProductVersion", "(7.0NG.775(Build 240123))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.775-240122
|
||||
Version: 7.0NG.775-240123
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.775-240122"
|
||||
pandora_version="7.0NG.775-240123"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -23,7 +23,10 @@ if ($headers['X-DS-Authorization']) {
|
|||
|
||||
list($user, $password) = explode(':', base64_decode($headers['X-DS-Authorization']));
|
||||
|
||||
// Check user login
|
||||
// Prevent sql injection.
|
||||
$user = mysqli_real_escape_string($config['dbconnection'], $user);
|
||||
|
||||
// Check user login.
|
||||
$user_in_db = process_user_login($user, $password, true);
|
||||
|
||||
if ($user_in_db !== false) {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
pandorafms.vmware=248788e0fb2cd4e11623e4a52ee7d05b
|
||||
pandorafms.mysql=fadb4750d18285c0eca34f47c6aa3cfe
|
||||
pandorafms.mssql=1cc215409741d19080269ffba112810e
|
||||
pandorafms.oracle=2d9320a514d1e48a0b2804e1653c31c6
|
||||
pandorafms.oracle=abdfd7280f76276f696115cabdac731e
|
||||
pandorafms.db2=122f2abff0ec1d668c35ee0911483021
|
||||
pandorafms.sap.deset=9bb72b7f7497a8b543f25cd71f96878f
|
||||
pandorafms.gcp.ce=6743d39452f8e1ad85d0d56a30843973
|
||||
pandorafms.aws.ec2=07416081f11d92a7d5d9441dabb5c5cb
|
||||
pandorafms.aws.s3=eff053a212ea112e2a37efd9debbe6a0
|
||||
pandorafms.aws.rds=47d7b02019329e1698f96db4959f9516
|
||||
pandorafms.azure.mc=04a1072d1ece8583645ad88204fbeed3
|
||||
pandorafms.azure.mc=04a1072d1ece8583645ad88204fbeed3
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
START TRANSACTION;
|
||||
|
||||
-- Update version for plugin oracle
|
||||
UPDATE `tdiscovery_apps` SET `version` = '1.2' WHERE `short_name` = 'pandorafms.oracle';
|
||||
|
||||
ALTER TABLE `tevent_sound` MODIFY COLUMN `name` text NULL;
|
||||
ALTER TABLE `tevent_sound` MODIFY COLUMN `sound` text NULL;
|
||||
ALTER TABLE `treport_content` MODIFY COLUMN `use_prefix_notation` tinyint unsigned NOT NULL DEFAULT 1;
|
||||
|
@ -9,7 +12,8 @@ ALTER TABLE `tsesion_filter` MODIFY COLUMN `period` text NULL;
|
|||
ALTER TABLE `tsesion_filter` MODIFY COLUMN `ip` text NULL;
|
||||
ALTER TABLE `tsesion_filter` MODIFY COLUMN `type` text NULL;
|
||||
ALTER TABLE `tsesion_filter` MODIFY COLUMN `user` text NULL;
|
||||
ALTER TABLE `tncm_agent_data` ADD COLUMN `id_agent_data` int not null default 0 AFTER `script_type`;
|
||||
ALTER TABLE `tncm_agent_data`
|
||||
ADD COLUMN `id_agent_data` int not null default 0 AFTER `script_type`;
|
||||
ALTER TABLE `tusuario` CHANGE COLUMN `metaconsole_data_section` `metaconsole_data_section` TEXT NOT NULL DEFAULT '' ;
|
||||
ALTER TABLE `tmensajes` ADD COLUMN `icon_notification` VARCHAR(250) NULL DEFAULT NULL AFTER `url`;
|
||||
|
||||
|
|
|
@ -131,9 +131,13 @@ if ($add_inventory_module) {
|
|||
}
|
||||
}
|
||||
|
||||
// Load inventory module data for updating
|
||||
// Load inventory module data for updating.
|
||||
if ($load_inventory_module) {
|
||||
$sql = 'SELECT * FROM tagent_module_inventory WHERE id_module_inventory = '.$load_inventory_module;
|
||||
$sql = sprintf(
|
||||
'SELECT * FROM tagent_module_inventory WHERE id_module_inventory = %s AND id_agente = %d',
|
||||
$load_inventory_module,
|
||||
$id_agente
|
||||
);
|
||||
$row = db_get_row_sql($sql);
|
||||
|
||||
if (!empty($row)) {
|
||||
|
|
|
@ -68,7 +68,7 @@ foreach ($layer_ids as $layer_id) {
|
|||
$layer_list[] = [
|
||||
'id' => (strpos($layer_id, 'new_') === false) ? (int) $layer_id : null,
|
||||
'layer_name' => $trimmed_name,
|
||||
'layer_visible' => ($layers[$layer_id]['visible'] === 'true'),
|
||||
'layer_visible' => ($layers[$layer_id]['visible'] == 'true' || $layers[$layer_id]['visible'] === '1'),
|
||||
'layer_group' => (int) $layers[$layer_id]['agents_from_group'],
|
||||
'layer_agent_list' => $layers[$layer_id]['agents'],
|
||||
'layer_group_list' => $layers[$layer_id]['groups'],
|
||||
|
@ -562,8 +562,6 @@ $table->data[9][1] = html_print_input_text('map_default_altitude', $map_default_
|
|||
|
||||
html_print_table($table);
|
||||
|
||||
$user_groups = users_get_groups($config['user'], 'AR', false);
|
||||
|
||||
echo '<fieldset class="margin-bottom-10"><legend>'.__('Layers').'</legend>';
|
||||
|
||||
$table->width = '100%';
|
||||
|
@ -589,7 +587,7 @@ $table->data[1][0] = '<div id="form_layer" class="invisible">
|
|||
</tr>
|
||||
<tr>
|
||||
<td>'.__('Show agents from group').':</td>
|
||||
<td colspan="3">'.html_print_select($user_groups, 'layer_group_form', '-1', '', __('none'), '-1', true).'</td>
|
||||
<td colspan="3">'.html_print_select_groups($config['id_user'], 'AR', true, 'layer_group_form', '', '', __('none'), '-1', true).'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4"><hr /></td>
|
||||
|
@ -923,11 +921,25 @@ function setLayerEditorData (data) {
|
|||
var $layerFormAgentsListItems = $("tr.agents_list_item");
|
||||
var $layerFormGroupsListItems = $("tr.groups_list_item");
|
||||
|
||||
$.ajax({
|
||||
url: 'ajax.php',
|
||||
data: {
|
||||
page: 'operation/gis_maps/ajax',
|
||||
opt: 'get_group_name',
|
||||
id_group: data.agentsFromGroup
|
||||
},
|
||||
type: 'POST',
|
||||
async: false,
|
||||
dataType: 'json',
|
||||
success: function (name) {
|
||||
var newOption = new Option(name, data.agentsFromGroup, true, true);
|
||||
$layerFormAgentsFromGroupSelect.append(newOption).trigger('change');
|
||||
},
|
||||
});
|
||||
|
||||
$layerFormIdInput.val(data.id);
|
||||
$layerFormNameInput.val(data.name);
|
||||
$layerFormVisibleCheckbox.prop("checked", data.visible);
|
||||
$(`#layer_group_form option[value=${data.agentsFromGroup}]`).attr('selected', 'selected');
|
||||
$(`#layer_group_form`).trigger('change');
|
||||
$layerFormAgentInput.val("");
|
||||
$layerFormAgentButton.prop("disabled", true);
|
||||
$layerFormAgentsListItems.remove();
|
||||
|
|
|
@ -301,6 +301,18 @@ class ConsoleSupervisor
|
|||
*/
|
||||
|
||||
$this->checkLogAlerts();
|
||||
|
||||
/*
|
||||
* Check total modules in system
|
||||
*/
|
||||
|
||||
$this->checkTotalModules();
|
||||
|
||||
/*
|
||||
* Check total modules by agent
|
||||
*/
|
||||
|
||||
$this->checkTotalModulesByAgent();
|
||||
}
|
||||
|
||||
|
||||
|
@ -591,8 +603,21 @@ class ConsoleSupervisor
|
|||
* Check MYSQL Support Version
|
||||
*
|
||||
*/
|
||||
|
||||
$this->checkMYSQLSettings();
|
||||
|
||||
/*
|
||||
* Check total modules in system
|
||||
*/
|
||||
|
||||
$this->checkTotalModules();
|
||||
|
||||
/*
|
||||
* Check total modules by agent
|
||||
*/
|
||||
|
||||
$this->checkTotalModulesByAgent();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -3199,4 +3224,65 @@ class ConsoleSupervisor
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if the total number of modules in Pandora is greater than 80000.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function checkTotalModules()
|
||||
{
|
||||
$total_modules = db_get_num_rows('select * from tagente_modulo');
|
||||
if ($total_modules > 80000) {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.MODULES.ALERT',
|
||||
'title' => __('Your system has a total of %s modules', $total_modules),
|
||||
'message' => __('This is higher than the recommended maximum 80,000 modules per node. This may result in poor performance of your system.'),
|
||||
'icon_notification' => self::ICON_HEADSUP,
|
||||
'url' => '__url__index.php?sec=gagente&sec2=godmode/agentes/modificar_agente',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
$this->cleanNotifications('NOTIF.MODULES.ALERT');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if the total number of modules by agent is greater than 200
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function checkTotalModulesByAgent()
|
||||
{
|
||||
$modules_by_agent = db_process_sql(
|
||||
'SELECT count(*) AS modules_by_agent
|
||||
FROM tagente a
|
||||
LEFT JOIN tagente_modulo m ON a.id_agente = m.id_agente
|
||||
GROUP BY m.id_agente'
|
||||
);
|
||||
|
||||
$show_warning = false;
|
||||
foreach ($modules_by_agent as $key => $total_modules) {
|
||||
if ($total_modules['modules_by_agent'] > 200) {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.MODULES_AGENT.ALERT',
|
||||
'title' => __('Your system has an average of %s modules per agent', $total_modules['modules_by_agent']),
|
||||
'message' => __('This is higher than the recommended maximum (200). This may result in poor performance of your system.'),
|
||||
'icon_notification' => self::ICON_HEADSUP,
|
||||
'url' => '__url__index.php?sec=gagente&sec2=godmode/agentes/modificar_agente',
|
||||
]
|
||||
);
|
||||
$show_warning = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($show_warning === false) {
|
||||
$this->cleanNotifications('NOTIF.MODULES_AGENT.ALERT');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC240122';
|
||||
$build_version = 'PC240123';
|
||||
$pandora_version = 'v7.0NG.775';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
|
|
@ -988,6 +988,10 @@ select:-internal-list-box {
|
|||
display: flex;
|
||||
}
|
||||
|
||||
.flex_important {
|
||||
display: flex !important;
|
||||
}
|
||||
|
||||
.flex-row-important {
|
||||
display: flex !important;
|
||||
flex-direction: row !important;
|
||||
|
|
|
@ -131,7 +131,7 @@
|
|||
<div style='padding-bottom: 50px'>
|
||||
<?php
|
||||
$version = '7.0NG.775';
|
||||
$build = '240122';
|
||||
$build = '240123';
|
||||
$banner = "v$version Build $build";
|
||||
error_reporting(0);
|
||||
|
||||
|
|
|
@ -535,6 +535,21 @@ echo '</div>';
|
|||
|
||||
ui_require_css_file('cluetip', 'include/styles/js/');
|
||||
ui_require_jquery_file('cluetip');
|
||||
|
||||
$system_higher = false;
|
||||
$modules_agent = db_get_all_rows_sql(sprintf('SELECT id_agente FROM tagente_modulo WHERE id_agente = %s', $id_agente));
|
||||
if (is_array($modules_agent)) {
|
||||
$all_modules = db_get_all_rows_sql('SELECT id_agente FROM tagente_modulo');
|
||||
$all_agents = db_get_all_rows_sql('SELECT id_agente FROM tagente');
|
||||
if (is_array($all_modules) && is_array($all_agents)) {
|
||||
if ((count($all_modules) / count($all_agents)) >= 200) {
|
||||
$system_higher = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo '<div id="system_higher" class="invisible_important agent_details_agent_data flex_important"><img src="images/alert-yellow@svg.svg" width="10%" class="mrgn_right_20px">'.__('Your system has a much higher rate of modules per agent than recommended (200 modules per agent). This implies performance problems in the system, please consider reducing the number of modules in this agent.').'</div>';
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
@ -607,6 +622,36 @@ $('table.alert-status-filter #ag_group').change (function () {
|
|||
}
|
||||
}).change();
|
||||
|
||||
<?php if ($system_higher === true) { ?>
|
||||
$("#system_higher").dialog({
|
||||
title: "<?php echo __('Warning'); ?>",
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
width: 500,
|
||||
height: 150,
|
||||
buttons: [{
|
||||
text: "OK",
|
||||
click: function() {
|
||||
$(this).dialog("close");
|
||||
},
|
||||
class: 'invisible_important',
|
||||
}],
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
closeOnEscape: false,
|
||||
open: function(event, ui) {
|
||||
$(".ui-dialog-titlebar-close").hide();
|
||||
$("#system_higher").removeClass('invisible_important');
|
||||
setTimeout(() => {
|
||||
$(".ui-dialog-buttonset").find('button').removeClass('invisible_important');
|
||||
}, 4000);
|
||||
}
|
||||
});
|
||||
<?php } ?>
|
||||
|
||||
function validateAlerts() {
|
||||
var alert_ids = [];
|
||||
|
||||
|
|
|
@ -541,4 +541,14 @@ switch ($opt) {
|
|||
|
||||
echo json_encode($returnJSON);
|
||||
break;
|
||||
|
||||
case 'get_group_name':
|
||||
$id_group = (int) get_parameter('id_group', -1);
|
||||
if ($id_group === -1) {
|
||||
echo json_encode(__('None'));
|
||||
} else {
|
||||
$result = groups_get_name($id_group, true);
|
||||
echo json_encode($result);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
%define debug_package %{nil}
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.775
|
||||
%define release 240122
|
||||
%define release 240123
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
%define debug_package %{nil}
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.775
|
||||
%define release 240122
|
||||
%define release 240123
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.775
|
||||
%define release 240122
|
||||
%define release 240123
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
|
|
@ -2913,7 +2913,7 @@ SET @short_name = 'pandorafms.oracle';
|
|||
SET @name = 'Oracle';
|
||||
SET @section = 'app';
|
||||
SET @description = 'Monitor Oracle databases';
|
||||
SET @version = '1.1';
|
||||
SET @version = '1.2';
|
||||
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
|
||||
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-server
|
||||
Version: 7.0NG.775-240122
|
||||
Version: 7.0NG.775-240123
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.775-240122"
|
||||
pandora_version="7.0NG.775-240123"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -46,7 +46,7 @@ our @EXPORT = qw(
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.775";
|
||||
my $pandora_build = "240122";
|
||||
my $pandora_build = "240123";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
|
|
@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.775";
|
||||
my $pandora_build = "240122";
|
||||
my $pandora_build = "240123";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
%define debug_package %{nil}
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.775
|
||||
%define release 240122
|
||||
%define release 240123
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.775
|
||||
%define release 240122
|
||||
%define release 240123
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.775"
|
||||
PI_BUILD="240122"
|
||||
PI_BUILD="240123"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
|
|
@ -38,7 +38,7 @@ use PandoraFMS::Config;
|
|||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.775 Build 240122";
|
||||
my $version = "7.0NG.775 Build 240123";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
@ -79,6 +79,15 @@ sub log_message ($$;$) {
|
|||
}
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# Print the given message and writes on error log.
|
||||
########################################################################
|
||||
sub log_error_message ($$) {
|
||||
my ($conf, $message) = @_;
|
||||
log_message('',,"$message\n\n");
|
||||
log_error_writter($conf, "$message\n");
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# Delete old data from the database.
|
||||
########################################################################
|
||||
|
@ -1289,9 +1298,6 @@ sub pandoradb_main {
|
|||
# Maintain Referential integrity and other stuff
|
||||
pandora_checkdb_integrity ($conf, $dbh);
|
||||
|
||||
# Close and open error log blocks
|
||||
handle_error_log_block($conf, $dbh);
|
||||
|
||||
# Move old data to the history DB
|
||||
if (defined ($history_dbh)) {
|
||||
undef ($history_dbh) unless defined (enterprise_hook ('pandora_historydb', [$dbh, $history_dbh, $conf->{'_history_db_days'}, $conf->{'_history_db_step'}, $conf->{'_history_db_delay'}, $conf->{'_history_db_string_days'}, $conf->{'_history_db_adv'}]));
|
||||
|
@ -1372,15 +1378,23 @@ sub pandora_check_forgotten_discovery_tasks {
|
|||
sub handle_error_log_block {
|
||||
my ($conf, $dbh) = @_;
|
||||
my $is_open = get_db_value ($dbh,"SELECT `value` FROM `tconfig` WHERE `token` = 'open_error_log'");
|
||||
open (STDERR, ">> " . $conf->{'errorlog_file'}) or die " [ERROR] " . pandora_get_initial_product_name() . " can't write to Errorlog. Aborting : \n $! \n";
|
||||
|
||||
if (!defined ($is_open)) {
|
||||
db_do($dbh, "INSERT INTO `tconfig`(`token`, `value`) VALUES ('open_error_log', 1)");
|
||||
} elsif ($is_open eq 1){
|
||||
print STDERR strftime ("%Y-%m-%d %H:%M:%S", localtime()) . ' - ' . $conf->{'servername'} . " pandora_db: pandora_db maintenance tasks ends\n";
|
||||
log_error_writter($conf, strftime ("%Y-%m-%d %H:%M:%S", localtime()) . ' - ' . $conf->{'servername'} . " pandora_db: pandora_db maintenance tasks ends\n");
|
||||
}
|
||||
|
||||
print STDERR strftime ("%Y-%m-%d %H:%M:%S", localtime()) . ' - ' . $conf->{'servername'} . " pandora_db: pandora_db maintenance tasks starts\n";
|
||||
log_error_writter($conf, strftime ("%Y-%m-%d %H:%M:%S", localtime()) . ' - ' . $conf->{'servername'} . " pandora_db: pandora_db maintenance tasks starts\n");
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Print messages on error log file
|
||||
###############################################################################
|
||||
sub log_error_writter($$){
|
||||
my ($conf, $message) = @_;
|
||||
open (STDERR, ">> " . $conf->{'errorlog_file'}) or die " [ERROR] " . pandora_get_initial_product_name() . " can't write to Errorlog. Aborting : \n $! \n";
|
||||
print STDERR $message;
|
||||
close (STDERR);
|
||||
}
|
||||
|
||||
|
@ -1417,17 +1431,20 @@ if (defined($conf{'_history_db_enabled'}) && $conf{'_history_db_enabled'} eq '1'
|
|||
}
|
||||
}
|
||||
|
||||
# Close and open error log blocks
|
||||
handle_error_log_block(\%conf, $dbh);
|
||||
|
||||
# Only run on master servers.
|
||||
pandora_set_master(\%conf, $dbh);
|
||||
if ($conf{'_force'} == 0 && pandora_is_master(\%conf) == 0) {
|
||||
log_message ('', " [*] Not a master server.\n\n");
|
||||
log_error_message (\%conf, " [*] Not a master server.");
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# Get a lock on the main database.
|
||||
my $db_lock = db_get_lock ($dbh, $conf{'dbname'} . '_pandora_db', $LOCK_TIMEOUT, 1);
|
||||
if ($db_lock == 0) {
|
||||
log_message ('', " [*] Another instance of DB Tool seems to be running on the main database.\n\n");
|
||||
log_error_message (\%conf, " [*] Another instance of DB Tool seems to be running on the main database.");
|
||||
exit 1;
|
||||
}
|
||||
|
||||
|
@ -1435,7 +1452,7 @@ if ($db_lock == 0) {
|
|||
if (defined($history_dbh)) {
|
||||
my $history_lock = db_get_lock ($history_dbh, $conf{'_history_db_name'} . '_pandora_db', $LOCK_TIMEOUT, 1);
|
||||
if ($history_lock == 0) {
|
||||
log_message ('', " [*] Another instance of DB Tool seems to be running on the history database.\n\n");
|
||||
log_error_message (\%conf, " [*] Another instance of DB Tool seems to be running on the history database.");
|
||||
exit 1;
|
||||
}
|
||||
}
|
||||
|
@ -1443,14 +1460,14 @@ if (defined($history_dbh)) {
|
|||
# Get a lock merging.
|
||||
my $lock_merge = db_get_lock ($dbh, 'merge-working', $LOCK_TIMEOUT, 1);
|
||||
if ($lock_merge == 0) {
|
||||
log_message ('', " [*] Merge is running.\n\n");
|
||||
log_error_message (\%conf, " [*] Merge is running.");
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# Get a lock on merging events.
|
||||
my $lock_merge_events = db_get_lock ($dbh, 'merging-events', $LOCK_TIMEOUT, 1);
|
||||
if ($lock_merge_events == 0) {
|
||||
log_message ('', " [*] Merge events is running.\n\n");
|
||||
log_error_message (\%conf, " [*] Merge events is running.");
|
||||
exit 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
|||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.775 Build 240122";
|
||||
my $version = "7.0NG.775 Build 240123";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
|
Loading…
Reference in New Issue