Merge branch 'develop' into '1241-adv-config-in-ldap-auth-dev'

# Conflicts:
#   pandora_console/include/auth/mysql.php
This commit is contained in:
artu30 2017-09-27 11:02:15 +02:00
commit d372d3a93e
44 changed files with 1164 additions and 897 deletions

View File

@ -58,6 +58,9 @@ server_port 41121
# Transfer mode: tentacle, ftp, ssh or local
transfer_mode tentacle
# Transfer mode user: Owner of files copied on local transfer mode (default apache)
#transfer_mode_user apache
# Server password (Tentacle or FTP). Leave empty for no password (default).
# server_pwd mypassword

View File

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

@ -88,6 +88,9 @@ server_port 41121
# Transfer mode: tentacle, ftp, ssh or local
transfer_mode tentacle
# Transfer mode user: Owner of files copied on local transfer mode (default apache)
#transfer_mode_user apache
# Server password (Tentacle or FTP). Leave empty for no password (default).
#server_pwd mypassword

View File

@ -98,6 +98,9 @@ server_port 41121
# Transfer mode: tentacle, ftp, ssh or local
transfer_mode tentacle
# Transfer mode user: Owner of files copied on local transfer mode (default apache)
#transfer_mode_user apache
# timeout in seconds for file transfer programs execution (30 by default)
#transfer_timeout 30

View File

@ -60,6 +60,9 @@ server_port 41121
# Transfer mode: tentacle, ftp, ssh or local
transfer_mode tentacle
# Transfer mode user: Owner of files copied on local transfer mode (default apache)
#transfer_mode_user apache
# Server password (Tentacle or FTP). Leave empty for no password (default).
# server_pwd mypassword

View File

@ -104,6 +104,9 @@ server_port 41121
# Transfer mode: tentacle, ftp, ssh or local
transfer_mode tentacle
# Transfer mode user: Owner of files copied on local transfer mode (default apache)
#transfer_mode_user apache
# timeout in seconds for file transfer programs execution (30 by default)
#transfer_timeout 30

View File

@ -66,6 +66,9 @@ server_port 41121
# Transfer mode: tentacle, ftp, ssh or local
transfer_mode tentacle
# Transfer mode user: Owner of files copied on local transfer mode (default apache)
#transfer_mode_user apache
# timeout in seconds for file transfer programs execution (30 by default)
#transfer_timeout 30

View File

@ -60,6 +60,9 @@ server_port 41121
# Transfer mode: tentacle, ftp, ssh or local
transfer_mode tentacle
# Transfer mode user: Owner of files copied on local transfer mode (default apache)
#transfer_mode_user apache
# timeout in seconds for file transfer programs execution (30 by default)
#transfer_timeout 30

View File

@ -41,7 +41,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.712';
use constant AGENT_BUILD => '170921';
use constant AGENT_BUILD => '170926';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -128,6 +128,9 @@ my @BrokerPid;
my %DefaultConf = (
'server_ip' => 'localhost',
'server_path' => '/var/spool/pandora/data_in',
'server_path_md5' => 'md5', #undocumented
'server_path_conf' => 'conf', #undocumented
'server_path_zip' => 'collections', #undocumented
'logfile' =>'/var/log/pandora/pandora_agent.log',
'logsize' => DEFAULT_MAX_LOG_SIZE,
'logrotate' => DEFAULT_LOG_ROTATE,
@ -146,6 +149,7 @@ my %DefaultConf = (
'encoding' => 'UTF-8',
'server_port' => 41121,
'transfer_mode' => 'tentacle',
'transfer_mode_user' => 'apache',
'transfer_timeout' => 30,
'server_user' => 'pandora',
'server_pwd' => '',
@ -906,13 +910,17 @@ sub fix_directory ($) {
################################################################################
# Sends a file to the server.
################################################################################
#sub send_file ($;$$$) {
sub send_file {
my ($file, $secondary, $rc_primary, $flag_always) = @_;
my ($file, $secondary, $rc_primary, $flag_always, $relative) = @_;
my $output;
my $pid = fork();
return 1 unless defined $pid;
# Fix remote dir to some transfer mode
my $remote_dir = $Conf{'server_path'} . "/";
$remote_dir .= fix_directory($relative) . '/' if defined($relative);
if ($pid == 0) {
# execute the transfer program by child process.
eval {
@ -935,7 +943,7 @@ sub send_file {
quit
FEOF1`
} elsif ($Conf{'transfer_mode'} eq 'local') {
$output = `cp "$file" "$Conf{'server_path'}/" 2>&1 >$DevNull`;
$output = `cp -p "$file" "$remote_dir" 2>&1 >$DevNull`;
}
alarm (0);
};
@ -966,7 +974,7 @@ sub send_file {
$rc_primary = 1;
}
swap_servers ();
$rc = send_file ($file, undef, $rc_primary);
$rc = send_file ($file, undef, $rc_primary, undef, $relative);
swap_servers ();
return $rc;
@ -1024,7 +1032,7 @@ sub send_file {
return $rc unless ($Conf{'secondary_mode'} eq 'always' || ($Conf{'secondary_mode'} eq 'on_error' && $rc != 0));
swap_servers ();
$rc = send_file ($file);
$rc = send_file ($file, undef, undef, undef, $relative);
swap_servers ();
return $rc;
}
@ -1075,13 +1083,17 @@ sub swap_servers () {
################################################################################
# Receive a file from the server.
################################################################################
sub recv_file ($) {
my $file = shift;
sub recv_file {
my ($file, $relative) = @_;
my $output;
my $pid = fork();
return 1 unless defined $pid;
# Fix remote dir to some transfer mode
my $remote_dir = $Conf{'server_path'};
$remote_dir .= "/" . fix_directory($relative) if defined($relative);
if ($pid == 0) {
# execute the transfer program by child process.
eval {
@ -1104,7 +1116,7 @@ sub recv_file ($) {
quit
FEOF1`
} elsif ($Conf{'transfer_mode'} eq 'local') {
$output = `cp $Conf{'server_path'}/$file $Conf{'temporal'} 2>&1 >$DevNull`;
$output = `cp "$remote_dir/$file" $Conf{'temporal'} 2>&1 >$DevNull`;
}
alarm (0);
};
@ -1148,14 +1160,19 @@ sub check_remote_config () {
}
# Get the remote MD5 file
if (recv_file ($RemoteMD5File) != 0) {
if (recv_file ($RemoteMD5File, $Conf{'server_path_md5'}) != 0) {
log_message ('remote config', 'Uploading configuration for the first time.');
open (MD5_FILE, "> $Conf{'temporal'}/$RemoteMD5File") || error ("Could not open file '$ConfDir/$RemoteMD5File' for writing: $!.");
print MD5_FILE $conf_md5;
close (MD5_FILE);
copy ("$ConfDir/$ConfFile", "$Conf{'temporal'}/$RemoteConfFile");
send_file ("$Conf{'temporal'}/$RemoteConfFile");
send_file ("$Conf{'temporal'}/$RemoteMD5File");
log_message ('remote config', 'Uploading configuration for the first time.');
if ($Conf{'transfer_mode'} eq 'local') {
my (undef, undef, $uid, $gid) = getpwnam($Conf{'transfer_mode_user'});
chown ($uid, $gid, "$Conf{'temporal'}/$RemoteMD5File");
chown ($uid, $gid, "$Conf{'temporal'}/$RemoteConfFile");
}
send_file ("$Conf{'temporal'}/$RemoteConfFile", undef, undef, undef, $Conf{'server_path_conf'});
send_file ("$Conf{'temporal'}/$RemoteMD5File", undef, undef, undef, $Conf{'server_path_md5'});
unlink ("$Conf{'temporal'}/$RemoteConfFile");
unlink ("$Conf{'temporal'}/$RemoteMD5File");
return;
@ -1169,7 +1186,7 @@ sub check_remote_config () {
return if ($remote_conf_md5 eq $conf_md5);
# Get the new configuration file
return if (recv_file ($RemoteConfFile) != 0);
return if (recv_file ($RemoteConfFile, $Conf{'server_path_conf'}) != 0);
log_message ('remote config', 'Configuration has changed!');
# Save the new configuration
@ -1255,7 +1272,7 @@ sub check_collections () {
# Get remote md5
error ("File '$Conf{'temporal'}/$collection_md5_file' already exists as a symlink and could not be removed: $!.") if (-l "$Conf{'temporal'}/$collection_md5_file" && !unlink("$Conf{'temporal'}/$collection_md5_file"));
next unless (recv_file ($collection_md5_file) == 0);
next unless (recv_file ($collection_md5_file, $Conf{'server_path_md5'}) == 0);
open (MD5_FILE, "< $Conf{'temporal'}/$collection_md5_file") || error ("Could not open file '$Conf{'temporal'}/$collection_md5_file' for reading: $!.");
my $remote_collection_md5 = <MD5_FILE>;
close (MD5_FILE);
@ -1273,7 +1290,7 @@ sub check_collections () {
next if ($local_collection_md5 eq $remote_collection_md5);
# Download and unzip
next unless (recv_file ($collection_file) == 0);
next unless (recv_file ($collection_file, $Conf{'server_path_zip'}) == 0);
rmrf ("$ConfDir/collections/$collection");
`unzip -d "$ConfDir/collections/$collection" "$Conf{'temporal'}/$collection_file" 2>$DevNull`;
unlink ("$Conf{'temporal'}/$collection_file");

View File

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

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.712"
PI_BUILD="170921"
PI_BUILD="170926"
OS_NAME=`uname -s`
FORCE=0

View File

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

View File

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

View File

@ -184,7 +184,7 @@ function extension_db_check_tables_differences($connection_test,
ui_print_result_message(
empty($diff_tables),
__('Successful the DB Pandora has all tables'),
__('Unsuccessful the DB Pandora has not all tables. The tables lost are (%s)',
__('Unsuccessful the DB Pandora has not all tables. The missing tables are (%s)',
implode(", ", $diff_tables)));
if (!empty($diff_tables)) {
@ -242,7 +242,6 @@ function extension_db_check_tables_differences($connection_test,
}
mysql_free_result ($result);
}
foreach ($fields_test as $name_field => $field_test) {
if (!isset($fields_system[$name_field])) {
$correct_fields = false;
@ -262,7 +261,6 @@ function extension_db_check_tables_differences($connection_test,
$field_system = $fields_system[$name_field];
$diff = array_diff($field_test, $field_system);
if (!empty($diff)) {
foreach ($diff as $config_field => $value) {
switch ($config_field) {
@ -279,13 +277,14 @@ function extension_db_check_tables_differences($connection_test,
break;
case 'null':
ui_print_error_message(
__('Unsuccessful the field %s in the table %s must be setted the null values with %s.',
__('Unsuccessful the field %s in the table %s must be null: (%s).',
$name_field, $table, $value));
if ($value == "no") {
if ($value == "YES") {
ui_print_info_message(
__('You can execute this SQL query for to fix.') . "<br />" .
'<pre>' .
"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . "INT NULL;" .
"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " " . $field_test['type'] . " NULL;" .
'</pre>'
);
}
@ -293,7 +292,7 @@ function extension_db_check_tables_differences($connection_test,
ui_print_info_message(
__('You can execute this SQL query for to fix.') . "<br />" .
'<pre>' .
"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . "INT NOT NULL;" .
"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " " . $field_test['type'] . " NOT NULL;" .
'</pre>'
);
}
@ -307,11 +306,21 @@ function extension_db_check_tables_differences($connection_test,
__('Please check the SQL file for to know the kind of key needed.'));
break;
case 'default':
if($field_test['null'] == "YES" || !isset($field_test['null']) || $field_test['null'] == ""){
$null_defect = " NULL";
}
else{
$null_defect = " NOT NULL";
}
ui_print_error_message(
__('Unsuccessful the field %s in the table %s must be setted the default value as %s.',
__('Unsuccessful the field %s in the table %s must be setted %s as default value.',
$name_field, $table, $value));
ui_print_info_message(
__('Please check the SQL file for to know the kind of default value needed.'));
__('You can execute this SQL query for to fix.') . "<br />" .
'<pre>' .
"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " " . $field_test['type'] . $null_defect . " DEFAULT " . $value . ";" .
'</pre>'
);
break;
case 'extra':
ui_print_error_message(

View File

@ -793,7 +793,7 @@ if ($update_agent) { // if modified some agent paramenter
WHERE id_group = ".$group_old);
$result = db_process_sql_update ('tagente', $values, array ('id_agente' => $id_agente));
if ($result === false) {
if ($result == false) {
ui_print_error_message(
__('There was a problem updating the agent'));
}

View File

@ -35,6 +35,7 @@ if (is_ajax ()) {
$get_group_json = (bool) get_parameter ('get_group_json');
$get_group_agents = (bool) get_parameter ('get_group_agents');
$get_is_disabled = (bool) get_parameter ('get_is_disabled');
if ($get_group_json) {
$id_group = (int) get_parameter ('id_group');
@ -70,6 +71,7 @@ if (is_ajax ()) {
$search = (string) get_parameter ('search', '');
$recursion = (int) get_parameter ('recursion', 0);
$privilege = (string) get_parameter ('privilege', '');
$all_agents = (int) get_parameter ('all_agents', 0);
// Is is possible add keys prefix to avoid auto sorting in js object conversion
$keys_prefix = (string) get_parameter ('keys_prefix', '');
// This attr is for the operation "bulk alert accions add", it controls the query that take the agents
@ -96,7 +98,12 @@ if (is_ajax ()) {
$filter['id_agente'] = json_decode(io_safe_output($filter_agents_json), true);
}
if ($all_agents) {
$filter['all_agents'] = true;
}
else {
$filter['disabled'] = $disabled;
}
if ($search != '') {
$filter['string'] = $search;
@ -126,18 +133,43 @@ if (is_ajax ()) {
false, $recursion, false, '|', $add_alert_bulk_op);
}
$agents_disabled = array();
// Add keys prefix
if ($keys_prefix !== "") {
foreach($agents as $k => $v) {
$agents[$keys_prefix . $k] = $v;
unset($agents[$k]);
if ($all_agents) {
$agent_disabled = db_get_value_filter('disabled', 'tagente', array('id_agente' => $k));
$agents_disabled[$keys_prefix . $k] = $agent_disabled;
}
}
}
if ($all_agents) {
$all_agents_array = array();
$all_agents_array['agents'] = $agents;
$all_agents_array['agents_disabled'] = $agents_disabled;
$agents = $all_agents_array;
}
echo json_encode ($agents);
return;
}
if ($get_is_disabled) {
$index = get_parameter('id_agent');
$agent_disabled = db_get_value_filter('disabled', 'tagente', array('id_agente' => $index));
$return['disabled'] = $agent_disabled;
$return['id_agent'] = $index;
echo json_encode($return);
return;
}
return;
}

View File

@ -94,6 +94,7 @@ $inventory_modules = array();
$date = null;
// Only avg is selected by default for the simple graphs
$only_avg = true;
$fullscale = false;
$percentil = false;
$time_compare_overlapped = false;
@ -212,6 +213,7 @@ switch ($action) {
break;
case 'simple_graph':
$only_avg = isset($style['only_avg']) ? (bool) $style['only_avg'] : true;
$fullscale = isset($style['fullscale']) ? (bool) $style['fullscale'] : 0;
$percentil = isset($style['percentil']) ? $config['percentil'] : 0;
// The break hasn't be forgotten.
case 'simple_baseline_graph':
@ -480,6 +482,7 @@ switch ($action) {
$description = $item['description'];
$group = $item['id_group'];
$period = $item['period'];
$fullscale = isset($style['fullscale']) ? (bool) $style['fullscale'] : 0;
break;
case 'top_n':
$description = $item['description'];
@ -1353,6 +1356,11 @@ You can of course remove the warnings, that's why we include the source and do n
<td style="font-weight:bold;"><?php echo __('Only average');?></td>
<td><?php html_print_checkbox('only_avg', 1, $only_avg);?></td>
</tr>
<tr id="row_fullscale" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Full resolution graph (TIP)').
ui_print_help_tip(__('This option may cause performance issues.'), true);?></td>
<td><?php html_print_checkbox('fullscale', 1, $fullscale);?></td>
</tr>
<tr id="row_percentil" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Percentil');?></td>
<td><?php html_print_checkbox('percentil', 1, $percentil);?></td>
@ -2643,6 +2651,7 @@ function chooseType() {
$("#row_show_graph").hide();
$("#row_max_min_avg").hide();
$("#row_only_avg").hide();
$("#row_fullscale").hide();
$("#row_time_compare_overlapped").hide();
$("#row_quantity").hide();
$("#row_exception_condition_value").hide();
@ -2725,6 +2734,7 @@ function chooseType() {
case 'simple_graph':
$("#row_time_compare_overlapped").show();
$("#row_only_avg").show();
$("#row_fullscale").show();
if ($("#checkbox-percentil").prop("checked"))
$("#row_percentil").show();
// The break hasn't be forgotten, this element
@ -3122,6 +3132,7 @@ function chooseType() {
$("#row_description").show();
$("#row_period").show();
$("#row_historical_db_check").hide();
$("#row_fullscale").show();
break;
case 'top_n':

View File

@ -1174,11 +1174,15 @@ switch ($action) {
// the modification of the database for compatibility reasons.
$style['only_avg'] = (int) get_parameter('only_avg');
$style['percentil'] = (int) get_parameter('percentil');
$style['fullscale'] = (int) get_parameter('fullscale');
if ($label != '')
$style['label'] = $label;
else
$style['label'] = '';
break;
case 'network_interfaces_report':
$style['fullscale'] = (int) get_parameter('fullscale');
break;
case 'module_histogram_graph':
case 'agent_configuration':
case 'alert_report_agent':
@ -1518,11 +1522,15 @@ switch ($action) {
// the modification of the database for compatibility reasons.
$style['only_avg'] = (int) get_parameter('only_avg');
$style['percentil'] = (int) get_parameter('percentil');
$style['fullscale'] = (int) get_parameter('fullscale');
if ($label != '')
$style['label'] = $label;
else
$style['label'] = '';
break;
case 'network_interfaces_report':
$style['fullscale'] = (int) get_parameter('fullscale');
break;
case 'module_histogram_graph':
case 'agent_configuration':
case 'alert_report_agent':

View File

@ -22,7 +22,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC170921';
$build_version = 'PC170926';
$pandora_version = 'v7.0NG.712';
// Do not overwrite default timezone set if defined.

View File

@ -164,7 +164,7 @@ function custom_graphs_print($id_graph, $height, $width, $period,
$background_color = 'white', $modules_param = array(), $homeurl = '',
$name_list = array(), $unit_list = array(), $show_last = true,
$show_max = true, $show_min = true, $show_avg = true, $ttl = 1,
$dashboard = false, $vconsole = false, $percentil = null, $from_interface = false,$id_widget_dashboard=false) {
$dashboard = false, $vconsole = false, $percentil = null, $from_interface = false,$id_widget_dashboard=false, $fullscale = false) {
global $config;
@ -261,7 +261,8 @@ function custom_graphs_print($id_graph, $height, $width, $period,
$vconsole,
$percentil,
$from_interface,
$id_widget_dashboard);
$id_widget_dashboard,
$fullscale);
if ($return)
return $output;

View File

@ -502,7 +502,7 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
$baseline = 0, $return_data = 0, $show_title = true, $projection = false,
$adapt_key = '', $compare = false, $series_suffix = '', $series_suffix_str = '',
$show_unknown = false, $percentil = null, $dashboard = false, $vconsole = false,
$type_graph='area', $fullscale = false) {
$type_graph='area', $fullscale = false, $flash_chart = false) {
global $config;
global $chart;
@ -573,7 +573,7 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
fullscale_data( $chart, $chart_data_extra, $long_index, $series_type,
$agent_module_id, $datelimit, $date, $events,
$show_events, $show_unknown, $show_alerts,
$series_suffix, $percentil);
$series_suffix, $percentil, $flash_chart);
if (count($chart) > $resolution) {
$resolution = count($chart); //Number of points of the graph
$interval = (int) ($period / $resolution);
@ -879,7 +879,7 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
$return_data, $show_title, $projection, $adapt_key,
$compare, $series_suffix, $series_suffix_str,
$show_unknown, $percentil, $dashboard, $vconsole,$type_graph,
$fullscale);
$fullscale, $flash_chart);
switch ($compare) {
case 'separated':
@ -912,7 +912,7 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
$show_alerts, $avg_only,
$date, $unit, $baseline, $return_data, $show_title,
$projection, $adapt_key, $compare, '', '', $show_unknown,
$percentil, $dashboard, $vconsole, $type_graph, $fullscale);
$percentil, $dashboard, $vconsole, $type_graph, $fullscale, $flash_chart);
if ($return_data) {
return $data_returned;
}
@ -1055,11 +1055,13 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$prediction_period = false, $background_color = 'white',
$name_list = array(), $unit_list = array(), $show_last = true, $show_max = true,
$show_min = true, $show_avg = true, $labels = array(), $dashboard = false,
$vconsole = false, $percentil = null, $from_interface = false, $id_widget_dashboard=false) {
$vconsole = false, $percentil = null, $from_interface = false,
$id_widget_dashboard=false, $fullscale = false) {
global $config;
global $graphic_type;
if(!$fullscale){
$time_format_2 = '';
$temp_range = $period;
@ -1161,7 +1163,6 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$graph[$timestamp]['event'] = 0;
$graph[$timestamp]['alert'] = 0;
}
$long_index = array();
$graph_values = array();
@ -1243,6 +1244,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
"utimestamp < $date",
'order' => 'utimestamp ASC'),
array ('datos', 'utimestamp'), 'AND', $search_in_history_db);
if ($data === false) {
$data = array ();
}
@ -1360,7 +1362,6 @@ function graphic_combined_module ($module_list, $weight_list, $period,
// Calculate chart data
$last_known = $previous_data;
for ($l = 0; $l <= $resolution; $l++) {
$countAvg ++;
@ -1831,6 +1832,43 @@ function graphic_combined_module ($module_list, $weight_list, $period,
}
break;
}
}
else{
$flash_charts = true;
if($ttl>1 || !$config['flash_charts']){
$flash_charts = false;
}
$temp = fullscale_data_combined($module_list, $period, $date, $flash_charts);
$resolution = count($temp); //Number of points of the graph
$interval = (int) ($period / $resolution);
$module_name_list = array();
if($ttl>1 || !$config['flash_charts']){
$temp2 = array();
foreach ($temp as $key => $value) {
$real_date = date("Y/M/d", $key);
$real_date .= "\n";
$real_date .= date(" H:i:s", $key);
$temp2[$real_date] = $value;
}
$temp = $temp2;
}
foreach ($module_list as $key => $value) {
$agent_name = io_safe_output( modules_get_agentmodule_agent_name ($value) );
$alias = db_get_value ("alias","tagente","nombre",$agent_name);
$module_name = io_safe_output( modules_get_agentmodule_name ($value) );
if ($flash_charts){
$module_name_list[$key] = '<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . $alias . " / " . $module_name. '</span>';
}
else{
$module_name_list[$key] = $alias . " / " . $module_name;
}
}
}
$graph_values = $temp;
@ -2081,6 +2119,47 @@ function graphic_combined_module ($module_list, $weight_list, $period,
}
}
function fullscale_data_combined($module_list, $period, $date, $flash_charts){
// Set variables
if ($date == 0){
$date = get_system_time();
}
$datelimit = $date - $period;
foreach ($module_list as $key_module => $value_module) {
$data_uncompress = db_uncompress_module_data($value_module, $datelimit, $date);
foreach ($data_uncompress as $key_data => $value_data) {
foreach ($value_data['data'] as $k => $v) {
if($flash_charts) {
$real_date = date("Y M d H:i:s", $v['utimestamp']);
}
else{
$real_date = $v['utimestamp'];
}
$data_all[$real_date][$key_module] = $v['datos'];
}
}
}
$data_prev = array();
ksort($data_all);
foreach ($data_all as $key => $value) {
foreach ($module_list as $key_module => $value_module) {
if(!isset($value[$key_module])){
$data_all[$key][$key_module] = $data_prev[$key_module];
}
else{
$data_prev[$key_module] = $value[$key_module];
}
}
}
return $data_all;
}
/**
* Print a graph with access data of agents
*
@ -3771,7 +3850,7 @@ function fs_error_image ($width = 300, $height = 110) {
function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
$unit_name, $show_alerts, $avg_only = 0,
$date = 0, $series_suffix = '', $series_suffix_str = '', $show_unknown = false,
$fullscale = false) {
$fullscale = false, $flash_chart = true) {
global $config;
global $chart;
@ -3831,7 +3910,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
fullscale_data( $chart, $chart_data_extra, $long_index, $series_type,
$agent_module_id, $datelimit, $date, $events,
$show_events, $show_unknown, $show_alerts,
$series_suffix);
$series_suffix, $percentil, $flash_chart);
if (count($chart) > $resolution) {
$resolution = count($chart); //Number of points of the graph
$interval = (int) ($period / $resolution);
@ -4177,7 +4256,8 @@ function fullscale_data ( &$chart_data, &$chart_extra_data, &$long_index,
$series_type, $agent_module_id, $datelimit, $date,
$events = false, $show_events = false,
$show_unknown = false, $show_alerts = false,
$series_suffix = '', $percentil = false ){
$series_suffix = '', $percentil = false,
$flash_chart = true ){
global $config;
global $max_value;
@ -4209,7 +4289,11 @@ function fullscale_data ( &$chart_data, &$chart_extra_data, &$long_index,
foreach ($data_uncompress as $v) {
foreach ($v['data'] as $key => $value) {
$real_date = date("Y M d H:i:s", $value['utimestamp']);
if(!$flash_chart){
$real_date = date("Y/M/d", $value['utimestamp']);
$real_date .= "\n";
$real_date .= date(" H:i:s", $value['utimestamp']);
}
// Read events and alerts that fall in the current interval
$event_value = 0;
$alert_value = 0;
@ -4229,7 +4313,7 @@ function fullscale_data ( &$chart_data, &$chart_extra_data, &$long_index,
$timestamp_second = $value['utimestamp'];
foreach ($events as $key => $val) {
if( $val['utimestamp'] >= $timestamp_first &&
if( $val['utimestamp'] > $timestamp_first &&
$val['utimestamp'] <= $timestamp_second ){
if ($show_events == 1) {
$event_ids[] = $val['id_evento'];
@ -4265,6 +4349,14 @@ function fullscale_data ( &$chart_data, &$chart_extra_data, &$long_index,
}
$timestamp_short = date("Y M d H:i:s", $value['utimestamp']);
if(!$flash_chart){
$timestamp_short = date("Y/M/d", $value['utimestamp']);
$timestamp_short .= "\n";
$timestamp_short .= date(" H:i:s", $value['utimestamp']);
}
$long_index[$timestamp_short] = date(
html_entity_decode($config['date_format'], ENT_QUOTES, "UTF-8"), $value['utimestamp']);
// In some cases, can be marked as known because a recovery event
@ -4331,7 +4423,6 @@ function fullscale_data ( &$chart_data, &$chart_extra_data, &$long_index,
$series_type['percentil' . $series_suffix] = 'line';
}
}
//html_debug_print($chart_data);
}
function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
@ -4365,7 +4456,7 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
// Build the data of the previous period
grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
$unit_name, $show_alerts, $avg_only, $date-$period, $series_suffix,
$series_suffix_str, $show_unknown, $fullscale);
$series_suffix_str, $show_unknown, $fullscale, $flash_chart);
switch ($compare) {
case 'separated':
// Store the chart calculated
@ -4391,7 +4482,7 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
}
grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
$unit_name, $show_alerts, $avg_only, $date, '', '', $show_unknown, $fullscale);
$unit_name, $show_alerts, $avg_only, $date, '', '', $show_unknown, $fullscale, $flash_chart);
if ($compare === 'overlapped') {

View File

@ -2675,6 +2675,10 @@ function reporting_network_interfaces_report($report, $content, $type = 'dinamic
$content['name'] = __('Network interfaces report');
}
if (isset($content['style']['fullscale'])) {
$fullscale = (bool) $content['style']['fullscale'];
}
$group_name = groups_get_name($content['id_group']);
$return['title'] = $content['name'];
@ -2745,7 +2749,13 @@ function reporting_network_interfaces_report($report, $content, $type = 'dinamic
true,
true,
true,
1);
1,
false,
false,
null,
false,
false,
$fullscale);
}
break;
case 'data':
@ -2768,7 +2778,13 @@ function reporting_network_interfaces_report($report, $content, $type = 'dinamic
true,
true,
true,
2);
2,
false,
false,
null,
false,
false,
$fullscale);
}
break;
}
@ -6035,12 +6051,14 @@ function reporting_simple_graph($report, $content, $type = 'dinamic',
$only_avg = (bool) $content['style']['only_avg'];
}
if (isset($content['style']['fullscale'])) {
$fullscale = (bool) $content['style']['fullscale'];
}
$moduletype_name = modules_get_moduletype_name(
modules_get_agentmodule_type(
$content['id_agent_module']));
$return['chart'] = '';
// Get chart
reporting_set_conf_charts($width, $height, $only_image, $type,
@ -6114,7 +6132,8 @@ function reporting_simple_graph($report, $content, $type = 'dinamic',
($content['style']['percentil'] == 1) ? $config['percentil'] : null,
false,
false,
$config['type_module_charts']);
$config['type_module_charts'],
$fullscale);
}
break;
case 'data':

View File

@ -3886,15 +3886,16 @@ function reporting_get_event_histogram_meta ($width) {
$user_groups_ids = array_keys($user_groups);
if (empty($user_groups)) {
$groups_condition = ' 1 = 0 ';
$groups_condition = ' AND 1 = 0 ';
}
else {
$groups_condition = ' id_grupo IN (' . implode(',', $user_groups_ids) . ') ';
$groups_condition = ' AND id_grupo IN (' . implode(',', $user_groups_ids) . ') ';
}
if (!check_acl ($config['id_user'], 0, "PM")) {
$groups_condition .= " AND id_grupo != 0";
}
$status_condition = " AND estado = 0 ";
$cont = 0;
for ($i = 0; $i < $interval; $i++) {
@ -3923,49 +3924,45 @@ function reporting_get_event_histogram_meta ($width) {
$full_legend[$cont] = $name;
$top = $datelimit + ($periodtime * ($i + 1));
$event = db_get_row_filter ('tmetaconsole_event',
array (
'utimestamp > '.$bottom,
'utimestamp < '.$top,
$groups_condition),
'criticity, utimestamp');
if (!empty($event['utimestamp'])) {
$data[$cont]['utimestamp'] = $periodtime;
switch ($event['criticity']) {
case 0:
$data[$cont]['data'] = EVENT_CRIT_MAINTENANCE;
break;
case 1:
$data[$cont]['data'] = EVENT_CRIT_INFORMATIONAL;
break;
case 2:
$data[$cont]['data'] = EVENT_CRIT_NORMAL;
break;
case 3:
$data[$cont]['data'] = EVENT_CRIT_WARNING;
break;
case 4:
$time_condition = 'utimestamp > '.$bottom . ' AND utimestamp < '.$top;
$sql = sprintf('SELECT criticity,utimestamp
FROM tmetaconsole_event
WHERE %s %s %s
ORDER BY criticity DESC',
$time_condition, $groups_condition, $status_condition);
$events = db_get_all_rows_sql($sql);
$events_criticity = array();
foreach ($events as $key => $value) {
array_push($events_criticity,$value['criticity']);
}
if (!empty($events)) {
if(array_search('4',$events_criticity) !== false){
$data[$cont]['data'] = EVENT_CRIT_CRITICAL;
break;
case 5:
$data[$cont]['data'] = EVENT_CRIT_MINOR;
break;
case 6:
}else if (array_search('3',$events_criticity) !== false){
$data[$cont]['data'] = EVENT_CRIT_WARNING;
}else if(array_search('6',$events_criticity) !== false){
$data[$cont]['data'] = EVENT_CRIT_MAJOR;
break;
case 20:
}else if(array_search('5',$events_criticity) !== false){
$data[$cont]['data'] = EVENT_CRIT_MINOR;
}else if(array_search('20',$events_criticity) !== false){
$data[$cont]['data'] = EVENT_CRIT_NOT_NORMAL;
break;
case 34:
}else if(array_search('34',$events_criticity) !== false){
$data[$cont]['data'] = EVENT_CRIT_WARNING_OR_CRITICAL;
break;
default:
$data[$cont]['data'] = 1;
break;
}else if(array_search('2',$events_criticity) !== false){
$data[$cont]['data'] = EVENT_CRIT_NORMAL;
}else if(array_search('0',$events_criticity) !== false){
$data[$cont]['data'] = EVENT_CRIT_MAINTENANCE;
}else {
$data[$cont]['data'] = EVENT_CRIT_INFORMATIONAL;
}
}
else {
$data[$cont]['utimestamp'] = $periodtime;
} else {
$data[$cont]['utimestamp'] = $periodtime;
$data[$cont]['data'] = 1;
}

View File

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

View File

@ -74,17 +74,35 @@ $table_agent->data = array();
$data = array();
$agent_name = ui_print_agent_name($agent["id_agente"], true, 500, "font-size: medium;font-weight:bold", true);
$in_planned_downtime = db_get_value_filter('id', 'tplanned_downtime_agents', array('id_agent' => $agent["id_agente"]));
if ($agent['disabled']) {
if ($in_planned_downtime) {
$agent_name = "<em>" . $agent_name . ui_print_help_tip(__('Disabled'), true);
}
else {
$agent_name = "<em>" . $agent_name . "</em>" . ui_print_help_tip(__('Disabled'), true);
}
}
else if ($agent['quiet']) {
if ($in_planned_downtime) {
$agent_name = "<em'>" . $agent_name . "&nbsp;" . html_print_image("images/dot_green.disabled.png", true, array("border" => '0', "title" => __('Quiet'), "alt" => ""));
}
else {
$agent_name = "<em'>" . $agent_name . "&nbsp;" . html_print_image("images/dot_green.disabled.png", true, array("border" => '0', "title" => __('Quiet'), "alt" => "")) . "</em>";
}
}
else {
$agent_name = $agent_name;
}
if ($in_planned_downtime && !$agent['disabled'] && !$agent['quiet']) {
$agent_name .= "<em>" . "&nbsp;" . ui_print_help_tip(__('Agent in planned downtime'), true, 'images/minireloj-16.png') . "</em>";
}
else if (($in_planned_downtime && !$agent['disabled']) || ($in_planned_downtime && !$agent['quiet'])) {
$agent_name .= "&nbsp;" . ui_print_help_tip(__('Agent in planned downtime'), true, 'images/minireloj-16.png') . "</em>";
}
if (!$config["show_group_name"])
$data[0] = ui_print_group_icon ($agent["id_grupo"], true);
else

View File

@ -150,6 +150,7 @@ $interface_traffic_modules = array(
$zoom = (int) get_parameter ("zoom", 1);
$baseline = get_parameter ("baseline", 0);
$show_percentil = get_parameter ("show_percentil", 0);
$fullscale = get_parameter("fullscale", 0);
if ($zoom > 1) {
$height = $height * ($zoom / 2.1);
@ -200,7 +201,9 @@ $interface_traffic_modules = array(
false,
false,
(($show_percentil)? $config['percentil'] : null),
true);
true,
false,
$fullscale);
echo '</div>';
@ -259,6 +262,12 @@ $interface_traffic_modules = array(
$table->data[] = $data;
$table->rowclass[] ='';
$data = array();
$data[0] = __('Show full scale graph (TIP)') . ui_print_help_tip(__('This option may cause performance issues'), true);
$data[1] = html_print_checkbox ("fullscale", 1, (bool) $fullscale, true);
$table->data[] = $data;
$table->rowclass[] ='';
$data = array();
$data[0] = __('Zoom factor');
$options = array();

View File

@ -404,7 +404,7 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent);
}
$data = array();
$data[0] = __('Show full scale graph (TIP)');
$data[0] = __('Show full scale graph (TIP)') . ui_print_help_tip(__('This option may cause performance issues'), true);
$data[1] = html_print_checkbox ("fullscale", 1, (bool) $fullscale, true);
$table->data[] = $data;
$table->rowclass[] = '';

View File

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

View File

@ -67,7 +67,7 @@ CREATE TABLE IF NOT EXISTS `tagente` (
`custom_id` varchar(255) default '',
`server_name` varchar(100) default '',
`cascade_protection` tinyint(2) NOT NULL default '0',
`cascade_protection_module` tinyint(2) NOT NULL default '0',
`cascade_protection_module` int(10) unsigned NOT NULL default '0',
`timezone_offset` TINYINT(2) NULL DEFAULT '0' COMMENT 'nuber of hours of diference with the server timezone' ,
`icon_path` VARCHAR(127) NULL DEFAULT NULL COMMENT 'path in the server to the image of the icon representing the agent' ,
`update_gis_data` TINYINT(1) NOT NULL DEFAULT '1' COMMENT 'set it to one to update the position data (altitude, longitude, latitude) when getting information from the agent or to 0 to keep the last value and do not update it' ,

View File

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

View File

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

View File

@ -211,6 +211,11 @@ sub pandora_snmptrapd {
# Try to save as much information as possible if the trap could not be parsed
$oid = $type_desc if ($oid eq '' || $oid eq '.');
if (!defined($oid)) {
logger($pa_config, "[W] snmpTrapOID not found (Illegal SNMPv1 trap?)", 5);
return;
}
} elsif ($trap_ver eq "SNMPv2") {
($date, $time, $source, $data) = split(/\[\*\*\]/, $line, 4);
my @data = split(/\t/, $data);
@ -219,7 +224,7 @@ sub pandora_snmptrapd {
$oid = shift @data;
if (!defined($oid)) {
logger($pa_config, "[W] snmpTrapOID not found (Illegal SNMPv2 trap?)", 1);
logger($pa_config, "[W] snmpTrapOID not found (Illegal SNMPv2 trap?)", 5);
return;
}
$oid =~ s/.* = OID: //;
@ -441,7 +446,10 @@ sub read_snmplogfile()
return undef if (! defined($line));
my $retry_count = 0;
# More lines ?
while(1) {
while($read_ahead_line = <SNMPLOGFILE>) {
# Get current file position
@ -458,6 +466,14 @@ sub read_snmplogfile()
$pos = $read_ahead_pos;
}
# if $line looks incomplete, try to get continued line
# just within 10sec. After that, giving up to complete it
# and flush $line as it is.
last if(chomp($line) > 0 || $retry_count++ >= 10);
sleep(1);
}
# return fetched line with file position to be saved.
return [$pos, $line];
}

View File

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

View File

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

View File

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

View File

@ -33,7 +33,7 @@ use PandoraFMS::Tools;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.712 PS170921";
my $version = "7.0NG.712 PS170926";
# 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.712 PS170921";
my $version = "7.0NG.712 PS170926";
# save program name for logging
my $progname = basename($0);
@ -5379,7 +5379,7 @@ sub cli_delete_visual_console_objects() {
##############################################################################
sub cli_duplicate_visual_console () {
my ($id_console,$prefix) = @ARGV[2..3];
my ($id_console,$times,$prefix) = @ARGV[2..4];
if($id_console eq '') {
print_log "[ERROR] Console ID field cannot be empty.\n\n";
@ -5400,6 +5400,7 @@ sub cli_duplicate_visual_console () {
$name_count = 1;
}
for (my $iteration = 0; $iteration < $times; $iteration++) {
my $exist = 1;
while ($exist == 1) {
my $name_in_db = get_db_single_row ($dbh, "SELECT name FROM tlayout WHERE name = '$new_name'");
@ -5451,6 +5452,7 @@ sub cli_duplicate_visual_console () {
print_log "[INFO] Element with ID " . $element->{"id"} . " has been duplicated to the new console \n\n";
}
}
}
##############################################################################
# Export a visual console elements to json.
@ -5465,15 +5467,29 @@ sub cli_export_visual_console() {
exit 1;
}
my $data_to_json = '';
my $first = 1;
print_log "[INFO] Exporting visual console elements with ID '$id' \n\n";
my $console = get_db_single_row ($dbh, "SELECT *
FROM tlayout
WHERE id = $id");
$data_to_json .= '"' . safe_output($console->{'name'}) . '"';
$data_to_json .= ' "' . $console->{'background'} . '"';
$data_to_json .= ' ' . $console->{'width'};
$data_to_json .= ' ' . $console->{'height'};
$data_to_json .= ' ' . $console->{'id_group'};
$data_to_json .= ' "static_objects"';
$data_to_json .= ' ""';
$data_to_json .= ' "' . $console->{'background_color'} . '" ';
my @console_elements = get_db_rows ($dbh, "SELECT *
FROM tlayout_data
WHERE id_layout = $id");
my $data_to_json = '[';
my $first = 1;
$data_to_json .= '[';
foreach my $element (@console_elements) {
my $pos_x = $element->{'pos_x'};
my $pos_y = $element->{'pos_y'};
@ -5504,6 +5520,8 @@ sub cli_export_visual_console() {
$first = 0;
}
$label =~ s/"/\\"/g;
$data_to_json .= '{"image":"' . $image . '"';
$data_to_json .= ',"pos_y":' . $pos_y;
$data_to_json .= ',"pos_x":' . $pos_x;
@ -5989,7 +6007,7 @@ sub pandora_manage_main ($$$) {
cli_delete_visual_console_objects();
}
elsif ($param eq '--duplicate_visual_console') {
param_check($ltotal, 2, 1);
param_check($ltotal, 3, 2);
cli_duplicate_visual_console();
}
elsif ($param eq '--export_json_visual_console') {