Merge branch 'ent-8409-bug-widget-agent-module-view' of brutus.artica.es:artica/pandorafms into ent-8409-bug-widget-agent-module-view

This commit is contained in:
Jose Gonzalez 2022-01-13 13:15:39 +01:00
commit f1fd4926a7
63 changed files with 403 additions and 201 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.759-220105 Version: 7.0NG.759-220113
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.759-220105" pandora_version="7.0NG.759-220113"
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.759'; use constant AGENT_VERSION => '7.0NG.759';
use constant AGENT_BUILD => '220105'; use constant AGENT_BUILD => '220113';
# 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.759 %define version 7.0NG.759
%define release 220105 %define release 220113
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.759 %define version 7.0NG.759
%define release 220105 %define release 220113
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.759" PI_VERSION="7.0NG.759"
PI_BUILD="220105" PI_BUILD="220113"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

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

View File

@ -115,4 +115,6 @@ enterprise/include/styles/tooltipster.bundle.min.css
mobile/include/javascript/jquery.mobile-1.3.1.js mobile/include/javascript/jquery.mobile-1.3.1.js
mobile/include/style/jquery.mobile-1.3.1.css mobile/include/style/jquery.mobile-1.3.1.css
godmode/alerts/configure_alert_special_days.php godmode/alerts/configure_alert_special_days.php
godmode/admin_access_logs.php godmode/admin_access_logs.php
enterprise/extensions/backup/main.php
enterprise/extensions/backup.php

View File

@ -1,5 +1,5 @@
START TRANSACTION; START TRANSACTION;
ALTER TABLE `tpolicy_queue` MODIFY COLUMN `progress` int(10) NOT NULL default '0'; ALTER TABLE `tpolicy_queue` MODIFY COLUMN `progress` int(10) NOT NULL default '0';
CREATE INDEX `IDX_tservice_element` ON `tservice_element`(`id_service`,`id_agente_modulo`);
COMMIT; COMMIT;

View File

@ -480,7 +480,8 @@ CREATE TABLE IF NOT EXISTS `tservice_element` (
`id_agent` int(10) unsigned NOT NULL default 0, `id_agent` int(10) unsigned NOT NULL default 0,
`id_service_child` int(10) unsigned NOT NULL default 0, `id_service_child` int(10) unsigned NOT NULL default 0,
`id_server_meta` int(10) unsigned NOT NULL default 0, `id_server_meta` int(10) unsigned NOT NULL default 0,
PRIMARY KEY (`id`) PRIMARY KEY (`id`),
INDEX `IDX_tservice_element` (`id_service`,`id_agente_modulo`)
) ENGINE=InnoDB ) ENGINE=InnoDB
COMMENT = 'Table to define the modules and the weights of the modules that define a service' COMMENT = 'Table to define the modules and the weights of the modules that define a service'
DEFAULT CHARSET=utf8; DEFAULT CHARSET=utf8;

View File

@ -2428,7 +2428,7 @@ switch ($tab) {
var aget_id_os = '<?php echo agents_get_os(modules_get_agentmodule_agent(get_parameter('id_agent_module'))); ?>'; var aget_id_os = '<?php echo agents_get_os(modules_get_agentmodule_agent(get_parameter('id_agent_module'))); ?>';
if('<?php echo modules_get_agentmodule_name(get_parameter('id_agent_module')); ?>' != $('#text-name').val() && if('<?php echo io_safe_output(modules_get_agentmodule_name(get_parameter('id_agent_module'))); ?>' != $('#text-name').val() &&
'<?php echo agents_get_os(modules_get_agentmodule_agent(get_parameter('id_agent_module'))); ?>' == 19){ '<?php echo agents_get_os(modules_get_agentmodule_agent(get_parameter('id_agent_module'))); ?>' == 19){
event.preventDefault(); event.preventDefault();
@ -2462,7 +2462,7 @@ switch ($tab) {
var module_type_snmp = '<?php echo modules_get_agentmodule_type(get_parameter('id_agent_module')); ?>'; var module_type_snmp = '<?php echo modules_get_agentmodule_type(get_parameter('id_agent_module')); ?>';
if('<?php echo modules_get_agentmodule_name(get_parameter('id_agent_module')); ?>' != $('#text-name').val() && ( if('<?php echo io_safe_output(modules_get_agentmodule_name(get_parameter('id_agent_module'))); ?>' != $('#text-name').val() && (
module_type_snmp == 15 || module_type_snmp == 16 || module_type_snmp == 17 || module_type_snmp == 18)){ module_type_snmp == 15 || module_type_snmp == 16 || module_type_snmp == 17 || module_type_snmp == 18)){
event.preventDefault(); event.preventDefault();

View File

@ -628,20 +628,20 @@ $table->data[5][1] = "
<tr><td>".ui_get_using_system_timezone_warning().'</td></tr> <tr><td>".ui_get_using_system_timezone_warning().'</td></tr>
<tr> <tr>
<td>'.__('Type Periodicity:').'&nbsp;'.html_print_select( <td>'.__('Type Periodicity:').'&nbsp;'.html_print_select(
[ [
'weekly' => __('Weekly'), 'weekly' => __('Weekly'),
'monthly' => __('Monthly'), 'monthly' => __('Monthly'),
], ],
'type_periodicity', 'type_periodicity',
$type_periodicity, $type_periodicity,
'change_type_periodicity();', 'change_type_periodicity();',
'', '',
0, 0,
true, true,
false, false,
true, true,
'', '',
$disabled_in_execution $disabled_in_execution
)."</td> )."</td>
</tr> </tr>
<tr> <tr>
@ -661,31 +661,31 @@ $table->data[5][1] = "
<tr> <tr>
<td>".__('From day:').'</td> <td>".__('From day:').'</td>
<td>'.html_print_select( <td>'.html_print_select(
$days, $days,
'periodically_day_from', 'periodically_day_from',
$periodically_day_from, $periodically_day_from,
'', '',
'', '',
0, 0,
true, true,
false, false,
true, true,
'', '',
$disabled_in_execution $disabled_in_execution
).'</td> ).'</td>
<td>'.__('To day:').'</td> <td>'.__('To day:').'</td>
<td>'.html_print_select( <td>'.html_print_select(
$days, $days,
'periodically_day_to', 'periodically_day_to',
$periodically_day_to, $periodically_day_to,
'', '',
'', '',
0, 0,
true, true,
false, false,
true, true,
'', '',
$disabled_in_execution $disabled_in_execution
).'</td> ).'</td>
<td>'.ui_print_help_tip(__('The end day must be higher than the start day'), true).'</td> <td>'.ui_print_help_tip(__('The end day must be higher than the start day'), true).'</td>
</tr> </tr>
@ -694,26 +694,26 @@ $table->data[5][1] = "
<tr> <tr>
<td>'.__('From hour:').'</td> <td>'.__('From hour:').'</td>
<td>'.html_print_input_text( <td>'.html_print_input_text(
'periodically_time_from', 'periodically_time_from',
$periodically_time_from, $periodically_time_from,
'', '',
7, 7,
7, 7,
true, true,
$disabled_in_execution $disabled_in_execution
).ui_print_help_tip( ).ui_print_help_tip(
__('The end time must be higher than the start time'), __('The end time must be higher than the start time'),
true true
).'</td> ).'</td>
<td>'.__('To hour:').'</td> <td>'.__('To hour:').'</td>
<td>'.html_print_input_text( <td>'.html_print_input_text(
'periodically_time_to', 'periodically_time_to',
$periodically_time_to, $periodically_time_to,
'', '',
7, 7,
7, 7,
true, true,
$disabled_in_execution $disabled_in_execution
).ui_print_help_tip( ).ui_print_help_tip(
__('The end time must be higher than the start time'), __('The end time must be higher than the start time'),
true true
@ -947,9 +947,7 @@ if (empty($downtimes_agents)) {
if (!$running) { if (!$running) {
$data[5] = ''; $data[5] = '';
if ($type_downtime != 'disable_agents_alerts' if ($type_downtime !== 'disable_agents') {
&& $type_downtime != 'disable_agents'
) {
$data[5] = '<a href="javascript:show_editor_module('.$downtime_agent['id_agente'].');">'.html_print_image('images/config.png', true, ['border' => '0', 'alt' => __('Delete'), 'class' => 'invert_filter']).'</a>'; $data[5] = '<a href="javascript:show_editor_module('.$downtime_agent['id_agente'].');">'.html_print_image('images/config.png', true, ['border' => '0', 'alt' => __('Delete'), 'class' => 'invert_filter']).'</a>';
} }
@ -999,13 +997,13 @@ $table->data['module'][1] = "
<td class='cell_delete_button' style='text-align: right; width:10%;' id=''>".'<a class="link_delete" <td class='cell_delete_button' style='text-align: right; width:10%;' id=''>".'<a class="link_delete"
onclick="if(!confirm(\''.__('Are you sure?').'\')) return false;" onclick="if(!confirm(\''.__('Are you sure?').'\')) return false;"
href="">'.html_print_image( href="">'.html_print_image(
'images/cross.png', 'images/cross.png',
true, true,
[ [
'border' => '0', 'border' => '0',
'alt' => __('Delete'), 'alt' => __('Delete'),
'class' => 'invert_filter', 'class' => 'invert_filter',
] ]
).'</a>'."</td> ).'</a>'."</td>
</tr> </tr>
<tr class='datos2' id='add_modules_row'> <tr class='datos2' id='add_modules_row'>

View File

@ -1134,7 +1134,7 @@ function show_add_action(id_alert) {
}, },
open: function() { open: function() {
$(`#add_action-div-${id_alert}`).css('overflow', 'hidden'); $(`#add_action-div-${id_alert}`).css('overflow', 'hidden');
$("#action_select, #action_select").select2({ $("select[id^='action_select'], select[id^='action_select']").select2({
tags: true, tags: true,
dropdownParent: $("#add_action-div-" + id_alert) dropdownParent: $("#add_action-div-" + id_alert)
}); });

View File

@ -694,10 +694,19 @@ $(document).ready (function () {
} }
} }
else { else {
var is_element_select = $("[name=field" + i + "_value]").is("select");
$("[name=field" + i + "_value]").val(old_value); $("[name=field" + i + "_value]").val(old_value);
$("[name=field" + i + "_value]").trigger('change'); if (is_element_select === true) {
$("[name=field" + i + "_value]").trigger('change');
}
$("[name=field" + i + "_recovery_value]").val(old_recovery_value); $("[name=field" + i + "_recovery_value]").val(old_recovery_value);
$("[name=field" + i + "_recovery_value]").trigger('change');
if (is_element_select === true) {
$("[name=field" + i + "_recovery_value]").trigger('change');
}
} }
} }
else { else {

View File

@ -406,6 +406,7 @@ if (check_acl($config['id_user'], 0, 'PM') || check_acl($config['id_user'], 0, '
$sub['extensions/dbmanager']['text'] = __('DB Interface'); $sub['extensions/dbmanager']['text'] = __('DB Interface');
$sub['extensions/dbmanager']['id'] = 'DB Interface'; $sub['extensions/dbmanager']['id'] = 'DB Interface';
$sub['extensions/dbmanager']['sec'] = 'gbman'; $sub['extensions/dbmanager']['sec'] = 'gbman';
enterprise_hook('dbBackupManager');
enterprise_hook('elasticsearch_interface_menu'); enterprise_hook('elasticsearch_interface_menu');
} }
} }

View File

@ -36,6 +36,7 @@ $ajax = true;
$render_map = (bool) get_parameter('render_map', false); $render_map = (bool) get_parameter('render_map', false);
$graph_javascript = (bool) get_parameter('graph_javascript', false); $graph_javascript = (bool) get_parameter('graph_javascript', false);
$force_remote_check = (bool) get_parameter('force_remote_check', false);
if ($render_map) { if ($render_map) {
$width = (int) get_parameter('width', '400'); $width = (int) get_parameter('width', '400');
@ -55,3 +56,36 @@ if ($render_map) {
); );
return; return;
} }
if ($force_remote_check) {
$id_layout = (int) get_parameter('id_layout', false);
$data = db_get_all_rows_sql(
sprintf(
'SELECT id_agent FROM tlayout_data WHERE id_layout = %d AND id_agent <> 0',
$id_layout
)
);
if (empty($data)) {
echo '0';
} else {
$ids = [];
foreach ($data as $key => $value) {
$ids[] = $value['id_agent'];
}
$sql = sprintf(
'UPDATE `tagente_modulo` SET flag = 1 WHERE `id_agente` IN (%s)',
implode(',', $ids)
);
$result = db_process_sql($sql);
if ($result) {
echo true;
} else {
echo '0';
}
}
return;
}

View File

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

View File

@ -874,10 +874,10 @@ function mysql_db_format_array_where_clause_sql($values, $join='AND', $prefix=fa
* *
* @return the first value of the first row of a table result from query. * @return the first value of the first row of a table result from query.
*/ */
function mysql_db_get_value_sql($sql, $dbconnection=false) function mysql_db_get_value_sql($sql, $dbconnection=false, $search_history_db=false)
{ {
$sql .= ' LIMIT 1'; $sql .= ' LIMIT 1';
$result = mysql_db_get_all_rows_sql($sql, false, true, $dbconnection); $result = mysql_db_get_all_rows_sql($sql, $search_history_db, true, $dbconnection);
if ($result === false) { if ($result === false) {
return false; return false;

View File

@ -977,10 +977,10 @@ function oracle_recode_query($sql, $values, $join='AND', $return=true)
* *
* @return the first value of the first row of a table result from query. * @return the first value of the first row of a table result from query.
*/ */
function oracle_db_get_value_sql($sql, $dbconnection=false) function oracle_db_get_value_sql($sql, $dbconnection=false, $search_history_db=false)
{ {
$sql = 'SELECT * FROM ('.$sql.') WHERE rownum < 2'; $sql = 'SELECT * FROM ('.$sql.') WHERE rownum < 2';
$result = oracle_db_get_all_rows_sql($sql, false, true, $dbconnection); $result = oracle_db_get_all_rows_sql($sql, $search_history_db, true, $dbconnection);
if ($result === false) { if ($result === false) {
return false; return false;

View File

@ -686,10 +686,10 @@ function postgresql_db_format_array_where_clause_sql($values, $join='AND', $pref
* *
* @return the first value of the first row of a table result from query. * @return the first value of the first row of a table result from query.
*/ */
function postgresql_db_get_value_sql($sql, $dbconnection=false) function postgresql_db_get_value_sql($sql, $dbconnection=false, $search_history_db=false)
{ {
$sql .= ' LIMIT 1'; $sql .= ' LIMIT 1';
$result = postgresql_db_get_all_rows_sql($sql, false, true, $dbconnection); $result = postgresql_db_get_all_rows_sql($sql, $search_history_db, true, $dbconnection);
if ($result === false) { if ($result === false) {
return false; return false;

View File

@ -162,9 +162,13 @@ function agents_locate_agent(string $field)
* *
* @return array|boolean Agents ids or false if error. * @return array|boolean Agents ids or false if error.
*/ */
function agents_get_agent_id_by_alias($alias) function agents_get_agent_id_by_alias($alias, $is_metaconsole=false)
{ {
return db_get_all_rows_sql("SELECT id_agente FROM tagente WHERE upper(alias) LIKE upper('%$alias%')"); if ($is_metaconsole === true) {
return db_get_all_rows_sql("SELECT id_tagente FROM tmetaconsole_agent WHERE upper(alias) LIKE upper('%$alias%')");
} else {
return db_get_all_rows_sql("SELECT id_agente FROM tagente WHERE upper(alias) LIKE upper('%$alias%')");
}
} }

View File

@ -9925,12 +9925,19 @@ function otherParameter2Filter($other, $return_as_array=false, $use_agent_name=f
if (isset($other['data'][2]) && $other['data'][2] != '') { if (isset($other['data'][2]) && $other['data'][2] != '') {
if ($use_agent_name === false) { if ($use_agent_name === false) {
$idAgents = agents_get_agent_id_by_alias($other['data'][2]); $idAgents = agents_get_agent_id_by_alias($other['data'][2], is_metaconsole());
if (!empty($idAgents)) { if (!empty($idAgents)) {
$idAgent = []; $idAgent = [];
$id_agent_field = 'id_agente';
if (is_metaconsole() === true) {
$id_agent_field = 'id_tagente';
}
foreach ($idAgents as $key => $value) { foreach ($idAgents as $key => $value) {
$idAgent[] .= $value['id_agente']; $idAgent[] .= $value[$id_agent_field];
} }
$filter[] = 'id_agente IN ('.implode(',', $idAgent).')'; $filter[] = 'id_agente IN ('.implode(',', $idAgent).')';
@ -9985,6 +9992,10 @@ function otherParameter2Filter($other, $return_as_array=false, $use_agent_name=f
} }
} }
if (isset($idTemplate) && $idTemplate != '') {
$filter['id_alert_template'] = $idTemplate;
}
if (isset($other['data'][5]) && $other['data'][5] != '') { if (isset($other['data'][5]) && $other['data'][5] != '') {
$filter['id_usuario'] = $other['data'][5]; $filter['id_usuario'] = $other['data'][5];
} }
@ -11434,7 +11445,7 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
global $config; global $config;
$table_events = 'tevento'; $table_events = 'tevento';
if (defined('METACONSOLE')) { if (is_metaconsole() === true) {
$table_events = 'tmetaconsole_event'; $table_events = 'tmetaconsole_event';
} }
@ -11451,10 +11462,9 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
$event_view_hr = 0; $event_view_hr = 0;
$tag = ''; $tag = '';
$group_rep = 0; $group_rep = 0;
$offset = 0;
$pagination = 40;
$utimestamp_upper = 0; $utimestamp_upper = 0;
$utimestamp_bottom = 0; $utimestamp_bottom = 0;
$id_alert_template = -1;
$use_agent_name = ($other['data'][16] === '1') ? true : false; $use_agent_name = ($other['data'][16] === '1') ? true : false;
@ -11469,7 +11479,7 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
} }
if (isset($filter['id_agentmodule'])) { if (isset($filter['id_agentmodule'])) {
$id_agentmodule = $filter['id_agentmodule']; $id_agentmodule = $filter['id_agentmodule'][0];
} }
if (isset($filter['id_alert_am'])) { if (isset($filter['id_alert_am'])) {
@ -11488,12 +11498,8 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
$search = $filter['evento']; $search = $filter['evento'];
} }
if (isset($filter['limit'])) { if (isset($filter['id_alert_template'])) {
$pagination = $filter['limit']; $id_alert_template = $filter['id_alert_template'];
}
if (isset($filter['offset'])) {
$offset = $filter['offset'];
} }
$id_group = (int) $filter['id_group']; $id_group = (int) $filter['id_group'];
@ -11611,10 +11617,6 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
$sql_post .= ' AND id_agentmodule = '.$id_agentmodule; $sql_post .= ' AND id_agentmodule = '.$id_agentmodule;
} }
if ($id_alert_am != -1) {
$sql_post .= ' AND id_alert_am = '.$id_alert_am;
}
if ($id_event != -1) { if ($id_event != -1) {
$sql_post .= ' AND id_evento = '.$id_event; $sql_post .= ' AND id_evento = '.$id_event;
} }
@ -11647,6 +11649,21 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
$sql_post .= ' AND ('.$filter['sql'].') '; $sql_post .= ' AND ('.$filter['sql'].') ';
} }
// Inject agent ID filter (it is set as the first numeric key in filter array).
if (isset($filter[0]) === true) {
$sql_post .= ' AND '.$filter[0];
}
if ($id_alert_template !== -1) {
$sql_post .= ' AND talert_template_modules.id_alert_template = '.$id_alert_template;
}
$alert_join = '';
if ($id_alert_template !== -1) {
$alert_join = ' INNER JOIN talert_template_modules ON '.$table_events.'.id_alert_am=talert_template_modules.id';
}
if ($group_rep == 0) { if ($group_rep == 0) {
switch ($config['dbtype']) { switch ($config['dbtype']) {
case 'mysql': case 'mysql':
@ -11661,7 +11678,7 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
ORDER BY criticity DESC ORDER BY criticity DESC
LIMIT 1'; LIMIT 1';
} else { } else {
if (defined('METACONSOLE')) { if (is_metaconsole() === true) {
$sql = 'SELECT *, $sql = 'SELECT *,
(SELECT t2.nombre (SELECT t2.nombre
FROM tgrupo t2 FROM tgrupo t2
@ -11669,10 +11686,9 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
(SELECT t2.icon (SELECT t2.icon
FROM tgrupo t2 FROM tgrupo t2
WHERE t2.id_grupo = '.$table_events.'.id_grupo) AS group_icon WHERE t2.id_grupo = '.$table_events.'.id_grupo) AS group_icon
FROM '.$table_events.' FROM '.$table_events.$alert_join.'
WHERE 1=1 '.$sql_post.' WHERE 1=1 '.$sql_post.'
ORDER BY utimestamp DESC ORDER BY utimestamp DESC';
LIMIT '.$offset.','.$pagination;
} else { } else {
$sql = 'SELECT *, $sql = 'SELECT *,
(SELECT t1.alias (SELECT t1.alias
@ -11690,10 +11706,9 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
SELECT tagente_modulo.id_modulo SELECT tagente_modulo.id_modulo
FROM tagente_modulo FROM tagente_modulo
WHERE tagente_modulo.id_agente_modulo=tevento.id_agentmodule)) AS module_name WHERE tagente_modulo.id_agente_modulo=tevento.id_agentmodule)) AS module_name
FROM '.$table_events.' FROM '.$table_events.$alert_join.'
WHERE 1=1 '.$sql_post.' WHERE 1=1 '.$sql_post.'
ORDER BY utimestamp DESC ORDER BY utimestamp DESC';
LIMIT '.$offset.','.$pagination;
} }
} }
break; break;
@ -11718,15 +11733,12 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
WHERE tagente_modulo.id_agente_modulo=tevento.id_agentmodule)) AS module_name WHERE tagente_modulo.id_agente_modulo=tevento.id_agentmodule)) AS module_name
FROM tevento FROM tevento
WHERE 1=1 '.$sql_post.' WHERE 1=1 '.$sql_post.'
ORDER BY utimestamp DESC ORDER BY utimestamp DESC';
LIMIT '.$pagination.' OFFSET '.$offset;
break; break;
case 'oracle': case 'oracle':
// TODO TOTAL // TODO TOTAL
$set = []; $set = [];
$set['limit'] = $pagination;
$set['offset'] = $offset;
$sql = 'SELECT *, $sql = 'SELECT *,
(SELECT t1.alias (SELECT t1.alias
@ -11764,8 +11776,7 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
FROM ".$table_events.' FROM ".$table_events.'
WHERE 1=1 '.$sql_post.' WHERE 1=1 '.$sql_post.'
GROUP BY evento, id_agentmodule GROUP BY evento, id_agentmodule
ORDER BY timestamp_rep DESC ORDER BY timestamp_rep DESC';
LIMIT '.$offset.','.$pagination;
break; break;
case 'postgresql': case 'postgresql':
@ -11776,14 +11787,11 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
FROM ".$table_events.' FROM ".$table_events.'
WHERE 1=1 '.$sql_post.' WHERE 1=1 '.$sql_post.'
GROUP BY evento, id_agentmodule GROUP BY evento, id_agentmodule
ORDER BY timestamp_rep DESC ORDER BY timestamp_rep DESC';
LIMIT '.$pagination.' OFFSET '.$offset;
break; break;
case 'oracle': case 'oracle':
$set = []; $set = [];
$set['limit'] = $pagination;
$set['offset'] = $offset;
// TODO: Remove duplicate user comments // TODO: Remove duplicate user comments
$sql = 'SELECT a.*, b.event_rep, b.timestamp_rep $sql = 'SELECT a.*, b.event_rep, b.timestamp_rep
FROM (SELECT * FROM (SELECT *
@ -11971,7 +11979,7 @@ function api_set_event($id_event, $unused1, $params, $unused2, $unused3)
* @param $returnType * @param $returnType
* @param $user_in_db * @param $user_in_db
*/ */
function api_get_events($trash1, $trash2, $other, $returnType, $user_in_db=null) function api_get_events($node_id, $trash2, $other, $returnType, $user_in_db=null)
{ {
if ($user_in_db !== null) { if ($user_in_db !== null) {
$correct = get_events_with_user( $correct = get_events_with_user(
@ -12016,6 +12024,10 @@ function api_get_events($trash1, $trash2, $other, $returnType, $user_in_db=null)
} }
if (is_metaconsole()) { if (is_metaconsole()) {
if ((int) $node_id !== 0) {
$filterString .= ' AND server_id = '.$node_id;
}
$dataRows = db_get_all_rows_filter('tmetaconsole_event', $filterString); $dataRows = db_get_all_rows_filter('tmetaconsole_event', $filterString);
} else { } else {
$dataRows = db_get_all_rows_filter('tevento', $filterString); $dataRows = db_get_all_rows_filter('tevento', $filterString);

View File

@ -414,21 +414,21 @@ function db_get_value_filter($field, $table, $filter, $where_join='AND', $search
* *
* @return mixed the first value of the first row of a table result from query. * @return mixed the first value of the first row of a table result from query.
*/ */
function db_get_value_sql($sql, $dbconnection=false) function db_get_value_sql($sql, $dbconnection=false, $search_history_db=false)
{ {
global $config; global $config;
switch ($config['dbtype']) { switch ($config['dbtype']) {
case 'mysql': case 'mysql':
return mysql_db_get_value_sql($sql, $dbconnection); return mysql_db_get_value_sql($sql, $dbconnection, $search_history_db);
break; break;
case 'postgresql': case 'postgresql':
return postgresql_db_get_value_sql($sql, $dbconnection); return postgresql_db_get_value_sql($sql, $dbconnection, $search_history_db);
break; break;
case 'oracle': case 'oracle':
return oracle_db_get_value_sql($sql, $dbconnection); return oracle_db_get_value_sql($sql, $dbconnection, $search_history_db);
break; break;
} }

View File

@ -609,24 +609,15 @@ function groups_get_groups_tree_recursive($groups, $trash=0, $trash2=0)
* *
* @return integer Status of the agents. * @return integer Status of the agents.
*/ */
function groups_get_status($id_group=0, $strict_user=false) function groups_get_status($id_group=0, $ignore_alerts=false)
{ {
global $config; global $config;
include_once $config['homedir'].'/include/functions_reporting.php'; include_once $config['homedir'].'/include/functions_reporting.php';
if ($strict_user) { $data = reporting_get_group_stats_resume($id_group);
$acltags = tags_get_user_groups_and_tags($config['id_user'], 'AR', $strict_user);
$group_status = group_get_data($config['id_user'], $strict_user, $acltags, false, 'group');
$data['monitor_alerts_fired'] = $groups_status['_monitors_alerts_fired_'];
$data['agent_critical'] = $groups_status['_agents_critical_'];
$data['agent_warning'] = $groups_status['_agents_warning_'];
$data['agent_unknown'] = $groups_status['_agents_unknown_'];
} else {
$data = reporting_get_group_stats_resume($id_group);
}
if ($data['monitor_alerts_fired'] > 0) { if ($data['monitor_alerts_fired'] > 0 && $ignore_alerts == false) {
return AGENT_STATUS_ALERT_FIRED; return AGENT_STATUS_ALERT_FIRED;
} else if ($data['agent_critical'] > 0) { } else if ($data['agent_critical'] > 0) {
return AGENT_STATUS_CRITICAL; return AGENT_STATUS_CRITICAL;

View File

@ -2425,6 +2425,38 @@ function html_print_div(
} }
/**
* Render an <pre> tag for show code.
* For debug purposes, see for `hd()` function.
*
* @param string $content Content of tag.
* @param boolean $return Return the tag string formed.
* @param array $attributes Attributes availables for pre tags.
*
* @return string
*/
function html_print_code(
string $content,
bool $return=true,
array $attributes=[]
) {
$output = '<pre';
if (empty($attributes) === false) {
foreach ($attributes as $attribute => $value) {
$output .= ' '.$attribute.'="'.io_safe_input_html($value).'"';
}
}
$output .= sprintf('>%s</pre>', $content);
if ($return === true) {
return $output;
} else {
echo $output;
}
}
/** /**
* Render an anchor <a> html element. * Render an anchor <a> html element.
* *

View File

@ -545,11 +545,12 @@ function io_input_password($password)
* Process the given password read from the Pandora FMS Database, * Process the given password read from the Pandora FMS Database,
* decrypting it if necessary. * decrypting it if necessary.
* *
* @param string password Password read from the DB. * @param string $password Password read from the DB.
* @param string $wrappedBy Wrap the password with the informed character.
* *
* @return string The processed password. * @return string The processed password.
*/ */
function io_output_password($password) function io_output_password($password, $wrappedBy='')
{ {
global $config; global $config;
@ -562,11 +563,14 @@ function io_output_password($password)
] ]
); );
if ($plaintext === ENTERPRISE_NOT_HOOK) { $output = ($plaintext === ENTERPRISE_NOT_HOOK) ? $password : $plaintext;
return io_safe_output($password);
}
return io_safe_output($plaintext); return sprintf(
'%s%s%s',
$wrappedBy,
io_safe_output($output),
$wrappedBy
);
} }

View File

@ -8775,6 +8775,8 @@ function reporting_increment($report, $content)
$return['data'] = []; $return['data'] = [];
$search_in_history_db = db_search_in_history_db($return['from']);
if (is_metaconsole()) { if (is_metaconsole()) {
$sql1 = 'SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.' $sql1 = 'SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.'
AND utimestamp <= '.(time() - $period).' ORDER BY utimestamp DESC'; AND utimestamp <= '.(time() - $period).' ORDER BY utimestamp DESC';
@ -8801,17 +8803,23 @@ function reporting_increment($report, $content)
$connection = false; $connection = false;
} }
$old_data = db_get_value_sql($sql1); $old_data = db_get_value_sql($sql1, false, $search_in_history_db);
$last_data = db_get_value_sql($sql2); $last_data = db_get_value_sql($sql2, false, $search_in_history_db);
} }
} else { } else {
$old_data = db_get_value_sql( $old_data = db_get_value_sql(
'SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.' 'SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.'
AND utimestamp <= '.(time() - $period).' ORDER BY utimestamp DESC' AND utimestamp <= '.(time() - $period).' ORDER BY utimestamp DESC',
false,
$search_in_history_db
); );
$last_data = db_get_value_sql('SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.' ORDER BY utimestamp DESC'); $last_data = db_get_value_sql(
'SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.' ORDER BY utimestamp DESC',
false,
$search_in_history_db
);
} }
if (!is_metaconsole()) { if (!is_metaconsole()) {

View File

@ -1347,7 +1347,16 @@ function servers_get_server_string_name(int $server)
return __('WUX server'); return __('WUX server');
case SERVER_TYPE_ENTERPRISE_SATELLITE: case SERVER_TYPE_ENTERPRISE_SATELLITE:
return __('Satellite'); return __('Satellite server');
case SERVER_TYPE_ENTERPRISE_TRANSACTIONAL:
return __('Transactional server');
case SERVER_TYPE_ALERT:
return __('Alert server');
case SERVER_TYPE_NCM:
return __('NCM server');
default: default:
return __('N/A'); return __('N/A');

View File

@ -3420,7 +3420,7 @@ function visual_map_get_status_element($layoutData)
break; break;
case GROUP_ITEM: case GROUP_ITEM:
$group_status = groups_get_status($layoutData['id_group']); $group_status = groups_get_status($layoutData['id_group'], true);
switch ($group_status) { switch ($group_status) {
case AGENT_STATUS_ALERT_FIRED: case AGENT_STATUS_ALERT_FIRED:

View File

@ -437,25 +437,23 @@ function pandoraFlotHBars(
var format = new Array(); var format = new Array();
for (var i = 0; i < labels_total.length; i++) { for (var i = 0; i < labels_total.length; i++) {
var label = labels_total[i][1]; var label = labels_total[i][1];
// var shortLabel = reduceText(label, 25);
var title = label;
if (label.length > 30) {
label = reduceText(label, 30);
}
var div_attributes = var div_attributes =
'style="font-size:' + 'style="font-size:' +
font_size + font_size +
"pt !important;" + "pt !important;" +
" margin: 0; max-width: 150px;" + "margin: 0; max-width: 200px;" +
"margin-right:5px"; "margin-right:5px;" +
+"margin-left: -1.5em"; "margin-left: -1.5em" +
+"text-align: right"; "text-align: right" +
"text-overflow: ellipsis;" +
"overflow: hidden;" +
"white-space: pre;";
if (label.indexOf("<br>") != -1) { if (label.indexOf("<br>") != -1) {
div_attributes += "min-height: 2.5em;"; div_attributes += "min-height: 2.5em;";
} }
div_attributes += '" title="' + title + '" style="overflow: hidden;"'; div_attributes += '" title="' + label + '" style="overflow: hidden;"';
format.push([i, "<div " + div_attributes + ">" + label + "</div>"]); format.push([i, "<div " + div_attributes + ">" + label + "</div>"]);
} }
@ -3270,5 +3268,6 @@ function reduceText(text, maxLength) {
if (text.length <= maxLength) return text; if (text.length <= maxLength) return text;
var firstSlideEnd = parseInt((maxLength - 3) / 1.6); var firstSlideEnd = parseInt((maxLength - 3) / 1.6);
var str_cut = text.substr(0, firstSlideEnd); var str_cut = text.substr(0, firstSlideEnd);
return str_cut + "...<br>" + text.substr(-firstSlideEnd - 3); //return str_cut + "...<br>" + text.substr(-firstSlideEnd - 3);
return str_cut + "..." + text.substr(-firstSlideEnd - 3);
} }

View File

@ -389,7 +389,7 @@ function initialiceLayout(data) {
widgetId: widgetId widgetId: widgetId
}, },
width: widgetId == 14 || widgetId == 2 || widgetId == 23 ? 750 : 450, width: widgetId == 14 || widgetId == 2 || widgetId == 23 ? 750 : 450,
maxHeight: 600, maxHeight: 610,
minHeight: 400 minHeight: 400
}, },
onsubmit: { onsubmit: {

View File

@ -976,6 +976,11 @@ var TreeController = {
"</span>" "</span>"
); );
// Avoiding 'undefined' text.
if (typeof element.value === "undefined") {
element.value = "";
}
// Value. // Value.
$content.append( $content.append(
'<span class="module-value">' + element.value + "</span>" '<span class="module-value">' + element.value + "</span>"

View File

@ -323,11 +323,22 @@ class MapsStatusWidget extends Widget
$data = []; $data = [];
$url = $config['homeurl']; $url = $config['homeurl'];
$url .= 'index.php?sec=visualc'; if (\is_metaconsole() === true) {
$url .= '&sec2=operation/visual_console/render_view&refr=60'; $url .= sprintf(
'index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=0&refr=%s&id_visualmap=%s',
$config['vc_refr'],
$id_layout
);
} else {
$url .= sprintf(
'index.php?sec=visualc&sec2=operation/visual_console/render_view&refr=%s&id=%s',
$config['vc_refr'],
$id_layout
);
}
// This will give us the group name. // This will give us the group name.
$data[0] = '<a href="'.$url.'&id='.$id_layout.'">'; $data[0] = '<a href="'.$url.'">';
$data[0] .= $user_layouts[$id_layout]['name']; $data[0] .= $user_layouts[$id_layout]['name'];
$data[0] .= '</a>'; $data[0] .= '</a>';

View File

@ -253,6 +253,14 @@ class NetworkMapWidget extends Widget
// Retrieve global - common inputs. // Retrieve global - common inputs.
$inputs = parent::getFormInputs(); $inputs = parent::getFormInputs();
$inputs[] = [
'label' => \ui_print_info_message(
__('It is recommended to have only one such widget in the control panel.'),
'',
true
),
];
// Default values. // Default values.
if (isset($values['xOffset']) === false) { if (isset($values['xOffset']) === false) {
$values['xOffset'] = 0; $values['xOffset'] = 0;

View File

@ -455,6 +455,7 @@ class TopNWidget extends Widget
$data_hbar = []; $data_hbar = [];
foreach ($modules as $module) { foreach ($modules as $module) {
$module['aliasAgent'] = ui_print_truncate_text($module['aliasAgent'], 20);
$item_name = ''; $item_name = '';
$item_name = $module['aliasAgent'].' - '.$module['nameModule']; $item_name = $module['aliasAgent'].' - '.$module['nameModule'];
$data_hbar[$item_name]['g'] = $module[$display]; $data_hbar[$item_name]['g'] = $module[$display];

View File

@ -346,9 +346,7 @@ final class Group extends Item
$countStatus = \db_get_row_sql($sql); $countStatus = \db_get_row_sql($sql);
if ($countStatus['fired'] > 0) { if ($countStatus['critical'] > 0) {
$status = AGENT_STATUS_ALERT_FIRED;
} else if ($countStatus['critical'] > 0) {
$status = AGENT_STATUS_CRITICAL; $status = AGENT_STATUS_CRITICAL;
} else if ($countStatus['warning'] > 0) { } else if ($countStatus['warning'] > 0) {
$status = AGENT_STATUS_WARNING; $status = AGENT_STATUS_WARNING;
@ -359,7 +357,7 @@ final class Group extends Item
} }
} else { } else {
// Get the status img src. // Get the status img src.
$status = \groups_get_status($groupId); $status = \groups_get_status($groupId, true);
} }
$imagePath = \visual_map_get_image_status_element($data, $status); $imagePath = \visual_map_get_image_status_element($data, $status);

View File

@ -8435,6 +8435,12 @@ div.stat-win-spinner img {
font-size: 12px; font-size: 12px;
} }
/* For backups dt, can be useful for others */
#backups_list > thead > tr > th:last-child,
#backups_list > tbody > tr > td:last-child {
text-align: center;
}
/* err_msg_centralised */ /* err_msg_centralised */
div#err_msg_centralised div { div#err_msg_centralised div {
margin-top: 1em; margin-top: 1em;

View File

@ -424,6 +424,8 @@ if (! isset($config['id_user'])) {
// Process logout. // Process logout.
include 'general/logoff.php'; include 'general/logoff.php';
} }
$validatedCSRF = true;
} else { } else {
// process_user_login is a virtual function which should be defined in each auth file. // process_user_login is a virtual function which should be defined in each auth file.
// It accepts username and password. The rest should be internal to the auth file. // It accepts username and password. The rest should be internal to the auth file.

View File

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

View File

@ -330,7 +330,7 @@ enterprise_hook('close_meta_frame');
<script type="text/javascript"> <script type="text/javascript">
var treeController = TreeController.getController(); var treeController = TreeController.getController();
processTreeSearch(); processTreeSearch();
$("form#tree_search").submit(function(e) { $("form#tree_search").submit(function(e) {

View File

@ -186,6 +186,8 @@ if (isset($_GET['modified']) && !$view_mode) {
} else { } else {
if (!empty($password_new) && !empty($password_confirm)) { if (!empty($password_new) && !empty($password_confirm)) {
$success_msg = __('Password successfully updated'); $success_msg = __('Password successfully updated');
} else if ($upd_info['id_skin'] !== $user_info['id_skin']) {
$success_msg = __('Skin successfully updated');
} else { } else {
$return = false; $return = false;
$error_msg = __('No changes have been made'); $error_msg = __('No changes have been made');
@ -549,13 +551,13 @@ $table_ichanges = '<div class="autorefresh_select">
</div> </div>
<div class="autorefresh_select_arrows" style="display:grid"> <div class="autorefresh_select_arrows" style="display:grid">
<a href="javascript:">'.html_print_image( <a href="javascript:">'.html_print_image(
'images/darrowright_green.png', 'images/darrowright_green.png',
true, true,
[ [
'id' => 'right_autorefreshlist', 'id' => 'right_autorefreshlist',
'alt' => __('Push selected pages into autorefresh list'), 'alt' => __('Push selected pages into autorefresh list'),
'title' => __('Push selected pages into autorefresh list'), 'title' => __('Push selected pages into autorefresh list'),
] ]
).'</a> ).'</a>
<a href="javascript:">'.html_print_image( <a href="javascript:">'.html_print_image(
'images/darrowleft_green.png', 'images/darrowleft_green.png',

View File

@ -398,6 +398,17 @@ if ($pure === false) {
echo '</div>'; echo '</div>';
if ($aclWrite === true || $aclManage === true) { if ($aclWrite === true || $aclManage === true) {
if (!is_metaconsole()) {
echo '<a id ="force_check" href="" style="margin-right: 25px;">'.html_print_image(
'images/target.png',
true,
[
'title' => __('Force remote checks'),
'class' => 'invert_filter',
]
).'</a>';
}
echo html_print_checkbox_switch('edit-mode', 1, false, true); echo html_print_checkbox_switch('edit-mode', 1, false, true);
} }
@ -671,12 +682,14 @@ if ($edit_capable === true) {
if ($(this).prop('checked')) { if ($(this).prop('checked')) {
visualConsoleManager.visualConsole.enableEditMode(); visualConsoleManager.visualConsole.enableEditMode();
visualConsoleManager.changeUpdateInterval(0); visualConsoleManager.changeUpdateInterval(0);
$('#force_check').hide();
$('#edit-controls').css('visibility', ''); $('#edit-controls').css('visibility', '');
} else { } else {
visualConsoleManager.visualConsole.disableEditMode(); visualConsoleManager.visualConsole.disableEditMode();
visualConsoleManager.visualConsole.unSelectItems(); visualConsoleManager.visualConsole.unSelectItems();
visualConsoleManager.changeUpdateInterval(<?php echo ($refr * 1000); ?>); // To ms. visualConsoleManager.changeUpdateInterval(<?php echo ($refr * 1000); ?>); // To ms.
$('#edit-controls').css('visibility', 'hidden'); $('#edit-controls').css('visibility', 'hidden');
$('#force_check').show();
} }
}); });
<?php <?php
@ -750,6 +763,37 @@ if ($edit_capable === true) {
}); });
$('#force_check').click(function (e) {
e.preventDefault();
visualConsoleManager.changeUpdateInterval(0);
const id_layout = '<?php echo $visualConsoleId; ?>';
$.ajax({
type: "GET",
url: "ajax.php",
dataType: "json",
data: {
page: "include/ajax/visual_console.ajax",
force_remote_check: true,
id_layout: id_layout
},
success: function (data) {
if (data == 1) {
visualConsoleManager.changeUpdateInterval(5000);
setTimeout(resetInterval, 6000);
} else {
resetInterval();
}
},
error: function (data) {
resetInterval();
}
});
});
function resetInterval() {
visualConsoleManager.changeUpdateInterval(<?php echo ($refr * 1000); ?>);
}
/** /**
* Process ajax responses and shows a dialog with results. * Process ajax responses and shows a dialog with results.
*/ */

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.759 %define version 7.0NG.759
%define release 220105 %define release 220113
# 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.759 %define version 7.0NG.759
%define release 220105 %define release 220113
# 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.759 %define version 7.0NG.759
%define release 220105 %define release 220113
%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

@ -2856,7 +2856,8 @@ CREATE TABLE IF NOT EXISTS `tservice_element` (
`id_service_child` int(10) unsigned NOT NULL default 0, `id_service_child` int(10) unsigned NOT NULL default 0,
`id_server_meta` int(10) unsigned NOT NULL default 0, `id_server_meta` int(10) unsigned NOT NULL default 0,
`rules` text, `rules` text,
PRIMARY KEY (`id`) PRIMARY KEY (`id`),
INDEX `IDX_tservice_element` (`id_service`,`id_agente_modulo`)
) ENGINE=InnoDB ) ENGINE=InnoDB
COMMENT = 'Table to define the modules and the weights of the modules that define a service' COMMENT = 'Table to define the modules and the weights of the modules that define a service'
DEFAULT CHARSET=utf8; DEFAULT CHARSET=utf8;

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.759-220105 Version: 7.0NG.759-220113
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.759-220105" pandora_version="7.0NG.759-220113"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

@ -348,6 +348,9 @@ fsnmp /usr/bin/pandorafsnmp
autocreate_group 10 autocreate_group 10
# Works like autocreate_group, except the name of the group is specified (instead of its id). Do not set both.
#autocreate_group_name Unknown
# If set to 1, new agents will be added to the group specified by autocreate_group (the group specified by the agent will be used as fallback). # If set to 1, new agents will be added to the group specified by autocreate_group (the group specified by the agent will be used as fallback).
# If set to 0, new agents will be added to the group specified by the agent (the group specified by autocreate_group will be used as fallback). # If set to 0, new agents will be added to the group specified by the agent (the group specified by autocreate_group will be used as fallback).

View File

@ -274,6 +274,9 @@ dataserver_threads 2
autocreate_group 10 autocreate_group 10
# Works like autocreate_group, except the name of the group is specified (instead of its id). Do not set both.
#autocreate_group_name Unknown
# If set to 1, new agents will be added to the group specified by autocreate_group (the group specified by the agent will be used as fallback). # If set to 1, new agents will be added to the group specified by autocreate_group (the group specified by the agent will be used as fallback).
# If set to 0, new agents will be added to the group specified by the agent (the group specified by autocreate_group will be used as fallback). # If set to 0, new agents will be added to the group specified by the agent (the group specified by autocreate_group will be used as fallback).

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.759"; my $pandora_version = "7.0NG.759";
my $pandora_build = "220105"; my $pandora_build = "220113";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash
@ -398,6 +398,7 @@ sub pandora_load_config {
$pa_config->{'autocreate_group'} = -1; $pa_config->{'autocreate_group'} = -1;
$pa_config->{'autocreate_group_force'} = 1; $pa_config->{'autocreate_group_force'} = 1;
$pa_config->{'autocreate_group_name'} = '';
$pa_config->{'autocreate'} = 1; $pa_config->{'autocreate'} = 1;
# max log size (bytes) # max log size (bytes)
@ -942,6 +943,9 @@ sub pandora_load_config {
elsif ($parametro =~ m/^autocreate_group_force\s+([0-1])/i) { elsif ($parametro =~ m/^autocreate_group_force\s+([0-1])/i) {
$pa_config->{'autocreate_group_force'}= clean_blank($1); $pa_config->{'autocreate_group_force'}= clean_blank($1);
} }
elsif ($parametro =~ m/^autocreate_group_name\s(.*)/i) {
$pa_config->{'autocreate_group_name'}= clean_blank($1);
}
elsif ($parametro =~ m/^discovery_threads\s+([0-9]*)/i) { elsif ($parametro =~ m/^discovery_threads\s+([0-9]*)/i) {
$pa_config->{'discovery_threads'}= clean_blank($1); $pa_config->{'discovery_threads'}= clean_blank($1);
} }

View File

@ -3846,7 +3846,8 @@ sub pandora_get_agent_group {
my ($pa_config, $dbh, $agent_name, $agent_group, $agent_group_password) = @_; my ($pa_config, $dbh, $agent_name, $agent_group, $agent_group_password) = @_;
my $group_id; my $group_id;
my @groups = $pa_config->{'autocreate_group_force'} == 1 ? ($pa_config->{'autocreate_group'}, $agent_group) : ($agent_group, $pa_config->{'autocreate_group'}); my $auto_group = $pa_config->{'autocreate_group_name'} ne '' ? $pa_config->{'autocreate_group_name'} : $pa_config->{'autocreate_group'};
my @groups = $pa_config->{'autocreate_group_force'} == 1 ? ($auto_group, $agent_group) : ($agent_group, $auto_group);
foreach my $group (@groups) { foreach my $group (@groups) {
next unless defined($group); next unless defined($group);

View File

@ -89,11 +89,20 @@ sub new ($$;$) {
} }
} }
if ($config->{'autocreate_group'} > 0 && !defined(get_group_name ($dbh, $config->{'autocreate_group'}))) { if ($config->{'autocreate_group_name'} ne '') {
my $msg = "Group id " . $config->{'autocreate_group'} . " does not exist (check autocreate_group config token)."; if (get_group_id($dbh, $config->{'autocreate_group_name'}) == -1) {
logger($config, $msg, 3); my $msg = "Group '" . $config->{'autocreate_group_name'} . "' does not exist (check autocreate_group_name config token).";
print_message($config, $msg, 1); logger($config, $msg, 3);
pandora_event ($config, $msg, 0, 0, 0, 0, 0, 'error', 0, $dbh); print_message($config, $msg, 1);
pandora_event ($config, $msg, 0, 0, 0, 0, 0, 'error', 0, $dbh);
}
} elsif ($config->{'autocreate_group'} > 0) {
if (!defined(get_group_name ($dbh, $config->{'autocreate_group'}))) {
my $msg = "Group id " . $config->{'autocreate_group'} . " does not exist (check autocreate_group config token).";
logger($config, $msg, 3);
print_message($config, $msg, 1);
pandora_event ($config, $msg, 0, 0, 0, 0, 0, 'error', 0, $dbh);
}
} }
bless $self, $class; bless $self, $class;

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.759"; my $pandora_version = "7.0NG.759";
my $pandora_build = "220105"; my $pandora_build = "220113";
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.759 %define version 7.0NG.759
%define release 220105 %define release 220113
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.759 %define version 7.0NG.759
%define release 220105 %define release 220113
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -9,7 +9,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.759" PI_VERSION="7.0NG.759"
PI_BUILD="220105" PI_BUILD="220113"
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.759 Build 220105"; my $version = "7.0NG.759 Build 220113";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;
@ -391,11 +391,11 @@ sub pandora_purgedb ($$) {
# Delete old log data # Delete old log data
log_message ('PURGE', "Deleting old network configuration manager data."); log_message ('PURGE', "Deleting old network configuration manager data.");
if (defined($conf->{'days_purge_ncm'}) && $conf->{'days_purge_ncm'} > 0) { if (defined($conf->{'_days_purge'}) && $conf->{'_days_purge'} > 0) {
log_message ('PURGE', 'Deleting NCM data older than ' . $conf->{'days_purge_ncm'} . ' days.'); log_message ('PURGE', 'Deleting NCM data older than ' . $conf->{'_days_purge'} . ' days.');
enterprise_hook ('pandora_purge_ncm', [$dbh, \&log_message, $conf->{'days_purge_ncm'}, $conf->{'_history_db_step'}, $conf->{'_history_db_delay'}]); enterprise_hook ('pandora_purge_ncm', [$dbh, \&log_message, $conf->{'_days_purge'}, $conf->{'_history_db_step'}, $conf->{'_history_db_delay'}]);
} else { } else {
log_message ('PURGE', 'days_purge_ncm is set to 0. Old network configuration manager data will not be deleted.'); log_message ('PURGE', '_days_purge is set to 0. Old network configuration manager data will not be deleted.');
} }
# Delete old special days # Delete old special days

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.759 Build 220105"; my $version = "7.0NG.759 Build 220113";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);