Merge remote-tracking branch 'origin/develop' into ent-4705-encriptado-de-nuevos-tokens

This commit is contained in:
marcos 2020-01-28 10:08:01 +01:00
commit d5016d4943
37 changed files with 3999 additions and 234 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.742-200122
Version: 7.0NG.742-200128
Architecture: all
Priority: optional
Section: admin

View File

@ -14,14 +14,20 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.742-200122"
pandora_version="7.0NG.742-200128"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
if [ $? = 1 ]
then
echo "No found \"dpkg-deb\" aplication, please install."
exit 1
if [ "$DPKG_DEB" == "" ]; then
echo "No found \"dpkg-deb\" aplication, please install."
exit 1
fi
echo ">> Using dockerized version of dpkg-deb: "
echo " $DPKG_DEB"
USE_DOCKER_APP=1
else
echo "Found \"dpkg-debs\"."
fi
@ -122,8 +128,12 @@ do
done
echo "END"
echo "Make the package \"Pandorafms console\"."
dpkg-deb --build temp_package
echo "Make the package \"Pandorafms agent\"."
if [ "$USE_DOCKER_APP" == "1" ]; then
eval $DPKG_DEB --build temp_package
else
dpkg-deb --build temp_package
fi
mv temp_package.deb pandorafms.agent_unix_$pandora_version.deb
echo "Delete the \"temp_package\" temp dir for job."

View File

@ -55,7 +55,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.742';
use constant AGENT_BUILD => '200122';
use constant AGENT_BUILD => '200128';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

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

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.742
%define release 200122
%define release 200128
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}
@ -18,7 +18,8 @@ Packager: Sancho Lerena <slerena@artica.es>
Prefix: /usr/share
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
BuildArch: noarch
PreReq: %fillup_prereq %insserv_prereq /usr/bin/sed /usr/bin/grep /usr/sbin/useradd
#PreReq: %fillup_prereq %insserv_prereq /usr/bin/sed /usr/bin/grep /usr/sbin/useradd
Requires(pre,preun):/usr/bin/sed /usr/bin/grep /usr/sbin/useradd
Requires: coreutils unzip perl perl(Sys::Syslog) perl(IO::Compress::Zip) perl(YAML::Tiny)
AutoReq: 0
Provides: %{name}-%{version}

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{200122}
{200128}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.742(Build 200122)")
#define PANDORA_VERSION ("7.0NG.742(Build 200128)")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.742(Build 200122))"
VALUE "ProductVersion", "(7.0NG.742(Build 200128))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.742-200122
Version: 7.0NG.742-200128
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.742-200122"
pandora_version="7.0NG.742-200128"
package_pear=0
package_pandora=1
@ -44,8 +44,15 @@ then
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
if [ $? = 1 ]
then
echo "No found \"dpkg-deb\" aplication, please install."
exit 1
if [ "$DPKG_DEB" == "" ]; then
echo "No found \"dpkg-deb\" aplication, please install."
exit 1
fi
echo ">> Using dockerized version of dpkg-deb: "
echo " $DPKG_DEB"
# Use dockerized app.
USE_DOCKER_APP=1
else
echo "Found \"dpkg-debs\"."
fi
@ -70,15 +77,15 @@ then
else
echo "Found \"fakeroot\"."
fi
fi
whereis dpkg-buildpackage | cut -d":" -f2 | grep dpkg-buildpackage > /dev/null
if [ $? = 1 ]
then
echo " \"dpkg-buildpackage\" aplication not found, please install."
exit 1
else
echo "Found \"dpkg-buildpackage\"."
whereis dpkg-buildpackage | cut -d":" -f2 | grep dpkg-buildpackage > /dev/null
if [ $? = 1 ]
then
echo " \"dpkg-buildpackage\" aplication not found, please install."
exit 1
else
echo "Found \"dpkg-buildpackage\"."
fi
fi
cd ..
@ -141,7 +148,11 @@ then
echo "END"
echo "Make the package \"Pandorafms console\"."
dpkg-deb --build temp_package
if [ "$USE_DOCKER_APP" == "1" ]; then
eval $DPKG_DEB --build temp_package
else
dpkg-deb --build temp_package
fi
mv temp_package.deb pandorafms.console_$pandora_version.deb
fi

View File

@ -4,5 +4,6 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_module_units', '{"bytes
ALTER TABLE `tserver` ADD COLUMN `port` int(5) unsigned NOT NULL default 0;
ALTER TABLE `tmap` ADD COLUMN `id_group_map` INT(10) UNSIGNED NOT NULL default 0;
ALTER TABLE `tevent_filter` MODIFY `severity` TEXT NOT NULL;
ALTER TABLE `treport_content_item` ADD `id_agent_module_failover` int(10) unsigned NOT NULL DEFAULT 0;
COMMIT;

View File

@ -2437,6 +2437,21 @@ CREATE TABLE `tagent_repository` (
ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------
-- Table `treport_content_item`
-- ----------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `treport_content_item` (
`id` INTEGER UNSIGNED NOT NULL auto_increment,
`id_report_content` INTEGER UNSIGNED NOT NULL,
`id_agent_module` int(10) unsigned NOT NULL,
`id_agent_module_failover` int(10) unsigned NOT NULL DEFAULT 0,
`server_name` text,
`operation` text,
PRIMARY KEY(`id`),
FOREIGN KEY (`id_report_content`) REFERENCES treport_content(`id_rc`)
ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------
-- Table `tdeployment_hosts`
-- ----------------------------------------------------------------------

View File

@ -703,8 +703,7 @@ if ($config['menu_type'] == 'classic') {
},
success: function (data) {
$('#result_order').html(data);
console.log(data);
},
},
error: function (data) {
console.error("Fatal error in AJAX call to interpreter order", data)
}

View File

@ -628,6 +628,8 @@ switch ($action) {
$unknown_checks = $item['unknown_checks'];
$agent_max_value = $item['agent_max_value'];
$agent_min_value = $item['agent_min_value'];
$failover_mode = $item['failover_mode'];
$failover_type = $item['failover_type'];
break;
case 'group_report':
@ -3263,6 +3265,13 @@ function print_General_list($width, $action, $idItem=null, $type='general')
$meta = false;
}
$failover_mode = db_get_value(
'failover_mode',
'treport_content',
'id_rc',
$idItem
);
$operation = [
'avg' => __('rate'),
'max' => __('max'),
@ -3284,6 +3293,18 @@ function print_General_list($width, $action, $idItem=null, $type='general')
<th class="header" scope="col">
<?php echo __('Module'); ?>
</th>
<?php
if ($failover_mode) {
?>
<th class="header" scope="col">
<?php echo __('Agent Failover'); ?>
</th>
<th class="header" scope="col">
<?php echo __('Module Failover'); ?>
</th>
<?php
}
?>
<th class="header" scope="col">
<?php echo __('Action'); ?>
</th>
@ -3365,19 +3386,50 @@ function print_General_list($width, $action, $idItem=null, $type='general')
['id_agente_modulo' => $item['id_agent_module']]
);
if (isset($item['id_agent_module_failover']) === true
&& $item['id_agent_module_failover'] !== 0
) {
$idAgentFailover = db_get_value_filter(
'id_agente',
'tagente_modulo',
['id_agente_modulo' => $item['id_agent_module_failover']]
);
$nameAgentFailover = agents_get_alias(
$idAgentFailover
);
$nameModuleFailover = db_get_value_filter(
'nombre',
'tagente_modulo',
['id_agente_modulo' => $item['id_agent_module_failover']]
);
}
$server_name_element = '';
if ($meta && $server_name != '') {
$server_name_element .= ' ('.$server_name.')';
}
if ($type == 'availability') {
echo '<tr id="general_'.$item['id'].'" style="" class="datos">
<td>'.printSmallFont($nameAgent).$server_name_element.'</td>
<td>'.printSmallFont($nameModule).'</td>
<td style="text-align: center;">
<a href="javascript: deleteGeneralRow('.$item['id'].');">'.html_print_image('images/cross.png', true).'</a>
</td>
</tr>';
if ($failover_mode) {
echo '<tr id="general_'.$item['id'].'" style="" class="datos">
<td>'.printSmallFont($nameAgent).$server_name_element.'</td>
<td>'.printSmallFont($nameModule).'</td>
<td>'.printSmallFont($nameAgentFailover).$server_name_element.'</td>
<td>'.printSmallFont($nameModuleFailover).'</td>
<td style="text-align: center;">
<a href="javascript: deleteGeneralRow('.$item['id'].');">'.html_print_image('images/cross.png', true).'</a>
</td>
</tr>';
} else {
echo '<tr id="general_'.$item['id'].'" style="" class="datos">
<td>'.printSmallFont($nameAgent).$server_name_element.'</td>
<td>'.printSmallFont($nameModule).'</td>
<td style="text-align: center;">
<a href="javascript: deleteGeneralRow('.$item['id'].');">'.html_print_image('images/cross.png', true).'</a>
</td>
</tr>';
}
} else {
echo '<tr id="general_'.$item['id'].'" style="" class="datos">
<td>'.printSmallFont($nameAgent).$server_name_element.'</td>
@ -3403,6 +3455,15 @@ function print_General_list($width, $action, $idItem=null, $type='general')
<td class="agent_name"></td>
<td class="module_name"></td>
<?php
if ($type == 'availability'
&& $failover_mode
) {
?>
<td class="agent_name_failover"></td>
<td class="module_name_failover"></td>
<?php
}
if ($type != 'availability') {
?>
<td class="operation_name"></td>
@ -3456,6 +3517,43 @@ function print_General_list($width, $action, $idItem=null, $type='general')
</select>
</td>
<?php
if ($type == 'availability' && $failover_mode) {
?>
<td class="sla_list_agent_failover_col">
<input id="hidden-id_agent_failover" name="id_agent_failover" value="" type="hidden">
<input id="hidden-server_name_failover" name="server_name_failover" value="" type="hidden">
<?php
$params = [];
$params['show_helptip'] = true;
$params['input_name'] = 'agent_failover';
$params['value'] = '';
$params['use_hidden_input_idagent'] = true;
$params['hidden_input_idagent_id'] = 'hidden-id_agent_failover';
$params['javascript_is_function_select'] = true;
$params['selectbox_id'] = 'id_agent_module_failover';
$params['add_none_module'] = false;
if ($meta) {
$params['use_input_id_server'] = true;
$params['input_id_server_id'] = 'hidden-id_server';
$params['disabled_javascript_on_blur_function'] = true;
}
ui_print_agent_autocomplete_input($params);
?>
</td>
<td class="sla_list_module_failover_col">
<select id="id_agent_module_failover" name="id_agent_module_failover" disabled="disabled" style="max-width: 180px">
<option value="0">
<?php
echo __('Select an Agent first');
?>
</option>
</select>
</td>
<?php
}
?>
<?php
if ($type !== 'availability') {
?>
<td>
@ -4495,6 +4593,10 @@ function addGeneralRow() {
var idAgent = $("input[name=id_agent_general]").val();
var serverId = $("input[name=id_server]").val();
var idModule = $("#id_agent_module_general").val();
var nameAgentFailover = $("input[name=agent_failover]").val();
var idModuleFailover = $("#id_agent_module_failover").val();
var nameModuleFailover = $("#id_agent_module_failover :selected").text();
var operation;
if ($("#id_operation_module_general").length) {
operation = $("#id_operation_module_general").val();
@ -4580,10 +4682,63 @@ function addGeneralRow() {
}
});
if (nameAgentFailover != '') {
//Truncate nameAgentFailover
var params = [];
params.push("truncate_text=1");
params.push("text=" + nameAgentFailover);
params.push("page=include/ajax/reporting.ajax");
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action=
<?php
echo '"'.ui_get_full_url(
false,
false,
false,
false
).'"';
?>
+ "/ajax.php",
async: false,
timeout: 10000,
success: function (data) {
nameAgentFailover = data;
}
});
//Truncate nameModuleFailover
var params = [];
params.push("truncate_text=1");
params.push("text=" + nameModuleFailover);
params.push("page=include/ajax/reporting.ajax");
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action=
<?php
echo '"'.ui_get_full_url(
false,
false,
false,
false
).'"';
?>
+ "/ajax.php",
async: false,
timeout: 10000,
success: function (data) {
nameModuleFailover = data;
}
});
}
var params = [];
params.push("add_general=1");
params.push("id=" + $("input[name=id_item]").val());
params.push("id_module=" + idModule);
params.push("id_module_failover=" + idModuleFailover);
params.push("id_server=" + serverId);
params.push("operation=" + operation);
params.push("id_agent=" + idAgent);
@ -4610,6 +4765,8 @@ function addGeneralRow() {
$("#row", row).attr('id', 'general_' + data['id']);
$(".agent_name", row).html(nameAgent);
$(".module_name", row).html(nameModule);
$(".agent_name_failover", row).html(nameAgentFailover);
$(".module_name_failover", row).html(nameModuleFailover);
$(".operation_name", row).html(nameOperation);
$(".delete_button", row).attr(
'href',
@ -4624,6 +4781,15 @@ function addGeneralRow() {
$("#id_operation_module_general").val('avg');
$("#id_agent_module_general").empty();
$("#id_agent_module_general").attr('disabled', 'true');
$("input[name=id_agent_failover]").val('');
$("input[name=agent_failover]").val('');
$("#id_agent_module_failover").empty();
$("#id_agent_module_failover").attr('disabled', 'true');
$("#id_agent_module_failover").append(
$("<option></option>")
.attr ("value", 0)
.html ($("#module_sla_text").html()));
}
}
});
@ -5111,6 +5277,12 @@ function chooseType() {
$("#row_select_fields3").hide();
}
$("#row_historical_db_check").hide();
$("#row_failover_mode").show();
var failover_checked = $("input[name='failover_mode']").prop("checked");
if(failover_checked){
$("#row_failover_type").show();
}
break;
case 'group_report':

View File

@ -1609,6 +1609,14 @@ switch ($action) {
$values['agent_min_value'] = get_parameter(
'agent_min_value'
);
$values['failover_mode'] = get_parameter(
'failover_mode',
0
);
$values['failover_type'] = get_parameter(
'failover_type',
REPORT_FAILOVER_TYPE_NORMAL
);
$good_format = true;
break;

View File

@ -111,6 +111,7 @@ if ($add_general) {
$id_module = get_parameter('id_module', 0);
$id_server = (int) get_parameter('id_server', 0);
$operation = get_parameter('operation', '');
$id_module_failover = (int) get_parameter('id_module_failover', 0);
$include_enterprise = enterprise_include('include/functions_metaconsole.php');
@ -126,10 +127,11 @@ if ($add_general) {
$result = db_process_sql_insert(
'treport_content_item',
[
'id_report_content' => $id,
'id_agent_module' => $id_module,
'server_name' => $connection['server_name'],
'operation' => $operation,
'id_report_content' => $id,
'id_agent_module' => $id_module,
'server_name' => $connection['server_name'],
'operation' => $operation,
'id_agent_module_failover' => $id_module_failover,
]
);

View File

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

View File

@ -6256,27 +6256,6 @@ function reporting_availability($report, $content, $date=false, $time=false)
$return['kind_availability'] = 'module';
}
if (empty($content['subitems'])) {
if (is_metaconsole()) {
metaconsole_restore_db();
}
$sql = sprintf(
'
SELECT id_agent_module,
server_name, operation
FROM treport_content_item
WHERE id_report_content = %d',
$content['id_rc']
);
$items = db_process_sql($sql);
} else {
$items = $content['subitems'];
}
$data = [];
$avg = 0;
$min = null;
$min_text = '';
@ -6284,180 +6263,241 @@ function reporting_availability($report, $content, $date=false, $time=false)
$max_text = '';
$count = 0;
$style = io_safe_output($content['style']);
if ($style['hide_notinit_agents']) {
$aux_id_agents = $agents;
$i = 0;
foreach ($items as $item) {
$utimestamp = db_get_value('utimestamp', 'tagente_datos', 'id_agente_modulo', $item['id_agent_module'], true);
if (($utimestamp === false) || (intval($utimestamp) > intval($datetime_to))) {
unset($items[$i]);
if ($content['failover_mode']) {
$availability_graph_data = reporting_availability_graph($report, $content, false, true);
$data = $availability_graph_data['data'];
foreach ($data as $key => $item_data) {
$percent_ok = $item_data['sla_value'];
$data[$key]['SLA'] = $percent_ok;
if ($item_data['failover'] != 'result') {
$data[$key]['availability_item'] = $item_data['module'];
$text = $item_data['agent'].' ('.$item_data['module'].')';
$avg = ((($avg * $count) + $percent_ok) / ($count + 1));
if (is_null($min)) {
$min = $percent_ok;
$min_text = $text;
} else {
if ($min > $percent_ok) {
$min = $percent_ok;
$min_text = $text;
}
}
if (is_null($max)) {
$max = $percent_ok;
$max_text = $text;
} else {
if ($max < $percent_ok) {
$max = $percent_ok;
$max_text = $text;
}
}
$count++;
} else {
$data[$key]['availability_item'] = '--';
$data[$key]['agent'] = '--';
}
}
} else {
if (empty($content['subitems'])) {
if (is_metaconsole()) {
metaconsole_restore_db();
}
$i++;
}
}
$sql = sprintf(
'
SELECT id_agent_module, id_agent_module_failover,
server_name, operation
FROM treport_content_item
WHERE id_report_content = %d',
$content['id_rc']
);
$items = db_process_sql($sql);
} else {
$items = $content['subitems'];
}
$data = [];
$style = io_safe_output($content['style']);
if ($style['hide_notinit_agents']) {
$aux_id_agents = $agents;
$i = 0;
foreach ($items as $item) {
$utimestamp = db_get_value('utimestamp', 'tagente_datos', 'id_agente_modulo', $item['id_agent_module'], true);
if (($utimestamp === false) || (intval($utimestamp) > intval($datetime_to))) {
unset($items[$i]);
}
$i++;
}
}
if (!empty($items)) {
foreach ($items as $item) {
// aaMetaconsole connection
$server_name = $item['server_name'];
if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
$connection = metaconsole_get_connection($server_name);
if (metaconsole_load_external_db($connection) != NOERR) {
// ui_print_error_message ("Error connecting to ".$server_name);
continue;
}
}
if (modules_is_disable_agent($item['id_agent_module'])
|| modules_is_not_init($item['id_agent_module'])
) {
// Restore dbconnection
if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
metaconsole_restore_db();
}
if (!empty($items)) {
foreach ($items as $item) {
// aaMetaconsole connection
$server_name = $item['server_name'];
if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
$connection = metaconsole_get_connection($server_name);
if (metaconsole_load_external_db($connection) != NOERR) {
// ui_print_error_message ("Error connecting to ".$server_name);
continue;
}
}
if (modules_is_disable_agent($item['id_agent_module'])
|| modules_is_not_init($item['id_agent_module'])
) {
$row = [];
$text = '';
$row['data'] = reporting_advanced_sla(
$item['id_agent_module'],
($report['datetime'] - $content['period']),
$report['datetime'],
null,
// min_value -> dynamic
null,
// max_value -> dynamic
null,
// inverse_interval -> dynamic
[
'1' => $content['sunday'],
'2' => $content['monday'],
'3' => $content['tuesday'],
'4' => $content['wednesday'],
'5' => $content['thursday'],
'6' => $content['friday'],
'7' => $content['saturday'],
],
$content['time_from'],
$content['time_to']
);
// HACK it is saved in show_graph field.
// Show interfaces instead the modules
if ($content['show_graph']) {
$text = $row['data']['availability_item'] = agents_get_address(
modules_get_agentmodule_agent($item['id_agent_module'])
);
if (empty($text)) {
$text = $row['data']['availability_item'] = __('No Address');
}
} else {
$text = $row['data']['availability_item'] = modules_get_agentmodule_name(
$item['id_agent_module']
);
}
$row['data']['agent'] = modules_get_agentmodule_agent_alias(
$item['id_agent_module']
);
$text = $row['data']['agent'].' ('.$text.')';
// Restore dbconnection
if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
metaconsole_restore_db();
}
continue;
}
// find order
$row['data']['order'] = $row['data']['SLA'];
$row = [];
$text = '';
$row['data'] = reporting_advanced_sla(
$item['id_agent_module'],
($report['datetime'] - $content['period']),
$report['datetime'],
null,
// min_value -> dynamic
null,
// max_value -> dynamic
null,
// inverse_interval -> dynamic
[
'1' => $content['sunday'],
'2' => $content['monday'],
'3' => $content['tuesday'],
'4' => $content['wednesday'],
'5' => $content['thursday'],
'6' => $content['friday'],
'7' => $content['saturday'],
],
$content['time_from'],
$content['time_to']
);
// HACK it is saved in show_graph field.
// Show interfaces instead the modules
if ($content['show_graph']) {
$text = $row['data']['availability_item'] = agents_get_address(
modules_get_agentmodule_agent($item['id_agent_module'])
);
if (empty($text)) {
$text = $row['data']['availability_item'] = __('No Address');
}
} else {
$text = $row['data']['availability_item'] = modules_get_agentmodule_name(
$item['id_agent_module']
);
}
$row['data']['agent'] = modules_get_agentmodule_agent_alias(
$item['id_agent_module']
);
$text = $row['data']['agent'].' ('.$text.')';
// Restore dbconnection
if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
metaconsole_restore_db();
}
// find order
$row['data']['order'] = $row['data']['SLA'];
$percent_ok = $row['data']['SLA'];
$avg = ((($avg * $count) + $percent_ok) / ($count + 1));
if (is_null($min)) {
$min = $percent_ok;
$min_text = $text;
} else {
if ($min > $percent_ok) {
$percent_ok = $row['data']['SLA'];
$avg = ((($avg * $count) + $percent_ok) / ($count + 1));
if (is_null($min)) {
$min = $percent_ok;
$min_text = $text;
} else {
if ($min > $percent_ok) {
$min = $percent_ok;
$min_text = $text;
}
}
}
if (is_null($max)) {
$max = $percent_ok;
$max_text = $text;
} else {
if ($max < $percent_ok) {
if (is_null($max)) {
$max = $percent_ok;
$max_text = $text;
} else {
if ($max < $percent_ok) {
$max = $percent_ok;
$max_text = $text;
}
}
$data[] = $row['data'];
$count++;
}
$data[] = $row['data'];
$count++;
}
switch ($content['order_uptodown']) {
case REPORT_ITEM_ORDER_BY_AGENT_NAME:
$temp = [];
foreach ($data as $row) {
$i = 0;
foreach ($temp as $t_row) {
if (strcmp($row['data']['agent'], $t_row['agent']) < 0) {
break;
}
switch ($content['order_uptodown']) {
case REPORT_ITEM_ORDER_BY_AGENT_NAME:
$temp = [];
foreach ($data as $row) {
$i = 0;
foreach ($temp as $t_row) {
if (strcmp($row['data']['agent'], $t_row['agent']) < 0) {
break;
$i++;
}
$i++;
array_splice($temp, $i, 0, [$row]);
}
array_splice($temp, $i, 0, [$row]);
}
$data = $temp;
break;
$data = $temp;
break;
case REPORT_ITEM_ORDER_BY_ASCENDING:
$temp = [];
foreach ($data as $row) {
$i = 0;
foreach ($temp as $t_row) {
if ($row['data']['SLA'] < $t_row['order']) {
break;
}
case REPORT_ITEM_ORDER_BY_ASCENDING:
$temp = [];
foreach ($data as $row) {
$i = 0;
foreach ($temp as $t_row) {
if ($row['data']['SLA'] < $t_row['order']) {
break;
$i++;
}
$i++;
array_splice($temp, $i, 0, [$row]);
}
array_splice($temp, $i, 0, [$row]);
}
$data = $temp;
break;
$data = $temp;
break;
case REPORT_ITEM_ORDER_BY_DESCENDING:
$temp = [];
foreach ($data as $row) {
$i = 0;
foreach ($temp as $t_row) {
if ($row['data']['SLA'] > $t_row['order']) {
break;
}
case REPORT_ITEM_ORDER_BY_DESCENDING:
$temp = [];
foreach ($data as $row) {
$i = 0;
foreach ($temp as $t_row) {
if ($row['data']['SLA'] > $t_row['order']) {
break;
$i++;
}
$i++;
array_splice($temp, $i, 0, [$row]);
}
array_splice($temp, $i, 0, [$row]);
}
$data = $temp;
break;
$data = $temp;
break;
}
}
}
@ -6496,7 +6536,7 @@ function reporting_availability($report, $content, $date=false, $time=false)
*
* @return array Generates a structure the report.
*/
function reporting_availability_graph($report, $content, $pdf=false)
function reporting_availability_graph($report, $content, $pdf=false, $failover=false)
{
global $config;
$return = [];
@ -6538,7 +6578,7 @@ function reporting_availability_graph($report, $content, $pdf=false)
$slas = io_safe_output(
db_get_all_rows_field_filter(
'treport_content_sla_combined',
($failover) ? 'treport_content_item' : 'treport_content_sla_combined',
'id_report_content',
$content['id_rc']
)
@ -6943,9 +6983,19 @@ function prepare_data_for_paint(
$alias_agent = modules_get_agentmodule_agent_alias(
$sla['id_agent_module']
);
$name_module = modules_get_agentmodule_name(
$sla['id_agent_module']
);
if ($content['show_graph']) {
$name_module = agents_get_address(
modules_get_agentmodule_agent($sla['id_agent_module'])
);
if (empty($name_module)) {
$name_module = __('No Address');
}
} else {
$name_module = modules_get_agentmodule_name(
$sla['id_agent_module']
);
}
$data['agent'] = $alias_agent;
$data['module'] = $name_module;

View File

@ -3028,6 +3028,10 @@ function reporting_html_availability($table, $item, $pdf=0)
$table1->data = [];
$table1->head = [];
if (isset($item['data'][0]['failover'])) {
$table1->head[-1] = __('Failover');
}
$table1->head[0] = __('Agent');
// HACK it is saved in show_graph field.
// Show interfaces instead the modules.
@ -3076,6 +3080,10 @@ function reporting_html_availability($table, $item, $pdf=0)
$table1->head[8] = __('% Ok');
$table1->headstyle = [];
if (isset($item['data'][0]['failover'])) {
$table1->headstyle[-1] = 'text-align: left';
}
$table1->headstyle[0] = 'text-align: left';
$table1->headstyle[1] = 'text-align: left';
$table1->headstyle[2] = 'text-align: center';
@ -3086,6 +3094,10 @@ function reporting_html_availability($table, $item, $pdf=0)
$table1->headstyle[7] = 'text-align: right';
$table1->headstyle[8] = 'text-align: right';
if (isset($item['data'][0]['failover'])) {
$table1->style[-1] = 'text-align: left';
}
$table1->style[0] = 'text-align: left';
$table1->style[1] = 'text-align: left';
$table1->style[2] = 'text-align: center';
@ -3101,6 +3113,10 @@ function reporting_html_availability($table, $item, $pdf=0)
$table2->data = [];
$table2->head = [];
if (isset($item['data'][0]['failover'])) {
$table2->head[-1] = __('Failover');
}
$table2->head[0] = __('Agent');
// HACK it is saved in show_graph field.
// Show interfaces instead the modules.
@ -3135,6 +3151,10 @@ function reporting_html_availability($table, $item, $pdf=0)
}
$table2->headstyle = [];
if (isset($item['data'][0]['failover'])) {
$table2->headstyle[-1] = 'text-align: left';
}
$table2->headstyle[0] = 'text-align: left';
$table2->headstyle[1] = 'text-align: left';
$table2->headstyle[2] = 'text-align: right';
@ -3142,6 +3162,10 @@ function reporting_html_availability($table, $item, $pdf=0)
$table2->headstyle[4] = 'text-align: right';
$table2->headstyle[5] = 'text-align: right';
if (isset($item['data'][0]['failover'])) {
$table2->style[-1] = 'text-align: left';
}
$table2->style[0] = 'text-align: left';
$table2->style[1] = 'text-align: left';
$table2->style[2] = 'text-align: right';
@ -3151,8 +3175,21 @@ function reporting_html_availability($table, $item, $pdf=0)
foreach ($item['data'] as $row) {
$table_row = [];
$table_row[] = $row['agent'];
$table_row[] = $row['availability_item'];
if (isset($row['failover'])) {
if (strpos($row['failover'], 'failover') !== false) {
$table_row[] = __('Failover');
} else {
$table_row[] = ucfirst($row['failover']);
}
}
if (isset($row['failover']) && $row['failover'] === 'result') {
$table_row[] = '--';
$table_row[] = '--';
} else {
$table_row[] = $row['agent'];
$table_row[] = $row['availability_item'];
}
if ($row['time_total'] != 0 && $item['fields']['total_time']) {
$table_row[] = human_time_description_raw(
@ -3229,6 +3266,10 @@ function reporting_html_availability($table, $item, $pdf=0)
$table_row[] = '<span style="font-size: '.$font_size.'; font-weight:bold;">'.sla_truncate($row['SLA'], $config['graph_precision']).'%</span>';
$table_row2 = [];
if (isset($row['failover'])) {
$table_row2[] = ucfirst($row['failover']);
}
$table_row2[] = $row['agent'];
$table_row2[] = $row['availability_item'];
if ($item['fields']['total_checks']) {

View File

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

View File

@ -70,7 +70,7 @@ class User
$this->sessions[$data['phpsessionid']] = 1;
$info = \db_get_row_filter(
'tsessions_php',
['id_session' => $data['phpsessionid']]
['id_session' => io_safe_input($data['phpsessionid'])]
);
if ($info !== false) {

View File

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

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.742
%define release 200122
%define release 200128
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.742
%define release 200122
%define release 200128
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.742
%define release 200122
%define release 200128
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -1486,14 +1486,15 @@ CREATE TABLE IF NOT EXISTS `treport_content_sla_combined` (
-- Table `treport_content_item`
-- ----------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `treport_content_item` (
`id` INTEGER UNSIGNED NOT NULL auto_increment,
`id_report_content` INTEGER UNSIGNED NOT NULL,
`id_agent_module` int(10) unsigned NOT NULL,
`id` INTEGER UNSIGNED NOT NULL auto_increment,
`id_report_content` INTEGER UNSIGNED NOT NULL,
`id_agent_module` int(10) unsigned NOT NULL,
`id_agent_module_failover` int(10) unsigned NOT NULL DEFAULT 0,
`server_name` text,
`operation` text,
PRIMARY KEY(`id`),
FOREIGN KEY (`id_report_content`) REFERENCES treport_content(`id_rc`)
ON UPDATE CASCADE ON DELETE CASCADE
ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
-- ---------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.742-200122
Version: 7.0NG.742-200128
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.742-200122"
pandora_version="7.0NG.742-200128"
package_cpan=0
package_pandora=1
@ -64,6 +64,22 @@ mkdir temp_package
if [ $package_pandora -eq 1 ]
then
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
if [ $? = 1 ]
then
if [ "$DPKG_DEB" == "" ]; then
echo "No found \"dpkg-deb\" aplication, please install."
exit 1
fi
echo ">> Using dockerized version of dpkg-deb: "
echo " $DPKG_DEB"
# Use dockerized app.
USE_DOCKER_APP=1
else
echo "Found \"dpkg-debs\"."
fi
mkdir -p temp_package/usr/bin/
mkdir -p temp_package/usr/sbin/
mkdir -p temp_package/etc/init.d/
@ -164,8 +180,15 @@ then
echo "END"
echo "Make the package \"Pandorafms server\"."
dpkg-deb --build temp_package
if [ "$USE_DOCKER_APP" == "1" ]; then
eval $DPKG_DEB --build temp_package
else
dpkg-deb --build temp_package
fi
mv temp_package.deb pandorafms.server_$pandora_version.deb
echo "generated: pandorafms.server_$pandora_version.deb"
pwd
ls -lah pandorafms.server_$pandora_version.deb
chmod 777 pandorafms.server_$pandora_version.deb
fi

View File

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

View File

@ -32,7 +32,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.742";
my $pandora_build = "200122";
my $pandora_build = "200128";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.742
%define release 200122
%define release 200128
Summary: Pandora FMS Server
Name: %{name}
@ -159,7 +159,7 @@ fi
exit 0
%files
%defattr(-,root,root)
%defattr(750,root,root)
%doc AUTHORS COPYING README
%{_sysconfdir}/rc.d/init.d/pandora_server
%{_sysconfdir}/rc.d/init.d/tentacle_serverd
@ -174,10 +174,11 @@ exit 0
%{_mandir}/man1/pandora_server.1.gz
%{_mandir}/man1/tentacle_server.1.gz
%defattr(-,pandora,root)
%defattr(750,pandora,root)
%{_bindir}/pandora_exec
%{_bindir}/pandora_server
%{_bindir}/tentacle_server
%dir %{_sysconfdir}/pandora
%dir %{_localstatedir}/spool/pandora

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.742
%define release 200122
%define release 200128
Summary: Pandora FMS Server
Name: %{name}
@ -18,7 +18,8 @@ Packager: Sancho Lerena <slerena@artica.es>
Prefix: /usr/share
BuildRoot: %{_tmppath}/%{name}-buildroot
BuildArch: noarch
PreReq: %fillup_prereq %insserv_prereq /usr/bin/sed /usr/bin/grep /usr/sbin/useradd
# PreReq: %fillup_prereq %insserv_prereq /usr/bin/sed /usr/bin/grep /usr/sbin/useradd
Requires(pre,preun):/usr/bin/sed /usr/bin/grep /usr/sbin/useradd
AutoReq: 0
Provides: %{name}-%{version}
Requires: perl-DBI perl-DBD-mysql perl-libwww-perl

View File

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

View File

@ -34,7 +34,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.742 PS200122";
my $version = "7.0NG.742 PS200128";
# Pandora server configuration
my %conf;

View File

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