Merge branch 'develop' into 'ent-4967-9083-Valores-unidades-en-graficas-no-son-por-1024'

# Conflicts:
#   pandora_console/extras/mr/35.sql
This commit is contained in:
Alejandro Campos 2020-01-15 14:37:00 +01:00
commit 6dbe75169f
34 changed files with 192 additions and 64 deletions

View File

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

@ -55,7 +55,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.742';
use constant AGENT_BUILD => '200114';
use constant AGENT_BUILD => '200115';
# 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.742
%define release 200114
%define release 200115
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.742"
PI_BUILD="200114"
PI_BUILD="200115"
OS_NAME=`uname -s`
FORCE=0

View File

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

View File

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

View File

@ -1,6 +1,7 @@
START TRANSACTION;
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_module_units', '{"bytes":"bytes","entries":"entries","files":"files","hits":"hits","sessions":"sessions","users":"users","ºC":"ºC","ºF":"ºF"}');
ALTER TABLE `tmap` ADD COLUMN `id_group_map` INT(10) UNSIGNED NOT NULL default 0;
ALTER TABLE `tevent_filter` MODIFY `severity` TEXT NOT NULL;
COMMIT;
COMMIT;

View File

@ -1195,6 +1195,8 @@ CREATE TABLE IF NOT EXISTS `tmap` (
`generation_method` INTEGER UNSIGNED NOT NULL default 0,
`generated` INTEGER UNSIGNED NOT NULL default 0,
`filter` TEXT,
`id_group_map` INT(10) UNSIGNED NOT NULL default 0,
PRIMARY KEY(`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;

View File

@ -1340,6 +1340,10 @@ class NetworkMap
if ($rel['parent_type'] == NODE_MODULE
&& $rel['child_type'] == NODE_MODULE
) {
// Keep std references.
$ref_id_parent = $id_parent;
$ref_id_child = $id_child;
// Module information available.
$id_parent = $rel['id_parent_source_data'];
$id_child = $rel['id_child_source_data'];
@ -1374,6 +1378,12 @@ class NetworkMap
'index' => $index,
'priority' => $priority,
];
// Keep node reference mapping - low precedence relationship.
$rel_map[$ref_id_parent.'_'.$ref_id_child] = [
'index' => $index,
'priority' => $priority,
];
}
} else if ($rel['parent_type'] == NODE_AGENT
&& $rel['child_type'] == NODE_AGENT

View File

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

View File

@ -1453,6 +1453,20 @@ function networkmap_delete_nodes($id_map)
}
/**
* Delete relations given id_map
*
* @param integer $id_map
* @return integer result
*/
function networkmap_delete_relations($id_map)
{
$result = db_process_sql_delete('trel_item', ['id_map' => $id_map]);
return $result;
}
function get_networkmaps($id)
{
$groups = array_keys(users_get_groups(null, 'IW'));

View File

@ -919,9 +919,10 @@ function servers_get_info($id_server=-1)
// Remote servers LAG Calculation (server_type != 0).
if ($server['server_type'] != 0) {
// MySQL 8.0 has function lag(). So, lag must be enclosed in quotations.
$result = db_get_row_sql(
'SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag,
AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS lag
AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS "lag"
FROM tagente_estado, tagente_modulo, tagente
WHERE utimestamp > 0
AND tagente.disabled = 0
@ -935,9 +936,10 @@ function servers_get_info($id_server=-1)
);
} else {
// Local/Dataserver server LAG calculation.
// MySQL 8.0 has function lag(). So, lag must be enclosed in quotations.
$result = db_get_row_sql(
'SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag,
AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS lag
AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS "lag"
FROM tagente_estado, tagente_modulo, tagente
WHERE utimestamp > 0
AND tagente.disabled = 0

View File

@ -129,7 +129,7 @@
<div style='height: 10px'>
<?php
$version = '7.0NG.742';
$build = '200114';
$build = '200115';
$banner = "v$version Build $build";
error_reporting(0);
@ -965,9 +965,12 @@ function install_step4()
$step5 = mysqli_query(
$connection,
"GRANT ALL PRIVILEGES ON `$dbname`.* to pandora@$host
IDENTIFIED BY '".$random_password."'"
"CREATE USER pandora@$host IDENTIFIED BY '".$random_password."'"
);
$step5 |= mysqli_query(
$connection,
"GRANT ALL PRIVILEGES ON `$dbname`.* to pandora@$host"
);
mysqli_query($connection, 'FLUSH PRIVILEGES');
check_generic($step5, "Established privileges for user pandora. A new random password has been generated: <b>$random_password</b><div class='warn'>Please write it down, you will need to setup your Pandora FMS server, editing the </i>/etc/pandora/pandora_server.conf</i> file</div>");

View File

@ -81,8 +81,8 @@ if ($edit_networkmap) {
$id_group = $values['id_group'];
// ACL for the network map.
$networkmap_write = check_acl($config['id_user'], $id_group, 'MW');
$networkmap_manage = check_acl($config['id_user'], $id_group, 'MM');
$networkmap_write = check_acl($config['id_user'], $id_group_map, 'MW');
$networkmap_manage = check_acl($config['id_user'], $id_group_map, 'MM');
if (!$networkmap_write && !$networkmap_manage) {
db_pandora_audit(
@ -95,6 +95,9 @@ if ($edit_networkmap) {
$name = io_safe_output($values['name']);
// Id group of the map itself, not data source.
$id_group_map = $values['id_group_map'];
$description = $values['description'];
$filter = json_decode($values['filter'], true);
@ -267,8 +270,8 @@ if ($not_found) {
$config['id_user'],
'AR',
true,
'id_group',
$id_group,
'id_group_map',
$id_group_map,
'',
'',
'',
@ -329,6 +332,28 @@ if ($not_found) {
$table->data['source_data_ip_mask'][0] = __('Source from CIDR IP mask');
$table->data['source_data_ip_mask'][1] = html_print_input_text('ip_mask', $ip_mask, '', 20, 255, true, $disabled_source);
$table->data['source_data_group'][0] = __('Source group');
$table->data['source_data_group'][1] = html_print_select_groups(
$config['id_user'],
'AR',
true,
'id_group',
$id_group,
'',
'',
'',
true
);
$table->data['source_data_group'][1] .= html_print_image(
'images/error.png',
true,
[
'id' => 'group_change_warning',
'title' => __('Source id group changed. All elements in networkmap will be lost.'),
'style' => 'display : none',
]
);
$table->data['source_data_dont_show_subgroups'][0] = __('Don\'t show subgroups:');
$table->data['source_data_dont_show_subgroups'][1] = html_print_checkbox(
'dont_show_subgroups',
@ -379,7 +404,7 @@ if ($not_found) {
$table->data['kval'][0] = __('Default ideal node separation');
$table->data['kval'][1] = html_print_input_text('kval', $kval, '', 5, 10, true, $disabled_source, false, $itemClass).ui_print_help_tip(__('Only fdp. Default ideal node separation in the layout. By default 0.3'), true);
echo '<form method="post" action="index.php?sec=network&amp;sec2=operation/agentes/pandora_networkmap">';
echo '<form id="networkmap_options_form" method="post" action="index.php?sec=network&amp;sec2=operation/agentes/pandora_networkmap">';
html_print_table($table);
@ -420,8 +445,11 @@ $(document).ready(function() {
.css('display', 'none');
$("#form_editor-source_data_dont_show_subgroups")
.css('display', 'none');
$("#form_editor-source_data_group")
.css('display', 'none');
$("#form_editor-source_data_recon_task")
.css('display', '');
}
else if (source == 'ip_mask') {
$("#form_editor-source_data_ip_mask")
@ -430,6 +458,8 @@ $(document).ready(function() {
.css('display', 'none');
$("#form_editor-source_data_dont_show_subgroups")
.css('display', 'none');
$("#form_editor-source_data_group")
.css('display', 'none');
}
else if (source == 'group') {
$("#form_editor-source_data_ip_mask")
@ -438,6 +468,8 @@ $(document).ready(function() {
.css('display', 'none');
$("#form_editor-source_data_dont_show_subgroups")
.css('display', '');
$("#form_editor-source_data_group")
.css('display', '');
}
});
@ -508,5 +540,53 @@ $(document).ready(function() {
$("input[name='source']").trigger("change");
$("#method").trigger("change");
// Control if id_group has changed.
var id_group_old = $("#id_group").val();
var id_group_changed = false;
$("#id_group").on('change',{id_group_old: id_group_old}, function () {
var id_group_new = $("#id_group").val();
if((id_group_old != id_group_new) && (update_networkmap == 1 )) {
id_group_changed = true;
$("#group_change_warning").show();
} else {
id_group_changed = false;
$("#group_change_warning").hide();
}
});
var update_networkmap = 0;
// Show advice if id_group has changed.
update_networkmap = $("input[name='update_networkmap']").val();
$( "#submit-crt" ).click(function( event ) {
if(update_networkmap == 1 && id_group_changed === true) {
confirmDialog({
title: '<?php echo __('Are you sure?'); ?>',
message: '<?php echo __('Source id group changed. All elements in Networkmap will be lost'); ?>',
ok: '<?php echo __('OK'); ?>',
cancel: '<?php echo __('Cancel'); ?>',
onDeny: function() {
// Continue execution.
return false;
},
onAccept: function () {
// Submit form
$("#networkmap_options_form").submit();
}
})
event.preventDefault();
}
});
});
</script>

View File

@ -12,10 +12,10 @@
// Load global variables
global $config;
// Check user credentials
// Check user credentials.
check_login();
// General ACL for the network maps
// General ACL for the network maps.
$networkmaps_read = check_acl($config['id_user'], 0, 'MR');
$networkmaps_write = check_acl($config['id_user'], 0, 'MW');
$networkmaps_manage = check_acl($config['id_user'], 0, 'MM');
@ -53,11 +53,12 @@ if (enterprise_installed()) {
if ($save_empty_networkmap) {
$id_group = (int) get_parameter('id_group', 0);
$id_group_map = (int) get_paramater('id_group_map', 0);
// ACL for the network map
// ACL for the network map.
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
$networkmap_write = check_acl($config['id_user'], $id_group, 'MW');
$networkmap_manage = check_acl($config['id_user'], $id_group, 'MM');
$networkmap_write = check_acl($config['id_user'], $id_group_map, 'MW');
$networkmap_manage = check_acl($config['id_user'], $id_group_map, 'MM');
if (!$networkmap_write && !$networkmap_manage) {
db_pandora_audit(
@ -93,6 +94,7 @@ if (enterprise_installed()) {
$values['description'] = $description;
$values['source'] = 0;
$values['source_data'] = $id_group;
$values['id_group_map'] = $id_group_map;
if (!$networkmap_write && !$networkmap_manage) {
@ -139,10 +141,12 @@ if (enterprise_installed()) {
}
} else if ($update_empty_networkmap) {
$id_group = (int) get_parameter('id_group', 0);
$id_group_map = (int) get_parameter('id_group_map', 0);
// ACL for the new network map
$networkmap_write_new = check_acl($config['id_user'], $id_group, 'MW');
$networkmap_manage_new = check_acl($config['id_user'], $id_group, 'MM');
$networkmap_write_new = check_acl($config['id_user'], $id_group_map, 'MW');
$networkmap_manage_new = check_acl($config['id_user'], $id_group_map, 'MM');
if (!$networkmap_write && !$networkmap_manage) {
db_pandora_audit(
@ -221,11 +225,13 @@ if ($new_networkmap || $save_networkmap) {
if ($save_networkmap) {
$id_group = (int) get_parameter('id_group', 0);
$id_group_map = (int) get_parameter('id_group_map', 0);
// ACL for the network map
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
$networkmap_write = check_acl($config['id_user'], $id_group, 'MW');
$networkmap_manage = check_acl($config['id_user'], $id_group, 'MM');
$networkmap_write = check_acl($config['id_user'], $id_group_map, 'MW');
$networkmap_manage = check_acl($config['id_user'], $id_group_map, 'MM');
if (!$networkmap_write && !$networkmap_manage) {
db_pandora_audit(
@ -282,6 +288,7 @@ if ($new_networkmap || $save_networkmap) {
$values['height'] = $height;
$values['id_user'] = $config['id_user'];
$values['description'] = $description;
$values['id_group_map'] = $id_group_map;
switch ($method) {
case 'twopi':
@ -401,8 +408,10 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
return;
}
$id_group_old = db_get_value('id_group', 'tmap', 'id', $id);
if ($id_group_old === false) {
// ACL for the network map.
$id_group_map_old = db_get_value('id_group_map', 'tmap', 'id', $id);
if ($id_group_map_old === false) {
db_pandora_audit(
'ACL Violation',
'Trying to accessnode graph builder'
@ -411,9 +420,8 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
return;
}
// ACL for the network map
$networkmap_write = check_acl($config['id_user'], $id_group_old, 'MW');
$networkmap_manage = check_acl($config['id_user'], $id_group_old, 'MM');
$networkmap_write = check_acl($config['id_user'], $id_group_map_old, 'MW');
$networkmap_manage = check_acl($config['id_user'], $id_group_map_old, 'MM');
if (!$networkmap_write && !$networkmap_manage) {
db_pandora_audit(
@ -426,10 +434,14 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
if ($update_networkmap) {
$id_group = (int) get_parameter('id_group', 0);
// Get id of old group source to check changes.
$id_group_old = db_get_value('id_group', 'tmap', 'id', $id);
// ACL for the new network map
$networkmap_write_new = check_acl($config['id_user'], $id_group, 'MW');
$networkmap_manage_new = check_acl($config['id_user'], $id_group, 'MM');
$id_group_map = (int) get_parameter('id_group_map', 0);
$networkmap_write_new = check_acl($config['id_user'], $id_group_map, 'MW');
$networkmap_manage_new = check_acl($config['id_user'], $id_group_map, 'MM');
if (!$networkmap_write && !$networkmap_manage) {
db_pandora_audit(
@ -456,6 +468,7 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
$values = [];
$values['name'] = $name;
$values['id_group'] = $id_group;
$values['id_group_map'] = $id_group_map;
$description = get_parameter('description', '');
$values['description'] = $description;
@ -493,6 +506,8 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
// If change the group, the map must be regenerated
if ($id_group != $id_group_old) {
networkmap_delete_nodes($id);
// Delete relations.
networkmap_delete_relations($id);
}
$networkmap_write = $networkmap_write_new;
@ -701,9 +716,9 @@ switch ($tab) {
$network_maps = db_get_all_rows_filter(
'tmap',
[
'id_group' => $id_groups,
'limit' => $limit,
'offset' => $offset,
'id_group_map' => $id_groups,
'limit' => $limit,
'offset' => $offset,
]
);
@ -712,9 +727,9 @@ switch ($tab) {
foreach ($network_maps as $network_map) {
// ACL for the network map
$networkmap_read = check_acl($config['id_user'], $network_map['id_group'], 'MR');
$networkmap_write = check_acl($config['id_user'], $network_map['id_group'], 'MW');
$networkmap_manage = check_acl($config['id_user'], $network_map['id_group'], 'MM');
$networkmap_read = check_acl($config['id_user'], $network_map['id_group_map'], 'MR');
$networkmap_write = check_acl($config['id_user'], $network_map['id_group_map'], 'MW');
$networkmap_manage = check_acl($config['id_user'], $network_map['id_group_map'], 'MM');
if (!$networkmap_read && !$networkmap_write && !$networkmap_manage) {
db_pandora_audit(
@ -722,7 +737,7 @@ switch ($tab) {
'Trying to access networkmap enterprise'
);
include 'general/noaccess.php';
return;
continue;
}
$data = [];
@ -768,7 +783,7 @@ switch ($tab) {
}
}
$data['groups'] = ui_print_group_icon($network_map['id_group'], true);
$data['groups'] = ui_print_group_icon($network_map['id_group_map'], true);
if ($networkmap_write || $networkmap_manage) {
$table->cellclass[] = [

View File

@ -576,8 +576,8 @@ if (is_ajax()) {
$filter = json_encode($array_filter);
// ACL for the network map.
$networkmap_write = check_acl($config['id_user'], $networkmap['id_group'], 'MW');
$networkmap_manage = check_acl($config['id_user'], $networkmap['id_group'], 'MM');
$networkmap_write = check_acl($config['id_user'], $networkmap['id_group_map'], 'MW');
$networkmap_manage = check_acl($config['id_user'], $networkmap['id_group_map'], 'MM');
if (!$networkmap_write && !$networkmap_manage) {
db_pandora_audit(
@ -800,9 +800,9 @@ if ($networkmap === false) {
return;
} else {
// ACL for the network map.
$networkmap_read = check_acl($config['id_user'], $networkmap['id_group'], 'MR');
$networkmap_write = check_acl($config['id_user'], $networkmap['id_group'], 'MW');
$networkmap_manage = check_acl($config['id_user'], $networkmap['id_group'], 'MM');
$networkmap_read = check_acl($config['id_user'], $networkmap['id_group_map'], 'MR');
$networkmap_write = check_acl($config['id_user'], $networkmap['id_group_map'], 'MW');
$networkmap_manage = check_acl($config['id_user'], $networkmap['id_group_map'], 'MM');
if (!$networkmap_read && !$networkmap_write && !$networkmap_manage) {
db_pandora_audit(

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.742
%define release 200114
%define release 200115
# 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.742
%define release 200114
%define release 200115
# 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.742
%define release 200114
%define release 200115
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -2188,6 +2188,7 @@ CREATE TABLE IF NOT EXISTS `tmap` (
`generation_method` INTEGER UNSIGNED NOT NULL default 0,
`generated` INTEGER UNSIGNED NOT NULL default 0,
`filter` TEXT,
`id_group_map` INT(10) UNSIGNED NOT NULL default 0,
PRIMARY KEY(`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.742-200114
Version: 7.0NG.742-200115
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.742-200114"
pandora_version="7.0NG.742-200115"
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.742";
my $pandora_build = "200114";
my $pandora_build = "200115";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

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

View File

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

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.742"
PI_BUILD="200114"
PI_BUILD="200115"
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.742 PS200114";
my $version = "7.0NG.742 PS200115";
# 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.742 PS200114";
my $version = "7.0NG.742 PS200115";
# save program name for logging
my $progname = basename($0);