Merge remote-tracking branch 'origin/develop' into ent-4545-Bug-creacion-infrome-con-graficas-MAX-Value-fallo-tabla

Conflicts:
	pandora_console/include/functions_reporting.php
This commit is contained in:
Tatiana Llorente 2019-09-13 09:24:24 +02:00
commit e16855396a
29 changed files with 227 additions and 345 deletions

View File

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

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

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.738"
PI_BUILD="190911"
PI_BUILD="190913"
OS_NAME=`uname -s`
FORCE=0

View File

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

View File

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

View File

@ -44,24 +44,16 @@ $groups = groups_get_all();
// Add the All group to the beginning to be always the first
// Use this instead array_unshift to keep the array keys
$groups = ([0 => __('All')] + $groups);
$html = '';
$style = 'style="padding: 2px 10px; display: inline-block;"';
$groups_selected = [];
foreach ($groups as $id => $name) {
$checked = in_array($id, $file['groups']);
$all_checked = false;
if ($id === 0) {
$checkbox = html_print_checkbox_extended('groups[]', $id, $checked, false, '', 'class="chkb_all"', true);
$all_checked = $checked;
} else {
$checkbox = html_print_checkbox_extended('groups[]', $id, $checked, $all_checked, '', 'class="chkb_group"', true);
if (in_array($id, $file['groups'])) {
$groups_selected[] = $id;
}
$html .= "<div $style>$name&nbsp;$checkbox</div>";
}
$row = [];
$row[0] = __('Groups');
$row[1] = $html;
$row[1] = html_print_select($groups, 'groups[]', $groups_selected, '', '', '', true, true, '', '', '');
$table->data[] = $row;
$table->colspan[][1] = 3;

View File

@ -193,7 +193,7 @@ function files_repo_add_file($file_input_name='upfile', $description='', $groups
global $config;
$attachment_path = io_safe_output($config['attachment_store']);
$files_repo_path = $attachment_path.'/'.'files_repo';
$files_repo_path = $attachment_path.'/files_repo';
$result = [];
$result['status'] = false;

View File

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

View File

@ -4785,12 +4785,10 @@ function reporting_value($report, $content, $type, $pdf=false)
'period' => $content['period'],
'width' => '600px',
'pure' => false,
// true
'date' => $report['datetime'],
'only_image' => $only_image,
'homeurl' => ui_get_full_url(false, false, false, false),
'ttl' => 1,
// 2
'type_graph' => $config['type_module_charts'],
'time_interval' => $content['lapse'],
'server_id' => $id_meta,
@ -4800,323 +4798,105 @@ function reporting_value($report, $content, $type, $pdf=false)
switch ($type) {
case 'max':
if ($content['lapse_calc'] == 0) {
$value = reporting_get_agentmodule_data_max(
$content['id_agent_module'],
$content['period'],
$report['datetime']
);
if (!$config['simple_module_value']) {
$formated_value = $value;
} else {
$formated_value = format_for_graph($value, $config['graph_precision']).' '.$unit;
}
} else {
$value = '
<table border="0" style="margin:0 auto;text-align:center;">
<tr>
<td width="400px;" height="20%;">';
if ($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3) {
$value .= '
<table style="width:90%;margin:0 auto;background-color:#eee;border: solid lightgray 1px;">
<tr>
<th style="padding:5px;background-color:#82b92e;">
'.__('Agent').'
</th>
<th style="padding:5px;background-color:#82b92e;">
'.__('Module').'
</th>
<th style="padding:5px;background-color:#82b92e;">
'.__('Maximum').'
</th>
<tr>
<td style="padding:5px;">
'.$agent_name.'
</td>
<td style="padding:5px;">
'.$module_name.'
</td>
<td style="padding:5px;">
'.format_for_graph(reporting_get_agentmodule_data_max($content['id_agent_module'], $content['period'], $report['datetime']), $config['graph_precision']).' '.$unit.'
</td>
</tr>
</table>';
}
$value .= '
</td>
<td rowspan="2" width="150px">
</td>
<td rowspan="2">';
if ($content['visual_format'] == 2 || $content['visual_format'] == 3) {
$params['force_interval'] = 'max_only';
$value .= grafico_modulo_sparse($params);
}
$value .= '
</td>
</tr>
<tr>
<td>';
if ($content['visual_format'] == 1 || $content['visual_format'] == 3) {
$value .= '
<table style="width:90%;margin:0 auto;margin-top:30px;background-color:#eee;border: solid lightgray 1px;">
<tr>
<th style="padding:5px;background-color:#82b92e;">
'.__('Lapse').'
</th>
<th style="padding:5px;background-color:#82b92e;">
'.__('Maximum').'
</th>
</tr>
<tr>';
$time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module'], true);
$date_reference = getdate();
for ($i = ($report['datetime'] - $content['period']); $i < $report['datetime']; $i += $content['lapse']) {
$value .= '<tr><td style="padding:5px;">'.date('Y-m-d H:i:s', ($i + 1)).' to '.date('Y-m-d H:i:s', (($i + $content['lapse']) )).'</td><td>';
if ($i > $time_begin['utimestamp']) {
$value .= format_for_graph(
reporting_get_agentmodule_data_max(
$content['id_agent_module'],
$content['lapse'],
($i + $content['lapse'])
),
$config['graph_precision']
).' '.$unit.'</td></tr>';
} else {
$value .= 'N/A</td></tr>';
}
}
$value .= '</table>';
}
$value .= '
</td>
</tr>
</table>';
$formated_value = $value;
}
break;
case 'min':
if ($content['lapse_calc'] == 0) {
$value = reporting_get_agentmodule_data_min(
$content['id_agent_module'],
$content['period'],
$report['datetime']
);
if (!$config['simple_module_value']) {
$formated_value = $value;
} else {
$formated_value = format_for_graph($value, $config['graph_precision']).' '.$unit;
}
} else {
$value = '
<table border="0" style="margin:0 auto;text-align:center;">
<tr>
<td width="400px;" height="20%;">';
if ($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3) {
$value .= '
<table style="width:90%;margin:0 auto;background-color:#eee;border: solid lightgray 1px;">
<tr>
<th style="padding:5px;background-color:#82b92e;">
'.__('Agent').'
</th>
<th style="padding:5px;background-color:#82b92e;">
'.__('Module').'
</th>
<th style="padding:5px;background-color:#82b92e;">
'.__('Minimum').'
</th>
<tr>
<td style="padding:5px;">
'.$agent_name.'
</td>
<td style="padding:5px;">
'.$module_name.'
</td>
<td style="padding:5px;">
'.format_for_graph(reporting_get_agentmodule_data_min($content['id_agent_module'], $content['period'], $report['datetime']), $config['graph_precision']).' '.$unit.'
</td>
</tr>
</table>';
}
$value .= '
</td>
<td rowspan="2" width="150px">
</td>
<td rowspan="2">';
if ($content['visual_format'] == 2 || $content['visual_format'] == 3) {
$params['force_interval'] = 'min_only';
$value .= grafico_modulo_sparse($params);
}
$value .= '
</td>
</tr>
<tr>
<td>';
if ($content['visual_format'] == 1 || $content['visual_format'] == 3) {
$value .= '
<table style="width:90%;margin:0 auto;margin-top:30px;background-color:#eee;border: solid lightgray 1px;">
<tr>
<th style="padding:5px;background-color:#82b92e;">
'.__('Lapse').'
</th>
<th style="padding:5px;background-color:#82b92e;">
'.__('Minimum').'
</th>
</tr>
<tr>';
$time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module']);
$date_reference = getdate();
for ($i = ($report['datetime'] - $content['period']); $i < $report['datetime']; $i += $content['lapse']) {
$value .= '<tr><td style="padding:5px;">'.date('Y-m-d H:i:s', ($i + 1)).' to '.date('Y-m-d H:i:s', (($i + $content['lapse']) )).'</td><td>';
if ($i > $time_begin['utimestamp']) {
$value .= format_for_graph(
reporting_get_agentmodule_data_min(
$content['id_agent_module'],
$content['lapse'],
($i + $content['lapse'])
),
$config['graph_precision']
).' '.$unit.'</td></tr>';
} else {
$value .= 'N/A</td></tr>';
}
}
$value .= '</table>';
}
$value .= '
</td>
</tr>
</table>';
$formated_value = $value;
}
break;
case 'avg':
if ($content['lapse_calc'] == 0) {
$value = reporting_get_agentmodule_data_average(
$content['id_agent_module'],
$content['period'],
$report['datetime']
);
switch ($type) {
case 'max':
$value = reporting_get_agentmodule_data_max(
$content['id_agent_module'],
$content['period'],
$report['datetime']
);
break;
case 'min':
$value = reporting_get_agentmodule_data_min(
$content['id_agent_module'],
$content['period'],
$report['datetime']
);
break;
case 'avg':
$value = reporting_get_agentmodule_data_average(
$content['id_agent_module'],
$content['period'],
$report['datetime']
);
break;
}
if (!$config['simple_module_value']) {
$formated_value = $value;
} else {
$formated_value = format_for_graph($value, $config['graph_precision']).' '.$unit;
}
} else {
$value = '
<table border="0" style="margin:0 auto;text-align:center;">
<tr>
<td width="400px;" height="20%;">';
$return['visual_format'] = $content['visual_format'];
if ($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3) {
$value .= '
<table style="width:90%;margin:0 auto;background-color:#eee;border: solid lightgray 1px;">
<tr>
<th style="padding:5px;background-color:#82b92e;">
'.__('Agent').'
</th>
<th style="padding:5px;background-color:#82b92e;">
'.__('Module').'
</th>
<th style="padding:5px;background-color:#82b92e;">
'.__('Average').'
</th>
<tr>
<td style="padding:5px;">
'.$agent_name.'
</td>
<td style="padding:5px;">
'.$module_name.'
</td>
<td style="padding:5px;">
'.format_for_graph(reporting_get_agentmodule_data_average($content['id_agent_module'], $content['period'], $report['datetime']), $config['graph_precision']).' '.$unit.'
</td>
</tr>
</table>';
switch ($type) {
case 'max':
$params['force_interval'] = 'max_only';
$value = format_for_graph(reporting_get_agentmodule_data_max($content['id_agent_module'], $content['period'], $report['datetime']), $config['graph_precision']).' '.$unit;
break;
case 'min':
$params['force_interval'] = 'min_only';
$value = format_for_graph(reporting_get_agentmodule_data_min($content['id_agent_module'], $content['period'], $report['datetime']), $config['graph_precision']).' '.$unit;
break;
case 'avg':
$params['force_interval'] = 'avg_only';
$value = format_for_graph(reporting_get_agentmodule_data_average($content['id_agent_module'], $content['period'], $report['datetime']), $config['graph_precision']).' '.$unit;
break;
}
$value .= '
</td>
<td rowspan="2" width="150px">
</td>
<td rowspan="2">';
if ($content['visual_format'] == 2 || $content['visual_format'] == 3) {
$params['force_interval'] = 'avg_only';
$value .= grafico_modulo_sparse($params);
$return['data'][] = [
__('Agent') => $agent_name,
__('Module') => $module_name,
__('Maximun') => $value,
];
if ($content['visual_format'] != 1) {
$graph = grafico_modulo_sparse($params);
$return['data'][] = ['value' => $graph];
}
$value .= '
</td>
</tr>
<tr>
<td>';
if ($content['visual_format'] == 1 || $content['visual_format'] == 3) {
$value .= '
<table style="width:90%;margin:0 auto;margin-top:30px;background-color:#eee;border: solid lightgray 1px;">
<tr>
<th style="padding:5px;background-color:#82b92e;">
'.__('Lapse').'
</th>
<th style="padding:5px;background-color:#82b92e;">
'.__('Average').'
</th>
</tr>
<tr>';
$time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module']);
$date_reference = getdate();
if ($content['visual_format'] != 2) {
$time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module'], true);
for ($i = ($report['datetime'] - $content['period']); $i < $report['datetime']; $i += $content['lapse']) {
$value .= '<tr><td style="padding:5px;">'.date('Y-m-d H:i:s', ($i + 1)).' to '.date('Y-m-d H:i:s', (($i + $content['lapse']) )).'</td><td>';
$row = [];
$row[__('Lapse')] = date('Y-m-d H:i:s', ($i + 1)).' to '.date('Y-m-d H:i:s', (($i + $content['lapse']) ));
if ($i > $time_begin['utimestamp']) {
$value .= format_for_graph(
reporting_get_agentmodule_data_average(
$content['id_agent_module'],
$content['lapse'],
($i + $content['lapse'])
),
$config['graph_precision']
).' '.$unit.'</td></tr>';
} else {
$value .= 'N/A</td></tr>';
}
}
switch ($type) {
case 'max':
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_max($content['id_agent_module'], $content['lapse'], ($i + $content['lapse'])), $config['graph_precision']).' '.$unit;
break;
$value .= '</table>';
case 'min':
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_min($content['id_agent_module'], $content['lapse'], ($i + $content['lapse'])), $config['graph_precision']).' '.$unit;
break;
case 'avg':
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_average($content['id_agent_module'], $content['lapse'], ($i + $content['lapse'])), $config['graph_precision']).' '.$unit;
break;
}
} else {
$row[__('Maximun')] = 'N/A';
}
$return['data'][] = $row;
}
}
$value .= '
</td>
</tr>
</table>';
if ($config['metaconsole']) {
metaconsole_restore_db();
}
$formated_value = $value;
return reporting_check_structure_content($return);
}
break;

View File

@ -2784,20 +2784,130 @@ function reporting_html_value(&$table, $item, $mini, $only_value=false, $check_e
$font_size = '3';
}
$table->colspan['data']['cell'] = 3;
$table->cellstyle['data']['cell'] = 'text-align: left;';
if (isset($item['visual_format']) && $item['visual_format'] != 0
&& ($item['type'] == 'max_value' || $item['type'] == 'min_value' || $item['type'] == 'avg_value')
) {
$table2 = new stdClass();
$table2->width = '100%';
switch ($item['type']) {
case 'max_value':
$table2->head = [
__('Agent'),
__('Module'),
__('Maximun'),
];
break;
$table->data['data']['cell'] = '<p style="font: bold '.$font_size.'em Arial, Sans-serif; color: #000000;">';
case 'min_value':
$table2->head = [
__('Agent'),
__('Module'),
__('Minimun'),
];
break;
if ($check_empty && empty($item['data']['value'])) {
$table->data['data']['cell'] .= __('Unknown');
} else if ($only_value) {
$table->data['data']['cell'] .= $item['data']['value'];
case 'avg_value':
$table2->head = [
__('Agent'),
__('Module'),
__('Average'),
];
break;
}
$table2->data = [];
$data = $item['data'][0];
$row = [
$data[__('Agent')],
$data[__('Module')],
$data[__('Maximun')],
];
$table2->data[] = $row;
$table2->title = $item['title'];
$table2->titleclass = 'title_table_pdf';
$table2->titlestyle = 'text-align:left;';
$table->colspan[1][0] = 3;
$table->colspan[2][0] = 3;
$table->colspan[3][0] = 3;
array_push($table->data, html_print_table($table2, true));
unset($item['data'][0]);
if ($item['visual_format'] != 1) {
$value = $item['data'][1]['value'];
array_push($table->data, $value);
unset($item['data'][1]);
}
if ($item['visual_format'] != 2) {
$table1 = new stdClass();
$table1->width = '100%';
switch ($item['type']) {
case 'max_value':
$table1->head = [
__('Lapse'),
__('Maximun'),
];
break;
case 'min_value':
$table1->head = [
__('Lapse'),
__('Minimun'),
];
break;
case 'avg_value':
$table1->head = [
__('Lapse'),
__('Average'),
];
break;
}
$table1->data = [];
foreach ($item['data'] as $data) {
if (!is_numeric($data[__('Maximun')])) {
$row = [
$data[__('Lapse')],
$data[__('Maximun')],
];
} else {
$row = [
$data[__('Lapse')],
remove_right_zeros(number_format($data[__('Maximun')], $config['graph_precision'])),
];
}
$table1->data[] = $row;
}
$table1->title = $item['title'];
$table1->titleclass = 'title_table_pdf';
$table1->titlestyle = 'text-align:left;';
array_push($table->data, html_print_table($table1, true));
}
} else {
$table->data['data']['cell'] .= $item['data']['formated_value'];
}
$table->colspan['data']['cell'] = 3;
$table->cellstyle['data']['cell'] = 'text-align: left;';
$table->data['data']['cell'] .= '</p>';
$table->data['data']['cell'] = '<p style="font: bold '.$font_size.'em Arial, Sans-serif; color: #000000;">';
if ($check_empty && empty($item['data']['value'])) {
$table->data['data']['cell'] .= __('Unknown');
} else if ($only_value) {
$table->data['data']['cell'] .= $item['data']['value'];
} else {
$table->data['data']['cell'] .= $item['data']['formated_value'];
}
$table->data['data']['cell'] .= '</p>';
}
}

View File

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

View File

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

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.738";
my $pandora_build = "190911";
my $pandora_build = "190913";
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.738";
my $pandora_build = "190911";
my $pandora_build = "190913";
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.738
%define release 190911
%define release 190913
Summary: Pandora FMS Server
Name: %{name}

View File

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

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.738"
PI_BUILD="190911"
PI_BUILD="190913"
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.738 PS190911";
my $version = "7.0NG.738 PS190913";
# 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.738 PS190911";
my $version = "7.0NG.738 PS190913";
# save program name for logging
my $progname = basename($0);