Merge remote-tracking branch 'origin/develop' into ent-8310-IPAM-Campo-Ubicacion

This commit is contained in:
alejandro.campos@artica.es 2021-11-29 15:33:00 +01:00
commit 29aacb57c1
40 changed files with 200 additions and 117 deletions

View File

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

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

View File

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

View File

@ -131,7 +131,7 @@ if (!empty($files)) {
$config_url = ui_get_full_url( $config_url = ui_get_full_url(
'index.php?sec=godmode/extensions&sec2=extensions/files_repo&file_id='.$file_id 'index.php?sec=godmode/extensions&sec2=extensions/files_repo&file_id='.$file_id
); );
$data[4] .= '<a href=\"$config_url\">'; $data[4] .= "<a href=\"$config_url\">";
$data[4] .= html_print_image( $data[4] .= html_print_image(
'images/config.png', 'images/config.png',
true, true,

View File

@ -1078,8 +1078,11 @@ if ($update_agent) {
// If IP is set for deletion, delete first. // If IP is set for deletion, delete first.
if ($action_delete_ip) { if ($action_delete_ip) {
$delete_ip = get_parameter_post('address_list'); $delete_ip = get_parameter_post('address_list');
if (empty($direccion_agente) === true) {
$direccion_agente = agents_delete_address($id_agente, $delete_ip); $direccideon_agente = agents_delete_address($id_agente, $delete_ip);
} else {
agents_delete_address($id_agente, $delete_ip);
}
} }
$values = [ $values = [

View File

@ -144,7 +144,7 @@ if ($prediction_available) {
$modules['predictionserver'] = __('Create a new prediction server module'); $modules['predictionserver'] = __('Create a new prediction server module');
} }
if ($web_available) { if (is_metaconsole() === true || $web_available === '1') {
$modules['webserver'] = __('Create a new web Server module'); $modules['webserver'] = __('Create a new web Server module');
} }

View File

@ -62,7 +62,9 @@ html_print_div(
] ]
); );
require_once $config['homedir'].'/include/ajax/web_server_module_debug.php'; if (is_int($id_agent_module) && $id_agent_module !== 0) {
include_once $config['homedir'].'/include/ajax/web_server_module_debug.php';
}
define('ID_NETWORK_COMPONENT_TYPE', 7); define('ID_NETWORK_COMPONENT_TYPE', 7);

View File

@ -34,6 +34,7 @@ require_once $config['homedir'].'/include/functions_modules.php';
require_once $config['homedir'].'/include/functions_users.php'; require_once $config['homedir'].'/include/functions_users.php';
$pure = get_parameter('pure', 0); $pure = get_parameter('pure', 0);
$agent_id = get_parameter('agent_id', 0);
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
$sec = 'advanced'; $sec = 'advanced';
@ -74,6 +75,11 @@ $params['input_name'] = 'agent_name';
$params['value'] = $agentName; $params['value'] = $agentName;
$params['size'] = 24; $params['size'] = 24;
$params['metaconsole_enabled'] = false; $params['metaconsole_enabled'] = false;
$params['use_hidden_input_idagent'] = true;
$params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_id'] = 'hidden-autocomplete_id_agent';
$params['hidden_input_idagent_name'] = 'agent_id';
$params['hidden_input_idagent_value'] = $agent_id;
$form_filter .= ui_print_agent_autocomplete_input($params); $form_filter .= ui_print_agent_autocomplete_input($params);
@ -234,7 +240,7 @@ if ($searchFlag) {
$id_agents = array_keys($agents); $id_agents = array_keys($agents);
$total = agents_get_alerts_simple( $total = agents_get_alerts_simple(
$id_agents, (empty($agent_id) === false) ? ['0' => $agent_id] : $id_agents,
false, false,
false, false,
$where, $where,
@ -412,7 +418,7 @@ if ($id_agente) {
$offset = (int) get_parameter('offset'); $offset = (int) get_parameter('offset');
$simple_alerts = agents_get_alerts_simple( $simple_alerts = agents_get_alerts_simple(
$id_agents, (empty($agent_id) === false) ? ['0' => $agent_id] : $id_agents,
false, false,
[ [
'offset' => $offset, 'offset' => $offset,

View File

@ -290,7 +290,7 @@ if (is_array($config) === true
$config['history_db_host'], $config['history_db_host'],
$config['history_db_name'], $config['history_db_name'],
$config['history_db_user'], $config['history_db_user'],
$config['history_db_pass'], io_output_password($config['history_db_pass']),
$config['history_db_port'] $config['history_db_port']
); );
ob_get_clean(); ob_get_clean();

View File

@ -1309,6 +1309,14 @@ if ($get_extended_event) {
&& isset($config['event_replication']) && isset($config['event_replication'])
&& $config['event_replication'] == 1 && $config['event_replication'] == 1
&& $config['show_events_in_local'] == 1 && $config['show_events_in_local'] == 1
|| enterprise_hook(
'enterprise_acl',
[
$config['id_user'],
'eventos',
'execute_event_responses',
]
) === false
) { ) {
$readonly = true; $readonly = true;
} }

View File

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

View File

@ -760,7 +760,11 @@ function mysql_db_format_array_where_clause_sql($values, $join='AND', $prefix=fa
if ($field[0] != '`') { if ($field[0] != '`') {
// If the field is as <table>.<field>, don't scape. // If the field is as <table>.<field>, don't scape.
if (strstr($field, '.') === false) { if (strstr($field, '.') === false) {
$field = '`'.$field.'`'; if (preg_match('/(UPPER|LOWER)(.+)/mi', $field)) {
$field = preg_replace('/(UPPER|LOWER])\((.+)\)/mi', '$1(`$2`)', $field);
} else {
$field = '`'.$field.'`';
}
} }
} }

View File

@ -421,12 +421,13 @@ function agents_get_alerts_simple($id_agent=false, $filter='', $options=false, $
INNER JOIN tagente_modulo t2 INNER JOIN tagente_modulo t2
ON talert_template_modules.id_agent_module = t2.id_agente_modulo ON talert_template_modules.id_agent_module = t2.id_agente_modulo
INNER JOIN tagente t3 INNER JOIN tagente t3
ON t2.id_agente = t3.id_agente ON t2.id_agente = t3.id_agente %s
%s %s
INNER JOIN talert_templates t4 INNER JOIN talert_templates t4
ON talert_template_modules.id_alert_template = t4.id ON talert_template_modules.id_alert_template = t4.id
WHERE id_agent_module in (%s) %s %s %s', WHERE id_agent_module in (%s) %s %s %s',
$selectText, $selectText,
($id_agent !== false && is_array($id_agent)) ? 'AND t3.id_agente IN ('.implode(',', $id_agent).')' : '',
$secondary_join, $secondary_join,
$subQuery, $subQuery,
$where, $where,
@ -434,40 +435,14 @@ function agents_get_alerts_simple($id_agent=false, $filter='', $options=false, $
$orderbyText $orderbyText
); );
switch ($config['dbtype']) { $limit_sql = '';
case 'mysql': if (isset($offset) && isset($limit)) {
$limit_sql = ''; $limit_sql = " LIMIT $offset, $limit ";
if (isset($offset) && isset($limit)) {
$limit_sql = " LIMIT $offset, $limit ";
}
$sql = sprintf('%s %s', $sql, $limit_sql);
$alerts = db_get_all_rows_sql($sql);
break;
case 'postgresql':
$limit_sql = '';
if (isset($offset) && isset($limit)) {
$limit_sql = " OFFSET $offset LIMIT $limit ";
}
$sql = sprintf('%s %s', $sql, $limit_sql);
$alerts = db_get_all_rows_sql($sql);
break;
case 'oracle':
$set = [];
if (isset($offset) && isset($limit)) {
$set['limit'] = $limit;
$set['offset'] = $offset;
}
$alerts = oracle_recode_query($sql, $set, 'AND', false);
break;
} }
$sql = sprintf('%s %s', $sql, $limit_sql);
$alerts = db_get_all_rows_sql($sql);
if ($alerts === false) { if ($alerts === false) {
return []; return [];
} }

View File

@ -194,11 +194,11 @@ function custom_graphs_get_user($id_user=0, $only_names=false, $returnAllGroup=t
function custom_graphs_search($id_group, $search) function custom_graphs_search($id_group, $search)
{ {
if ($id_group != '' && $search != '') { if ($id_group != '' && $search != '') {
$all_graphs = db_get_all_rows_sql('select * from tgraph where id_group = '.$id_group.' AND name LIKE "%'.$search.'%"'); $all_graphs = db_get_all_rows_sql('select * from tgraph where id_group = '.$id_group.' AND (name LIKE "%'.$search.'%" OR description LIKE "'.$search.'")');
} else if ($id_group != '') { } else if ($id_group != '') {
$all_graphs = db_get_all_rows_sql('select * from tgraph where id_group = '.$id_group.''); $all_graphs = db_get_all_rows_sql('select * from tgraph where id_group = '.$id_group.'');
} else { } else {
$all_graphs = db_get_all_rows_sql('select * from tgraph where name LIKE "%'.$search.'%"'); $all_graphs = db_get_all_rows_sql('select * from tgraph where name LIKE "%'.$search.'%" OR description LIKE "'.$search.'"');
} }
if ($all_graphs === false) { if ($all_graphs === false) {

View File

@ -503,14 +503,14 @@ function menu_add_extras(&$menu)
$menu_extra['reporting']['sub']['enterprise/godmode/reporting/graph_template_editor']['text'] = __('Manage graph templates'); $menu_extra['reporting']['sub']['enterprise/godmode/reporting/graph_template_editor']['text'] = __('Manage graph templates');
$menu_extra['reporting']['sub']['enterprise/godmode/reporting/graph_template_item_editor']['text'] = __('Graph template items'); $menu_extra['reporting']['sub']['enterprise/godmode/reporting/graph_template_item_editor']['text'] = __('Graph template items');
$menu_extra['reporting']['sub']['enterprise/godmode/reporting/graph_template_wizard']['text'] = __('Graph template wizard'); $menu_extra['reporting']['sub']['enterprise/godmode/reporting/graph_template_wizard']['text'] = __('Graph template wizard');
$menu_extra['reporting']['sub']['godmode/reporting/reporting_builder&tab=wizard&action=wizard']['text'] = __('Templates wizard');
$menu_extra['reporting']['sub']['godmode/reporting/reporting_builder&tab=template&action=list_template']['text'] = __('Templates');
if ($config['activate_gis']) { if ($config['activate_gis']) {
$menu_extra['godgismaps']['sub']['godmode/gis_maps/configure_gis_map']['text'] = __('Manage GIS Maps'); $menu_extra['godgismaps']['sub']['godmode/gis_maps/configure_gis_map']['text'] = __('Manage GIS Maps');
} }
$menu_extra['workspace']['sub']['operation/messages/message_edit']['text'] = __('Manage messages'); $menu_extra['workspace']['sub']['operation/messages/message_edit']['text'] = __('Manage messages');
$menu_extra['gagente']['sub']['godmode/groups/configure_group']['text'] = __('Manage groups');
$menu_extra['gagente']['sub']['godmode/groups/configure_modu_group']['text'] = __('Manage module groups'); $menu_extra['gagente']['sub']['godmode/groups/configure_modu_group']['text'] = __('Manage module groups');
$menu_extra['gagente']['sub']['godmode/agentes/configure_field']['text'] = __('Manage custom field'); $menu_extra['gagente']['sub']['godmode/agentes/configure_field']['text'] = __('Manage custom field');
@ -524,6 +524,9 @@ function menu_add_extras(&$menu)
$menu_extra['workspace']['sub']['operation/incidents/incident_detail']['text'] = __('Manage incident'); $menu_extra['workspace']['sub']['operation/incidents/incident_detail']['text'] = __('Manage incident');
$menu_extra['gusuarios']['sub']['godmode/groups/configure_group']['text'] = __('Manage groups');
$menu_extra['gusuarios']['sub']['godmode/tag/edit_tag']['text'] = __('Tags management');
// Duplicate extensions as sec=extension to check it from url. // Duplicate extensions as sec=extension to check it from url.
foreach ($menu as $k => $m) { foreach ($menu as $k => $m) {
if (!isset($m['sub'])) { if (!isset($m['sub'])) {
@ -532,7 +535,9 @@ function menu_add_extras(&$menu)
foreach ($m['sub'] as $kk => $mm) { foreach ($m['sub'] as $kk => $mm) {
if (isset($mm['sec'])) { if (isset($mm['sec'])) {
$menu_extra[$mm['sec']]['sub'][$kk]['text'] = $mm['text']; if (empty($menu[$mm['sec']]['sub'][$kk]['text']) === true) {
$menu_extra[$mm['sec']]['sub'][$kk]['text'] = $mm['text'];
}
} }
} }
} }

View File

@ -1,5 +1,19 @@
/* global $, jQuery*/ /* global $, jQuery*/
/**
* Custom selector for case instensitive contains.
*/
jQuery.expr[":"].iContains = jQuery.expr.createPseudo(function(arg) {
return function(elem) {
return (
jQuery(elem)
.text()
.toUpperCase()
.indexOf(arg.toUpperCase()) >= 0
);
};
});
/** /**
* Add modules from available to selected. * Add modules from available to selected.
*/ */
@ -58,14 +72,14 @@ function filterItems(id, str) {
$("#" + id + " option[value=0]").remove(); $("#" + id + " option[value=0]").remove();
// Move not matching elements filtered to tmp-id. // Move not matching elements filtered to tmp-id.
var tmp = $("#" + id + " option:not(:contains(" + str + "))").toArray(); var tmp = $("#" + id + " option:not(:iContains(" + str + "))").toArray();
tmp.forEach(function(item) { tmp.forEach(function(item) {
$("#tmp-" + id).append(item); $("#tmp-" + id).append(item);
$(this).remove(); $(this).remove();
}); });
// Move matching filter back to id. // Move matching filter back to id.
tmp = $("#tmp-" + id + " option:contains(" + str + ")").toArray(); tmp = $("#tmp-" + id + " option:iContains(" + str + ")").toArray();
tmp.forEach(function(item) { tmp.forEach(function(item) {
$("#" + id).append(item); $("#" + id).append(item);
$(this).remove(); $(this).remove();

View File

@ -129,7 +129,7 @@
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '7.0NG.758.1'; $version = '7.0NG.758.1';
$build = '211125'; $build = '211129';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);
@ -993,8 +993,14 @@ function install_step4()
$step5 = mysqli_query( $step5 = mysqli_query(
$connection, $connection,
"CREATE USER pandora@$host IDENTIFIED BY '".$random_password."'" "CREATE USER IF NOT EXISTS pandora@$host"
); );
mysqli_query(
$connection,
"SET PASSWORD FOR 'pandora'@'".$host."' = '".$random_password."'"
);
$step5 |= mysqli_query( $step5 |= mysqli_query(
$connection, $connection,
"GRANT ALL PRIVILEGES ON `$dbname`.* to pandora@$host" "GRANT ALL PRIVILEGES ON `$dbname`.* to pandora@$host"

View File

@ -239,7 +239,8 @@ if ($free_search != '') {
WHERE id_agente IN ( WHERE id_agente IN (
SELECT id_agente SELECT id_agente
FROM tagente FROM tagente
WHERE nombre LIKE "%'.$free_search.'%") OR alias LIKE "%'.$free_search.'%")'.')'; WHERE nombre COLLATE utf8_general_ci LIKE "%'.$free_search.'%")
OR alias COLLATE utf8_general_ci LIKE "%'.$free_search.'%")'.')';
} else { } else {
$whereAlertSimple = ''; $whereAlertSimple = '';
} }

View File

@ -1009,6 +1009,18 @@ if (is_metaconsole() !== true) {
} }
} }
if (enterprise_hook(
'enterprise_acl',
[
$config['id_user'],
'eventos',
'execute_event_responses',
]
) === false
) {
$readonly = true;
}
/* /*
* Load filter form. * Load filter form.
*/ */

View File

@ -139,32 +139,32 @@ if ($searchAlerts) {
switch ($config['dbtype']) { switch ($config['dbtype']) {
case 'mysql': case 'mysql':
$whereAlerts = 'AND ( $whereAlerts = 'AND (
id_alert_template IN (SELECT id FROM talert_templates WHERE name LIKE "%'.$stringSearchSQL.'%") OR id_alert_template IN (SELECT id FROM talert_templates WHERE name COLLATE utf8_general_ci LIKE "%'.$stringSearchSQL.'%") OR
id_alert_template IN ( id_alert_template IN (
SELECT id SELECT id
FROM talert_templates FROM talert_templates
WHERE id_alert_action IN ( WHERE id_alert_action IN (
SELECT id SELECT id
FROM talert_actions FROM talert_actions
WHERE name LIKE "%'.$stringSearchSQL.'%")) OR WHERE name COLLATE utf8_general_ci LIKE "%'.$stringSearchSQL.'%")) OR
talert_template_modules.id IN ( talert_template_modules.id IN (
SELECT id_alert_template_module SELECT id_alert_template_module
FROM talert_template_module_actions FROM talert_template_module_actions
WHERE id_alert_action IN ( WHERE id_alert_action IN (
SELECT id SELECT id
FROM talert_actions FROM talert_actions
WHERE name LIKE "%'.$stringSearchSQL.'%")) OR WHERE name COLLATE utf8_general_ci LIKE "%'.$stringSearchSQL.'%")) OR
id_agent_module IN ( id_agent_module IN (
SELECT id_agente_modulo SELECT id_agente_modulo
FROM tagente_modulo FROM tagente_modulo
WHERE nombre LIKE "%'.$stringSearchSQL.'%") OR WHERE nombre COLLATE utf8_general_ci LIKE "%'.$stringSearchSQL.'%") OR
id_agent_module IN ( id_agent_module IN (
SELECT id_agente_modulo SELECT id_agente_modulo
FROM tagente_modulo FROM tagente_modulo
WHERE id_agente IN ( WHERE id_agente IN (
SELECT id_agente SELECT id_agente
FROM tagente FROM tagente
WHERE nombre LIKE "%'.$stringSearchSQL.'%" '.$extra_sql.')) WHERE nombre COLLATE utf8_general_ci LIKE "%'.$stringSearchSQL.'%" '.$extra_sql.'))
)'; )';
break; break;

View File

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

View File

@ -46,7 +46,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.758.1"; my $pandora_version = "7.0NG.758.1";
my $pandora_build = "211125"; my $pandora_build = "211129";
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.758.1"; my $pandora_version = "7.0NG.758.1";
my $pandora_build = "211125"; my $pandora_build = "211129";
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.758.1 %define version 7.0NG.758.1
%define release 211125 %define release 211129
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.758.1 %define version 7.0NG.758.1
%define release 211125 %define release 211129
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -9,7 +9,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.758.1" PI_VERSION="7.0NG.758.1"
PI_BUILD="211125" PI_BUILD="211129"
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.758.1 Build 211125"; my $version = "7.0NG.758.1 Build 211129";
# 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.758.1 Build 211125"; my $version = "7.0NG.758.1 Build 211129";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);
@ -343,6 +343,23 @@ sub update_conf_txt ($$$$) {
return $result; return $result;
} }
###############################################################################
###############################################################################
# PRINT HELP AND CHECK ERRORS FUNCTIONS
###############################################################################
###############################################################################
###############################################################################
# log wrapper
###############################################################################
sub print_log ($) {
my ($msg) = @_;
print $msg; # show message
$msg =~ s/\n+$//;
logger( $conf, "($progname) $msg", 10); # save to logging file
}
############################################################################### ###############################################################################
# Disable a entire group # Disable a entire group
@ -353,6 +370,11 @@ sub pandora_disable_group ($$$) {
my @agents_bd = []; my @agents_bd = [];
my $result = 0; my $result = 0;
if(is_metaconsole($conf) != 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) {
print_log "[ERROR] This node is configured with centralized mode. To disable a group go to metaconsole. \n\n";
exit;
}
if ($group == 0){ if ($group == 0){
# Extract all the names of the pandora agents if it is for all = 0. # Extract all the names of the pandora agents if it is for all = 0.
@agents_bd = get_db_rows ($dbh, 'SELECT nombre FROM tagente'); @agents_bd = get_db_rows ($dbh, 'SELECT nombre FROM tagente');
@ -390,6 +412,11 @@ sub pandora_enable_group ($$$) {
my @agents_bd = []; my @agents_bd = [];
my $result = 0; my $result = 0;
if(is_metaconsole($conf) != 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) {
print_log "[ERROR] This node is configured with centralized mode. To enable a group go to metaconsole. \n\n";
exit;
}
if ($group == 0){ if ($group == 0){
# Extract all the names of the pandora agents if it is for all = 0. # Extract all the names of the pandora agents if it is for all = 0.
@agents_bd = get_db_rows ($dbh, 'SELECT nombre FROM tagente'); @agents_bd = get_db_rows ($dbh, 'SELECT nombre FROM tagente');
@ -510,8 +537,12 @@ sub cli_create_snmp_trap ($$) {
sub pandora_create_user ($$$$$) { sub pandora_create_user ($$$$$) {
my ($dbh, $name, $password, $is_admin, $comments) = @_; my ($dbh, $name, $password, $is_admin, $comments) = @_;
if(is_metaconsole($conf) != 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) {
print_log "[ERROR] This node is configured with centralized mode. To create a user go to metaconsole. \n\n";
exit;
}
return db_insert ($dbh, 'id_user', 'INSERT INTO tusuario (id_user, fullname, password, comments, is_admin) return db_insert ($dbh, 'id_user', 'INSERT INTO tusuario (id_user, fullname, password, comments, is_admin)
VALUES (?, ?, ?, ?, ?)', safe_input($name), safe_input($name), $password, safe_input($comments), $is_admin); VALUES (?, ?, ?, ?, ?)', safe_input($name), safe_input($name), $password, safe_input($comments), $is_admin);
} }
@ -521,18 +552,23 @@ return db_insert ($dbh, 'id_user', 'INSERT INTO tusuario (id_user, fullname, pas
sub pandora_delete_user ($$) { sub pandora_delete_user ($$) {
my ($dbh, $name) = @_; my ($dbh, $name) = @_;
# Delete user profiles if(is_metaconsole($conf) != 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) {
db_do ($dbh, 'DELETE FROM tusuario_perfil WHERE id_usuario = ?', $name); print_log "[ERROR] This node is configured with centralized mode. To delete a user go to metaconsole. \n\n";
exit;
}
# Delete the user # Delete user profiles
my $return = db_do ($dbh, 'DELETE FROM tusuario WHERE id_user = ?', $name); db_do ($dbh, 'DELETE FROM tusuario_perfil WHERE id_usuario = ?', $name);
if($return eq '0E0') { # Delete the user
return -1; my $return = db_do ($dbh, 'DELETE FROM tusuario WHERE id_user = ?', $name);
}
else { if($return eq '0E0') {
return 0; return -1;
} }
else {
return 0;
}
} }
########################################################################## ##########################################################################
@ -749,7 +785,7 @@ sub pandora_validate_event_id ($$$) {
########################################################################## ##########################################################################
sub pandora_update_user_from_hash ($$$$) { sub pandora_update_user_from_hash ($$$$) {
my ($parameters, $where_column, $where_value, $dbh) = @_; my ($parameters, $where_column, $where_value, $dbh) = @_;
my $user_id = db_process_update($dbh, 'tusuario', $parameters, {$where_column => $where_value}); my $user_id = db_process_update($dbh, 'tusuario', $parameters, {$where_column => $where_value});
return $user_id; return $user_id;
} }
@ -976,7 +1012,7 @@ sub pandora_get_calendar_id ($$) {
sub pandora_get_same_day_id ($$) { sub pandora_get_same_day_id ($$) {
my ($dbh, $same_day) = @_; my ($dbh, $same_day) = @_;
my $weeks = { 'monday' => 1, 'tuesday' => 2, 'wednesday' => 3, 'thursday' => 4, 'friday' => 5, 'saturday' => 6, 'sunday' => 7, 'holiday' => 8}; my $weeks = { 'monday' => 1, 'tuesday' => 2, 'wednesday' => 3, 'thursday' => 4, 'friday' => 5, 'saturday' => 6, 'sunday' => 7, 'holiday' => 8 };
return defined ($weeks->{$same_day}) ? $weeks->{$same_day} : -1; return defined ($weeks->{$same_day}) ? $weeks->{$same_day} : -1;
} }
@ -998,25 +1034,6 @@ sub pandora_delete_special_day ($$) {
} }
} }
###############################################################################
###############################################################################
# PRINT HELP AND CHECK ERRORS FUNCTIONS
###############################################################################
###############################################################################
###############################################################################
# log wrapper
###############################################################################
sub print_log ($) {
my ($msg) = @_;
print $msg; # show message
$msg =~ s/\n+$//;
logger( $conf, "($progname) $msg", 10); # save to logging file
}
############################################################################### ###############################################################################
# Print a parameter error and exit the program. # Print a parameter error and exit the program.
############################################################################### ###############################################################################
@ -3037,10 +3054,15 @@ sub cli_create_user() {
sub cli_user_update() { sub cli_user_update() {
my ($user_id,$field,$new_value) = @ARGV[2..4]; my ($user_id,$field,$new_value) = @ARGV[2..4];
if(is_metaconsole($conf) != 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) {
print_log "[ERROR] This node is configured with centralized mode. To update a user go to metaconsole. \n\n";
exit;
}
my $user_exists = get_user_exists ($dbh, $user_id); my $user_exists = get_user_exists ($dbh, $user_id);
exist_check($user_exists,'user',$user_id); exist_check($user_exists,'user',$user_id);
if($field eq 'email' || $field eq 'phone' || $field eq 'is_admin' || $field eq 'language' || $field eq 'id_skin') { if($field eq 'email' || $field eq 'phone' || $field eq 'is_admin' || $field eq 'language' || $field eq 'id_skin') {
# Fields admited, no changes # Fields admited, no changes
} }
@ -5523,7 +5545,7 @@ sub cli_get_agents() {
my $head_print = 0; my $head_print = 0;
use Data::Dumper; # use Data::Dumper;
foreach my $agent (@agents) { foreach my $agent (@agents) {
@ -5850,7 +5872,12 @@ sub cli_get_planned_downtimes_items() {
sub cli_create_group() { sub cli_create_group() {
my ($group_name,$parent_group_name,$icon,$description) = @ARGV[2..5]; my ($group_name,$parent_group_name,$icon,$description) = @ARGV[2..5];
if(is_metaconsole($conf) != 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) {
print_log "[ERROR] This node is configured with centralized mode. To create a group go to metaconsole. \n\n";
exit;
}
my $group_id = get_group_id($dbh,$group_name); my $group_id = get_group_id($dbh,$group_name);
non_exist_check($group_id, 'group name', $group_name); non_exist_check($group_id, 'group name', $group_name);
@ -5922,6 +5949,11 @@ sub cli_create_group() {
sub cli_delete_group() { sub cli_delete_group() {
my ($group_name) = @ARGV[2]; my ($group_name) = @ARGV[2];
if(is_metaconsole($conf) != 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) {
print_log "[ERROR] This node is configured with centralized mode. To delete a group go to metaconsole. \n\n";
exit;
}
my $group_id = get_group_id($dbh,$group_name); my $group_id = get_group_id($dbh,$group_name);
exist_check($group_id, 'group name', $group_name); exist_check($group_id, 'group name', $group_name);
@ -5946,6 +5978,11 @@ sub cli_update_group() {
my ($group_id,$group_name,$parent_group_name,$icon,$description) = @ARGV[2..6]; my ($group_id,$group_name,$parent_group_name,$icon,$description) = @ARGV[2..6];
my $result; my $result;
if(is_metaconsole($conf) != 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) {
print_log "[ERROR] This node is configured with centralized mode. To update a group go to metaconsole. \n\n";
exit;
}
$result = get_db_value ($dbh, 'SELECT * FROM tgrupo WHERE id_grupo=?', $group_id); $result = get_db_value ($dbh, 'SELECT * FROM tgrupo WHERE id_grupo=?', $group_id);
if($result == "0E0"){ if($result == "0E0"){
@ -6144,6 +6181,11 @@ sub cli_disable_double_auth () {
sub cli_user_enable () { sub cli_user_enable () {
my $user_id = @ARGV[2]; my $user_id = @ARGV[2];
if(is_metaconsole($conf) != 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) {
print_log "[ERROR] This node is configured with centralized mode. To enable a user go to metaconsole. \n\n";
exit;
}
my $user_disabled = get_user_disabled ($dbh, $user_id); my $user_disabled = get_user_disabled ($dbh, $user_id);
exist_check($user_disabled,'user',$user_id); exist_check($user_disabled,'user',$user_id);
@ -6169,6 +6211,11 @@ sub cli_user_enable () {
sub cli_user_disable () { sub cli_user_disable () {
my $user_id = @ARGV[2]; my $user_id = @ARGV[2];
if(is_metaconsole($conf) != 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) {
print_log "[ERROR] This node is configured with centralized mode. To disable a user go to metaconsole. \n\n";
exit;
}
my $user_disabled = get_user_disabled ($dbh, $user_id); my $user_disabled = get_user_disabled ($dbh, $user_id);
exist_check($user_disabled,'user',$user_id); exist_check($user_disabled,'user',$user_id);