Merge remote-tracking branch 'origin/develop' into ent-6802-super-8

This commit is contained in:
fbsanchez 2022-02-02 11:36:14 +01:00
commit 17be6f3ca5
41 changed files with 287 additions and 100 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.759-220201
Version: 7.0NG.759-220202
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.759-220201"
pandora_version="7.0NG.759-220202"
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.759';
use constant AGENT_BUILD => '220201';
use constant AGENT_BUILD => '220202';
# 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.759
%define release 220201
%define release 220202
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.759"
PI_BUILD="220201"
PI_BUILD="220202"
OS_NAME=`uname -s`
FORCE=0

View File

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

View File

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

View File

@ -135,6 +135,7 @@ $first_create = (int) get_parameter('first_create');
$create_downtime = (int) get_parameter('create_downtime');
$update_downtime = (int) get_parameter('update_downtime');
$edit_downtime = (int) get_parameter('edit_downtime');
$downtime_copy = (int) get_parameter('downtime_copy');
$id_downtime = (int) get_parameter('id_downtime');
$id_agent = (int) get_parameter('id_agent');
@ -420,6 +421,16 @@ if ($create_downtime || $update_downtime) {
}
}
if ($downtime_copy) {
$result = planned_downtimes_copy($id_downtime);
if ($result['id_downtime'] !== false) {
$id_downtime = $result['id_downtime'];
ui_print_success_message($result['success']);
} else {
ui_print_error_message(__($result['error']));
}
}
// Have any data to show ?
if ($id_downtime > 0) {
// Columns of the table tplanned_downtime.
@ -628,20 +639,20 @@ $table->data[5][1] = "
<tr><td>".ui_get_using_system_timezone_warning().'</td></tr>
<tr>
<td>'.__('Type Periodicity:').'&nbsp;'.html_print_select(
[
'weekly' => __('Weekly'),
'monthly' => __('Monthly'),
],
'type_periodicity',
$type_periodicity,
'change_type_periodicity();',
'',
0,
true,
false,
true,
'',
$disabled_in_execution
[
'weekly' => __('Weekly'),
'monthly' => __('Monthly'),
],
'type_periodicity',
$type_periodicity,
'change_type_periodicity();',
'',
0,
true,
false,
true,
'',
$disabled_in_execution
)."</td>
</tr>
<tr>
@ -661,31 +672,31 @@ $table->data[5][1] = "
<tr>
<td>".__('From day:').'</td>
<td>'.html_print_select(
$days,
'periodically_day_from',
$periodically_day_from,
'',
'',
0,
true,
false,
true,
'',
$disabled_in_execution
$days,
'periodically_day_from',
$periodically_day_from,
'',
'',
0,
true,
false,
true,
'',
$disabled_in_execution
).'</td>
<td>'.__('To day:').'</td>
<td>'.html_print_select(
$days,
'periodically_day_to',
$periodically_day_to,
'',
'',
0,
true,
false,
true,
'',
$disabled_in_execution
$days,
'periodically_day_to',
$periodically_day_to,
'',
'',
0,
true,
false,
true,
'',
$disabled_in_execution
).'</td>
<td>'.ui_print_help_tip(__('The end day must be higher than the start day'), true).'</td>
</tr>
@ -694,26 +705,26 @@ $table->data[5][1] = "
<tr>
<td>'.__('From hour:').'</td>
<td>'.html_print_input_text(
'periodically_time_from',
$periodically_time_from,
'',
7,
7,
true,
$disabled_in_execution
'periodically_time_from',
$periodically_time_from,
'',
7,
7,
true,
$disabled_in_execution
).ui_print_help_tip(
__('The end time must be higher than the start time'),
true
).'</td>
<td>'.__('To hour:').'</td>
<td>'.html_print_input_text(
'periodically_time_to',
$periodically_time_to,
'',
7,
7,
true,
$disabled_in_execution
'periodically_time_to',
$periodically_time_to,
'',
7,
7,
true,
$disabled_in_execution
).ui_print_help_tip(
__('The end time must be higher than the start time'),
true
@ -997,13 +1008,13 @@ $table->data['module'][1] = "
<td class='cell_delete_button' style='text-align: right; width:10%;' id=''>".'<a class="link_delete"
onclick="if(!confirm(\''.__('Are you sure?').'\')) return false;"
href="">'.html_print_image(
'images/cross.png',
true,
[
'border' => '0',
'alt' => __('Delete'),
'class' => 'invert_filter',
]
'images/cross.png',
true,
[
'border' => '0',
'alt' => __('Delete'),
'class' => 'invert_filter',
]
).'</a>'."</td>
</tr>
<tr class='datos2' id='add_modules_row'>

View File

@ -405,6 +405,7 @@ else {
if ($write_permisson || $manage_permisson) {
$table->head['stop'] = __('Stop downtime');
$table->head['copy'] = __('Copy');
$table->head['edit'] = __('Edit');
$table->head['delete'] = __('Delete');
}
@ -492,6 +493,8 @@ else {
if (check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW')
|| check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD')
) {
// Copy.
$data['copy'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&downtime_copy=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/copy.png', true, ['title' => __('Copy'), 'class' => 'invert_filter']).'</a>';
// Edit.
$data['edit'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update'), 'class' => 'invert_filter']).'</a>';
// Delete.
@ -504,6 +507,8 @@ else {
if (check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW')
|| check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD')
) {
// Copy.
$data['copy'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&downtime_copy=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/copy.png', true, ['title' => __('Copy'), 'class' => 'invert_filter']).'</a>';
// Edit.
$data['edit'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update'), 'class' => 'invert_filter']).'</a>';
// Delete.
@ -513,11 +518,13 @@ else {
$data['delete'] = '';
}
} else {
$data['copy'] = '';
$data['edit'] = '';
$data['delete'] = '';
}
} else {
$data['stop'] = '';
$data['copy'] = '';
$data['edit'] = '';
$data['delete'] = '';
}

View File

@ -683,6 +683,7 @@ $(document).ready (function () {
var params = {
"page" : "operation/agentes/ver_agente",
"get_agent_modules_json" : 1,
"truncate_module_names": 1,
"get_distinct_name" : 1,
"indexed" : 0,
"privilege" : "AW",
@ -712,7 +713,7 @@ $(document).ready (function () {
function (data, status) {
jQuery.each (data, function (id, value) {
option = $("<option></option>")
.attr("value", value["nombre"])
.attr({value: value["nombre"], title: value["nombre"]})
.html(value["safe_name"]);
$("#module_name").append (option);
});

View File

@ -1369,6 +1369,7 @@ $(document).ready (function () {
var params = {
"page" : "operation/agentes/ver_agente",
"get_agent_modules_json" : 1,
"truncate_module_names": 1,
"get_distinct_name" : 1,
"indexed" : 0,
"safe_name" : 1
@ -1396,7 +1397,7 @@ $(document).ready (function () {
params,
function (data, status) {
jQuery.each (data, function (id, value) {
option = $("<option></option>").attr("value", value["nombre"]).html(value["safe_name"]);
option = $("<option></option>").attr({value: value["nombre"], title: value["nombre"]}).html(value["safe_name"]);
$("#module_name").append (option);
});
hideSpinner();

View File

@ -1672,10 +1672,15 @@ class NetworkMap
if (isset($source_data['color'])) {
$item['color'] = $source_data['color'];
} else {
$item['color'] = self::getColorByStatus(
$node['status'],
(bool) $node['id_module']
);
if (empty($node['status']) && empty($node['id_module']) && !empty($node['style']['id_networkmap'])) {
$status_aux = get_status_color_networkmap_fictional_point($node['style']['id_networkmap']);
$item['color'] = $status_aux;
} else {
$item['color'] = self::getColorByStatus(
$node['status'],
(bool) $node['id_module']
);
}
}
break;
}

View File

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

View File

@ -890,7 +890,7 @@ function modules_create_agent_module(
} else {
db_process_sql(
'UPDATE tagente
SET total_count=total_count+1, notinit_count=notinit_count+1
SET total_count=total_count+1, notinit_count=notinit_count+1, update_module_count=1
WHERE id_agente='.(int) $id_agent
);
}

View File

@ -3280,7 +3280,10 @@ function get_status_color_networkmap_fictional_point($id_networkmap, $parent='')
if ((int) $id_networkmap !== 0) {
$agents = db_get_all_rows_filter(
'titem',
['id_map' => $id_networkmap]
[
'id_map' => $id_networkmap,
'deleted' => 0,
]
);
if ((bool) $agents === false) {

View File

@ -919,3 +919,88 @@ function delete_planned_downtimes($filter)
return $return;
}
function planned_downtimes_copy($id_downtime)
{
$planned_downtime = db_get_row_filter(
'tplanned_downtime',
['id' => $id_downtime]
);
$planned_agents = db_get_all_rows_filter(
'tplanned_downtime_agents',
['id_downtime' => $id_downtime]
);
$planned_modules = db_get_all_rows_filter(
'tplanned_downtime_modules',
['id_downtime' => $id_downtime]
);
if ($planned_downtime === false) {
return false;
}
// Unset id.
unset($planned_downtime['id']);
// Change copy name.
$planned_downtime['name'] = __('Copy of ').$planned_downtime['name'];
// Insert new downtime
$result['id_downtime'] = db_process_sql_insert(
'tplanned_downtime',
$planned_downtime
);
if ($result === false) {
$result['error'] = __('Could not be copied');
return $result;
} else {
$result['success'] = __('Successfully copied');
}
if ($planned_agents !== false) {
foreach ($planned_agents as $planned_agent) {
// Unset id.
unset($planned_agent['id']);
// Set id_planned downtime
$planned_agent['id_downtime'] = $result['id_downtime'];
$result['id_agents'][] = db_process_sql_insert(
'tplanned_downtime_agents',
$planned_agent
);
if ($result === false) {
$return['error'] = __('Error adding agents to copied downtime');
break;
}
}
}
if ($result === false) {
return false;
}
if ((bool) $planned_agents['all_modules'] === false
&& $planned_modules !== false
) {
foreach ($planned_modules as $planned_module) {
// Unset id.
unset($planned_module['id']);
// Set id_planned downtime
$planned_module['id_downtime'] = $result['id_downtime'];
$result['id_modules'][] = db_process_sql_insert(
'tplanned_downtime_moduless',
$planned_module
);
if ($result === false) {
$return['error'] = __('Error adding module to copied downtime');
break;
}
}
}
return $result;
}

View File

@ -88,6 +88,23 @@ function js_html_entity_decode(str) {
return str2;
}
function truncate_string(str, str_length, separator) {
if (str.length <= str_length) {
return str;
}
separator = separator || "...";
var separator_length = separator.length,
chars_to_show = str_length - separator_length,
front_chars = Math.ceil(chars_to_show / 2),
tail_chars = Math.floor(chars_to_show / 2);
return (
str.substr(0, front_chars) + separator + str.substr(str.length - tail_chars)
);
}
/**
* Function to search an element in an array.
*
@ -554,6 +571,7 @@ function module_changed_by_multiple_modules(event, id_module, selected) {
{
page: "operation/agentes/ver_agente",
get_agents_json_for_multiple_modules: 1,
truncate_agent_names: 1,
status_module: status_module,
"module_name[]": idModules,
selection_mode: selection_mode,
@ -619,8 +637,8 @@ function module_changed_by_multiple_modules(event, id_module, selected) {
s = js_html_entity_decode(val);
$("#agents").append(
$("<option></option>")
.html(s)
.attr("value", i)
.html(truncate_string(s, 30, "..."))
.attr({ value: i, title: s })
);
$("#agents").fadeIn("normal");
});

View File

@ -630,7 +630,7 @@ function configure_modules_form() {
moduletype = $("#hidden-moduletype").val();
if (moduletype == 5) {
if ($("#prediction_module").val() == null) {
if ($("#id_modules").val() === null) {
$("#prediction_module").focus();
$("#message").showMessage(no_prediction_module_lang);
return false;

View File

@ -406,7 +406,8 @@ final class Group extends Item
$html .= '<div class="group-item-title">';
$html .= $groupName;
$html .= '</div>';
$html .= '<div class="group-item-info" style="padding:0%;width: 96%">';
$html .= '<div class="group-item-info" style="padding:0%;width: 100%;justify-content:center">';
$html .= '<div style="width:90%;display:flex;flex-direction:row;flex-wrap:wrap;padding:1%">';
// Critical.
$html .= '<div class="group-item-info-container">';
$html .= '<div class="value-style red_background">';
@ -436,6 +437,7 @@ final class Group extends Item
$html .= '<div class="name-style">'.__('Unknown').'</div>';
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';

View File

@ -491,6 +491,7 @@ li#li-timeZone-item > select:not(:first-child) {
flex-direction: row;
border-radius: 2px;
max-height: 50px;
min-height: 35px;
margin: 1%;
}
@ -498,7 +499,7 @@ li#li-timeZone-item > select:not(:first-child) {
flex: 1;
color: #fff;
font-size: 100%;
padding: 5%;
padding: 0%;
width: 100%;
display: flex;
flex-direction: row;
@ -511,7 +512,7 @@ li#li-timeZone-item > select:not(:first-child) {
background-color: white;
color: black;
font-size: 100%;
padding: 5%;
padding: 0%;
width: 100%;
height: 100%;
display: flex;
@ -695,6 +696,25 @@ div.module-graph .gauge_d3_class {
color: #000;
}
.orange_background {
background: #ffa631;
}
.red_background {
background: #e63c52;
}
.yellow_background {
background: #f3b200;
}
.grey_background {
background: #b2b2b2;
}
.blue_background {
background: #4a83f3;
}
.green_background {
background: #82b92e;
}
/* Styles for the solid icons */
.fa {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

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

View File

@ -353,6 +353,8 @@ if (is_ajax()) {
$selection_mode = get_parameter('selection_mode', 'common') == 'all';
$status_modulo = (int) get_parameter('status_module', -1);
$tags_selected = (array) get_parameter('tags', []);
$truncate_agent_names = (bool) get_parameter('truncate_agent_names');
$names = select_agents_for_module_group(
$nameModules,
$selection_mode,
@ -790,6 +792,8 @@ if (is_ajax()) {
$safe_name = (bool) get_parameter('safe_name', false);
$truncate_module_names = (bool) get_parameter('truncate_module_names');
// Filter.
$filter = [];
if ($disabled !== -1) {
@ -945,6 +949,16 @@ if (is_ajax()) {
$agent_modules = $new_elements;
}
if ($truncate_module_names === true) {
$agent_modules = array_map(
function ($item) {
$item['safe_name'] = ui_print_truncate_text($item['safe_name'], 'module_medium');
return $item;
},
$agent_modules
);
}
echo json_encode($agent_modules);
return;

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.759-220201
Version: 7.0NG.759-220202
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.759-220201"
pandora_version="7.0NG.759-220202"
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.759";
my $pandora_build = "220201";
my $pandora_build = "220202";
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.759";
my $pandora_build = "220201";
my $pandora_build = "220202";
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.759
%define release 220201
%define release 220202
Summary: Pandora FMS Server
Name: %{name}

View File

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

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.759"
PI_BUILD="220201"
PI_BUILD="220202"
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.759 Build 220201";
my $version = "7.0NG.759 Build 220202";
# Pandora server configuration
my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "7.0NG.759 Build 220201";
my $version = "7.0NG.759 Build 220202";
# save program name for logging
my $progname = basename($0);

View File

@ -491,6 +491,7 @@ li#li-timeZone-item > select:not(:first-child) {
flex-direction: row;
border-radius: 2px;
max-height: 50px;
min-height: 35px;
margin: 1%;
}
@ -498,7 +499,7 @@ li#li-timeZone-item > select:not(:first-child) {
flex: 1;
color: #fff;
font-size: 100%;
padding: 5%;
padding: 0%;
width: 100%;
display: flex;
flex-direction: row;
@ -511,7 +512,7 @@ li#li-timeZone-item > select:not(:first-child) {
background-color: white;
color: black;
font-size: 100%;
padding: 5%;
padding: 0%;
width: 100%;
height: 100%;
display: flex;
@ -694,3 +695,22 @@ div.module-graph .gauge_d3_class {
.gauge-data #percent {
color: #000;
}
.orange_background {
background: #ffa631;
}
.red_background {
background: #e63c52;
}
.yellow_background {
background: #f3b200;
}
.grey_background {
background: #b2b2b2;
}
.blue_background {
background: #4a83f3;
}
.green_background {
background: #82b92e;
}