Merge remote-tracking branch 'origin/develop' into ent-9086-eliminacion-de-la-replicacion-de-eventos-duplicado

Conflicts:
	pandora_console/include/functions_reporting.php
This commit is contained in:
Daniel Barbero Martin 2022-06-08 08:15:49 +02:00
commit 951a1703bf
45 changed files with 1371 additions and 1133 deletions

View File

@ -11,7 +11,7 @@ PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
S_VERSION='2022020801'
S_VERSION='2022050901'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
# define default variables
@ -82,7 +82,6 @@ check_pre_pandora () {
}
check_repo_connection () {
execute_cmd "ping -c 2 8.8.8.8" "Checking internet connection"
execute_cmd "ping -c 2 firefly.artica.es" "Checking Community repo"
execute_cmd "ping -c 2 support.pandorafms.com" "Checking Enterprise repo"
}

View File

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

View File

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

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

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.762"
PI_BUILD="220606"
PI_BUILD="220608"
OS_NAME=`uname -s`
FORCE=0

View File

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

View File

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

View File

@ -2,4 +2,6 @@ START TRANSACTION;
ALTER TABLE `tservice` ADD COLUMN `enable_sunburst` tinyint(1) NOT NULL default 0;
ALTER TABLE `tdashboard` MODIFY `name` TEXT NOT NULL DEFAULT '';
COMMIT;

View File

@ -954,7 +954,7 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$("a.autorefresh").click (function () {
$("a.autorefresh_txt").toggle ();
$("#combo_refr").toggle ();
$("#combo_refr").toggle();
$("select#ref").change (function () {
href = $("a.autorefresh").attr ("href");

View File

@ -261,7 +261,7 @@ $table->data[2][1] = html_print_select_from_sql(
'id_command',
$id_command,
'',
__('None'),
'',
0,
true,
false,

View File

@ -140,7 +140,7 @@ function process_manage_delete($id_agents)
}
$id_group = (int) get_parameter('id_group');
$id_group = (is_metaconsole() === true) ? get_parameter('id_group', '') : (int) get_parameter('id_group');
$id_agents = get_parameter('id_agents');
$recursion = get_parameter('recursion');
$delete = (bool) get_parameter_post('delete');
@ -282,15 +282,15 @@ $table->data[3][0] .= '<span id="agent_loading" class="invisible">';
$table->data[3][0] .= html_print_image('images/spinner.png', true);
$table->data[3][0] .= '</span>';
$agents = agents_get_group_agents(
array_keys(users_get_groups($config['id_user'], 'AW', false)),
['disabled' => 2],
'none',
false,
false,
is_metaconsole(),
'|'
);
$agents = [];
if (is_metaconsole() === false) {
$agents = agents_get_group_agents(
array_keys(users_get_groups($config['id_user'], 'AW', false)),
['disabled' => 2],
'none'
);
}
$table->data[3][1] = html_print_select(
$agents,

View File

@ -606,6 +606,7 @@ switch ($action) {
$event_graph_by_criticity = $style['event_graph_by_criticity'];
$event_graph_validated_vs_unvalidated = $style['event_graph_validated_vs_unvalidated'];
$include_extended_events = $item['show_extended_events'];
$custom_data_events = $style['custom_data_events'];
$filter_search = $style['event_filter_search'];
$filter_exclude = $style['event_filter_exclude'];
@ -631,6 +632,7 @@ switch ($action) {
$include_extended_events = $item['show_extended_events'];
$custom_data_events = $style['custom_data_events'];
break;
case 'event_report_module':
@ -665,6 +667,7 @@ switch ($action) {
$include_extended_events = $item['show_extended_events'];
$custom_data_events = $style['custom_data_events'];
break;
case 'general':
@ -2911,6 +2914,23 @@ $class = 'databox filters';
</td>
</tr>
<tr id="row_custom_data_events" class="datos">
<td class="bolder">
<?php
echo __('Show custom data');
?>
</td>
<td>
<?php
html_print_checkbox_switch(
'custom_data_events',
true,
$custom_data_events
);
?>
</td>
</tr>
<tr id="row_event_graphs" class="datos">
<td class="bolder"><?php echo __('Event graphs'); ?></td>
<td>
@ -5974,6 +5994,7 @@ function chooseType() {
$("#row_event_graph_by_criticity").hide();
$("#row_event_graph_by_validated").hide();
$("#row_extended_events").hide();
$("#row_custom_data_events").hide();
$("#row_netflow_filter").hide();
$("#row_max_values").hide();
$("#row_resolution").hide();
@ -6044,6 +6065,7 @@ function chooseType() {
$("#row_event_graph_by_criticity").show();
$("#row_event_graph_by_validated").show();
$("#row_extended_events").show();
$("#row_custom_data_events").show();
$("#row_filter_search").show();
$("#row_filter_exclude").show();
@ -6371,6 +6393,7 @@ function chooseType() {
$("#row_event_graph_by_validated").show();
$("#row_event_type").show();
$("#row_extended_events").show();
$("#row_custom_data_events").show();
$("#row_filter_search").show();
$("#row_filter_exclude").show();
@ -6389,7 +6412,7 @@ function chooseType() {
$("#row_event_graphs").show();
$("#row_event_type").show();
$("#row_extended_events").show();
$("#row_extended_events").show();
$("#row_custom_data_events").show();
$("#row_event_graph_by_user").show();
$("#row_event_graph_by_criticity").show();
@ -6414,6 +6437,7 @@ function chooseType() {
$("#row_event_graphs").show();
$("#row_event_type").show();
$("#row_extended_events").show();
$("#row_custom_data_events").show();
$("#row_event_graph_by_user").show();
$("#row_event_graph_by_criticity").show();

View File

@ -2224,12 +2224,18 @@ switch ($action) {
$filter_event_status
);
$custom_data_events = get_parameter_switch(
'custom_data_events',
0
);
$style['event_graph_by_agent'] = $event_graph_by_agent;
$style['event_graph_by_user_validator'] = $event_graph_by_user_validator;
$style['event_graph_by_criticity'] = $event_graph_by_criticity;
$style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated;
$style['event_filter_search'] = $event_filter_search;
$style['event_filter_exclude'] = $event_filter_exclude;
$style['custom_data_events'] = $custom_data_events;
if ($label != '') {
@ -2957,6 +2963,11 @@ switch ($action) {
''
);
$custom_data_events = get_parameter_switch(
'custom_data_events',
0
);
// Added for events items.
$style['show_summary_group'] = $show_summary_group;
@ -2976,6 +2987,7 @@ switch ($action) {
$style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated;
$style['event_filter_search'] = $event_filter_search;
$style['event_filter_exclude'] = $event_filter_exclude;
$style['custom_data_events'] = $custom_data_events;
if ($label != '') {
$style['label'] = $label;

View File

@ -523,6 +523,14 @@ class TreeService extends Tree
continue 2;
}
$title = get_parameter('title', '');
if (empty($title) === true) {
$tmp['title'] = '';
} else {
$tmp['title'] = $title.'/';
}
$tmp['title'] .= $service->name();
$tmp['id'] = (int) $item->service()->id();
$tmp['name'] = $item->service()->name();
$tmp['alias'] = $item->service()->name();

View File

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

View File

@ -5988,6 +5988,56 @@ function send_test_email(
}
/**
* Return array of ancestors of item, given array.
*
* @param integer $item From index.
* @param array $data Array data.
* @param string $key Pivot key (identifies the parent).
* @param string|null $extract Extract certain column or index.
* @param array $visited Cycle detection.
*
* @return array Array of ancestors.
*/
function get_ancestors(
int $item,
array $data,
string $key,
?string $extract=null,
array &$visited=[]
) :array {
if (isset($visited[$item]) === true) {
return [];
}
$visited[$item] = 1;
if (isset($data[$item]) === false) {
return [];
}
if (isset($data[$item][$key]) === false) {
if ($extract !== null) {
return [$data[$item][$extract]];
}
return [$item];
}
if ($extract !== null) {
return array_merge(
get_ancestors($data[$item][$key], $data, $key, $extract, $visited),
[$data[$item][$extract]]
);
}
return array_merge(
get_ancestors($data[$item][$key], $data, $key, $extract, $visited),
[$item]
);
}
if (function_exists('str_contains') === false) {

View File

@ -118,6 +118,9 @@ function alerts_get_alerts($id_group=0, $free_search='', $status='all', $standby
$sql .= ' AND t3.id_agente = '.$id_agent;
}
// Only enabled agent.
$sql .= ' AND t3.disabled = 0';
$row_alerts = db_get_all_rows_sql($sql);
if ($total) {

View File

@ -810,7 +810,7 @@ function reporting_make_reporting_data(
break;
}
$report['contents'][] = $report_control;
$report['contents'][] = $report_control;
break;
case 'event_report_module':
@ -826,7 +826,7 @@ function reporting_make_reporting_data(
break;
}
$report['contents'][] = $report_control;
$report['contents'][] = $report_control;
break;
case 'event_report_group':
@ -1943,6 +1943,8 @@ function reporting_event_report_group(
$event_filter = $content['style'];
$return['show_summary_group'] = $event_filter['show_summary_group'];
$return['show_custom_data'] = (isset($event_filter['custom_data_events']) === true) ? (bool) $event_filter['custom_data_events'] : false;
// Filter.
$show_summary_group = $event_filter['show_summary_group'];
$filter_event_severity = json_decode($event_filter['filter_event_severity'], true);
@ -2250,6 +2252,8 @@ function reporting_event_report_module(
$event_filter = $content['style'];
$return['show_summary_group'] = $event_filter['show_summary_group'];
$return['show_custom_data'] = (isset($event_filter['custom_data_events']) === true) ? (bool) $event_filter['custom_data_events'] : false;
// Filter.
$show_summary_group = $event_filter['show_summary_group'];
$filter_event_severity = json_decode(
@ -3783,6 +3787,8 @@ function reporting_event_report_agent(
$filter_event_status = json_decode($style['filter_event_status'], true);
$filter_event_filter_search = $style['event_filter_search'];
$filter_event_filter_exclude = $style['event_filter_exclude'];
$show_custom_data = (isset($style['custom_data_events']) === true) ? (bool) $style['custom_data_events'] : false;
$return['show_custom_data'] = $show_custom_data;
// Graph.
$event_graph_by_user_validator = $style['event_graph_by_user_validator'];
@ -3804,7 +3810,8 @@ function reporting_event_report_agent(
$filter_event_status,
$filter_event_filter_search,
$filter_event_filter_exclude,
$id_server
$id_server,
$show_custom_data
);
reporting_set_conf_charts(
@ -6956,7 +6963,7 @@ function sla_truncate($num, $accurancy=2)
*
* @param integer $value Value.
* @param integer $min Treshold min SLA.
* @param boolean $max Treshold max SLA.
* @param integer $max Treshold max SLA.
* @param boolean $inverse_interval Treshold inverse SLA.
*
* @return boolean Returns the interval in downtime (false if no matches).
@ -10594,7 +10601,8 @@ function reporting_get_agents_detailed_event(
$filter_event_status=false,
$filter_event_filter_search=false,
$filter_event_filter_exclude=false,
$id_server=0
$id_server=0,
$show_custom_data=false
) {
global $config;
@ -10645,6 +10653,7 @@ function reporting_get_agents_detailed_event(
'validated_by' => $e['id_usuario'],
'timestamp' => $e['timestamp_rep'],
'id_evento' => $e['id_evento'],
'custom_data' => ($show_custom_data === true) ? $e['custom_data'] : '',
];
} else {
$return_data[] = [
@ -10655,6 +10664,7 @@ function reporting_get_agents_detailed_event(
'validated_by' => $e['id_usuario'],
'timestamp' => $e['timestamp'],
'id_evento' => $e['id_evento'],
'custom_data' => ($show_custom_data === true) ? $e['custom_data'] : '',
];
}
}
@ -14657,8 +14667,10 @@ function reporting_module_histogram_graph($report, $content, $pdf=0)
if ($modules_is_string === false) {
if ($agentmodule_info['max_critical'] == 0) {
$max_value_critical = null;
if ((bool) $content['dinamic_proc'] === true) {
$max_value_critical = 0.01;
if ($agentmodule_info['min_critical'] == 0) {
if ((bool) $content['dinamic_proc'] === true) {
$max_value_critical = 0.01;
}
}
} else {
$max_value_critical = $agentmodule_info['max_critical'];

View File

@ -1025,6 +1025,7 @@ function reporting_html_event_report_group($table, $item, $pdf=0)
global $config;
$show_extended_events = $item['show_extended_events'];
$show_custom_data = (bool) $item['show_custom_data'];
if ($item['total_events']) {
$table1 = new stdClass();
@ -1060,6 +1061,10 @@ function reporting_html_event_report_group($table, $item, $pdf=0)
$table1->head[6] = __('Timestamp');
}
if ($show_custom_data === true) {
$table1->head[8] = __('Custom data');
}
foreach ($item['data'] as $k => $event) {
// First pass along the class of this row.
if ($item['show_summary_group']) {
@ -1132,6 +1137,16 @@ function reporting_html_event_report_group($table, $item, $pdf=0)
$data[] = '<font class="font_6pt">'.date($config['date_format'], strtotime($event['timestamp'])).'</font>';
}
if ($show_custom_data === true) {
$custom_data = json_decode($event['custom_data'], true);
$custom_data_text = '';
foreach ($custom_data as $key => $value) {
$custom_data_text .= $key.' = '.$value.'<br>';
}
$data[] = $custom_data_text;
}
array_push($table1->data, $data);
if ($show_extended_events == 1 && events_has_extended_info($event['id_evento'])) {
@ -1246,10 +1261,10 @@ function reporting_html_event_report_group($table, $item, $pdf=0)
function reporting_html_event_report_module($table, $item, $pdf=0)
{
global $config;
$show_extended_events = $item['show_extended_events'];
$show_summary_group = $item['show_summary_group'];
$show_custom_data = (bool) $item['show_custom_data'];
if ($item['total_events']) {
if (!empty($item['failed'])) {
$table->colspan['events']['cell'] = 3;
@ -1279,6 +1294,10 @@ function reporting_html_event_report_module($table, $item, $pdf=0)
$table1->style[0] = 'text-align: center;';
}
if ($show_custom_data === true) {
$table1->head[6] = __('Custom data');
}
if (is_array($item['data']) || is_object($item['data'])) {
$item_data = array_reverse($item['data']);
}
@ -1331,6 +1350,16 @@ function reporting_html_event_report_module($table, $item, $pdf=0)
$data[4] = date($config['date_format'], strtotime($event['timestamp']));
}
if ($show_custom_data === true) {
$custom_data = json_decode($event['custom_data'], true);
$custom_data_text = '';
foreach ($custom_data as $key => $value) {
$custom_data_text .= $key.' = '.$value.'<br>';
}
$data[6] = $custom_data_text;
}
$table1->data[] = $data;
if ($show_extended_events == 1 && events_has_extended_info($event['id_evento'])) {
@ -2341,6 +2370,13 @@ function reporting_html_event_report_agent($table, $item, $pdf=0)
$table1->align[0] = 'center';
$table1->align[1] = 'center';
$table1->align[3] = 'center';
if ((bool) $item['show_custom_data'] === true) {
if ($item['show_summary_group']) {
$table1->align[7] = 'left';
} else {
$table1->align[6] = 'left';
}
}
$table1->data = [];
@ -2355,6 +2391,9 @@ function reporting_html_event_report_agent($table, $item, $pdf=0)
$table1->head[4] = __('Severity');
$table1->head[5] = __('Val. by');
$table1->head[6] = __('Timestamp');
if ((bool) $item['show_custom_data'] === true) {
$table1->head[7] = __('Custom data');
}
foreach ($item['data'] as $i => $event) {
if ($item['show_summary_group']) {
@ -2420,6 +2459,16 @@ function reporting_html_event_report_agent($table, $item, $pdf=0)
$data[] = '<font class="font_6pt">'.date($config['date_format'], strtotime($event['timestamp'])).'</font>';
}
if ((bool) $item['show_custom_data'] === true) {
$custom_data = json_decode($event['custom_data'], true);
$custom_data_text = '';
foreach ($custom_data as $key => $value) {
$custom_data_text .= $key.' = '.$value.'<br>';
}
$data[] = $custom_data_text;
}
array_push($table1->data, $data);
if ($show_extended_events == 1 && events_has_extended_info($event['id_evento'])) {

View File

@ -861,7 +861,7 @@ var TreeController = {
'<span><img class="invert_filter" src="' +
(controller.baseURL.length > 0 ? controller.baseURL : "") +
'images/help.png" class="img_help" title="' +
element.name +
(element.title ? element.title : element.name) +
'" alt="' +
element.name +
'"/></span> ';
@ -1314,6 +1314,7 @@ var TreeController = {
serverID: element.serverID,
rootType: element.rootType,
metaID: element.metaID,
title: element.title,
filter: controller.filter,
auth_class: controller.auth_class,
id_user: controller.id_user,

View File

@ -272,7 +272,20 @@ class ServiceMapWidget extends Widget
$fields = array_reduce(
$services_res,
function ($carry, $item) {
$carry[$item['id']] = $item['name'];
$parents = '';
if (class_exists('\PandoraFMS\Enterprise\Service') === true) {
try {
$service = new \PandoraFMS\Enterprise\Service($item['id']);
$ancestors = $service->getAncestors();
if (empty($ancestors) === false) {
$parents = '('.join('/', $ancestors).')';
}
} catch (\Exception $e) {
$parents = '';
}
}
$carry[$item['id']] = $item['name'].' '.$parents;
return $carry;
},
[]

View File

@ -9021,3 +9021,29 @@ div#err_msg_centralised {
#reset-styles var {
font-style: italic;
}
.div-col {
width: 33%;
display: flex;
flex-direction: row;
align-items: center;
padding-top: 15px;
}
.div-span {
width: 25%;
}
.div-input {
width: 75%;
}
@media screen and (max-width: 1369px) {
.div-col {
width: 50%;
display: flex;
flex-direction: row;
align-items: center;
padding-top: 15px;
}
}

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -1403,7 +1403,7 @@ if ($agent_interfaces_count > 0) {
]
).'</a>';
if ($tab == 'interface') {
if ($tab === 'interface') {
$interfacetab['active'] = true;
} else {
$interfacetab['active'] = false;
@ -1420,19 +1420,19 @@ $alerttab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_ag
]
).'</a>';
if ($tab == 'alert') {
if ($tab === 'alert') {
$alerttab['active'] = true;
} else {
$alerttab['active'] = false;
}
// Inventory.
$inventoryCount = db_get_num_rows('SELECT id_agent_module_inventory FROM tagent_module_inventory WHERE id_agente = '.$agent['id_agente']);
$inventorytab = enterprise_hook('inventory_tab');
if ($inventorytab == -1) {
if ($inventorytab == -1 || $inventoryCount === 0) {
$inventorytab = '';
}
// Collection.
$collectiontab = enterprise_hook('collection_tab');
if ($collectiontab == -1) {

View File

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

View File

@ -2578,7 +2578,7 @@ CREATE TABLE IF NOT EXISTS `tpolicy_group_agents` (
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tdashboard` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(60) NOT NULL DEFAULT '',
`name` TEXT NOT NULL DEFAULT '',
`id_user` VARCHAR(60) NOT NULL DEFAULT '',
`id_group` INT NOT NULL DEFAULT 0,
`active` TINYINT NOT NULL DEFAULT 0,

View File

@ -219,7 +219,7 @@ INSERT INTO `tlink` VALUES
(1,'Documentation','https://pandorafms.com/manual'),
(2,'Enterprise Edition','http://pandorafms.com'),
(3,'Report a bug','https://github.com/pandorafms/pandorafms/issues'),
(4,'Suggest new feature','http://forums.pandorafms.com/index.php?board=22.0'),
(4,'Suggest new feature','https://pandorafms.com/community/beta-program/'),
(5,'Module library','http://library.pandorafms.com/');
UNLOCK TABLES;

View File

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

View File

@ -46,7 +46,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.762";
my $pandora_build = "220606";
my $pandora_build = "220608";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

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

View File

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

View File

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

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.762 Build 220606";
my $version = "7.0NG.762 Build 220608";
# Pandora server configuration
my %conf;

View File

@ -21,7 +21,7 @@ use JSON qw(decode_json encode_json);
use MIME::Base64;
use Encode qw(decode encode_utf8);
use LWP::Simple;
use Data::Dumper;
#use Data::Dumper;
# Default lib dir for RPM and DEB packages
BEGIN { push @INC, '/usr/lib/perl5'; }
@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "7.0NG.762 Build 220606";
my $version = "7.0NG.762 Build 220608";
# save program name for logging
my $progname = basename($0);
@ -375,29 +375,53 @@ sub pandora_disable_group ($$$) {
exit;
}
if ($group == 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');
if(is_metaconsole($conf) == 1) {
my $servers = enterprise_hook('get_metaconsole_setup_servers',[$dbh]);
my @servers_id = split(',',$servers);
foreach my $server (@servers_id) {
my $dbh_metaconsole = enterprise_hook('get_node_dbh',[$conf, $server, $dbh]);
# Update bbdd.
db_do ($dbh, "UPDATE tagente SET disabled = 1");
}
else {
# Extract all the names of the pandora agents if it is for group.
@agents_bd = get_db_rows ($dbh, 'SELECT nombre FROM tagente WHERE id_grupo = ?', $group);
if ($group == 0){
# Extract all the names of the pandora agents if it is for all = 0.
@agents_bd = get_db_rows ($dbh_metaconsole, 'SELECT id_agente FROM tagente');
}
else {
# Extract all the names of the pandora agents if it is for group.
@agents_bd = get_db_rows ($dbh_metaconsole, 'SELECT id_agente FROM tagente WHERE id_grupo = ?', $group);
}
# Update bbdd.
db_do ($dbh, "UPDATE tagente SET disabled = 1 WHERE id_grupo = $group");
}
foreach my $id_agent (@agents_bd) {
# Call the API.
$result += api_call(
$conf, 'set', 'disabled_and_standby', $id_agent->{'id_agente'}, $server, '1|1'
);
}
}
} else {
if ($group == 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');
foreach my $name_agent (@agents_bd) {
# Check the standby field I put it to 0.
my $new_conf = update_conf_txt(
$conf,
$name_agent->{'nombre'},
'standby',
'1'
);
# Update bbdd.
$result = db_update ($dbh, "UPDATE tagente SET disabled = 1");
}
else {
# Extract all the names of the pandora agents if it is for group.
@agents_bd = get_db_rows ($dbh, 'SELECT nombre FROM tagente WHERE id_grupo = ?', $group);
# Update bbdd.
$result = db_update ($dbh, "UPDATE tagente SET disabled = 1 WHERE id_grupo = $group");
}
foreach my $name_agent (@agents_bd) {
# Check the standby field I put it to 0.
my $new_conf = update_conf_txt(
$conf,
$name_agent->{'nombre'},
'standby',
'1'
);
}
}
return $result;
@ -1138,7 +1162,8 @@ sub cli_disable_group() {
print_log "[INFO] Disabling group '$group_name'\n\n";
}
pandora_disable_group ($conf, $dbh, $id_group);
my $result = pandora_disable_group ($conf, $dbh, $id_group);
print_log "[INFO] Disabled ".$result." agents from group ".$group_name."\n\n";
}
##############################################################################
@ -5534,8 +5559,6 @@ sub cli_get_agents() {
my $head_print = 0;
# use Data::Dumper;
foreach my $agent (@agents) {
if($status ne '') {
@ -5948,6 +5971,24 @@ sub cli_delete_group() {
$group_id = db_do ($dbh, 'DELETE FROM tgrupo WHERE nombre=?', safe_input($group_name));
# Delete on nodes too if metaconsole.
if(is_metaconsole($conf) == 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) {
my $servers = enterprise_hook('get_metaconsole_setup_servers',[$dbh]);
my @servers_id = split(',',$servers);
foreach my $server (@servers_id) {
my $dbh_node = enterprise_hook('get_node_dbh',[$conf, $server, $dbh]);
my $group_id = get_group_id($dbh_node,$group_name);
exist_check($group_id, 'group name', $group_name);
$group_id = db_do ($dbh_node, 'DELETE FROM tgrupo WHERE nombre=?', safe_input($group_name));
}
}
if($group_id == -1) {
print_log "[ERROR] A problem has been ocurred deleting group '$group_name'\n\n";
}else{