From fc357b8c14a8337e1bfde7aee2028c222decaea4 Mon Sep 17 00:00:00 2001 From: Shigekazu Aoyagi Date: Tue, 11 Apr 2017 03:32:58 +0000 Subject: [PATCH 01/55] add initialize $conf->{'verbosity'} when not defined config file. --- pandora_server/util/pandora_db.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index fcec542ed8..48c9471141 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -669,6 +669,7 @@ sub pandora_load_config ($) { $conf->{'dbengine'} = 'mysql' unless defined ($conf->{'dbengine'}); $conf->{'dbport'} = '3306' unless defined ($conf->{'dbport'}); $conf->{'claim_back_snmp_modules'} = '1' unless defined ($conf->{'claim_back_snmp_modules'}); + $conf->{'verbosity'} = '3' unless defined ($conf->{'verbosity'}); # Dynamic interval configuration. $conf->{"dynamic_constant"} = 0.10 unless defined($conf->{"dynamic_constant"}); From 311ac744c6227f477d693a4bcf04186f400f00de Mon Sep 17 00:00:00 2001 From: Shigekazu Aoyagi Date: Tue, 11 Apr 2017 03:35:12 +0000 Subject: [PATCH 02/55] move logging $conf->{'_days_delete_unknown'} after defined checking --- pandora_server/util/pandora_db.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 48c9471141..3eea7ec0a4 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -840,10 +840,10 @@ sub pandora_checkdb_consistency { log_message ('CHECKDB', "Ignoring not-init data."); } - log_message ('CHECKDB', - "Deleting unknown data (More than " . $conf{'_days_delete_unknown'} . " days)."); - if (defined($conf{'_days_delete_unknown'}) && $conf{'_days_delete_unknown'} > 0) { + log_message ('CHECKDB', + "Deleting unknown data (More than " . $conf{'_days_delete_unknown'} . " days)."); + my @modules = get_db_rows($dbh, 'SELECT tagente_modulo.id_agente_modulo, tagente_modulo.id_agente FROM tagente_modulo, tagente_estado From 200b821a203d648bf8c87372b0ad138a5bb09b5c Mon Sep 17 00:00:00 2001 From: Shigekazu Aoyagi Date: Tue, 11 Apr 2017 03:37:23 +0000 Subject: [PATCH 03/55] add defined check for $conf->{'_inventory_purge'} --- pandora_server/util/pandora_db.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 3eea7ec0a4..28c5adca1d 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -93,7 +93,7 @@ sub pandora_purgedb ($$) { } # Delete old inventory data - if ($conf->{'_inventory_purge'} > 0) { + if (defined ($conf->{'_inventory_purge'}) && $conf->{'_inventory_purge'} > 0) { if (enterprise_load (\%conf) != 0) { my $ulimit_timestamp_inventory = time() - (86400 * $conf->{'_inventory_purge'}); From 09ddd9aa9324b6755865ff4ee2209da32e8b2c60 Mon Sep 17 00:00:00 2001 From: Hirofumi Kosaka Date: Mon, 19 Jun 2017 15:54:27 +0900 Subject: [PATCH 04/55] Improved SNMP trap handling against incomplete traps or partially delayed ones. --- pandora_server/lib/PandoraFMS/SNMPServer.pm | 36 +++++++++++++++------ 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/SNMPServer.pm b/pandora_server/lib/PandoraFMS/SNMPServer.pm index af15614465..cadf725a90 100644 --- a/pandora_server/lib/PandoraFMS/SNMPServer.pm +++ b/pandora_server/lib/PandoraFMS/SNMPServer.pm @@ -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?)", 1); + return; + } + } elsif ($trap_ver eq "SNMPv2") { ($date, $time, $source, $data) = split(/\[\*\*\]/, $line, 4); my @data = split(/\t/, $data); @@ -441,21 +446,32 @@ sub read_snmplogfile() return undef if (! defined($line)); + my $retry_count = 0; + # More lines ? - while($read_ahead_line = ) { + while(1) { + while($read_ahead_line = ) { - # Get current file position - $read_ahead_pos = tell(SNMPLOGFILE); + # Get current file position + $read_ahead_pos = tell(SNMPLOGFILE); - # Get out of the loop if you find another Trap - last if($read_ahead_line =~ /^SNMP/ ); + # Get out of the loop if you find another Trap + last if($read_ahead_line =~ /^SNMP/ ); - # $read_ahead_line looks continued line... + # $read_ahead_line looks continued line... - # Append to the line and correct the position - chomp($line); - $line .= "$read_ahead_line"; - $pos = $read_ahead_pos; + # Append to the line and correct the position + chomp($line); + $line .= "$read_ahead_line"; + $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. From 660a4594e59595c9a7acead58bda2bd582a0493e Mon Sep 17 00:00:00 2001 From: Hirofumi Kosaka Date: Tue, 20 Jun 2017 16:52:06 +0900 Subject: [PATCH 05/55] Changed verbosity level of the warning "snmpTrapOID not found" to 5. --- pandora_server/lib/PandoraFMS/SNMPServer.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/SNMPServer.pm b/pandora_server/lib/PandoraFMS/SNMPServer.pm index cadf725a90..bc7b3a708a 100644 --- a/pandora_server/lib/PandoraFMS/SNMPServer.pm +++ b/pandora_server/lib/PandoraFMS/SNMPServer.pm @@ -212,7 +212,7 @@ sub pandora_snmptrapd { $oid = $type_desc if ($oid eq '' || $oid eq '.'); if (!defined($oid)) { - logger($pa_config, "[W] snmpTrapOID not found (Illegal SNMPv1 trap?)", 1); + logger($pa_config, "[W] snmpTrapOID not found (Illegal SNMPv1 trap?)", 5); return; } @@ -224,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: //; From 70a226540e1910d0401609e7a8f405e03dffee73 Mon Sep 17 00:00:00 2001 From: Hirofumi Kosaka Date: Mon, 14 Aug 2017 12:03:35 +0900 Subject: [PATCH 06/55] "Massive Operations" had remained at Pandora Console. #161 --- pandora_console/godmode/massive/massive_operations.php | 2 +- pandora_console/godmode/setup/setup_general.php | 2 +- pandora_console/include/functions_config.php | 2 +- pandora_console/include/help/en/help_profile.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pandora_console/godmode/massive/massive_operations.php b/pandora_console/godmode/massive/massive_operations.php index 494e95e3f5..276ab4c478 100755 --- a/pandora_console/godmode/massive/massive_operations.php +++ b/pandora_console/godmode/massive/massive_operations.php @@ -212,7 +212,7 @@ You can of course remove the warnings, that's why we include the source and do n */ ui_print_page_header( - __('Massive operations') . ' » '. $options[$option], + __('Bulk operations') . ' » '. $options[$option], "images/gm_massive_operations.png", false, "", true, $onheader,true, "massivemodal"); // Checks if the PHP configuration is correctly diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php index 23a8805570..dc83d2d7f6 100644 --- a/pandora_console/godmode/setup/setup_general.php +++ b/pandora_console/godmode/setup/setup_general.php @@ -209,7 +209,7 @@ $table->data[34][0] = __('Allow create planned downtimes in the past') . $table->data[34][1] = __('Yes').'   '.html_print_radio_button ('past_planned_downtimes', 1, '', $config["past_planned_downtimes"], true).'  '; $table->data[34][1] .= __('No').'   '.html_print_radio_button ('past_planned_downtimes', 0, '', $config["past_planned_downtimes"], true); -$table->data[35][0] = __('Limit parameters massive') . +$table->data[35][0] = __('Limit parameters bulk') . ui_print_help_tip(__('Your PHP environment is setted with %d max_input_vars. Maybe you must not set this value with upper values.', ini_get("max_input_vars")), true); $table->data[35][1] = html_print_input_text('limit_parameters_massive', $config['limit_parameters_massive'], '', 10, 10, true); diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 0317a34141..632dad5455 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -201,7 +201,7 @@ function config_update_config () { if (!config_update_value ('past_planned_downtimes', get_parameter('past_planned_downtimes'))) $error_update[] = __('Allow create planned downtimes in the past'); if (!config_update_value ('limit_parameters_massive', get_parameter('limit_parameters_massive'))) - $error_update[] = __('Limit parameters massive'); + $error_update[] = __('Limit parameters bulk'); if (!config_update_value ('identification_reminder', get_parameter('identification_reminder'))) $error_update[] = __('Identification_reminder'); if (!config_update_value ('include_agents', (bool)get_parameter('include_agents'))) diff --git a/pandora_console/include/help/en/help_profile.php b/pandora_console/include/help/en/help_profile.php index 58327eb36a..1222af8668 100644 --- a/pandora_console/include/help/en/help_profile.php +++ b/pandora_console/include/help/en/help_profile.php @@ -51,7 +51,7 @@ Group ManagementPM Creating inventory modulesPM Module Management (includes all suboptions)PM -Massive Management Operations AW +Bulk Management Operations AW Creating agentsAW Duplicating remote configurationsAW Downtime ManagementAW From 731e9bf91784e6de11a86cde2dafeeeffe42d304 Mon Sep 17 00:00:00 2001 From: daniel Date: Fri, 8 Sep 2017 16:10:31 +0200 Subject: [PATCH 07/55] fixed error in full_scale --- pandora_console/include/functions_graph.php | 60 +++++++++------------ 1 file changed, 24 insertions(+), 36 deletions(-) diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index d6ced0e99c..6ec7e8587c 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -3851,13 +3851,27 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, if ($fullscale) { // Get module data - $data = db_get_all_rows_filter ('tagente_datos', - array ('id_agente_modulo' => $agent_module_id, - "utimestamp > $datelimit", - "utimestamp < $date", - 'order' => 'utimestamp ASC'), - array ('datos', 'utimestamp'), 'AND', true); - + + $data_uncompress = db_uncompress_module_data($agent_module_id, $datelimit, $date); + + $i = 0; + $j = 0; + $array_unknown = array(); + $data = array(); + if(is_array($data_uncompress)){ + foreach ($data_uncompress as $value) { + foreach ($value['data'] as $key => $value) { + $data[$i]['datos'] = $value['datos']; + if(empty($value['datos'])){ + $events[$j]['utimestamp'] = $value['utimestamp']; + $j++; + } + $data[$i]['utimestamp'] = $value['utimestamp']; + $i++; + } + } + } + if (count($data) > $resolution) { $resolution = count($data); //Number of points of the graph $interval = (int) ($period / $resolution); @@ -3937,25 +3951,6 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, } $max_value = 0; - - if ($fullscale) { - $data2 = array(); - $previus_datas_cont = -1; - $k = 0; - for ($i = 0; $i <= $resolution; $i++) { - $timestamp = $datelimit + ($interval * $i); - - if ($timestamp < $data[0]['utimestamp']) { - $previus_datas_cont++; - $data2[$k]['utimestamp'] = $timestamp; - $data2[$k]['datos'] = 0; - $k++; - } - } - - $data = array_merge($data2, $data); - $resolution += $previus_datas_cont; - } // Calculate chart data $last_known = $previous_data; @@ -4013,19 +4008,12 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, $alert_ids[] = $events[$k]['id_evento']; } if ($show_unknown) { - if ($events[$k]['event_type'] == 'going_unknown') { - if ($is_unknown == false) { - $first_unknown = true; - } - $is_unknown = true; - } - else if (substr ($events[$k]['event_type'], 0, 5) == 'going') { - $is_unknown = false; - } + $first_unknown = true; + $is_unknown = true; } $k++; } - + // In some cases, can be marked as known because a recovery event // was found in same interval. For this cases first_unknown is // checked too From ac36c701f79fe0f790d55f1b490b250354756c27 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Mon, 11 Sep 2017 16:09:13 +0200 Subject: [PATCH 08/55] Added a first contact with the new functions --- pandora_server/util/pandora_manage.pl | 105 +++++++++++++++++++++++++- 1 file changed, 104 insertions(+), 1 deletion(-) diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 48e42b5d2f..3fafbf8d25 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -213,6 +213,15 @@ sub help_screen{ help_screen_line('--create_tag', ' [] []', 'Create a new tag'); help_screen_line('--add_tag_to_user_profile', ' ', 'Add a tag to the given user profile'); help_screen_line('--add_tag_to_module', ' ', 'Add a tag to the given module'); + + print "\nVISUAL CONSOLES\n\n" unless $param ne ''; + help_screen_line('--create_visual_console', ' [] []', 'Create a new visual console'); + help_screen_line('--edit_visual_console', ' [] []', 'Edit a visual console'); + help_screen_line('--delete_visual_console', '', 'Delete a visual console'); + help_screen_line('--delete_visual_console_objects', ' ', 'Delete a visual console elements'); + help_screen_line('--duplicate_visual_console', ' []', 'Duplicate a visual console'); + help_screen_line('--export_json_visual_console', '', 'Creates a json with the visual console elements information'); + print "\n"; exit; @@ -4753,6 +4762,76 @@ sub cli_delete_special_day() { exist_check($result,'special day',$special_day); } +############################################################################## +# Creates a new visual console. +# Related option: --create_visual_console +############################################################################## + +sub cli_create_visual_console() { + my ($name,$background,$width,$height,$group,$background_color,$elements) = @ARGV[2..8]; + + if($name eq '') { + print_log "[ERROR] Name field cannot be empty.\n\n"; + exit 1; + } + elsif ($background eq '') { + print_log "[ERROR] Background field cannot be empty.\n\n"; + exit 1; + } + elsif (($width eq '') || ($height eq '')) { + print_log "[ERROR] Please specify size.\n\n"; + exit 1; + } + elsif ($group eq '') { + print_log "[ERROR] Group field cannot be empty.\n\n"; + exit 1; + } + + if ($background_color eq '') { + $background_color = '#FFF'; + } + + print_log "[INFO] Creating visual console '$name' \n\n"; + + my $vc_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout (name, id_group, background, width, height, background_color) + VALUES (?, ?, ?, ?, ?, ?)', safe_input($name), $group, $background, $width, $height, $background_color); + + print_log "[INFO] The visual console id is '$vc_id' \n\n"; + + if ($elements ne '') { + my @elements_in_array = json_decoce($elements); + + foreach my $elem (@elements_in_array) { + print_log $elem . "\n\n"; + } + } +} + +############################################################################## +# Delete a visual console. +# Related option: --delete_visual_console +############################################################################## + +sub cli_delete_visual_console() { + my ($id) = @ARGV[2]; + + if($id eq '') { + print_log "[ERROR] ID field cannot be empty.\n\n"; + exit 1; + } + + print_log "[INFO] Delete visual console with ID '$id' \n\n"; + + my $delete_layout = db_do($dbh, 'DELETE FROM tlayout WHERE id = ?', $id); + + if ($delete_layout eq 1) { + db_do($dbh, 'DELETE FROM tlayout_data WHERE id_layout = ?', $id); + } + else { + print_log "[ERROR] Error at remove the visual console.\n\n"; + exit 1; + } +} ############################################################################### ############################################################################### @@ -5183,7 +5262,31 @@ sub pandora_manage_main ($$$) { elsif ($param eq '--locate_agent') { param_check($ltotal, 1); cli_locate_agent(); - } + } + elsif ($param eq '--create_visual_console') { + param_check($ltotal, 7, 2); + cli_create_visual_console(); + } + elsif ($param eq '--edit_visual_console') { + param_check($ltotal, 6, 2); + cli_edit_visual_console(); + } + elsif ($param eq '--delete_visual_console') { + param_check($ltotal, 1); + cli_delete_visual_console(); + } + elsif ($param eq '--delete_visual_console_objects') { + param_check($ltotal, 3); + cli_delete_visual_console_objects(); + } + elsif ($param eq '--duplicate_visual_console') { + param_check($ltotal, 2, 1); + cli_duplicate_visual_console(); + } + elsif ($param eq '--export_json_visual_console') { + param_check($ltotal, 1); + cli_export_visual_console(); + } else { print_log "[ERROR] Invalid option '$param'.\n\n"; $param = ''; From 4dec318607349db8519c4786db03ac4dc0ad2b63 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Mon, 11 Sep 2017 17:56:42 +0200 Subject: [PATCH 09/55] Added function to create visual console with elements in cli --- pandora_server/util/pandora_manage.pl | 30 ++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 3fafbf8d25..ee45368900 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -21,6 +21,7 @@ use JSON qw(decode_json encode_json); use MIME::Base64; use Encode qw(decode encode_utf8); use LWP::Simple; +use Data::Dumper; # Default lib dir for RPM and DEB packages use lib '/usr/lib/perl5'; @@ -4799,10 +4800,33 @@ sub cli_create_visual_console() { print_log "[INFO] The visual console id is '$vc_id' \n\n"; if ($elements ne '') { - my @elements_in_array = json_decoce($elements); + my $elements_in_array = decode_json($elements); - foreach my $elem (@elements_in_array) { - print_log $elem . "\n\n"; + foreach my $elem (@$elements_in_array) { + my $pos_x = $elem->{'pos_x'}; + my $pos_y = $elem->{'pos_y'}; + my $width = $elem->{'width'}; + my $height = $elem->{'height'}; + my $label = $elem->{'label'}; + my $image = $elem->{'image'}; + my $type = $elem->{'type'}; + my $period = $elem->{'period'}; + my $id_agente_modulo = $elem->{'id_agente_modulo'}; + my $id_agent = $elem->{'id_agent'}; + my $id_layout_linked = $elem->{'id_layout_linked'}; + my $parent_item = $elem->{'parent_item'}; + my $enable_link = $elem->{'enable_link'}; + my $id_metaconsole = $elem->{'id_metaconsole'}; + my $id_group = $elem->{'id_group'}; + my $id_custom_graph = $elem->{'id_custom_graph'}; + my $border_width = $elem->{'border_width'}; + my $type_graph = $elem->{'type_graph'}; + my $label_position = $elem->{'label_position'}; + my $border_color = $elem->{'border_color'}; + my $fill_color = $elem->{'fill_color'}; + + db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $vc_id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0); } } } From e7cdf9b049660be547c87d0162b0a036be418660 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Wed, 13 Sep 2017 13:27:37 +0200 Subject: [PATCH 10/55] Added creation when elements position is auto --- pandora_server/util/pandora_manage.pl | 149 +++++++++++++++++++++----- 1 file changed, 122 insertions(+), 27 deletions(-) diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index ee45368900..f258082280 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -216,7 +216,7 @@ sub help_screen{ help_screen_line('--add_tag_to_module', ' ', 'Add a tag to the given module'); print "\nVISUAL CONSOLES\n\n" unless $param ne ''; - help_screen_line('--create_visual_console', ' [] []', 'Create a new visual console'); + help_screen_line('--create_visual_console', ' [] [] []', 'Create a new visual console'); help_screen_line('--edit_visual_console', ' [] []', 'Edit a visual console'); help_screen_line('--delete_visual_console', '', 'Delete a visual console'); help_screen_line('--delete_visual_console_objects', ' ', 'Delete a visual console elements'); @@ -4769,7 +4769,7 @@ sub cli_delete_special_day() { ############################################################################## sub cli_create_visual_console() { - my ($name,$background,$width,$height,$group,$background_color,$elements) = @ARGV[2..8]; + my ($name,$background,$width,$height,$group,$mode,$element_square_positions,$background_color,$elements) = @ARGV[2..10]; if($name eq '') { print_log "[ERROR] Name field cannot be empty.\n\n"; @@ -4787,6 +4787,10 @@ sub cli_create_visual_console() { print_log "[ERROR] Group field cannot be empty.\n\n"; exit 1; } + elsif ($mode eq '') { + print_log "[ERROR] Mode parameter must be 'static_objects' or 'auto_creation'.\n\n"; + exit 1; + } if ($background_color eq '') { $background_color = '#FFF'; @@ -4802,31 +4806,120 @@ sub cli_create_visual_console() { if ($elements ne '') { my $elements_in_array = decode_json($elements); - foreach my $elem (@$elements_in_array) { - my $pos_x = $elem->{'pos_x'}; - my $pos_y = $elem->{'pos_y'}; - my $width = $elem->{'width'}; - my $height = $elem->{'height'}; - my $label = $elem->{'label'}; - my $image = $elem->{'image'}; - my $type = $elem->{'type'}; - my $period = $elem->{'period'}; - my $id_agente_modulo = $elem->{'id_agente_modulo'}; - my $id_agent = $elem->{'id_agent'}; - my $id_layout_linked = $elem->{'id_layout_linked'}; - my $parent_item = $elem->{'parent_item'}; - my $enable_link = $elem->{'enable_link'}; - my $id_metaconsole = $elem->{'id_metaconsole'}; - my $id_group = $elem->{'id_group'}; - my $id_custom_graph = $elem->{'id_custom_graph'}; - my $border_width = $elem->{'border_width'}; - my $type_graph = $elem->{'type_graph'}; - my $label_position = $elem->{'label_position'}; - my $border_color = $elem->{'border_color'}; - my $fill_color = $elem->{'fill_color'}; + if ($mode eq 'static_objects') { + my $elem_count = 1; - db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $vc_id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0); + foreach my $elem (@$elements_in_array) { + my $pos_x = $elem->{'pos_x'}; + my $pos_y = $elem->{'pos_y'}; + my $width = $elem->{'width'}; + my $height = $elem->{'height'}; + my $label = $elem->{'label'}; + my $image = $elem->{'image'}; + my $type = $elem->{'type'}; + my $period = $elem->{'period'}; + my $id_agente_modulo = $elem->{'id_agente_modulo'}; + my $id_agent = $elem->{'id_agent'}; + my $id_layout_linked = $elem->{'id_layout_linked'}; + my $parent_item = $elem->{'parent_item'}; + my $enable_link = $elem->{'enable_link'}; + my $id_metaconsole = $elem->{'id_metaconsole'}; + my $id_group = $elem->{'id_group'}; + my $id_custom_graph = $elem->{'id_custom_graph'}; + my $border_width = $elem->{'border_width'}; + my $type_graph = $elem->{'type_graph'}; + my $label_position = $elem->{'label_position'}; + my $border_color = $elem->{'border_color'}; + my $fill_color = $elem->{'fill_color'}; + + my $elem_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $vc_id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0); + + print_log "[INFO] The element id in position $elem_count is '$elem_id' \n\n"; + + $elem_count++; + } + } + elsif ($mode eq 'auto_creation') { + if ($element_square_positions eq '') { + print_log "[ERROR] With this mode, square positions is obligatory'.\n\n"; + exit 1; + } + else { + my $positions = decode_json($element_square_positions); + + my $pos1X = $positions->{'pos1x'}; + my $pos1Y = $positions->{'pos1y'}; + my $pos2X = $positions->{'pos2x'}; + my $pos2Y = $positions->{'pos2y'}; + + my $number_of_elements = scalar(@$elements_in_array); + + my $x_divider = 4; + my $y_divider = 1; + + for (my $i = 1; $i <= 1000; $i++) { + if (($i * 4) < $number_of_elements) { + $y_divider++; + } + else { + last; + } + } + + my $elem_width = ($pos2X - $pos1X) / $x_divider; + my $elem_height = ($pos2Y - $pos1Y) / $y_divider; + + if ($number_of_elements < 4) { + $elem_height = ($pos2Y - $pos1Y) / 3; + } + + my $elem_count = 1; + my $pos_helper_x = 0; + my $pos_helper_y = 0; + foreach my $elem (@$elements_in_array) { + my $pos_x = $pos_helper_x * $elem_width; + my $pos_y = $pos_helper_y * $elem_height; + my $width = $elem_width; + my $height = $elem_height; + my $label = $elem->{'label'}; + my $image = $elem->{'image'}; + my $type = $elem->{'type'}; + my $period = $elem->{'period'}; + my $id_agente_modulo = $elem->{'id_agente_modulo'}; + my $id_agent = $elem->{'id_agent'}; + my $id_layout_linked = $elem->{'id_layout_linked'}; + my $parent_item = $elem->{'parent_item'}; + my $enable_link = $elem->{'enable_link'}; + my $id_metaconsole = $elem->{'id_metaconsole'}; + my $id_group = $elem->{'id_group'}; + my $id_custom_graph = $elem->{'id_custom_graph'}; + my $border_width = $elem->{'border_width'}; + my $type_graph = $elem->{'type_graph'}; + my $label_position = $elem->{'label_position'}; + my $border_color = $elem->{'border_color'}; + my $fill_color = $elem->{'fill_color'}; + + my $elem_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $vc_id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0); + + print_log "[INFO] The element id in position $elem_count is '$elem_id' \n\n"; + + $elem_count++; + + if ($pos_helper_x == 3) { + $pos_helper_x = 0; + $pos_helper_y++; + } + else { + $pos_helper_x++; + } + } + } + } + else { + print_log "[ERROR] Mode parameter must be 'static_objects' or 'auto_creation'.\n\n"; + exit 1; } } } @@ -4850,6 +4943,8 @@ sub cli_delete_visual_console() { if ($delete_layout eq 1) { db_do($dbh, 'DELETE FROM tlayout_data WHERE id_layout = ?', $id); + + print_log "[INFO] Delete visual console elements with console ID '$id' \n\n"; } else { print_log "[ERROR] Error at remove the visual console.\n\n"; @@ -5288,7 +5383,7 @@ sub pandora_manage_main ($$$) { cli_locate_agent(); } elsif ($param eq '--create_visual_console') { - param_check($ltotal, 7, 2); + param_check($ltotal, 9, 3); cli_create_visual_console(); } elsif ($param eq '--edit_visual_console') { From 26522ecaaa459e67c3fa1fc5baa9a7cbc2e3fff8 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Wed, 13 Sep 2017 15:19:41 +0200 Subject: [PATCH 11/55] Added remove console items function to cli --- pandora_server/util/pandora_manage.pl | 33 +++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index f258082280..67e1214907 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -4952,6 +4952,39 @@ sub cli_delete_visual_console() { } } +############################################################################## +# Delete a visual console objects. +# Related option: --delete_visual_console_objects +############################################################################## + +sub cli_delete_visual_console_objects() { + my ($id_console,$mode,$id_mode) = @ARGV[2..4]; + + if($id_console eq '') { + print_log "[ERROR] Console ID field cannot be empty.\n\n"; + exit 1; + } + elsif ($mode eq '') { + print_log "[ERROR] Mode field cannot be empty.\n\n"; + exit 1; + } + elsif ($id_mode eq '') { + print_log "[ERROR] Mode index field cannot be empty.\n\n"; + exit 1; + } + + if (($mode eq 'type') || ($mode eq 'image') || ($mode eq 'id_agent') || + ($mode eq 'id_agente_modulo') || ($mode eq 'id_group') || ($mode eq 'type_graph')) { + print_log "[INFO] Removind objects with mode '$mode' and id '$id_mode' \n\n"; + + db_do($dbh, 'DELETE FROM tlayout_data WHERE id_layout = ' . $id_console . ' AND ' . $mode . ' = "' . $id_mode . '"'); + } + else { + print_log "[ERROR] Mode is not correct.\n\n"; + exit 1; + } +} + ############################################################################### ############################################################################### # MAIN From 351f9e27b19f436d6e668bdf2550188d05d33e21 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Wed, 13 Sep 2017 17:39:17 +0200 Subject: [PATCH 12/55] Added duplicate function --- pandora_server/util/pandora_manage.pl | 74 +++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 67e1214907..e0322c3718 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -4985,6 +4985,80 @@ sub cli_delete_visual_console_objects() { } } +sub cli_duplicate_visual_console () { + my ($id_console,$prefix) = @ARGV[2..3]; + + if($id_console eq '') { + print_log "[ERROR] Console ID field cannot be empty.\n\n"; + exit 1; + } + + my $console = get_db_single_row ($dbh, "SELECT * + FROM tlayout + WHERE id = $id_console"); + + my $name_to_compare = $console->{'name'}; + my $new_name = $console->{'name'} . "_1"; + my $name_count = 2; + + if ($prefix ne '') { + $new_name = $prefix; + $name_to_compare = $prefix; + $name_count = 1; + } + + my $exist = 1; + while ($exist == 1) { + my $name_in_db = get_db_single_row ($dbh, "SELECT name FROM tlayout WHERE name = '$new_name'"); + + if (defined($name_in_db->{'name'}) && ($name_in_db->{'name'} eq $new_name)) { + $new_name = $name_to_compare . "_" . $name_count; + $name_count++; + } + else { + $exist = 0; + } + } + + my $new_console_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout (name, id_group, background, width, height, background_color) + VALUES (?, ?, ?, ?, ?, ?)', $new_name, $console->{'id_group'}, $console->{'background'}, $console->{'width'}, $console->{'height'}, $console->{'background_color'}); + + print_log "[INFO] The new visual console '$new_name' has been created. The new ID is '$new_console_id' \n\n"; + + my @console_elements = get_db_rows ($dbh, "SELECT * + FROM tlayout_data + WHERE id_layout = $id_console"); + + foreach my $element (@console_elements) { + my $pos_x = $element->{'pos_x'}; + my $pos_y = $element->{'pos_y'}; + my $width = $element->{'width'}; + my $height = $element->{'height'}; + my $label = $element->{'label'}; + my $image = $element->{'image'}; + my $type = $element->{'type'}; + my $period = $element->{'period'}; + my $id_agente_modulo = $element->{'id_agente_modulo'}; + my $id_agent = $element->{'id_agent'}; + my $id_layout_linked = $element->{'id_layout_linked'}; + my $parent_item = $element->{'parent_item'}; + my $enable_link = $element->{'enable_link'}; + my $id_metaconsole = $element->{'id_metaconsole'}; + my $id_group = $element->{'id_group'}; + my $id_custom_graph = $element->{'id_custom_graph'}; + my $border_width = $element->{'border_width'}; + my $type_graph = $element->{'type_graph'}; + my $label_position = $element->{'label_position'}; + my $border_color = $element->{'border_color'}; + my $fill_color = $element->{'fill_color'}; + + my $element_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $new_console_id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0); + + print_log "[INFO] Element with ID " . $element->{"id"} . " has been duplicated to the new console \n\n"; + } +} + ############################################################################### ############################################################################### # MAIN From a3bc7f207b863f7e60a0e6bd964c2894a2887ab8 Mon Sep 17 00:00:00 2001 From: fermin831 Date: Wed, 13 Sep 2017 18:07:37 +0200 Subject: [PATCH 13/55] Fixed remote config on local transfer mode --- pandora_agents/unix/pandora_agent | 45 +++++++++++++++++++------------ 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 34492724e6..5791e1582c 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -128,6 +128,9 @@ my @BrokerPid; my %DefaultConf = ( 'server_ip' => 'localhost', 'server_path' => '/var/spool/pandora/data_in', + 'server_path_md5' => 'md5', + 'server_path_conf' => 'conf', + 'server_path_zip' => 'collections', 'logfile' =>'/var/log/pandora/pandora_agent.log', 'logsize' => DEFAULT_MAX_LOG_SIZE, 'logrotate' => DEFAULT_LOG_ROTATE, @@ -906,13 +909,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 +942,7 @@ sub send_file { quit FEOF1` } elsif ($Conf{'transfer_mode'} eq 'local') { - $output = `cp "$file" "$Conf{'server_path'}/" 2>&1 >$DevNull`; + $output = `cp "$file" "$remote_dir" 2>&1 >$DevNull`; } alarm (0); }; @@ -966,7 +973,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 +1031,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,12 +1082,16 @@ 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; + 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. @@ -1104,7 +1115,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 +1159,14 @@ 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.'); + 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 +1180,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 +1266,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 = ; close (MD5_FILE); @@ -1273,7 +1284,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"); From f03514c77106912b753891da7c768a7dd850b20b Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Wed, 13 Sep 2017 18:07:45 +0200 Subject: [PATCH 14/55] Added first version to export console elements to json --- pandora_server/util/pandora_manage.pl | 86 +++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index e0322c3718..34c42053e4 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -4985,6 +4985,11 @@ sub cli_delete_visual_console_objects() { } } +############################################################################## +# Duplicate a visual console. +# Related option: --duplicate_visual_console +############################################################################## + sub cli_duplicate_visual_console () { my ($id_console,$prefix) = @ARGV[2..3]; @@ -5059,6 +5064,87 @@ sub cli_duplicate_visual_console () { } } +############################################################################## +# Export a visual console elements to json. +# Related option: --export_json_visual_console +############################################################################## + +sub cli_export_visual_console() { + my ($id) = @ARGV[2]; + + if($id eq '') { + print_log "[ERROR] ID field cannot be empty.\n\n"; + exit 1; + } + + print_log "[INFO] Exporting visual console elements with ID '$id' \n\n"; + + my @console_elements = get_db_rows ($dbh, "SELECT * + FROM tlayout_data + WHERE id_layout = $id"); + + my $data_to_json = '['; + my $first = 1; + + foreach my $element (@console_elements) { + my $pos_x = $element->{'pos_x'}; + my $pos_y = $element->{'pos_y'}; + my $width = $element->{'width'}; + my $height = $element->{'height'}; + my $label = $element->{'label'}; + my $image = $element->{'image'}; + my $type = $element->{'type'}; + my $period = $element->{'period'}; + my $id_agente_modulo = $element->{'id_agente_modulo'}; + my $id_agent = $element->{'id_agent'}; + my $id_layout_linked = $element->{'id_layout_linked'}; + my $parent_item = $element->{'parent_item'}; + my $enable_link = $element->{'enable_link'}; + my $id_metaconsole = $element->{'id_metaconsole'}; + my $id_group = $element->{'id_group'}; + my $id_custom_graph = $element->{'id_custom_graph'}; + my $border_width = $element->{'border_width'}; + my $type_graph = $element->{'type_graph'}; + my $label_position = $element->{'label_position'}; + my $border_color = $element->{'border_color'}; + my $fill_color = $element->{'fill_color'}; + + if ($first == 0) { + $data_to_json .= ',' + } + else { + $first = 0; + } + + $data_to_json .= '{"image":"' . $image . '"'; + $data_to_json .= ',"pos_y":' . $pos_y; + $data_to_json .= ',"pos_x":' . $pos_x; + $data_to_json .= ',"width":' . $width; + $data_to_json .= ',"height":' . $height; + $data_to_json .= ',"label":"' . $label . '"'; + $data_to_json .= ',"type":' . $type; + $data_to_json .= ',"period":' . $period; + $data_to_json .= ',"id_agente_modulo":' . $id_agente_modulo; + $data_to_json .= ',"id_agent":' . $id_agent; + $data_to_json .= ',"id_layout_linked":' . $id_layout_linked; + $data_to_json .= ',"parent_item":' . $parent_item; + $data_to_json .= ',"enable_link":' . $enable_link; + $data_to_json .= ',"id_metaconsole":' . $id_metaconsole; + $data_to_json .= ',"id_group":' . $id_group; + $data_to_json .= ',"id_custom_graph":' . $id_custom_graph; + $data_to_json .= ',"border_width":' . $border_width; + $data_to_json .= ',"type_graph":"' . $type_graph . '"'; + $data_to_json .= ',"label_position":"' . $label_position . '"'; + $data_to_json .= ',"border_color":"' . $border_color . '"'; + $data_to_json .= ',"fill_color":"' . $fill_color . '"'; + $data_to_json .= '}'; + } + + $data_to_json .= ']'; + + print_log "[INFO] JSON file now contents: \n" . $data_to_json . "\n\n"; +} + ############################################################################### ############################################################################### # MAIN From 7eecf38378d77d56a4efb3ba1e5a008d6c3fcd0b Mon Sep 17 00:00:00 2001 From: fermin831 Date: Wed, 13 Sep 2017 18:58:24 +0200 Subject: [PATCH 15/55] Added transfer_mode_user to change owner of local copies files --- pandora_agents/unix/pandora_agent | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 5791e1582c..32a98d3574 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -149,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' => '', @@ -942,7 +943,7 @@ sub send_file { quit FEOF1` } elsif ($Conf{'transfer_mode'} eq 'local') { - $output = `cp "$file" "$remote_dir" 2>&1 >$DevNull`; + $output = `cp -p "$file" "$remote_dir" 2>&1 >$DevNull`; } alarm (0); }; @@ -1165,6 +1166,11 @@ sub check_remote_config () { print MD5_FILE $conf_md5; close (MD5_FILE); copy ("$ConfDir/$ConfFile", "$Conf{'temporal'}/$RemoteConfFile"); + 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"); From aa8ee4278d36f969080d0ab30f2cd9d0ddb5f908 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Thu, 14 Sep 2017 09:37:45 +0200 Subject: [PATCH 16/55] Added export to JSON function to cli --- pandora_server/util/pandora_manage.pl | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 34c42053e4..a34d918338 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -221,7 +221,7 @@ sub help_screen{ help_screen_line('--delete_visual_console', '', 'Delete a visual console'); help_screen_line('--delete_visual_console_objects', ' ', 'Delete a visual console elements'); help_screen_line('--duplicate_visual_console', ' []', 'Duplicate a visual console'); - help_screen_line('--export_json_visual_console', '', 'Creates a json with the visual console elements information'); + help_screen_line('--export_json_visual_console', ' []', 'Creates a json with the visual console elements information'); print "\n"; @@ -5070,7 +5070,7 @@ sub cli_duplicate_visual_console () { ############################################################################## sub cli_export_visual_console() { - my ($id) = @ARGV[2]; + my ($id,$path) = @ARGV[2..3]; if($id eq '') { print_log "[ERROR] ID field cannot be empty.\n\n"; @@ -5142,6 +5142,15 @@ sub cli_export_visual_console() { $data_to_json .= ']'; + if ($path eq '') { + open(FicheroJSON, ">console_" . $id . "_elements"); + } + else { + open(FicheroJSON, ">" . $path . "/console_" . $id . "_elements"); + } + + print FicheroJSON $data_to_json; + print_log "[INFO] JSON file now contents: \n" . $data_to_json . "\n\n"; } @@ -5596,7 +5605,7 @@ sub pandora_manage_main ($$$) { cli_duplicate_visual_console(); } elsif ($param eq '--export_json_visual_console') { - param_check($ltotal, 1); + param_check($ltotal, 2, 1); cli_export_visual_console(); } else { From 8907b393df23d86d920e0b93082c1f852e40bf04 Mon Sep 17 00:00:00 2001 From: enriquecd Date: Thu, 14 Sep 2017 10:27:11 +0200 Subject: [PATCH 17/55] Fix - Horizontal scrolling of elements with hyperlink in label for VC - #1327 --- .../operation/visual_console/render_view.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pandora_console/operation/visual_console/render_view.php b/pandora_console/operation/visual_console/render_view.php index 4364bfda9f..261205818b 100755 --- a/pandora_console/operation/visual_console/render_view.php +++ b/pandora_console/operation/visual_console/render_view.php @@ -282,7 +282,12 @@ $ignored_params['refr'] = ''; $('.item:not(.icon) img:not(.b64img)').each( function() { if ($(this).css('float')=='left' || $(this).css('float')=='right') { - $(this).css('margin-top',(parseInt($(this).parent().parent().css('height'))/2-parseInt($(this).css('height'))/2)+'px'); + if( $(this).parent()[0].tagName == 'DIV'){ + $(this).css('margin-top',(parseInt($(this).parent().css('height'))/2-parseInt($(this).css('height'))/2)+'px'); + } + else if ( $(this).parent()[0].tagName == 'A') { + $(this).css('margin-top',(parseInt($(this).parent().parent().css('height'))/2-parseInt($(this).css('height'))/2)+'px'); + } $(this).css('margin-left',''); } else { @@ -290,7 +295,12 @@ $ignored_params['refr'] = ''; $(this).css('margin-left',''); $(this).css('margin-top',''); } else { - $(this).css('margin-left',(parseInt($(this).parent().parent().css('width'))/2-parseInt($(this).css('width'))/2)+'px'); + if( $(this).parent()[0].tagName == 'DIV'){ + $(this).css('margin-left',(parseInt($(this).parent().css('width'))/2-parseInt($(this).css('width'))/2)+'px'); + } + else if ( $(this).parent()[0].tagName == 'A') { + $(this).css('margin-left',(parseInt($(this).parent().parent().css('width'))/2-parseInt($(this).css('width'))/2)+'px'); + } $(this).css('margin-top',''); } } From bb0e15261a17c4c27beed7c85a0cd1291cd793ba Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Thu, 14 Sep 2017 12:07:52 +0200 Subject: [PATCH 18/55] Added editor function when static option is enabled --- pandora_server/util/pandora_manage.pl | 275 +++++++++++++++++++++++++- 1 file changed, 273 insertions(+), 2 deletions(-) diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index a34d918338..8cdb7df9b8 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -217,7 +217,7 @@ sub help_screen{ print "\nVISUAL CONSOLES\n\n" unless $param ne ''; help_screen_line('--create_visual_console', ' [] [] []', 'Create a new visual console'); - help_screen_line('--edit_visual_console', ' [] []', 'Edit a visual console'); + help_screen_line('--edit_visual_console', ' [] [] [] [] [] [] [] [] []', 'Edit a visual console'); help_screen_line('--delete_visual_console', '', 'Delete a visual console'); help_screen_line('--delete_visual_console_objects', ' ', 'Delete a visual console elements'); help_screen_line('--duplicate_visual_console', ' []', 'Duplicate a visual console'); @@ -4924,6 +4924,277 @@ sub cli_create_visual_console() { } } +############################################################################## +# Edit a visual console. +# Related option: --edit_visual_console +############################################################################## + +sub cli_edit_visual_console() { + my ($id,$name,$background,$width,$height,$group,$mode,$element_square_positions,$background_color,$elements) = @ARGV[2..11]; + + if($id eq '') { + print_log "[ERROR] ID field cannot be empty.\n\n"; + exit 1; + } + + my $console = get_db_single_row ($dbh, "SELECT * + FROM tlayout + WHERE id = $id"); + + my $new_name = $console->{'name'}; + my $new_background = $console->{'background'}; + my $new_console_width = $console->{'width'}; + my $new_console_height = $console->{'height'}; + my $new_console_id_group = $console->{'id_group'}; + my $new_background_color = $console->{'background_color'}; + + if($name ne '') { + $new_name = $name; + } + if ($background ne '') { + $new_background = $background; + } + if ($width ne '') { + $new_console_width = $width; + } + if ($height ne '') { + $new_console_height = $height; + } + if ($group ne '') { + $new_console_id_group = $group; + } + if ($background_color ne '') { + $new_background_color = $background_color; + } + + print_log "[INFO] The visual console with id $id is updated \n\n"; + + db_update ($dbh, "UPDATE tlayout SET name = '" . $new_name . "', background = '" . $new_background . "', width = " . $new_console_width . ", height = " . $new_console_height . ", id_group = " . $new_console_id_group . ", background_color = '" . $new_background_color . "' WHERE id = " . $id); + + if ($elements ne '') { + my $elements_in_array = decode_json($elements); + + if ($mode eq 'static_objects') { + foreach my $elem (@$elements_in_array) { + if (defined($elem->{'id'})) { + + print_log "[INFO] Edit element with id " . $elem->{'id'} . " \n\n"; + + my $element_in_db = get_db_single_row ($dbh, "SELECT * + FROM tlayout_data + WHERE id = " . $elem->{'id'}); + + my $new_pos_x = $element_in_db->{'pos_x'}; + my $new_pos_y = $element_in_db->{'pos_y'}; + my $new_width = $element_in_db->{'width'}; + my $new_height = $element_in_db->{'height'}; + my $new_label = $element_in_db->{'label'}; + my $new_image = $element_in_db->{'image'}; + my $new_type = $element_in_db->{'type'}; + my $new_period = $element_in_db->{'period'}; + my $new_id_agente_modulo = $element_in_db->{'id_agente_modulo'}; + my $new_id_agent = $element_in_db->{'id_agent'}; + my $new_id_layout_linked = $element_in_db->{'id_layout_linked'}; + my $new_parent_item = $element_in_db->{'parent_item'}; + my $new_enable_link = $element_in_db->{'enable_link'}; + my $new_id_metaconsole = $element_in_db->{'id_metaconsole'}; + my $new_id_group = $element_in_db->{'id_group'}; + my $new_id_custom_graph = $element_in_db->{'id_custom_graph'}; + my $new_border_width = $element_in_db->{'border_width'}; + my $new_type_graph = $element_in_db->{'type_graph'}; + my $new_label_position = $element_in_db->{'label_position'}; + my $new_border_color = $element_in_db->{'border_color'}; + my $new_fill_color = $element_in_db->{'fill_color'}; + + if(defined($elem->{'pos_x'})) { + $new_pos_x = $elem->{'pos_x'}; + } + if(defined($elem->{'pos_y'})) { + $new_pos_y = $elem->{'pos_y'}; + } + if(defined($elem->{'width'})) { + $new_width = $elem->{'width'}; + } + if(defined($elem->{'height'})) { + $new_height = $elem->{'height'}; + } + if(defined($elem->{'label'})) { + $new_label = $elem->{'label'}; + } + if(defined($elem->{'image'})) { + $new_image = $elem->{'image'}; + } + if(defined($elem->{'type'})) { + $new_type = $elem->{'type'}; + } + if(defined($elem->{'period'})) { + $new_period = $elem->{'period'}; + } + if(defined($elem->{'id_agente_modulo'})) { + $new_id_agente_modulo = $elem->{'id_agente_modulo'}; + } + if(defined($elem->{'id_agent'})) { + $new_id_agent = $elem->{'id_agent'}; + } + if(defined($elem->{'id_layout_linked'})) { + $new_id_layout_linked = $elem->{'id_layout_linked'}; + } + if(defined($elem->{'parent_item'})) { + $new_parent_item = $elem->{'parent_item'}; + } + if(defined($elem->{'enable_link'})) { + $new_enable_link = $elem->{'enable_link'}; + } + if(defined($elem->{'id_metaconsole'})) { + $new_id_metaconsole = $elem->{'id_metaconsole'}; + } + if(defined($elem->{'id_group'})) { + $new_id_group = $elem->{'id_group'}; + } + if(defined($elem->{'id_custom_graph'})) { + $new_id_custom_graph = $elem->{'id_custom_graph'}; + } + if(defined($elem->{'border_width'})) { + $new_border_width = $elem->{'border_width'}; + } + if(defined($elem->{'type_graph'})) { + $new_type_graph = $elem->{'type_graph'}; + } + if(defined($elem->{'label_position'})) { + $new_label_position = $elem->{'label_position'}; + } + if(defined($elem->{'border_color'})) { + $new_border_color = $elem->{'border_color'}; + } + if(defined($elem->{'fill_color'})) { + $new_fill_color = $elem->{'fill_color'}; + } + + db_update ($dbh, "UPDATE tlayout_data SET pos_x = " . $new_pos_x . ", pos_y = " . $new_pos_y . ", width = " . $new_width . + ", height = " . $new_height . ", label = '" . $new_label . "', image = '" . $new_image . + "', type = " . $new_type . ", period = " . $new_period . ", id_agente_modulo = " . $new_id_agente_modulo . + ", id_agent = " . $new_id_agent . ", id_layout_linked = " . $new_id_layout_linked . ", parent_item = " . $new_parent_item . + ", enable_link = " . $new_enable_link . ", id_metaconsole = " . $new_id_metaconsole . ", id_group = " . $new_id_group . + ", id_custom_graph = " . $new_id_custom_graph . ", border_width = " . $new_border_width . ", type_graph = '" . $new_type_graph . + "', label_position = '" . $new_label_position . "', border_color = '" . $new_border_color . "', fill_color = '" . $new_fill_color . + "' WHERE id = " . $elem->{'id'}); + + print_log "[INFO] Element with id " . $elem->{'id'} . " has been updated \n\n"; + } + else { + my $pos_x = $elem->{'pos_x'}; + my $pos_y = $elem->{'pos_y'}; + my $width = $elem->{'width'}; + my $height = $elem->{'height'}; + my $label = $elem->{'label'}; + my $image = $elem->{'image'}; + my $type = $elem->{'type'}; + my $period = $elem->{'period'}; + my $id_agente_modulo = $elem->{'id_agente_modulo'}; + my $id_agent = $elem->{'id_agent'}; + my $id_layout_linked = $elem->{'id_layout_linked'}; + my $parent_item = $elem->{'parent_item'}; + my $enable_link = $elem->{'enable_link'}; + my $id_metaconsole = $elem->{'id_metaconsole'}; + my $id_group = $elem->{'id_group'}; + my $id_custom_graph = $elem->{'id_custom_graph'}; + my $border_width = $elem->{'border_width'}; + my $type_graph = $elem->{'type_graph'}; + my $label_position = $elem->{'label_position'}; + my $border_color = $elem->{'border_color'}; + my $fill_color = $elem->{'fill_color'}; + + my $new_elem_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0); + + print_log "[INFO] New element with id $new_elem_id has been created \n\n"; + } + } + } + elsif ($mode eq 'auto_creation') { + if ($element_square_positions eq '') { + print_log "[ERROR] With this mode, square positions is obligatory'.\n\n"; + exit 1; + } + else { + my $positions = decode_json($element_square_positions); + + my $pos1X = $positions->{'pos1x'}; + my $pos1Y = $positions->{'pos1y'}; + my $pos2X = $positions->{'pos2x'}; + my $pos2Y = $positions->{'pos2y'}; + + my $number_of_elements = scalar(@$elements_in_array); + + my $x_divider = 4; + my $y_divider = 1; + + for (my $i = 1; $i <= 1000; $i++) { + if (($i * 4) < $number_of_elements) { + $y_divider++; + } + else { + last; + } + } + + my $elem_width = ($pos2X - $pos1X) / $x_divider; + my $elem_height = ($pos2Y - $pos1Y) / $y_divider; + + if ($number_of_elements < 4) { + $elem_height = ($pos2Y - $pos1Y) / 3; + } + + my $elem_count = 1; + my $pos_helper_x = 0; + my $pos_helper_y = 0; + foreach my $elem (@$elements_in_array) { + my $pos_x = $pos_helper_x * $elem_width; + my $pos_y = $pos_helper_y * $elem_height; + my $width = $elem_width; + my $height = $elem_height; + my $label = $elem->{'label'}; + my $image = $elem->{'image'}; + my $type = $elem->{'type'}; + my $period = $elem->{'period'}; + my $id_agente_modulo = $elem->{'id_agente_modulo'}; + my $id_agent = $elem->{'id_agent'}; + my $id_layout_linked = $elem->{'id_layout_linked'}; + my $parent_item = $elem->{'parent_item'}; + my $enable_link = $elem->{'enable_link'}; + my $id_metaconsole = $elem->{'id_metaconsole'}; + my $id_group = $elem->{'id_group'}; + my $id_custom_graph = $elem->{'id_custom_graph'}; + my $border_width = $elem->{'border_width'}; + my $type_graph = $elem->{'type_graph'}; + my $label_position = $elem->{'label_position'}; + my $border_color = $elem->{'border_color'}; + my $fill_color = $elem->{'fill_color'}; + + my $elem_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0); + + print_log "[INFO] The element id in position $elem_count is '$elem_id' \n\n"; + + $elem_count++; + + if ($pos_helper_x == 3) { + $pos_helper_x = 0; + $pos_helper_y++; + } + else { + $pos_helper_x++; + } + } + } + } + else { + print_log "[ERROR] Mode parameter must be 'static_objects' or 'auto_creation'.\n\n"; + exit 1; + } + } +} + ############################################################################## # Delete a visual console. # Related option: --delete_visual_console @@ -5589,7 +5860,7 @@ sub pandora_manage_main ($$$) { cli_create_visual_console(); } elsif ($param eq '--edit_visual_console') { - param_check($ltotal, 6, 2); + param_check($ltotal, 10, 9); cli_edit_visual_console(); } elsif ($param eq '--delete_visual_console') { From 4fd4783bc56733368813bd2a87f6fb8ccf2dc2bb Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Thu, 14 Sep 2017 13:14:31 +0200 Subject: [PATCH 19/55] Added edit function with auto position --- pandora_server/util/pandora_manage.pl | 171 ++++++++++++++++++++++---- 1 file changed, 144 insertions(+), 27 deletions(-) diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 8cdb7df9b8..9af7840fe9 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -5117,6 +5117,135 @@ sub cli_edit_visual_console() { exit 1; } else { + foreach my $elem (@$elements_in_array) { + if (defined($elem->{'id'})) { + print_log "[INFO] Edit element with id " . $elem->{'id'} . " \n\n"; + + my $element_in_db = get_db_single_row ($dbh, "SELECT * + FROM tlayout_data + WHERE id = " . $elem->{'id'}); + + my $new_pos_x = $element_in_db->{'pos_x'}; + my $new_pos_y = $element_in_db->{'pos_y'}; + my $new_width = $element_in_db->{'width'}; + my $new_height = $element_in_db->{'height'}; + my $new_label = $element_in_db->{'label'}; + my $new_image = $element_in_db->{'image'}; + my $new_type = $element_in_db->{'type'}; + my $new_period = $element_in_db->{'period'}; + my $new_id_agente_modulo = $element_in_db->{'id_agente_modulo'}; + my $new_id_agent = $element_in_db->{'id_agent'}; + my $new_id_layout_linked = $element_in_db->{'id_layout_linked'}; + my $new_parent_item = $element_in_db->{'parent_item'}; + my $new_enable_link = $element_in_db->{'enable_link'}; + my $new_id_metaconsole = $element_in_db->{'id_metaconsole'}; + my $new_id_group = $element_in_db->{'id_group'}; + my $new_id_custom_graph = $element_in_db->{'id_custom_graph'}; + my $new_border_width = $element_in_db->{'border_width'}; + my $new_type_graph = $element_in_db->{'type_graph'}; + my $new_label_position = $element_in_db->{'label_position'}; + my $new_border_color = $element_in_db->{'border_color'}; + my $new_fill_color = $element_in_db->{'fill_color'}; + + if(defined($elem->{'width'})) { + $new_width = $elem->{'width'}; + } + if(defined($elem->{'height'})) { + $new_height = $elem->{'height'}; + } + if(defined($elem->{'label'})) { + $new_label = $elem->{'label'}; + } + if(defined($elem->{'image'})) { + $new_image = $elem->{'image'}; + } + if(defined($elem->{'type'})) { + $new_type = $elem->{'type'}; + } + if(defined($elem->{'period'})) { + $new_period = $elem->{'period'}; + } + if(defined($elem->{'id_agente_modulo'})) { + $new_id_agente_modulo = $elem->{'id_agente_modulo'}; + } + if(defined($elem->{'id_agent'})) { + $new_id_agent = $elem->{'id_agent'}; + } + if(defined($elem->{'id_layout_linked'})) { + $new_id_layout_linked = $elem->{'id_layout_linked'}; + } + if(defined($elem->{'parent_item'})) { + $new_parent_item = $elem->{'parent_item'}; + } + if(defined($elem->{'enable_link'})) { + $new_enable_link = $elem->{'enable_link'}; + } + if(defined($elem->{'id_metaconsole'})) { + $new_id_metaconsole = $elem->{'id_metaconsole'}; + } + if(defined($elem->{'id_group'})) { + $new_id_group = $elem->{'id_group'}; + } + if(defined($elem->{'id_custom_graph'})) { + $new_id_custom_graph = $elem->{'id_custom_graph'}; + } + if(defined($elem->{'border_width'})) { + $new_border_width = $elem->{'border_width'}; + } + if(defined($elem->{'type_graph'})) { + $new_type_graph = $elem->{'type_graph'}; + } + if(defined($elem->{'label_position'})) { + $new_label_position = $elem->{'label_position'}; + } + if(defined($elem->{'border_color'})) { + $new_border_color = $elem->{'border_color'}; + } + if(defined($elem->{'fill_color'})) { + $new_fill_color = $elem->{'fill_color'}; + } + + db_update ($dbh, "UPDATE tlayout_data SET pos_x = " . $new_pos_x . ", pos_y = " . $new_pos_y . ", width = " . $new_width . + ", height = " . $new_height . ", label = '" . $new_label . "', image = '" . $new_image . + "', type = " . $new_type . ", period = " . $new_period . ", id_agente_modulo = " . $new_id_agente_modulo . + ", id_agent = " . $new_id_agent . ", id_layout_linked = " . $new_id_layout_linked . ", parent_item = " . $new_parent_item . + ", enable_link = " . $new_enable_link . ", id_metaconsole = " . $new_id_metaconsole . ", id_group = " . $new_id_group . + ", id_custom_graph = " . $new_id_custom_graph . ", border_width = " . $new_border_width . ", type_graph = '" . $new_type_graph . + "', label_position = '" . $new_label_position . "', border_color = '" . $new_border_color . "', fill_color = '" . $new_fill_color . + "' WHERE id = " . $elem->{'id'}); + + print_log "[INFO] Element with id " . $elem->{'id'} . " has been updated \n\n"; + } + else { + my $pos_x = 0; + my $pos_y = 0; + my $width = $elem->{'width'}; + my $height = $elem->{'height'}; + my $label = $elem->{'label'}; + my $image = $elem->{'image'}; + my $type = $elem->{'type'}; + my $period = $elem->{'period'}; + my $id_agente_modulo = $elem->{'id_agente_modulo'}; + my $id_agent = $elem->{'id_agent'}; + my $id_layout_linked = $elem->{'id_layout_linked'}; + my $parent_item = $elem->{'parent_item'}; + my $enable_link = $elem->{'enable_link'}; + my $id_metaconsole = $elem->{'id_metaconsole'}; + my $id_group = $elem->{'id_group'}; + my $id_custom_graph = $elem->{'id_custom_graph'}; + my $border_width = $elem->{'border_width'}; + my $type_graph = $elem->{'type_graph'}; + my $label_position = $elem->{'label_position'}; + my $border_color = $elem->{'border_color'}; + my $fill_color = $elem->{'fill_color'}; + + my $new_elem_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0); + + print_log "[INFO] New element with id $new_elem_id has been created \n\n"; + } + } + my $positions = decode_json($element_square_positions); my $pos1X = $positions->{'pos1x'}; @@ -5124,8 +5253,12 @@ sub cli_edit_visual_console() { my $pos2X = $positions->{'pos2x'}; my $pos2Y = $positions->{'pos2y'}; - my $number_of_elements = scalar(@$elements_in_array); - + my @console_elements = get_db_rows ($dbh, "SELECT * + FROM tlayout_data + WHERE id_layout = $id"); + + my $number_of_elements = scalar(@console_elements); + my $x_divider = 4; my $y_divider = 1; @@ -5148,33 +5281,17 @@ sub cli_edit_visual_console() { my $elem_count = 1; my $pos_helper_x = 0; my $pos_helper_y = 0; - foreach my $elem (@$elements_in_array) { - my $pos_x = $pos_helper_x * $elem_width; - my $pos_y = $pos_helper_y * $elem_height; - my $width = $elem_width; - my $height = $elem_height; - my $label = $elem->{'label'}; - my $image = $elem->{'image'}; - my $type = $elem->{'type'}; - my $period = $elem->{'period'}; - my $id_agente_modulo = $elem->{'id_agente_modulo'}; - my $id_agent = $elem->{'id_agent'}; - my $id_layout_linked = $elem->{'id_layout_linked'}; - my $parent_item = $elem->{'parent_item'}; - my $enable_link = $elem->{'enable_link'}; - my $id_metaconsole = $elem->{'id_metaconsole'}; - my $id_group = $elem->{'id_group'}; - my $id_custom_graph = $elem->{'id_custom_graph'}; - my $border_width = $elem->{'border_width'}; - my $type_graph = $elem->{'type_graph'}; - my $label_position = $elem->{'label_position'}; - my $border_color = $elem->{'border_color'}; - my $fill_color = $elem->{'fill_color'}; + foreach my $elem (@console_elements) { + my $new_pos_x = $pos_helper_x * $elem_width; + my $new_pos_y = $pos_helper_y * $elem_height; + my $new_elem_width = $elem_width; + my $new_elem_height = $elem_height; - my $elem_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0); + db_update ($dbh, "UPDATE tlayout_data SET pos_x = " . $new_pos_x . ", pos_y = " . $new_pos_y . + ", width = " . $new_elem_width . ", height = " . $new_elem_height . + " WHERE id = " . $elem->{'id'}); - print_log "[INFO] The element id in position $elem_count is '$elem_id' \n\n"; + print_log "[INFO] Recolocate element with id " . $elem->{'id'} . " \n\n"; $elem_count++; From eb6e67e1ca028c8deb3d031d8eabb604008ddb74 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Thu, 14 Sep 2017 17:56:57 +0200 Subject: [PATCH 20/55] Added servers sction in menu to RR perms --- pandora_console/godmode/menu.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index 38c0f2dfc6..b929a1ec84 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -196,7 +196,7 @@ if (!empty($sub)) { } -if (check_acl ($config['id_user'], 0, "AW") || check_acl ($config['id_user'], 0, "PM")) { +if (check_acl ($config['id_user'], 0, "AW") || check_acl ($config['id_user'], 0, "PM") || check_acl ($config['id_user'], 0, "RR")) { // Servers $menu_godmode["gservers"]["text"] = __('Servers'); $menu_godmode["gservers"]["sec2"] = "godmode/servers/modificar_server"; From 802a782c9ac812c2d03f868c69682aba9039e8ba Mon Sep 17 00:00:00 2001 From: artica Date: Fri, 15 Sep 2017 00:01:21 +0200 Subject: [PATCH 21/55] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 5a75c5dca4..21580b7e8c 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.712-170914 +Version: 7.0NG.712-170915 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 9d4335697a..e7e42e4c6a 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -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-170914" +pandora_version="7.0NG.712-170915" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 89945c274d..86e0ebfa7f 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.712'; -use constant AGENT_BUILD => '170914'; +use constant AGENT_BUILD => '170915'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index adaa8404c3..61b2f9e67e 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.712 -%define release 170914 +%define release 170915 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index e77bed63f0..9db99dbde2 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.712 -%define release 170914 +%define release 170915 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index aa7c62cb6c..2c3bd737c8 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.712" -PI_BUILD="170914" +PI_BUILD="170915" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 3979f27147..804ce5dc7a 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{170914} +{170915} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index e0770c3c57..b9837b99ff 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.712(Build 170914)") +#define PANDORA_VERSION ("7.0NG.712(Build 170915)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index e25d77599a..73d4b21d79 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -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 170914))" + VALUE "ProductVersion", "(7.0NG.712(Build 170915))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index f03a7cbd15..156efc60ee 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.712-170914 +Version: 7.0NG.712-170915 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 057d259316..3b0fd9286a 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -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-170914" +pandora_version="7.0NG.712-170915" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 0a07b5ca99..7b42fe4333 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC170914'; +$build_version = 'PC170915'; $pandora_version = 'v7.0NG.712'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 004fc2f7d8..cc96071e5c 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
Date: Fri, 15 Sep 2017 13:21:51 +0200 Subject: [PATCH 22/55] Added changes to NODE --- .../include/functions_reporting.php | 91 +++++++++++++++++-- 1 file changed, 82 insertions(+), 9 deletions(-) diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index d46ea0759a..877a0e54b7 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -129,12 +129,51 @@ function reporting_make_reporting_data($report = null, $id_report, } $content['style'] = json_decode(io_safe_output($content['style']), true); + + $graphs_to_macro = db_get_all_rows_field_filter ("tgraph_source", + "id_graph", $content['id_gs']); + + if ($graphs_to_macro === false) + $graphs_to_macro = array(); + + $modules_to_macro = array (); + $agents_to_macro = array(); + foreach ($graphs_to_macro as $graph_item) { + if ($type == 'automatic_graph') { + array_push ($modules_to_macro, array( + 'module' => $graph_item['id_agent_module'], + 'server' => $graph_item['id_server'])); + } + else { + array_push ($modules_to_macro, $graph_item['id_agent_module']); + } + + if (in_array('label', $content['style'])) { + if (defined('METACONSOLE')) { + array_push ($agents_to_macro, $content['id_agent']); + } + else { + array_push ($agents_to_macro, modules_get_agentmodule_agent($graph_item['id_agent_module'])); + } + } + } + + $agents_to_macro_aux = array(); + foreach ($agents_to_macro as $ag) { + if (!in_array($ag, $agents_to_macro_aux)) { + $agents_to_macro_aux[$ag] = $ag; + } + } + $agents_to_macro = $agents_to_macro_aux; + if(isset($content['style']['name_label'])){ //Add macros name $items_label = array(); $items_label['type'] = $content['type']; $items_label['id_agent'] = $content['id_agent']; $items_label['id_agent_module'] = $content['id_agent_module']; + $items_label['modules'] = $modules_to_macro; + $items_label['agents'] = $agents_to_macro; $metaconsole_on = is_metaconsole(); $server_name = $content['server_name']; @@ -5852,11 +5891,12 @@ function reporting_custom_graph($report, $content, $type = 'dinamic', 'id_agent_module'=>$graph_item['id_agent_module']); } else { - $item = array('type' => 'custom_graph', - 'id_agent' =>modules_get_agentmodule_agent($graph_item['id_agent_module']), - 'id_agent_module'=>$graph_item['id_agent_module']); + $item = array('type' => 'custom_graph', + 'id_agent' =>modules_get_agentmodule_agent($graph_item['id_agent_module']), + 'id_agent_module'=>$graph_item['id_agent_module']); } + $label = reporting_label_macro($item, $content['style']['label']); $labels[$graph_item['id_agent_module']] = $label; } } @@ -10313,32 +10353,65 @@ function reporting_label_macro ($item, $label) { case 'MTTR': case 'automatic_graph': if (preg_match("/_agent_/", $label)) { - $agent_name = agents_get_alias($item['id_agent']); + if (count($item['agents']) > 1) { + $agent_name = count($item['agents']) . __(' agents'); + } + else { + $agent_name = agents_get_alias($item['id_agent']); + } + $label = str_replace("_agent_", $agent_name, $label); } if (preg_match("/_agentdescription_/", $label)) { - $agent_name = agents_get_description($item['id_agent']); + if (count($item['agents']) > 1) { + $agent_name = ""; + } + else { + $agent_name = agents_get_description($item['id_agent']); + } $label = str_replace("_agentdescription_", $agent_name, $label); } if (preg_match("/_agentgroup_/", $label)) { - $agent_name = groups_get_name(agents_get_agent_group($item['id_agent']),true); + if (count($item['agents']) > 1) { + $agent_name = ""; + } + else { + $agent_name = groups_get_name(agents_get_agent_group($item['id_agent']),true); + } $label = str_replace("_agentgroup_", $agent_name, $label); } if (preg_match("/_address_/", $label)) { - $agent_name = agents_get_address($item['id_agent']); + if (count($item['agents']) > 1) { + $agent_name = ""; + } + else { + $agent_name = agents_get_address($item['id_agent']); + } $label = str_replace("_address_", $agent_name, $label); } if (preg_match("/_module_/", $label)) { - $module_name = modules_get_agentmodule_name($item['id_agent_module']); + if (count($item['modules']) > 1) { + $module_name = count($item['modules']) . __(' modules'); + } + else { + $module_name = modules_get_agentmodule_name($item['id_agent_module']); + } + $label = str_replace("_module_", $module_name, $label); } if (preg_match("/_moduledescription_/", $label)) { - $module_description = modules_get_agentmodule_descripcion($item['id_agent_module']); + if (count($item['modules']) > 1) { + $module_description = ""; + } + else { + $module_description = modules_get_agentmodule_descripcion($item['id_agent_module']); + } + $label = str_replace("_moduledescription_", $module_description, $label); } break; From d35a88e439632f4f71d25634867751a6b0715b0a Mon Sep 17 00:00:00 2001 From: artica Date: Sat, 16 Sep 2017 00:01:20 +0200 Subject: [PATCH 23/55] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 21580b7e8c..aba821340b 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.712-170915 +Version: 7.0NG.712-170916 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index e7e42e4c6a..2d0722e17b 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -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-170915" +pandora_version="7.0NG.712-170916" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 86e0ebfa7f..98a538d954 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.712'; -use constant AGENT_BUILD => '170915'; +use constant AGENT_BUILD => '170916'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 61b2f9e67e..3efb067815 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.712 -%define release 170915 +%define release 170916 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 9db99dbde2..7484582db2 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.712 -%define release 170915 +%define release 170916 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 2c3bd737c8..80eeda97f0 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.712" -PI_BUILD="170915" +PI_BUILD="170916" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 804ce5dc7a..e78951cd01 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{170915} +{170916} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index b9837b99ff..cfce19d1cf 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.712(Build 170915)") +#define PANDORA_VERSION ("7.0NG.712(Build 170916)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 73d4b21d79..aee954e3d2 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -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 170915))" + VALUE "ProductVersion", "(7.0NG.712(Build 170916))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 156efc60ee..4cdbb59da8 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.712-170915 +Version: 7.0NG.712-170916 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 3b0fd9286a..a9ec6f7a02 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -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-170915" +pandora_version="7.0NG.712-170916" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 7b42fe4333..53a06acf2f 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC170915'; +$build_version = 'PC170916'; $pandora_version = 'v7.0NG.712'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index cc96071e5c..99b27bdcec 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
Date: Sun, 17 Sep 2017 00:01:19 +0200 Subject: [PATCH 24/55] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index aba821340b..dad82e973b 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.712-170916 +Version: 7.0NG.712-170917 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 2d0722e17b..f85bd8f352 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -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-170916" +pandora_version="7.0NG.712-170917" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 98a538d954..7f427ba5a8 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.712'; -use constant AGENT_BUILD => '170916'; +use constant AGENT_BUILD => '170917'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 3efb067815..65dc2a1781 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.712 -%define release 170916 +%define release 170917 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 7484582db2..e55c6d650f 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.712 -%define release 170916 +%define release 170917 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 80eeda97f0..3800e1e24b 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.712" -PI_BUILD="170916" +PI_BUILD="170917" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index e78951cd01..8bccd65c98 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{170916} +{170917} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index cfce19d1cf..35c099d00e 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.712(Build 170916)") +#define PANDORA_VERSION ("7.0NG.712(Build 170917)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index aee954e3d2..6fcd384ff5 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -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 170916))" + VALUE "ProductVersion", "(7.0NG.712(Build 170917))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 4cdbb59da8..7e3f15e946 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.712-170916 +Version: 7.0NG.712-170917 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index a9ec6f7a02..1006eb6138 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -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-170916" +pandora_version="7.0NG.712-170917" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 53a06acf2f..fe59b2cf0d 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC170916'; +$build_version = 'PC170917'; $pandora_version = 'v7.0NG.712'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 99b27bdcec..d618b21787 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
Date: Mon, 18 Sep 2017 00:01:20 +0200 Subject: [PATCH 25/55] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index dad82e973b..319b9576b3 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.712-170917 +Version: 7.0NG.712-170918 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index f85bd8f352..51ad8a1022 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -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-170917" +pandora_version="7.0NG.712-170918" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 7f427ba5a8..888503e250 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.712'; -use constant AGENT_BUILD => '170917'; +use constant AGENT_BUILD => '170918'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 65dc2a1781..c203ededfe 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.712 -%define release 170917 +%define release 170918 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index e55c6d650f..cbe8810399 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.712 -%define release 170917 +%define release 170918 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 3800e1e24b..2514106d2c 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.712" -PI_BUILD="170917" +PI_BUILD="170918" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 8bccd65c98..b7a5656323 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{170917} +{170918} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 35c099d00e..4f30f872f7 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.712(Build 170917)") +#define PANDORA_VERSION ("7.0NG.712(Build 170918)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 6fcd384ff5..0b5f8e9f34 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -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 170917))" + VALUE "ProductVersion", "(7.0NG.712(Build 170918))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 7e3f15e946..adfa26fdfe 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.712-170917 +Version: 7.0NG.712-170918 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 1006eb6138..194ef391f0 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -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-170917" +pandora_version="7.0NG.712-170918" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index fe59b2cf0d..7b40d5695a 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC170917'; +$build_version = 'PC170918'; $pandora_version = 'v7.0NG.712'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index d618b21787..e735b43e01 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
Date: Mon, 18 Sep 2017 10:18:38 +0200 Subject: [PATCH 26/55] Added changes to meta report templates --- .../include/functions_reporting.php | 23 +++++-------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 877a0e54b7..66b36f98f1 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -149,15 +149,10 @@ function reporting_make_reporting_data($report = null, $id_report, } if (in_array('label', $content['style'])) { - if (defined('METACONSOLE')) { - array_push ($agents_to_macro, $content['id_agent']); - } - else { - array_push ($agents_to_macro, modules_get_agentmodule_agent($graph_item['id_agent_module'])); - } + array_push ($agents_to_macro, modules_get_agentmodule_agent($graph_item['id_agent_module'])); } } - + $agents_to_macro_aux = array(); foreach ($agents_to_macro as $ag) { if (!in_array($ag, $agents_to_macro_aux)) { @@ -5885,17 +5880,11 @@ function reporting_custom_graph($report, $content, $type = 'dinamic', array_push ($weights, $graph_item["weight"]); if (in_array('label',$content['style'])) { - if (defined('METACONSOLE')) { - $item = array('type' => 'custom_graph', - 'id_agent' =>$content['id_agent'], - 'id_agent_module'=>$graph_item['id_agent_module']); - } - else { - $item = array('type' => 'custom_graph', - 'id_agent' =>modules_get_agentmodule_agent($graph_item['id_agent_module']), - 'id_agent_module'=>$graph_item['id_agent_module']); - } + $item = array('type' => 'custom_graph', + 'id_agent' =>modules_get_agentmodule_agent($graph_item['id_agent_module']), + 'id_agent_module'=>$graph_item['id_agent_module']); + //html_debug($item); $label = reporting_label_macro($item, $content['style']['label']); $labels[$graph_item['id_agent_module']] = $label; } From e05d0bab25c60deeab4afc1da5394dc968458192 Mon Sep 17 00:00:00 2001 From: enriquecd Date: Mon, 18 Sep 2017 11:07:59 +0200 Subject: [PATCH 27/55] Compatible with all browsers - #1245 --- .../visual_console_builder.editor.js | 6 +++--- .../include/functions_visual_map.php | 20 +++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index 7e0ff10cec..2c98fb5493 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -313,9 +313,9 @@ function update_button_palette_callback() { if ((values['width'] == 0) || (values['height'] == 0)) { $("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('height'); - $("#image_" + idItem).attr('width', 450); + $("#image_" + idItem).attr('width', 520); $("#image_" + idItem).attr('height', 80); - $("#image_" + idItem).css('width', '450px'); + $("#image_" + idItem).css('width', '520px'); $("#image_" + idItem).css('height', '80px'); $("#image_" + idItem).attr('src', 'images/console/signes/group_status.png'); @@ -1742,7 +1742,7 @@ function set_image(type, idElement, image) { $(item).attr('src', data); if(image == 'show_statistics_bad.png' || image == 'show_statistics_ok.png' || image == 'show_statistics_warning.png' || image == 'show_statistics.png'){ - $(item).attr('width', 450); + $(item).attr('width', 520); $(item).attr('height', 80); } diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index b83abdfa2c..b06a0c6d5c 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -1277,7 +1277,7 @@ function visual_map_print_item($mode = "read", $layoutData, if ($width == 0 || $height == 0) { - echo ''; + echo ''; } else{ echo ''; @@ -1318,7 +1318,7 @@ function visual_map_print_item($mode = "read", $layoutData, $stat_agent_un = $agents_unknown[0]['total']/$total_agents*100; if($width == 0 || $height == 0){ - $dyn_width = 450; + $dyn_width = 520; $dyn_height = 80; } else{ @@ -1344,14 +1344,14 @@ function visual_map_print_item($mode = "read", $layoutData, echo ""; echo ""; echo ""; - echo "
". remove_right_zeros(number_format($stat_agent_cr, 2)) ."%
"; - echo "
Critical
"; - echo "
". remove_right_zeros(number_format($stat_agent_wa, 2)) ."%
"; - echo "
Warning
"; - echo "
". remove_right_zeros(number_format($stat_agent_ok, 2)) ."%
"; - echo "
Normal
"; - echo "
". remove_right_zeros(number_format($stat_agent_un, 2)) ."%
"; - echo "
Unknown
"; + echo "
". remove_right_zeros(number_format($stat_agent_cr, 2)) ."%
"; + echo "
Critical
"; + echo "
". remove_right_zeros(number_format($stat_agent_wa, 2)) ."%
"; + echo "
Warning
"; + echo "
". remove_right_zeros(number_format($stat_agent_ok, 2)) ."%
"; + echo "
Normal
"; + echo "
". remove_right_zeros(number_format($stat_agent_un, 2)) ."%
"; + echo "
Unknown
"; echo ""; echo ""; From 4d2709367909319404ae7ecaaedbb95082c983ad Mon Sep 17 00:00:00 2001 From: fermin831 Date: Mon, 18 Sep 2017 11:50:40 +0200 Subject: [PATCH 28/55] Fixed down server time calculation --- pandora_server/bin/pandora_server | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pandora_server/bin/pandora_server b/pandora_server/bin/pandora_server index 709b6c7b04..ef617343aa 100755 --- a/pandora_server/bin/pandora_server +++ b/pandora_server/bin/pandora_server @@ -607,7 +607,10 @@ sub main() { $server->update(); } - db_do ($DBH, "UPDATE tserver SET status = 0 WHERE now()-keepalive > 2*server_keepalive"); + db_do ($DBH, + "UPDATE tserver SET status = 0 + WHERE UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(keepalive) > 2*server_keepalive" + ); # Set the master server pandora_set_master(\%Config, $DBH); From d54509fd1e2c1db4ccfbba0d55f6f85c0696e4c6 Mon Sep 17 00:00:00 2001 From: daniel Date: Mon, 18 Sep 2017 17:57:43 +0200 Subject: [PATCH 29/55] fixed errors in TIP boolean graphs --- pandora_console/include/functions_graph.php | 77 +++++++++++++++++---- 1 file changed, 65 insertions(+), 12 deletions(-) diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 6ec7e8587c..0ef5e1d9d3 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -3794,7 +3794,7 @@ 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) { - + global $config; global $chart; global $color; @@ -3851,22 +3851,65 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, if ($fullscale) { // Get module data + $events = db_get_all_rows_filter('tevento', + array ('id_agentmodule' => $agent_module_id, + "utimestamp > $datelimit", + "utimestamp < $date", + 'order' => 'utimestamp ASC'), + array ('evento', 'utimestamp', 'event_type', 'id_evento')); + + $table = "tagente_datos"; + $module_type_str = modules_get_type_name ($agent_module_id); + if (strstr ($module_type_str, 'string') !== false) { + $table = "tagente_datos_string"; + } + + $query = " SELECT utimestamp, datos FROM $table "; + $query .= " WHERE id_agente_modulo=$agent_module_id "; + $query .= " ORDER BY utimestamp ASC LIMIT 1"; + + $ret = db_get_all_rows_sql( $query , true); + + $first_data = $ret[0]['utimestamp']; + /* + // Get the last event after inverval to know if graph start on unknown + $prev_event = db_get_row_filter ('tevento', + array ('id_agentmodule' => $agent_module_id, + "utimestamp <= $datelimit", + 'order' => 'utimestamp DESC')); + if (isset($prev_event['event_type']) && $prev_event['event_type'] == 'going_unknown') { + $start_unknown = true; + } + */ + if ($events === false) { + $events = array (); + } $data_uncompress = db_uncompress_module_data($agent_module_id, $datelimit, $date); - + $i = 0; - $j = 0; - $array_unknown = array(); $data = array(); if(is_array($data_uncompress)){ foreach ($data_uncompress as $value) { foreach ($value['data'] as $key => $value) { $data[$i]['datos'] = $value['datos']; if(empty($value['datos'])){ - $events[$j]['utimestamp'] = $value['utimestamp']; - $j++; + if($value['utimestamp'] < $first_data){ + $data[$i]['unknown'] = 0; + $data[$i]['not_init'] = 1; + $data[$i]['utimestamp'] = $value['utimestamp']; + } + else{ + $data[$i]['not_init'] = 0; + $data[$i]['unknown'] = 1; + $data[$i]['utimestamp'] = $value['utimestamp']; + } } - $data[$i]['utimestamp'] = $value['utimestamp']; + else{ + $data[$i]['not_init'] = 0; + $data[$i]['unknown'] = 0; + } + $data[$i]['utimestamp'] = $value['utimestamp']; $i++; } } @@ -3964,7 +4007,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, $zero = 0; $total = 0; $count = 0; - + $is_unknown = false; // Read data that falls in the current interval while (isset ($data[$j]) && $data[$j]['utimestamp'] >= $timestamp && @@ -3978,6 +4021,10 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, } $last_known = $data[$j]['datos']; + + if ($show_unknown && $data[$j]['unknown']){ + $is_unknown = true; + } $j++; } @@ -3990,7 +4037,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, $event_value = 0; $alert_value = 0; $unknown_value = 0; - $is_unknown = false; + // Is the first point of a unknown interval $first_unknown = false; @@ -4008,8 +4055,15 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, $alert_ids[] = $events[$k]['id_evento']; } if ($show_unknown) { - $first_unknown = true; - $is_unknown = true; + if ($events[$k]['event_type'] == 'going_unknown') { + if ($is_unknown == false) { + $first_unknown = true; + } + $is_unknown = true; + } + else if (substr ($events[$k]['event_type'], 0, 5) == 'going') { + $is_unknown = false; + } } $k++; } @@ -4094,7 +4148,6 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, if (!isset($chart[$timestamp]['unknown'.$series_suffix])) { $chart[$timestamp]['unknown'.$series_suffix] = 0; } - $chart[$timestamp]['unknown'.$series_suffix] = $unknown_value; $series_type['unknown'.$series_suffix] = 'area'; } From 2e802e1b705aae35f52cadca65bdf4c6a0584cb8 Mon Sep 17 00:00:00 2001 From: artica Date: Tue, 19 Sep 2017 00:01:21 +0200 Subject: [PATCH 30/55] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 319b9576b3..a06e7378ca 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.712-170918 +Version: 7.0NG.712-170919 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 51ad8a1022..f8d8fb9030 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -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-170918" +pandora_version="7.0NG.712-170919" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 888503e250..2549bfd26c 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.712'; -use constant AGENT_BUILD => '170918'; +use constant AGENT_BUILD => '170919'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index c203ededfe..78c0aa401c 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.712 -%define release 170918 +%define release 170919 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index cbe8810399..c288bed121 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.712 -%define release 170918 +%define release 170919 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 2514106d2c..b5beb38046 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.712" -PI_BUILD="170918" +PI_BUILD="170919" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index b7a5656323..1b6c70f863 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{170918} +{170919} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 4f30f872f7..73695629ba 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.712(Build 170918)") +#define PANDORA_VERSION ("7.0NG.712(Build 170919)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 0b5f8e9f34..3adac4c3c5 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -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 170918))" + VALUE "ProductVersion", "(7.0NG.712(Build 170919))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index adfa26fdfe..192f84302a 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.712-170918 +Version: 7.0NG.712-170919 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 194ef391f0..e967db8d6a 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -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-170918" +pandora_version="7.0NG.712-170919" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 7b40d5695a..cbcd7ec774 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC170918'; +$build_version = 'PC170919'; $pandora_version = 'v7.0NG.712'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index e735b43e01..6acecb6d2e 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
Date: Tue, 19 Sep 2017 10:48:30 +0200 Subject: [PATCH 31/55] Added a minor change to test optimization --- pandora_console/include/functions.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index f59032071f..c5830bfbfa 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -1806,7 +1806,18 @@ function check_acl($id_user, $id_group, $access, $onlyOneGroup = false) { else { $id_group = (int) $id_group; } - + + $three_eyes_crow_groups = db_get_all_rows_sql("SELECT tperfil.*, tusuario_perfil.id_perfil FROM tperfil, tusuario_perfil WHERE tusuario_perfil.id_usuario = '" . + $id_user . "' AND tusuario_perfil.id_grupo = 0 AND tusuario_perfil.id_perfil = tperfil.id_perfil"); + if ($three_eyes_crow_groups && !empty($three_eyes_crow_groups)) { + $acl_column = get_acl_column($access); + foreach ($three_eyes_crow_groups as $three_eyes_crow_group) { + if (isset($three_eyes_crow_group[$acl_column])) { + return 1; + } + } + } + $parents_id = array($id_group); if ($id_group != 0 && $onlyOneGroup !== true) { $group = db_get_row_filter('tgrupo', array('id_grupo' => $id_group)); From 36c13e44c6f931e59842dd9204a520b937f98135 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Wed, 20 Sep 2017 10:48:06 +0200 Subject: [PATCH 32/55] Added some changes to label and name macros in custom graphs --- .../include/functions_reporting.php | 73 +++++++++++++------ 1 file changed, 49 insertions(+), 24 deletions(-) diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 66b36f98f1..0baeb463f7 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -122,6 +122,8 @@ function reporting_make_reporting_data($report = null, $id_report, if (empty($contents)) { return reporting_check_structure_report($report); } + + $metaconsole_on = is_metaconsole(); foreach ($contents as $content) { if (!empty($period)) { @@ -136,20 +138,27 @@ function reporting_make_reporting_data($report = null, $id_report, if ($graphs_to_macro === false) $graphs_to_macro = array(); - $modules_to_macro = array (); + $modules_to_macro = 0; $agents_to_macro = array(); foreach ($graphs_to_macro as $graph_item) { - if ($type == 'automatic_graph') { - array_push ($modules_to_macro, array( - 'module' => $graph_item['id_agent_module'], - 'server' => $graph_item['id_server'])); - } - else { - array_push ($modules_to_macro, $graph_item['id_agent_module']); - } + $modules_to_macro++; if (in_array('label', $content['style'])) { - array_push ($agents_to_macro, modules_get_agentmodule_agent($graph_item['id_agent_module'])); + if ($content['id_agent'] == 0) { + //Metaconsole connection + if ($metaconsole_on && $server_name != '') { + $connection = metaconsole_get_connection($server_name); + if (!metaconsole_load_external_db($connection)) { + //ui_print_error_message ("Error connecting to ".$server_name); + continue; + } + } + array_push ($agents_to_macro, modules_get_agentmodule_agent($graph_item['id_agent_module'])); + if ($metaconsole_on) { + //Restore db connection + metaconsole_restore_db(); + } + } } } @@ -169,7 +178,6 @@ function reporting_make_reporting_data($report = null, $id_report, $items_label['id_agent_module'] = $content['id_agent_module']; $items_label['modules'] = $modules_to_macro; $items_label['agents'] = $agents_to_macro; - $metaconsole_on = is_metaconsole(); $server_name = $content['server_name']; //Metaconsole connection @@ -181,7 +189,6 @@ function reporting_make_reporting_data($report = null, $id_report, } } - if(sizeof($content['id_agent']) != 1){ $content['style']['name_label'] = str_replace("_agent_",sizeof($content['id_agent']).__(' agents'),$content['style']['name_label']); } @@ -5834,12 +5841,6 @@ function reporting_custom_graph($report, $content, $type = 'dinamic', require_once ($config["homedir"] . '/include/functions_graph.php'); - if ($config['metaconsole'] && $type_report != 'automatic_graph') { - $id_meta = metaconsole_get_id_server($content["server_name"]); - $server = metaconsole_get_connection_by_id ($id_meta); - metaconsole_connect($server); - } - $graph = db_get_row ("tgraph", "id_graph", $content['id_gs']); $return = array(); $return['type'] = 'custom_graph'; @@ -5878,18 +5879,42 @@ function reporting_custom_graph($report, $content, $type = 'dinamic', array_push ($modules, $graph_item['id_agent_module']); } - array_push ($weights, $graph_item["weight"]); if (in_array('label',$content['style'])) { - $item = array('type' => 'custom_graph', + if (defined('METACONSOLE')) { + $server_name = $content['server_name']; + $connection = metaconsole_get_connection($server_name); + if (!metaconsole_load_external_db($connection)) { + //ui_print_error_message ("Error connecting to ".$server_name); + continue; + } + $item = array('type' => 'custom_graph', 'id_agent' =>modules_get_agentmodule_agent($graph_item['id_agent_module']), 'id_agent_module'=>$graph_item['id_agent_module']); + } + else { + $item = array('type' => 'custom_graph', + 'id_agent' =>modules_get_agentmodule_agent($graph_item['id_agent_module']), + 'id_agent_module'=>$graph_item['id_agent_module']); + } - //html_debug($item); $label = reporting_label_macro($item, $content['style']['label']); + $labels[$graph_item['id_agent_module']] = $label; + if (defined('METACONSOLE')) { + //Restore db connection + metaconsole_restore_db(); + } } + + array_push ($weights, $graph_item["weight"]); } + if ($config['metaconsole'] && $type_report != 'automatic_graph') { + $id_meta = metaconsole_get_id_server($content["server_name"]); + $server = metaconsole_get_connection_by_id ($id_meta); + metaconsole_connect($server); + } + $return['chart'] = ''; // Get chart reporting_set_conf_charts($width, $height, $only_image, $type, @@ -10383,8 +10408,8 @@ function reporting_label_macro ($item, $label) { } if (preg_match("/_module_/", $label)) { - if (count($item['modules']) > 1) { - $module_name = count($item['modules']) . __(' modules'); + if ($item['modules'] > 1) { + $module_name = $item['modules'] . __(' modules'); } else { $module_name = modules_get_agentmodule_name($item['id_agent_module']); @@ -10394,7 +10419,7 @@ function reporting_label_macro ($item, $label) { } if (preg_match("/_moduledescription_/", $label)) { - if (count($item['modules']) > 1) { + if ($item['modules'] > 1) { $module_description = ""; } else { From 526f76d7d164badd1da3f2001da0469e8d4853ac Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Wed, 20 Sep 2017 12:08:31 +0200 Subject: [PATCH 33/55] Added minor change to fix this issue --- pandora_console/include/functions.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index c5830bfbfa..f8edfd1d27 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -1809,10 +1809,12 @@ function check_acl($id_user, $id_group, $access, $onlyOneGroup = false) { $three_eyes_crow_groups = db_get_all_rows_sql("SELECT tperfil.*, tusuario_perfil.id_perfil FROM tperfil, tusuario_perfil WHERE tusuario_perfil.id_usuario = '" . $id_user . "' AND tusuario_perfil.id_grupo = 0 AND tusuario_perfil.id_perfil = tperfil.id_perfil"); + if ($three_eyes_crow_groups && !empty($three_eyes_crow_groups)) { $acl_column = get_acl_column($access); + foreach ($three_eyes_crow_groups as $three_eyes_crow_group) { - if (isset($three_eyes_crow_group[$acl_column])) { + if (isset($three_eyes_crow_group[$acl_column]) && $three_eyes_crow_group[$acl_column] == 1) { return 1; } } From 3f253b9db488e4b26aef7bdc37989e8eebf1fc49 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Wed, 20 Sep 2017 15:44:30 +0200 Subject: [PATCH 34/55] Added restriction when report comes from template --- pandora_console/include/functions_reporting.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 0baeb463f7..8969718ca8 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -98,7 +98,8 @@ function reporting_get_name($id_report) { function reporting_make_reporting_data($report = null, $id_report, $date, $time, $period = null, $type = 'dinamic', - $force_width_chart = null, $force_height_chart = null, $pdf= false) { + $force_width_chart = null, $force_height_chart = null, $pdf= false, + $from_template = false) { global $config; @@ -161,6 +162,10 @@ function reporting_make_reporting_data($report = null, $id_report, } } } + + if (!empty($report) && $from_template) { + $agents_to_macro = $content['id_agent']; + } $agents_to_macro_aux = array(); foreach ($agents_to_macro as $ag) { @@ -10320,7 +10325,6 @@ function reporting_get_agentmodule_sla_working_timestamp ($period, $date_end, $w } function reporting_label_macro ($item, $label) { - switch ($item['type']) { case 'event_report_agent': case 'alert_report_agent': From f5e14104062eaca7573514efdd97b2c8e3517204 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Wed, 20 Sep 2017 17:09:50 +0200 Subject: [PATCH 35/55] Added fix to macros in pdf view --- pandora_console/include/functions_reporting.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 8969718ca8..7209d11094 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -103,6 +103,8 @@ function reporting_make_reporting_data($report = null, $id_report, global $config; + enterprise_include_once('include/functions_metaconsole.php'); + $return = array(); if (!empty($report)) { @@ -127,6 +129,8 @@ function reporting_make_reporting_data($report = null, $id_report, $metaconsole_on = is_metaconsole(); foreach ($contents as $content) { + $server_name = $content['server_name']; + if (!empty($period)) { $content['period'] = $period; } @@ -154,6 +158,7 @@ function reporting_make_reporting_data($report = null, $id_report, continue; } } + array_push ($agents_to_macro, modules_get_agentmodule_agent($graph_item['id_agent_module'])); if ($metaconsole_on) { //Restore db connection @@ -162,10 +167,6 @@ function reporting_make_reporting_data($report = null, $id_report, } } } - - if (!empty($report) && $from_template) { - $agents_to_macro = $content['id_agent']; - } $agents_to_macro_aux = array(); foreach ($agents_to_macro as $ag) { @@ -175,6 +176,10 @@ function reporting_make_reporting_data($report = null, $id_report, } $agents_to_macro = $agents_to_macro_aux; + if (!empty($report) && $from_template) { + $agents_to_macro = $content['id_agent']; + } + if(isset($content['style']['name_label'])){ //Add macros name $items_label = array(); @@ -183,7 +188,6 @@ function reporting_make_reporting_data($report = null, $id_report, $items_label['id_agent_module'] = $content['id_agent_module']; $items_label['modules'] = $modules_to_macro; $items_label['agents'] = $agents_to_macro; - $server_name = $content['server_name']; //Metaconsole connection if ($metaconsole_on && $server_name != '') { From edb2865430e0a766ca0533bd5e9aea823f0d77db Mon Sep 17 00:00:00 2001 From: daniel Date: Wed, 20 Sep 2017 17:29:17 +0200 Subject: [PATCH 36/55] fixed errors in TIP SPARSE --- pandora_console/include/functions_graph.php | 918 +++++++++++--------- 1 file changed, 489 insertions(+), 429 deletions(-) diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 0ef5e1d9d3..050816b17e 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -570,12 +570,14 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, // Get module data if ($fullscale) { - $data = db_get_all_rows_filter ('tagente_datos', - array ('id_agente_modulo' => (int)$agent_module_id, - "utimestamp > $datelimit", - "utimestamp < $date", - 'order' => 'utimestamp ASC'), - array ('datos', 'utimestamp'), 'AND', true); + 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); + if (count($chart) > $resolution) { + $resolution = count($chart); //Number of points of the graph + $interval = (int) ($period / $resolution); + } } else { $data = db_get_all_rows_filter ('tagente_datos', @@ -619,73 +621,68 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, } $data = $new_data; } - } - // Get module warning_min and critical_min - $warning_min = db_get_value('min_warning','tagente_modulo','id_agente_modulo',$agent_module_id); - $critical_min = db_get_value('min_critical','tagente_modulo','id_agente_modulo',$agent_module_id); - - if ($data === false) { - $data = array (); - } - - - if ($uncompressed_module) { - // Uncompressed module data - $min_necessary = 1; - } - else { - // Compressed module data - // Get previous data - $previous_data = modules_get_previous_data ($agent_module_id, $datelimit); - if ($previous_data !== false) { - $previous_data['utimestamp'] = $datelimit; - array_unshift ($data, $previous_data); + if ($data === false) { + $data = array (); } - // Get next data - $nextData = modules_get_next_data ($agent_module_id, $date); - if ($nextData !== false) { - array_push ($data, $nextData); + if ($uncompressed_module) { + // Uncompressed module data + $min_necessary = 1; } - else if (count ($data) > 0) { - // Propagate the last known data to the end of the interval - $nextData = array_pop ($data); - array_push ($data, $nextData); - $nextData['utimestamp'] = $date; - array_push ($data, $nextData); + else { + // Compressed module data + + // Get previous data + $previous_data = modules_get_previous_data ($agent_module_id, $datelimit); + if ($previous_data !== false) { + $previous_data['utimestamp'] = $datelimit; + array_unshift ($data, $previous_data); + } + + // Get next data + $nextData = modules_get_next_data ($agent_module_id, $date); + if ($nextData !== false) { + array_push ($data, $nextData); + } + else if (count ($data) > 0) { + // Propagate the last known data to the end of the interval + $nextData = array_pop ($data); + array_push ($data, $nextData); + $nextData['utimestamp'] = $date; + array_push ($data, $nextData); + } + $min_necessary = 2; } - - $min_necessary = 2; - } - // Check available data - if (count ($data) < $min_necessary) { - if (!$graphic_type) { - if (!$projection) { - return fs_error_image (); - } - else { - return fs_error_image (); + // Check available data + if (count ($data) < $min_necessary) { + if (!$graphic_type) { + if (!$projection) { + return fs_error_image (); + } + else { + return fs_error_image (); + } } + graphic_error (); + } + + + // Data iterator + $data_i = 0; + + // Set initial conditions + if ($data[0]['utimestamp'] == $datelimit) { + $previous_data = $data[0]['datos']; + $data_i++; + } + else { + $previous_data = 0; } - graphic_error (); } - - // Data iterator - $data_i = 0; - - // Set initial conditions - if ($data[0]['utimestamp'] == $datelimit) { - $previous_data = $data[0]['datos']; - $data_i++; - } - else { - $previous_data = 0; - } - // Get baseline data $baseline_data = array(); if ($baseline) { @@ -704,49 +701,29 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, $unit = modules_get_unit($agent_module_id); } - if ($fullscale) { - if (count($data) > $resolution) { - $resolution = count($data); //Number of points of the graph - $interval = (int) ($period / $resolution); - } + // Get module warning_min and critical_min + $warning_min = db_get_value('min_warning','tagente_modulo','id_agente_modulo',$agent_module_id); + $critical_min = db_get_value('min_critical','tagente_modulo','id_agente_modulo',$agent_module_id); + + // Calculate chart data + if($fullscale){ + $avg_only = 1; + } + else{ + grafico_modulo_sparse_data_chart ($chart, $chart_data_extra, $long_index, + $data, $data_i, $previous_data, $resolution, $interval, $period, $datelimit, + $projection, $avg_only, $uncompressed_module, + $show_events, $show_alerts, $show_unknown, $baseline, + $baseline_data, $events, $series_suffix, $start_unknown, + $percentil, $fullscale); } - // Calculate chart data - grafico_modulo_sparse_data_chart ($chart, $chart_data_extra, $long_index, - $data, $data_i, $previous_data, $resolution, $interval, $period, $datelimit, - $projection, $avg_only, $uncompressed_module, - $show_events, $show_alerts, $show_unknown, $baseline, - $baseline_data, $events, $series_suffix, $start_unknown, - $percentil, $fullscale); - - if ($fullscale) { - if (!$flash_chart) { - $time_format = "Y M \nd H:i:s"; - } - else { - $time_format = "Y M d H:i:s"; - } - - $new_chart = array(); - $new_long_index = array(); - foreach ($chart as $c_timestamp => $c_data) { - $timestamp_short = date($time_format, $c_timestamp); - $new_long_index[$timestamp_short] = date( - html_entity_decode($time_format, ENT_QUOTES, "UTF-8"), $c_timestamp); - $new_chart[$timestamp_short] = $c_data; - } - - $long_index = $new_long_index; - $chart = $new_chart; - } - // Return chart data and don't draw if ($return_data == 1) { return $chart; } $graph_stats = get_statwin_graph_statistics($chart, $series_suffix); - // Fix event and alert scale if ($max_value > 0) { $event_max = 2 + (float)$max_value * 1.05; @@ -811,11 +788,11 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, 'border' => '#000000', 'color' => $config['graph_color1'], 'alpha' => CHART_DEFAULT_ALPHA); - $color['unit'.$series_suffix] = array('border' => null, 'color' => '#0097BC', 'alpha' => 10); + $color['unit'.$series_suffix] = array('border' => null, 'color' => '#0097BC', 'alpha' => 10); if ($show_events) { $legend['event'.$series_suffix_str] = __('Events').$series_suffix_str; - $chart_extra_data['legend_events'] = $legend['event'].$series_suffix_str; + $chart_extra_data['legend_events'] = $legend['event'.$series_suffix_str]; } if ($show_alerts) { $legend['alert'.$series_suffix] = __('Alerts').$series_suffix_str; @@ -837,11 +814,14 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, __('Last') . ': ' . remove_right_zeros(number_format($graph_stats['sum']['last'], $config['graph_precision'])) . ($unit ? ' ' . $unit : '') . ' ; ' . __('Avg') . ': ' . remove_right_zeros(number_format($graph_stats['sum']['avg'], $config['graph_precision'])) . ($unit ? ' ' . $unit : ''); } - else if (!$avg_only) { + else if (!$avg_only && !$fullscale) { $legend['max'.$series_suffix] = __('Max').$series_suffix_str.': '.__('Avg').': '.remove_right_zeros(number_format($graph_stats['max']['avg'], $config['graph_precision'])).' '.$unit.' ; '.__('Max').': '.remove_right_zeros(number_format($graph_stats['max']['max'], $config['graph_precision'])).' '.$unit.' ; '.__('Min').': '.remove_right_zeros(number_format($graph_stats['max']['min'], $config['graph_precision'])).' '.$unit; $legend['sum'.$series_suffix] = __('Avg').$series_suffix_str.': '.__('Avg').': '.remove_right_zeros(number_format($graph_stats['sum']['avg'], $config['graph_precision'])).' '.$unit.' ; '.__('Max').': '.remove_right_zeros(number_format($graph_stats['sum']['max'], $config['graph_precision'])).' '.$unit.' ; '.__('Min').': '.remove_right_zeros(number_format($graph_stats['sum']['min'], $config['graph_precision'])).' '.$unit; $legend['min'.$series_suffix] = __('Min').$series_suffix_str.': '.__('Avg').': '.remove_right_zeros(number_format($graph_stats['min']['avg'], $config['graph_precision'])).' '.$unit.' ; '.__('Max').': '.remove_right_zeros(number_format($graph_stats['min']['max'], $config['graph_precision'])).' '.$unit.' ; '.__('Min').': '.remove_right_zeros(number_format($graph_stats['min']['min'], $config['graph_precision'])).' '.$unit; } + else if ($fullscale){ + $legend['sum'.$series_suffix] = __('Data').$series_suffix_str.': '; + } else { $legend['sum'.$series_suffix] = __('Avg').$series_suffix_str.': '.__('Avg').': '.remove_right_zeros(number_format($graph_stats['sum']['avg'], $config['graph_precision'])).' '.$unit.' ; '.__('Max').': '.remove_right_zeros(number_format($graph_stats['sum']['max'], $config['graph_precision'])).' '.$unit.' ; '.__('Min').': '.remove_right_zeros(number_format($graph_stats['sum']['min'], $config['graph_precision'])).' '.$unit; } @@ -850,7 +830,7 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, $legend['unknown'.$series_suffix] = __('Unknown').$series_suffix_str; $chart_extra_data['legend_unknown'] = $legend['unknown'.$series_suffix_str]; } - + if (!is_null($percentil) && $percentil) { $first_data = reset($chart); $percentil_value = format_for_graph($first_data['percentil'], 2); @@ -933,11 +913,9 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events, $date, $unit, $baseline, $return_data, $show_title, $projection, $adapt_key, $compare, '', '', $show_unknown, $percentil, $dashboard, $vconsole, $type_graph, $fullscale); - if ($return_data) { return $data_returned; } - if ($compare === 'overlapped') { $i = 0; foreach ($chart as $k=>$v) { @@ -3850,75 +3828,15 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, } if ($fullscale) { - // Get module data - $events = db_get_all_rows_filter('tevento', - array ('id_agentmodule' => $agent_module_id, - "utimestamp > $datelimit", - "utimestamp < $date", - 'order' => 'utimestamp ASC'), - array ('evento', 'utimestamp', 'event_type', 'id_evento')); - - $table = "tagente_datos"; - $module_type_str = modules_get_type_name ($agent_module_id); - if (strstr ($module_type_str, 'string') !== false) { - $table = "tagente_datos_string"; - } - - $query = " SELECT utimestamp, datos FROM $table "; - $query .= " WHERE id_agente_modulo=$agent_module_id "; - $query .= " ORDER BY utimestamp ASC LIMIT 1"; - - $ret = db_get_all_rows_sql( $query , true); - - $first_data = $ret[0]['utimestamp']; - /* - // Get the last event after inverval to know if graph start on unknown - $prev_event = db_get_row_filter ('tevento', - array ('id_agentmodule' => $agent_module_id, - "utimestamp <= $datelimit", - 'order' => 'utimestamp DESC')); - if (isset($prev_event['event_type']) && $prev_event['event_type'] == 'going_unknown') { - $start_unknown = true; - } - */ - if ($events === false) { - $events = array (); - } - - $data_uncompress = db_uncompress_module_data($agent_module_id, $datelimit, $date); - - $i = 0; - $data = array(); - if(is_array($data_uncompress)){ - foreach ($data_uncompress as $value) { - foreach ($value['data'] as $key => $value) { - $data[$i]['datos'] = $value['datos']; - if(empty($value['datos'])){ - if($value['utimestamp'] < $first_data){ - $data[$i]['unknown'] = 0; - $data[$i]['not_init'] = 1; - $data[$i]['utimestamp'] = $value['utimestamp']; - } - else{ - $data[$i]['not_init'] = 0; - $data[$i]['unknown'] = 1; - $data[$i]['utimestamp'] = $value['utimestamp']; - } - } - else{ - $data[$i]['not_init'] = 0; - $data[$i]['unknown'] = 0; - } - $data[$i]['utimestamp'] = $value['utimestamp']; - $i++; - } - } - } - - if (count($data) > $resolution) { - $resolution = count($data); //Number of points of the graph + fullscale_data( $chart, $chart_data_extra, $long_index, $series_type, + $agent_module_id, $datelimit, $date, $events, + $show_events, $show_unknown, $show_alerts, + $series_suffix); + if (count($chart) > $resolution) { + $resolution = count($chart); //Number of points of the graph $interval = (int) ($period / $resolution); } + $max_value=1; } else { // Get module data @@ -3928,241 +3846,241 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, "utimestamp < $date", 'order' => 'utimestamp ASC'), array ('datos', 'utimestamp'), 'AND', $search_in_history_db); - } - if ($data === false) { - $data = array (); - } - // Uncompressed module data - if ($uncompressed_module) { - $min_necessary = 1; - - // Compressed module data - } - else { - // Get previous data - $previous_data = modules_get_previous_data ($agent_module_id, $datelimit); - if ($previous_data !== false) { - $previous_data['utimestamp'] = $datelimit; - array_unshift ($data, $previous_data); + if ($data === false) { + $data = array (); } - // Get next data - $nextData = modules_get_next_data ($agent_module_id, $date); - if ($nextData !== false) { - array_push ($data, $nextData); + // Uncompressed module data + if ($uncompressed_module) { + $min_necessary = 1; + + // Compressed module data } - else if (count ($data) > 0) { - // Propagate the last known data to the end of the interval - $nextData = array_pop ($data); - array_push ($data, $nextData); - $nextData['utimestamp'] = $date; - array_push ($data, $nextData); + else { + // Get previous data + $previous_data = modules_get_previous_data ($agent_module_id, $datelimit); + if ($previous_data !== false) { + $previous_data['utimestamp'] = $datelimit; + array_unshift ($data, $previous_data); + } + + // Get next data + $nextData = modules_get_next_data ($agent_module_id, $date); + if ($nextData !== false) { + array_push ($data, $nextData); + } + else if (count ($data) > 0) { + // Propagate the last known data to the end of the interval + $nextData = array_pop ($data); + array_push ($data, $nextData); + $nextData['utimestamp'] = $date; + array_push ($data, $nextData); + } + + $min_necessary = 2; } - $min_necessary = 2; - } - - // Check available data - if (count ($data) < $min_necessary) { - if (!$graphic_type) { - return fs_error_image (); + // Check available data + if (count ($data) < $min_necessary) { + if (!$graphic_type) { + return fs_error_image (); + } + graphic_error (); + } + + + + // Data iterator + $j = 0; + + // Event iterator + $k = 0; + + // Set initial conditions + if ($data[0]['utimestamp'] == $datelimit) { + $previous_data = $data[0]['datos']; + $j++; + } + else { + $previous_data = 0; + } + + $max_value = 0; + + // Calculate chart data + $last_known = $previous_data; + for ($i = 0; $i <= $resolution; $i++) { + $timestamp = $datelimit + ($interval * $i); + + /* + if ($fullscale && ($resolution > ($config['graph_res'] * 50))) { + $timestamp = $data[$i]['utimestamp']; + } + */ + $zero = 0; + $total = 0; + $count = 0; + $is_unknown = false; + // Read data that falls in the current interval + while (isset ($data[$j]) && + $data[$j]['utimestamp'] >= $timestamp && + $data[$j]['utimestamp'] <= ($timestamp + $interval)) { + if ($data[$j]['datos'] == 0) { + $zero = 1; + } + else { + $total += $data[$j]['datos']; + $count++; + } + + $last_known = $data[$j]['datos']; + + if ($show_unknown && $data[$j]['unknown']){ + $is_unknown = true; + } + $j++; + } + + // Average + if ($count > 0) { + $total /= $count; + } + + // Read events and alerts that fall in the current interval + $event_value = 0; + $alert_value = 0; + $unknown_value = 0; + + // Is the first point of a unknown interval + $first_unknown = false; + + $event_ids = array(); + $alert_ids = array(); + while (isset ($events[$k]) && + $events[$k]['utimestamp'] >= $timestamp && + $events[$k]['utimestamp'] < ($timestamp + $interval)) { + if ($show_events == 1) { + $event_value++; + $event_ids[] = $events[$k]['id_evento']; + } + if ($show_alerts == 1 && substr ($events[$k]['event_type'], 0, 5) == 'alert') { + $alert_value++; + $alert_ids[] = $events[$k]['id_evento']; + } + if ($show_unknown) { + if ($events[$k]['event_type'] == 'going_unknown') { + if ($is_unknown == false) { + $first_unknown = true; + } + $is_unknown = true; + } + else if (substr ($events[$k]['event_type'], 0, 5) == 'going') { + $is_unknown = false; + } + } + $k++; + } + + // In some cases, can be marked as known because a recovery event + // was found in same interval. For this cases first_unknown is + // checked too + if ($is_unknown || $first_unknown) { + $unknown_value++; + } + + // Set the title and time format + if ($period <= SECONDS_6HOURS) { + $time_format = 'H:i:s'; + } + elseif ($period < SECONDS_1DAY) { + $time_format = 'H:i'; + } + elseif ($period < SECONDS_15DAYS) { + $time_format = 'M d H:i'; + } + elseif ($period < SECONDS_1MONTH) { + $time_format = 'M d H\h'; + } + else { + $time_format = 'M d H\h'; + } + + $timestamp_short = date($time_format, $timestamp); + $long_index[$timestamp_short] = date( + html_entity_decode($config['date_format'], ENT_QUOTES, "UTF-8"), $timestamp); + if (!$fullscale) { + $timestamp = $timestamp_short; + } + ///////////////////////////////////////////////////////////////// + + if ($total > $max_value) { + $max_value = $total; + } + + if ($show_events) { + if (!isset($chart[$timestamp]['event'.$series_suffix])) { + $chart[$timestamp]['event'.$series_suffix] = 0; + } + + $chart[$timestamp]['event'.$series_suffix] += $event_value; + $series_type['event'.$series_suffix] = 'points'; + } + if ($show_alerts) { + if (!isset($chart[$timestamp]['alert'.$series_suffix])) { + $chart[$timestamp]['alert'.$series_suffix] = 0; + } + + $chart[$timestamp]['alert'.$series_suffix] += $alert_value; + $series_type['alert'.$series_suffix] = 'points'; + } + + // Data and zeroes (draw a step) + if ($zero == 1 && $count > 0) { + $chart[$timestamp]['sum'.$series_suffix] = 0; + } + else if ($zero == 1) { // Just zeros + $chart[$timestamp]['sum'.$series_suffix] = 0; + } + else if ($count > 0) { // No zeros + $chart[$timestamp]['sum'.$series_suffix] = $total; + } + else { // Compressed data + if ($uncompressed_module || ($timestamp > time ()) || $is_unknown) { + $chart[$timestamp]['sum'.$series_suffix] = 0; + } + else { + $chart[$timestamp]['sum'.$series_suffix] = $last_known; + } + } + + if ($show_unknown) { + if (!isset($chart[$timestamp]['unknown'.$series_suffix])) { + $chart[$timestamp]['unknown'.$series_suffix] = 0; + } + $chart[$timestamp]['unknown'.$series_suffix] = $unknown_value; + $series_type['unknown'.$series_suffix] = 'area'; + } + + $series_type['sum' . $series_suffix] = 'boolean'; + + if (!empty($event_ids)) { + $chart_extra_data[count($chart)-1]['events'] = implode(',',$event_ids); + } + if (!empty($alert_ids)) { + $chart_extra_data[count($chart)-1]['alerts'] = implode(',',$alert_ids); + } + } - graphic_error (); } - + if (empty($unit_name)) { $unit = modules_get_unit($agent_module_id); } else $unit = $unit_name; - - // Data iterator - $j = 0; - - // Event iterator - $k = 0; - - // Set initial conditions - if ($data[0]['utimestamp'] == $datelimit) { - $previous_data = $data[0]['datos']; - $j++; - } - else { - $previous_data = 0; - } - - $max_value = 0; - - // Calculate chart data - $last_known = $previous_data; - for ($i = 0; $i <= $resolution; $i++) { - $timestamp = $datelimit + ($interval * $i); - if ($fullscale && ($resolution > ($config['graph_res'] * 50))) { - $timestamp = $data[$i]['utimestamp']; - } - - $zero = 0; - $total = 0; - $count = 0; - $is_unknown = false; - // Read data that falls in the current interval - while (isset ($data[$j]) && - $data[$j]['utimestamp'] >= $timestamp && - $data[$j]['utimestamp'] <= ($timestamp + $interval)) { - if ($data[$j]['datos'] == 0) { - $zero = 1; - } - else { - $total += $data[$j]['datos']; - $count++; - } - - $last_known = $data[$j]['datos']; - - if ($show_unknown && $data[$j]['unknown']){ - $is_unknown = true; - } - $j++; - } - - // Average - if ($count > 0) { - $total /= $count; - } - - // Read events and alerts that fall in the current interval - $event_value = 0; - $alert_value = 0; - $unknown_value = 0; - - // Is the first point of a unknown interval - $first_unknown = false; - - $event_ids = array(); - $alert_ids = array(); - while (isset ($events[$k]) && - $events[$k]['utimestamp'] >= $timestamp && - $events[$k]['utimestamp'] < ($timestamp + $interval)) { - if ($show_events == 1) { - $event_value++; - $event_ids[] = $events[$k]['id_evento']; - } - if ($show_alerts == 1 && substr ($events[$k]['event_type'], 0, 5) == 'alert') { - $alert_value++; - $alert_ids[] = $events[$k]['id_evento']; - } - if ($show_unknown) { - if ($events[$k]['event_type'] == 'going_unknown') { - if ($is_unknown == false) { - $first_unknown = true; - } - $is_unknown = true; - } - else if (substr ($events[$k]['event_type'], 0, 5) == 'going') { - $is_unknown = false; - } - } - $k++; - } - - // In some cases, can be marked as known because a recovery event - // was found in same interval. For this cases first_unknown is - // checked too - if ($is_unknown || $first_unknown) { - $unknown_value++; - } - - // Set the title and time format - if ($period <= SECONDS_6HOURS) { - $time_format = 'H:i:s'; - } - elseif ($period < SECONDS_1DAY) { - $time_format = 'H:i'; - } - elseif ($period < SECONDS_15DAYS) { - $time_format = 'M d H:i'; - } - elseif ($period < SECONDS_1MONTH) { - $time_format = 'M d H\h'; - } - else { - $time_format = 'M d H\h'; - } - - $timestamp_short = date($time_format, $timestamp); - $long_index[$timestamp_short] = date( - html_entity_decode($config['date_format'], ENT_QUOTES, "UTF-8"), $timestamp); - if (!$fullscale) { - $timestamp = $timestamp_short; - } - ///////////////////////////////////////////////////////////////// - - if ($total > $max_value) { - $max_value = $total; - } - - if ($show_events) { - if (!isset($chart[$timestamp]['event'.$series_suffix])) { - $chart[$timestamp]['event'.$series_suffix] = 0; - } - - $chart[$timestamp]['event'.$series_suffix] += $event_value; - $series_type['event'.$series_suffix] = 'points'; - } - if ($show_alerts) { - if (!isset($chart[$timestamp]['alert'.$series_suffix])) { - $chart[$timestamp]['alert'.$series_suffix] = 0; - } - - $chart[$timestamp]['alert'.$series_suffix] += $alert_value; - $series_type['alert'.$series_suffix] = 'points'; - } - - // Data and zeroes (draw a step) - if ($zero == 1 && $count > 0) { - - //New code set 0 if there is a 0 - //Please check the incident #665 - //http://192.168.50.2/integria/index.php?sec=incidents&sec2=operation/incidents/incident_dashboard_detail&id=665 - $chart[$timestamp]['sum'.$series_suffix] = 0; - } - else if ($zero == 1) { // Just zeros - $chart[$timestamp]['sum'.$series_suffix] = 0; - } - else if ($count > 0) { // No zeros - $chart[$timestamp]['sum'.$series_suffix] = $total; - } - else { // Compressed data - if ($uncompressed_module || ($timestamp > time ()) || $is_unknown) { - $chart[$timestamp]['sum'.$series_suffix] = 0; - } - else { - $chart[$timestamp]['sum'.$series_suffix] = $last_known; - } - } - - if ($show_unknown) { - if (!isset($chart[$timestamp]['unknown'.$series_suffix])) { - $chart[$timestamp]['unknown'.$series_suffix] = 0; - } - $chart[$timestamp]['unknown'.$series_suffix] = $unknown_value; - $series_type['unknown'.$series_suffix] = 'area'; - } - - $series_type['sum' . $series_suffix] = 'boolean'; - - if (!empty($event_ids)) { - $chart_extra_data[count($chart)-1]['events'] = implode(',',$event_ids); - } - if (!empty($alert_ids)) { - $chart_extra_data[count($chart)-1]['alerts'] = implode(',',$alert_ids); - } - - } - // Get min, max and avg (less efficient but centralized for all modules and reports) $graph_stats = get_statwin_graph_statistics($chart, $series_suffix); @@ -4186,26 +4104,27 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, } /////////////////////////////////////////////////// - // Set the title and time format - if ($period <= SECONDS_6HOURS) { - $time_format = 'H:i:s'; + if(!$fullscale){ + // Set the title and time format + if ($period <= SECONDS_6HOURS) { + $time_format = 'H:i:s'; + } + elseif ($period < SECONDS_1DAY) { + $time_format = 'H:i'; + } + elseif ($period < SECONDS_15DAYS) { + $time_format = 'M d H:i'; + } + elseif ($period < SECONDS_1MONTH) { + $time_format = 'M d H\h'; + } + elseif ($period < SECONDS_6MONTHS) { + $time_format = "M d H\h"; + } + else { + $time_format = 'M d H\h'; + } } - elseif ($period < SECONDS_1DAY) { - $time_format = 'H:i'; - } - elseif ($period < SECONDS_15DAYS) { - $time_format = 'M d H:i'; - } - elseif ($period < SECONDS_1MONTH) { - $time_format = 'M d H\h'; - } - elseif ($period < SECONDS_6MONTHS) { - $time_format = "M d H\h"; - } - else { - $time_format = 'M d H\h'; - } - // Flash chart $caption = __('Max. Value').$series_suffix_str . ': ' . $graph_stats['sum']['max'] . ' ' . __('Avg. Value').$series_suffix_str . ': ' . $graph_stats['sum']['avg'] . ' ' . __('Min. Value').$series_suffix_str . ': ' . $graph_stats['sum']['min'] . ' ' . __('Units').$series_suffix_str . ': ' . $unit; @@ -4254,6 +4173,167 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, } } +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 ){ + + global $config; + global $max_value; + global $min_value; + global $series_type; + global $chart_extra_data; + + $ranges_unknown = db_get_module_ranges_unknown($agent_module_id, $datelimit, $date); + + $table = "tagente_datos"; + $module_type_str = modules_get_type_name ($agent_module_id); + if (strstr ($module_type_str, 'string') !== false) { + $table = "tagente_datos_string"; + } + + $query = " SELECT utimestamp, datos FROM $table "; + $query .= " WHERE id_agente_modulo=$agent_module_id "; + $query .= " ORDER BY utimestamp ASC LIMIT 1"; + + $ret = db_get_all_rows_sql( $query , true); + + $first_data = $ret[0]['utimestamp']; + $data_uncompress = db_uncompress_module_data($agent_module_id, $datelimit, $date); + $i = 0; + $max_value = 0; + $min_value = 0; + $timestamp_second = 0; + if(is_array($data_uncompress)){ + foreach ($data_uncompress as $v) { + foreach ($v['data'] as $key => $value) { + $real_date = date("Y M d H:i:s", $value['utimestamp']); + + // Read events and alerts that fall in the current interval + $event_value = 0; + $alert_value = 0; + $unknown_value = 0; + $event_i = 0; + // Is the first point of a unknown interval + $first_unknown = false; + + $event_ids = array(); + $alert_ids = array(); + + // + if($timestamp_second == 0){ + $timestamp_second = $value['utimestamp']; + } + $timestamp_first = $timestamp_second; + $timestamp_second = $value['utimestamp']; + + foreach ($events as $key => $val) { + if( $val['utimestamp'] >= $timestamp_first && + $val['utimestamp'] <= $timestamp_second ){ + if ($show_events == 1) { + $event_ids[] = $val['id_evento']; + $event_value++; + } + if ($show_alerts == 1 && substr ($val['event_type'], 0, 5) == 'alert') { + $alert_ids[] = $val['id_evento']; + $alert_value++; + } + if ($show_unknown) { + if ($val['event_type'] == 'going_unknown') { + if ($is_unknown == false) { + $first_unknown = true; + } + $is_unknown = true; + } + else if (substr ($val['event_type'], 0, 5) == 'going') { + $is_unknown = false; + } + } + } + } + + if(empty($value['datos'])){ + if($value['utimestamp'] < $first_data){ + //$chart_data[$real_date]['unknown'.$series_suffix] = 0; + $is_unknown = false; + } + else{ + //$chart_data[$real_date]['unknown'.$series_suffix] = 1; + $first_unknown = true; + } + } + + $timestamp_short = date("Y M d 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 + // was found in same interval. For this cases first_unknown is + // checked too + if ($is_unknown || $first_unknown) { + $unknown_value++; + } + + // Data + if ($show_events) { + if (!isset($chart_data[$real_date]['event'.$series_suffix])) { + $chart_data[$real_date]['event'.$series_suffix] = 0; + } + + $chart_data[$real_date]['event'.$series_suffix] += $event_value; + + $series_type['event'.$series_suffix] = 'points'; + } + + if ($show_alerts) { + if (!isset($chart_data[$real_date]['alert'.$series_suffix])) { + $chart_data[$real_date]['alert'.$series_suffix] = 0; + } + + $chart_data[$real_date]['alert'.$series_suffix] += $alert_value; + + $series_type['alert'.$series_suffix] = 'points'; + } + + $chart_data[$real_date]['sum'.$series_suffix] = $value['datos']; + + if($value['datos'] > $max_value){ + $max_value = $value['datos']; + } + + if($value['datos'] < $min_value){ + $min_value = $value['datos']; + } + + if ($show_unknown) { + if (!isset($chart_data[$real_date]['unknown'.$series_suffix])) { + $chart_data[$real_date]['unknown'.$series_suffix] = 0; + } + $chart_data[$real_date]['unknown'.$series_suffix] = $unknown_value; + $series_type['unknown'.$series_suffix] = 'area'; + } + + if (!empty($event_ids)) { + $chart_extra_data[count($chart_data)-1]['events'] = implode(',',$event_ids); + } + if (!empty($alert_ids)) { + $chart_extra_data[count($chart_data)-1]['alerts'] = implode(',',$alert_ids); + } + } + } + + if (!is_null($percentil) && $percentil) { + $avg = array_map(function($item) { return $item['sum']; }, $chart_data); + $percentil_result = get_percentile($percentil, $avg); + //Fill the data of chart + array_walk($chart_data, function(&$item) use ($percentil_result, $series_suffix) { + $item['percentil' . $series_suffix] = $percentil_result; }); + $series_type['percentil' . $series_suffix] = 'line'; + } + } + //html_debug_print($chart_data); +} + function grafico_modulo_boolean ($agent_module_id, $period, $show_events, $width, $height , $title='', $unit_name, $show_alerts, $avg_only = 0, $pure=0, $date = 0, $only_image = false, $homeurl = '', $adapt_key = '', $compare = false, @@ -4313,26 +4393,6 @@ 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); - if ($fullscale) { - if (!$flash_chart) { - $time_format = "Y M \nd H:i:s"; - } - else { - $time_format = "Y M d H:i:s"; - } - - $new_chart = array(); - $new_long_index = array(); - foreach ($chart as $c_timestamp => $c_data) { - $timestamp_short = date($time_format, $c_timestamp); - $new_long_index[$timestamp_short] = date( - html_entity_decode($time_format, ENT_QUOTES, "UTF-8"), $c_timestamp); - $new_chart[$timestamp_short] = $c_data; - } - - $long_index = $new_long_index; - $chart = $new_chart; - } if ($compare === 'overlapped') { $i = 0; From 581b6cbae2c38b464c83d5b0a9670a809ccd1446 Mon Sep 17 00:00:00 2001 From: artica Date: Thu, 21 Sep 2017 00:01:28 +0200 Subject: [PATCH 37/55] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index a06e7378ca..be2d8f1e9c 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.712-170919 +Version: 7.0NG.712-170921 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index f8d8fb9030..15318f6506 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -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-170919" +pandora_version="7.0NG.712-170921" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 2549bfd26c..e107e816c2 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.712'; -use constant AGENT_BUILD => '170919'; +use constant AGENT_BUILD => '170921'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 78c0aa401c..aa1c2448ce 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.712 -%define release 170919 +%define release 170921 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index c288bed121..f3a7255999 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.712 -%define release 170919 +%define release 170921 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index b5beb38046..71523b5060 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.712" -PI_BUILD="170919" +PI_BUILD="170921" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 1b6c70f863..8978afc781 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{170919} +{170921} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 73695629ba..429da76deb 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.712(Build 170919)") +#define PANDORA_VERSION ("7.0NG.712(Build 170921)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 3adac4c3c5..25eafde1e9 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -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 170919))" + VALUE "ProductVersion", "(7.0NG.712(Build 170921))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 192f84302a..cfcbbfa475 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.712-170919 +Version: 7.0NG.712-170921 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index e967db8d6a..208098ba56 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -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-170919" +pandora_version="7.0NG.712-170921" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index cbcd7ec774..3abbb6f9a1 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC170919'; +$build_version = 'PC170921'; $pandora_version = 'v7.0NG.712'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 6acecb6d2e..c2ee3f7e41 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
Date: Thu, 21 Sep 2017 10:09:06 +0200 Subject: [PATCH 38/55] Marked some config options like undocumented and added transfer_mode_user on all unix confs --- pandora_agents/unix/AIX/pandora_agent.conf | 3 +++ pandora_agents/unix/Darwin/pandora_agent.conf | 3 +++ pandora_agents/unix/FreeBSD/pandora_agent.conf | 3 +++ pandora_agents/unix/HP-UX/pandora_agent.conf | 3 +++ pandora_agents/unix/Linux/pandora_agent.conf | 3 +++ pandora_agents/unix/NetBSD/pandora_agent.conf | 3 +++ pandora_agents/unix/SunOS/pandora_agent.conf | 3 +++ pandora_agents/unix/pandora_agent | 6 +++--- 8 files changed, 24 insertions(+), 3 deletions(-) diff --git a/pandora_agents/unix/AIX/pandora_agent.conf b/pandora_agents/unix/AIX/pandora_agent.conf index 4fc8c757ba..d78044b76d 100644 --- a/pandora_agents/unix/AIX/pandora_agent.conf +++ b/pandora_agents/unix/AIX/pandora_agent.conf @@ -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 diff --git a/pandora_agents/unix/Darwin/pandora_agent.conf b/pandora_agents/unix/Darwin/pandora_agent.conf index 41c6747052..11a58e3225 100644 --- a/pandora_agents/unix/Darwin/pandora_agent.conf +++ b/pandora_agents/unix/Darwin/pandora_agent.conf @@ -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 diff --git a/pandora_agents/unix/FreeBSD/pandora_agent.conf b/pandora_agents/unix/FreeBSD/pandora_agent.conf index 29d6e893b7..6d988c94ac 100644 --- a/pandora_agents/unix/FreeBSD/pandora_agent.conf +++ b/pandora_agents/unix/FreeBSD/pandora_agent.conf @@ -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 diff --git a/pandora_agents/unix/HP-UX/pandora_agent.conf b/pandora_agents/unix/HP-UX/pandora_agent.conf index 9db22b3b47..01bc718c43 100644 --- a/pandora_agents/unix/HP-UX/pandora_agent.conf +++ b/pandora_agents/unix/HP-UX/pandora_agent.conf @@ -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 diff --git a/pandora_agents/unix/Linux/pandora_agent.conf b/pandora_agents/unix/Linux/pandora_agent.conf index fcfa94b429..00fa91f85f 100644 --- a/pandora_agents/unix/Linux/pandora_agent.conf +++ b/pandora_agents/unix/Linux/pandora_agent.conf @@ -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 diff --git a/pandora_agents/unix/NetBSD/pandora_agent.conf b/pandora_agents/unix/NetBSD/pandora_agent.conf index 4f89baee8b..088a6b5159 100644 --- a/pandora_agents/unix/NetBSD/pandora_agent.conf +++ b/pandora_agents/unix/NetBSD/pandora_agent.conf @@ -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 diff --git a/pandora_agents/unix/SunOS/pandora_agent.conf b/pandora_agents/unix/SunOS/pandora_agent.conf index 94bc194a05..3c50a12bfa 100644 --- a/pandora_agents/unix/SunOS/pandora_agent.conf +++ b/pandora_agents/unix/SunOS/pandora_agent.conf @@ -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 diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 32a98d3574..9f40e3b263 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -128,9 +128,9 @@ my @BrokerPid; my %DefaultConf = ( 'server_ip' => 'localhost', 'server_path' => '/var/spool/pandora/data_in', - 'server_path_md5' => 'md5', - 'server_path_conf' => 'conf', - 'server_path_zip' => 'collections', + '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, From bc077c8a7d04926a3ab20330084ed8b738b16c84 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Thu, 21 Sep 2017 12:22:55 +0200 Subject: [PATCH 39/55] Added disable agents in policy when js is crazy --- pandora_console/godmode/groups/group_list.php | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/pandora_console/godmode/groups/group_list.php b/pandora_console/godmode/groups/group_list.php index 023ed6e84c..6be8d61b40 100644 --- a/pandora_console/godmode/groups/group_list.php +++ b/pandora_console/godmode/groups/group_list.php @@ -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); } - $filter['disabled'] = $disabled; + if ($all_agents) { + $filter['all_agents'] = true; + } + else { + $filter['disabled'] = $disabled; + } if ($search != '') { $filter['string'] = $search; @@ -126,17 +133,42 @@ 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; } From 9337d33ceba8b001cd1b3499dd9c383f0f72a266 Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 21 Sep 2017 15:35:28 +0200 Subject: [PATCH 40/55] tip in graph interfaces --- .../include/functions_custom_graphs.php | 5 +- pandora_console/include/functions_graph.php | 1475 +++++++++-------- .../agentes/interface_traffic_graph_win.php | 11 +- 3 files changed, 779 insertions(+), 712 deletions(-) diff --git a/pandora_console/include/functions_custom_graphs.php b/pandora_console/include/functions_custom_graphs.php index 499a8a817f..adf077ec6a 100644 --- a/pandora_console/include/functions_custom_graphs.php +++ b/pandora_console/include/functions_custom_graphs.php @@ -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; diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 050816b17e..0bc6717986 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -1055,488 +1055,521 @@ 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; - $time_format_2 = ''; - $temp_range = $period; - - if ($projection != false) { - if ($period < $prediction_period) - $temp_range = $prediction_period; - } - - // Set the title and time format - if ($temp_range <= SECONDS_1DAY) { - $time_format = 'Y M d H:i:s'; - } - elseif ($temp_range < SECONDS_15DAYS) { - $time_format = 'Y M d'; - $time_format_2 = 'H:i'; if ($projection != false) { + if ($period < $prediction_period) + $temp_range = $prediction_period; + } + + // Set the title and time format + if ($temp_range <= SECONDS_1DAY) { + $time_format = 'Y M d H:i:s'; + } + elseif ($temp_range < SECONDS_15DAYS) { + $time_format = 'Y M d'; + $time_format_2 = 'H:i'; + if ($projection != false) { + $time_format_2 = 'H\h'; + } + } + elseif ($temp_range <= SECONDS_1MONTH) { + $time_format = 'Y M d'; $time_format_2 = 'H\h'; } - } - elseif ($temp_range <= SECONDS_1MONTH) { - $time_format = 'Y M d'; - $time_format_2 = 'H\h'; - } - elseif ($temp_range <= SECONDS_1MONTH) { - $time_format = 'Y M d'; - $time_format_2 = 'H\h'; - } - elseif ($period < SECONDS_6MONTHS) { - $time_format = 'Y M d'; - $time_format_2 = 'H\h'; - } - else { - $time_format = "Y M d"; - $time_format_2 = 'H\h'; - } - - // Set variables - if ($date == 0) - $date = get_system_time(); - $datelimit = $date - $period; - - $resolution = $config['graph_res'] * 50; //Number of points of the graph - $interval = (int) ($period / $resolution); - - // If projection graph, fill with zero previous data to projection interval - if ($projection != false) { - $j = $datelimit; - $in_range = true; - while ($in_range) { - $timestamp_f = graph_get_formatted_date($j, $time_format, $time_format_2); - - $before_projection[$timestamp_f] = 0; - - if ($j > $date) { - $in_range = false; - } - $j = $j + $interval; + elseif ($temp_range <= SECONDS_1MONTH) { + $time_format = 'Y M d'; + $time_format_2 = 'H\h'; } - } - - // Added support for projection graphs (normal_module + 1(prediction data)) - if ($projection !== false) { - $module_number = count ($module_list) + 1; - } - else { - $module_number = count ($module_list); - } - - $names_number = count($name_list); - $units_number = count($unit_list); - - // interval - This is the number of "rows" we are divided the time to fill data. - // more interval, more resolution, and slower. - // periodo - Gap of time, in seconds. This is now to (now-periodo) secs - - // Init weights - for ($i = 0; $i < $module_number; $i++) { - if (! isset ($weight_list[$i])) { - $weight_list[$i] = 1; - } - else if ($weight_list[$i] == 0) { - $weight_list[$i] = 1; - } - } - - // Set data containers - for ($i = 0; $i < $resolution; $i++) { - $timestamp = $datelimit + ($interval * $i);/* - $timestamp_short = date($time_format, $timestamp); - $long_index[$timestamp_short] = date( - html_entity_decode($config['date_format'], ENT_QUOTES, "UTF-8"), $timestamp); - $timestamp = $timestamp_short;*/ - - $graph[$timestamp]['count'] = 0; - $graph[$timestamp]['timestamp_bottom'] = $timestamp; - $graph[$timestamp]['timestamp_top'] = $timestamp + $interval; - $graph[$timestamp]['min'] = 0; - $graph[$timestamp]['max'] = 0; - $graph[$timestamp]['event'] = 0; - $graph[$timestamp]['alert'] = 0; - } - - $long_index = array(); - - $graph_values = array(); - $module_name_list = array(); - $collector = 0; - $user = users_get_user_by_id($config['id_user']); - $user_flash_charts = $user['flash_chart']; - - if ($user_flash_charts == 1) - $flash_charts = true; - elseif($user_flash_charts == -1) - $flash_charts = $config['flash_charts']; - elseif($user_flash_charts == 0) - $flash_charts = false; - - if ($only_image) { - $flash_charts = false; - } - - // Calculate data for each module - for ($i = 0; $i < $module_number; $i++) { - $automatic_custom_graph_meta = false; - if ($config['metaconsole']) { - // Automatic custom graph from the report template in metaconsole - if (is_array($module_list[$i])) { - $server = metaconsole_get_connection_by_id ($module_list[$i]['server']); - metaconsole_connect($server); - $automatic_custom_graph_meta = true; - } - } - - $search_in_history_db = db_search_in_history_db($datelimit); - - // If its a projection graph, - // first module will be data and second will be the projection - if ($projection != false && $i != 0) { - if ($automatic_custom_graph_meta) - $agent_module_id = $module_list[0]['module']; - else - $agent_module_id = $module_list[0]; - - $id_module_type = modules_get_agentmodule_type ($agent_module_id); - $module_type = modules_get_moduletype_name ($id_module_type); - $uncompressed_module = is_module_uncompressed ($module_type); + elseif ($period < SECONDS_6MONTHS) { + $time_format = 'Y M d'; + $time_format_2 = 'H\h'; } else { - if ($automatic_custom_graph_meta) - $agent_module_id = $module_list[$i]['module']; - else - $agent_module_id = $module_list[$i]; - - - $id_module_type = modules_get_agentmodule_type ($agent_module_id); - $module_type = modules_get_moduletype_name ($id_module_type); - $uncompressed_module = is_module_uncompressed ($module_type); + $time_format = "Y M d"; + $time_format_2 = 'H\h'; } - if ($uncompressed_module) { - $avg_only = 1; + // Set variables + if ($date == 0) + $date = get_system_time(); + $datelimit = $date - $period; + + $resolution = $config['graph_res'] * 50; //Number of points of the graph + $interval = (int) ($period / $resolution); + + // If projection graph, fill with zero previous data to projection interval + if ($projection != false) { + $j = $datelimit; + $in_range = true; + while ($in_range) { + $timestamp_f = graph_get_formatted_date($j, $time_format, $time_format_2); + + $before_projection[$timestamp_f] = 0; + + if ($j > $date) { + $in_range = false; + } + $j = $j + $interval; + } } - // Get event data (contains alert data too) - if ($show_events == 1 || $show_alerts == 1) { - $events = db_get_all_rows_filter ('tevento', - array ('id_agentmodule' => $agent_module_id, + // Added support for projection graphs (normal_module + 1(prediction data)) + if ($projection !== false) { + $module_number = count ($module_list) + 1; + } + else { + $module_number = count ($module_list); + } + + $names_number = count($name_list); + $units_number = count($unit_list); + + // interval - This is the number of "rows" we are divided the time to fill data. + // more interval, more resolution, and slower. + // periodo - Gap of time, in seconds. This is now to (now-periodo) secs + + // Init weights + for ($i = 0; $i < $module_number; $i++) { + if (! isset ($weight_list[$i])) { + $weight_list[$i] = 1; + } + else if ($weight_list[$i] == 0) { + $weight_list[$i] = 1; + } + } + + // Set data containers + for ($i = 0; $i < $resolution; $i++) { + $timestamp = $datelimit + ($interval * $i);/* + $timestamp_short = date($time_format, $timestamp); + $long_index[$timestamp_short] = date( + html_entity_decode($config['date_format'], ENT_QUOTES, "UTF-8"), $timestamp); + $timestamp = $timestamp_short;*/ + + $graph[$timestamp]['count'] = 0; + $graph[$timestamp]['timestamp_bottom'] = $timestamp; + $graph[$timestamp]['timestamp_top'] = $timestamp + $interval; + $graph[$timestamp]['min'] = 0; + $graph[$timestamp]['max'] = 0; + $graph[$timestamp]['event'] = 0; + $graph[$timestamp]['alert'] = 0; + } + $long_index = array(); + + $graph_values = array(); + $module_name_list = array(); + $collector = 0; + $user = users_get_user_by_id($config['id_user']); + $user_flash_charts = $user['flash_chart']; + + if ($user_flash_charts == 1) + $flash_charts = true; + elseif($user_flash_charts == -1) + $flash_charts = $config['flash_charts']; + elseif($user_flash_charts == 0) + $flash_charts = false; + + if ($only_image) { + $flash_charts = false; + } + + // Calculate data for each module + for ($i = 0; $i < $module_number; $i++) { + $automatic_custom_graph_meta = false; + if ($config['metaconsole']) { + // Automatic custom graph from the report template in metaconsole + if (is_array($module_list[$i])) { + $server = metaconsole_get_connection_by_id ($module_list[$i]['server']); + metaconsole_connect($server); + $automatic_custom_graph_meta = true; + } + } + + $search_in_history_db = db_search_in_history_db($datelimit); + + // If its a projection graph, + // first module will be data and second will be the projection + if ($projection != false && $i != 0) { + if ($automatic_custom_graph_meta) + $agent_module_id = $module_list[0]['module']; + else + $agent_module_id = $module_list[0]; + + $id_module_type = modules_get_agentmodule_type ($agent_module_id); + $module_type = modules_get_moduletype_name ($id_module_type); + $uncompressed_module = is_module_uncompressed ($module_type); + } + else { + if ($automatic_custom_graph_meta) + $agent_module_id = $module_list[$i]['module']; + else + $agent_module_id = $module_list[$i]; + + + $id_module_type = modules_get_agentmodule_type ($agent_module_id); + $module_type = modules_get_moduletype_name ($id_module_type); + $uncompressed_module = is_module_uncompressed ($module_type); + } + + if ($uncompressed_module) { + $avg_only = 1; + } + + // Get event data (contains alert data too) + if ($show_events == 1 || $show_alerts == 1) { + $events = db_get_all_rows_filter ('tevento', + array ('id_agentmodule' => $agent_module_id, + "utimestamp > $datelimit", + "utimestamp < $date", + 'order' => 'utimestamp ASC'), + array ('evento', 'utimestamp', 'event_type')); + if ($events === false) { + $events = array (); + } + } + + // Get module data + $data = db_get_all_rows_filter ('tagente_datos', + array ('id_agente_modulo' => $agent_module_id, "utimestamp > $datelimit", "utimestamp < $date", 'order' => 'utimestamp ASC'), - array ('evento', 'utimestamp', 'event_type')); - if ($events === false) { - $events = array (); - } - } - - // Get module data - $data = db_get_all_rows_filter ('tagente_datos', - array ('id_agente_modulo' => $agent_module_id, - "utimestamp > $datelimit", - "utimestamp < $date", - 'order' => 'utimestamp ASC'), - array ('datos', 'utimestamp'), 'AND', $search_in_history_db); - if ($data === false) { - $data = array (); - } - - // Uncompressed module data - if ($uncompressed_module) { - $min_necessary = 1; - - // Compressed module data - } - else { - // Get previous data - $previous_data = modules_get_previous_data ($agent_module_id, $datelimit); - if ($previous_data !== false) { - $previous_data['utimestamp'] = $datelimit; - array_unshift ($data, $previous_data); - } + array ('datos', 'utimestamp'), 'AND', $search_in_history_db); - // Get next data - $nextData = modules_get_next_data ($agent_module_id, $date); - if ($nextData !== false) { - array_push ($data, $nextData); - } - else if (count ($data) > 0) { - // Propagate the last known data to the end of the interval - $nextData = array_pop ($data); - array_push ($data, $nextData); - $nextData['utimestamp'] = $date; - array_push ($data, $nextData); + if ($data === false) { + $data = array (); } + + // Uncompressed module data + if ($uncompressed_module) { + $min_necessary = 1; - $min_necessary = 2; - } - - // Set initial conditions - $graph_values[$i] = array(); - - // Check available data - if (count ($data) < $min_necessary) { - continue; - } - - if (!empty($name_list) && $names_number == $module_number && isset($name_list[$i])) { - if ($labels[$agent_module_id] != '') - $module_name_list[$i] = $labels[$agent_module_id]; + // Compressed module data + } else { + // Get previous data + $previous_data = modules_get_previous_data ($agent_module_id, $datelimit); + if ($previous_data !== false) { + $previous_data['utimestamp'] = $datelimit; + array_unshift ($data, $previous_data); + } + + // Get next data + $nextData = modules_get_next_data ($agent_module_id, $date); + if ($nextData !== false) { + array_push ($data, $nextData); + } + else if (count ($data) > 0) { + // Propagate the last known data to the end of the interval + $nextData = array_pop ($data); + array_push ($data, $nextData); + $nextData['utimestamp'] = $date; + array_push ($data, $nextData); + } + + $min_necessary = 2; + } + + // Set initial conditions + $graph_values[$i] = array(); + + // Check available data + if (count ($data) < $min_necessary) { + continue; + } + + if (!empty($name_list) && $names_number == $module_number && isset($name_list[$i])) { + if ($labels[$agent_module_id] != '') + $module_name_list[$i] = $labels[$agent_module_id]; + else { + $agent_name = io_safe_output( + modules_get_agentmodule_agent_name ($agent_module_id)); + $alias = db_get_value ("alias","tagente","nombre",$agent_name); + $module_name = io_safe_output( + modules_get_agentmodule_name ($agent_module_id)); + + if ($flash_charts) + $module_name_list[$i] = '' . $alias . " / " . $module_name. ''; + else + $module_name_list[$i] = $alias . " / " . $module_name; + } + } + else { + //Get and process agent name $agent_name = io_safe_output( modules_get_agentmodule_agent_name ($agent_module_id)); $alias = db_get_value ("alias","tagente","nombre",$agent_name); + $agent_name = ui_print_truncate_text($agent_name, 'agent_small', false, true, false, '...', false); + + $agent_id = agents_get_agent_id ($agent_name); + + //Get and process module name $module_name = io_safe_output( modules_get_agentmodule_name ($agent_module_id)); + $module_name = sprintf(__("%s"), $module_name); + $module_name = ui_print_truncate_text($module_name, 'module_small', false, true, false, '...', false); - if ($flash_charts) - $module_name_list[$i] = '' . $alias . " / " . $module_name. ''; - else - $module_name_list[$i] = $alias . " / " . $module_name; - } - } - else { - //Get and process agent name - $agent_name = io_safe_output( - modules_get_agentmodule_agent_name ($agent_module_id)); - $alias = db_get_value ("alias","tagente","nombre",$agent_name); - $agent_name = ui_print_truncate_text($agent_name, 'agent_small', false, true, false, '...', false); - - $agent_id = agents_get_agent_id ($agent_name); - - //Get and process module name - $module_name = io_safe_output( - modules_get_agentmodule_name ($agent_module_id)); - $module_name = sprintf(__("%s"), $module_name); - $module_name = ui_print_truncate_text($module_name, 'module_small', false, true, false, '...', false); - - if ($flash_charts) { - if ($labels[$agent_module_id] != '') - $module_name_list[$i] = '' . - $labels[$agent_module_id] . ''; - else - $module_name_list[$i] = '' . - $alias . ' / ' . $module_name . ''; - } - else { - if ($labels[$agent_module_id] != '') - $module_name_list[$i] = $labels[$agent_module_id]; - else - $module_name_list[$i] = $alias . ' / ' . $module_name; - } - } - - // Data iterator - $j = 0; - - // Event iterator - $k = 0; - - // Set initial conditions - - //$graph_values[$i] = array(); - $temp_graph_values = array(); - - if ($data[0]['utimestamp'] == $datelimit) { - $previous_data = $data[0]['datos']; - $j++; - } - else { - $previous_data = 0; - } - - $max = 0; - $min = null; - $avg = 0; - $countAvg = 0; - - // Calculate chart data - $last_known = $previous_data; - - for ($l = 0; $l <= $resolution; $l++) { - $countAvg ++; - - $timestamp = $datelimit + ($interval * $l); - $timestamp_short = graph_get_formatted_date($timestamp, $time_format, $time_format_2); - - $long_index[$timestamp_short] = date( - html_entity_decode($config['date_format'], ENT_QUOTES, "UTF-8"), $timestamp); - //$timestamp = $timestamp_short; - - $total = 0; - $count = 0; - - // Read data that falls in the current interval - $interval_min = $last_known; - $interval_max = $last_known; - - while (isset ($data[$j]) && $data[$j]['utimestamp'] >= $timestamp && $data[$j]['utimestamp'] < ($timestamp + $interval)) { - if ($data[$j]['datos'] > $interval_max) { - $interval_max = $data[$j]['datos']; - } - else if ($data[$j]['datos'] < $interval_max) { - $interval_min = $data[$j]['datos']; - } - $total += $data[$j]['datos']; - $last_known = $data[$j]['datos']; - $count++; - $j++; - } - - // Average - if ($count > 0) { - $total /= $count; - } - - // Read events and alerts that fall in the current interval - $event_value = 0; - $alert_value = 0; - while (isset ($events[$k]) && $events[$k]['utimestamp'] >= $timestamp && $events[$k]['utimestamp'] <= ($timestamp + $interval)) { - if ($show_events == 1) { - $event_value++; - } - if ($show_alerts == 1 && substr ($events[$k]['event_type'], 0, 5) == 'alert') { - $alert_value++; - } - $k++; - } - - // Data - if ($count > 0) { - //$graph_values[$i][$timestamp] = $total * $weight_list[$i]; - $temp_graph_values[$timestamp_short] = $total * $weight_list[$i]; - } - else { - // Compressed data - if ($uncompressed_module || ($timestamp > time ())) { - $temp_graph_values[$timestamp_short] = 0; + if ($flash_charts) { + if ($labels[$agent_module_id] != '') + $module_name_list[$i] = '' . + $labels[$agent_module_id] . ''; + else + $module_name_list[$i] = '' . + $alias . ' / ' . $module_name . ''; } else { - $temp_graph_values[$timestamp_short] = $last_known * $weight_list[$i]; + if ($labels[$agent_module_id] != '') + $module_name_list[$i] = $labels[$agent_module_id]; + else + $module_name_list[$i] = $alias . ' / ' . $module_name; } } - //Extract max, min, avg - if ($max < $temp_graph_values[$timestamp_short]) { - $max = $temp_graph_values[$timestamp_short]; + // Data iterator + $j = 0; + + // Event iterator + $k = 0; + + // Set initial conditions + + //$graph_values[$i] = array(); + $temp_graph_values = array(); + + if ($data[0]['utimestamp'] == $datelimit) { + $previous_data = $data[0]['datos']; + $j++; + } + else { + $previous_data = 0; } - if (isset($min)) { - if ($min > $temp_graph_values[$timestamp_short]) { + $max = 0; + $min = null; + $avg = 0; + $countAvg = 0; + + // Calculate chart data + $last_known = $previous_data; + for ($l = 0; $l <= $resolution; $l++) { + $countAvg ++; + + $timestamp = $datelimit + ($interval * $l); + $timestamp_short = graph_get_formatted_date($timestamp, $time_format, $time_format_2); + + $long_index[$timestamp_short] = date( + html_entity_decode($config['date_format'], ENT_QUOTES, "UTF-8"), $timestamp); + //$timestamp = $timestamp_short; + + $total = 0; + $count = 0; + + // Read data that falls in the current interval + $interval_min = $last_known; + $interval_max = $last_known; + + while (isset ($data[$j]) && $data[$j]['utimestamp'] >= $timestamp && $data[$j]['utimestamp'] < ($timestamp + $interval)) { + if ($data[$j]['datos'] > $interval_max) { + $interval_max = $data[$j]['datos']; + } + else if ($data[$j]['datos'] < $interval_max) { + $interval_min = $data[$j]['datos']; + } + $total += $data[$j]['datos']; + $last_known = $data[$j]['datos']; + $count++; + $j++; + } + + // Average + if ($count > 0) { + $total /= $count; + } + + // Read events and alerts that fall in the current interval + $event_value = 0; + $alert_value = 0; + while (isset ($events[$k]) && $events[$k]['utimestamp'] >= $timestamp && $events[$k]['utimestamp'] <= ($timestamp + $interval)) { + if ($show_events == 1) { + $event_value++; + } + if ($show_alerts == 1 && substr ($events[$k]['event_type'], 0, 5) == 'alert') { + $alert_value++; + } + $k++; + } + + // Data + if ($count > 0) { + //$graph_values[$i][$timestamp] = $total * $weight_list[$i]; + $temp_graph_values[$timestamp_short] = $total * $weight_list[$i]; + } + else { + // Compressed data + if ($uncompressed_module || ($timestamp > time ())) { + $temp_graph_values[$timestamp_short] = 0; + } + else { + $temp_graph_values[$timestamp_short] = $last_known * $weight_list[$i]; + } + } + + //Extract max, min, avg + if ($max < $temp_graph_values[$timestamp_short]) { + $max = $temp_graph_values[$timestamp_short]; + } + + if (isset($min)) { + if ($min > $temp_graph_values[$timestamp_short]) { + $min = $temp_graph_values[$timestamp_short]; + } + } + else { $min = $temp_graph_values[$timestamp_short]; } + $avg += $temp_graph_values[$timestamp_short]; + + // Added to support projection graphs + if ($projection != false and $i != 0) { + $projection_data = array(); + $projection_data = array_merge($before_projection, $projection); + $graph_values[$i] = $projection_data; + } + else { + $graph_values[$i] = $temp_graph_values; + } + } + + //Add the max, min and avg in the legend + $avg = round($avg / $countAvg, 1); + + $graph_stats = get_graph_statistics($graph_values[$i]); + + if (!isset($config["short_module_graph_data"])) + $config["short_module_graph_data"] = true; + + if ($config["short_module_graph_data"]) { + $min = $graph_stats['min']; + $max = $graph_stats['max']; + $avg = $graph_stats['avg']; + $last = $graph_stats['last']; + + if ($min > 1000000) + $min = sprintf("%sM", remove_right_zeros(number_format($min / 1000000, remove_right_zeros))); + else if ($min > 1000) + $min = sprintf("%sK", remove_right_zeros(number_format($min / 1000, $config['graph_precision']))); + + if ($max > 1000000) + $max = sprintf("%sM", remove_right_zeros(number_format($max / 1000000, $config['graph_precision']))); + else if ($max > 1000) + $max = sprintf("%sK", remove_right_zeros(number_format($max / 1000, $config['graph_precision']))); + + if ($avg > 1000000) + $avg = sprintf("%sM", remove_right_zeros(number_format($avg / 1000000, $config['graph_precision']))); + else if ($avg > 1000) + $avg = sprintf("%sK", remove_right_zeros(number_format($avg / 1000, $config['graph_precision']))); + + if ($last > 1000000) + $last = sprintf("%sM", remove_right_zeros(number_format($last / 1000000, $config['graph_precision']))); + else if ($last > 1000) + $last = sprintf("%sK", remove_right_zeros(number_format($last / 1000, $config['graph_precision']))); } else { - $min = $temp_graph_values[$timestamp_short]; + $min = remove_right_zeros(number_format($graph_stats['min'], $config['graph_precision'])); + $max = remove_right_zeros(number_format($graph_stats['max'], $config['graph_precision'])); + $avg = remove_right_zeros(number_format($graph_stats['avg'], $config['graph_precision'])); + $last = remove_right_zeros(number_format($graph_stats['last'], $config['graph_precision'])); } - $avg += $temp_graph_values[$timestamp_short]; - // Added to support projection graphs - if ($projection != false and $i != 0) { - $projection_data = array(); - $projection_data = array_merge($before_projection, $projection); - $graph_values[$i] = $projection_data; + + if (!empty($unit_list) && $units_number == $module_number && isset($unit_list[$i])) { + $unit = $unit_list[$i]; } - else { - $graph_values[$i] = $temp_graph_values; + + if ($projection == false or ($projection != false and $i == 0)) { + $module_name_list[$i] .= ": "; + if ($show_max) + $module_name_list[$i] .= __("Max") . ": $max $unit; "; + if ($show_min) + $module_name_list[$i] .= __("Min") . ": $min $unit; "; + if ($show_avg) + $module_name_list[$i] .= __("Avg") . ": $avg $unit"; + } + + if ($weight_list[$i] != 1) { + //$module_name_list[$i] .= " (x". format_numeric ($weight_list[$i], 1).")"; + $module_name_list[$i] .= " (x". format_numeric ($weight_list[$i], 1).")"; + } + + //$graph_values[$module_name_list[$i]] = $graph_values[$i]; + //unset($graph_values[$i]); + + //$graph_values[$i] = $graph_values[$i]; + + if ($config['metaconsole']) { + // Automatic custom graph from the report template in metaconsole + if (is_array($module_list[0])) { + metaconsole_restore_db(); + } } } - //Add the max, min and avg in the legend - $avg = round($avg / $countAvg, 1); + $temp = array(); - $graph_stats = get_graph_statistics($graph_values[$i]); + if ($flash_charts === false && $stacked == CUSTOM_GRAPH_GAUGE) + $stacked = CUSTOM_GRAPH_BULLET_CHART; - if (!isset($config["short_module_graph_data"])) - $config["short_module_graph_data"] = true; - - if ($config["short_module_graph_data"]) { - $min = $graph_stats['min']; - $max = $graph_stats['max']; - $avg = $graph_stats['avg']; - $last = $graph_stats['last']; - - if ($min > 1000000) - $min = sprintf("%sM", remove_right_zeros(number_format($min / 1000000, remove_right_zeros))); - else if ($min > 1000) - $min = sprintf("%sK", remove_right_zeros(number_format($min / 1000, $config['graph_precision']))); - - if ($max > 1000000) - $max = sprintf("%sM", remove_right_zeros(number_format($max / 1000000, $config['graph_precision']))); - else if ($max > 1000) - $max = sprintf("%sK", remove_right_zeros(number_format($max / 1000, $config['graph_precision']))); - - if ($avg > 1000000) - $avg = sprintf("%sM", remove_right_zeros(number_format($avg / 1000000, $config['graph_precision']))); - else if ($avg > 1000) - $avg = sprintf("%sK", remove_right_zeros(number_format($avg / 1000, $config['graph_precision']))); - - if ($last > 1000000) - $last = sprintf("%sM", remove_right_zeros(number_format($last / 1000000, $config['graph_precision']))); - else if ($last > 1000) - $last = sprintf("%sK", remove_right_zeros(number_format($last / 1000, $config['graph_precision']))); - } - else { - $min = remove_right_zeros(number_format($graph_stats['min'], $config['graph_precision'])); - $max = remove_right_zeros(number_format($graph_stats['max'], $config['graph_precision'])); - $avg = remove_right_zeros(number_format($graph_stats['avg'], $config['graph_precision'])); - $last = remove_right_zeros(number_format($graph_stats['last'], $config['graph_precision'])); - } - - - if (!empty($unit_list) && $units_number == $module_number && isset($unit_list[$i])) { - $unit = $unit_list[$i]; - } - - if ($projection == false or ($projection != false and $i == 0)) { - $module_name_list[$i] .= ": "; - if ($show_max) - $module_name_list[$i] .= __("Max") . ": $max $unit; "; - if ($show_min) - $module_name_list[$i] .= __("Min") . ": $min $unit; "; - if ($show_avg) - $module_name_list[$i] .= __("Avg") . ": $avg $unit"; - } - - if ($weight_list[$i] != 1) { - //$module_name_list[$i] .= " (x". format_numeric ($weight_list[$i], 1).")"; - $module_name_list[$i] .= " (x". format_numeric ($weight_list[$i], 1).")"; - } - - //$graph_values[$module_name_list[$i]] = $graph_values[$i]; - //unset($graph_values[$i]); - - //$graph_values[$i] = $graph_values[$i]; - - if ($config['metaconsole']) { - // Automatic custom graph from the report template in metaconsole - if (is_array($module_list[0])) { - metaconsole_restore_db(); - } - } - } - - $temp = array(); - - if ($flash_charts === false && $stacked == CUSTOM_GRAPH_GAUGE) - $stacked = CUSTOM_GRAPH_BULLET_CHART; - - switch ($stacked) { - case CUSTOM_GRAPH_BULLET_CHART_THRESHOLD: - case CUSTOM_GRAPH_BULLET_CHART: - $datelimit = $date - $period; - if($stacked == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){ - $acumulador = 0; + switch ($stacked) { + case CUSTOM_GRAPH_BULLET_CHART_THRESHOLD: + case CUSTOM_GRAPH_BULLET_CHART: + $datelimit = $date - $period; + if($stacked == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){ + $acumulador = 0; + foreach ($module_list as $module_item) { + $module = $module_item; + $query_last_value = sprintf(' + SELECT datos + FROM tagente_datos + WHERE id_agente_modulo = %d + AND utimestamp < %d + ORDER BY utimestamp DESC', + $module, $date); + $temp_data = db_get_value_sql($query_last_value); + if ($acumulador < $temp_data){ + $acumulador = $temp_data; + } + } + } foreach ($module_list as $module_item) { - $module = $module_item; + $automatic_custom_graph_meta = false; + if ($config['metaconsole']) { + // Automatic custom graph from the report template in metaconsole + if (is_array($module_list[$i])) { + $server = metaconsole_get_connection_by_id ($module_item['server']); + metaconsole_connect($server); + $automatic_custom_graph_meta = true; + } + } + + if ($automatic_custom_graph_meta) + $module = $module_item['module']; + else + $module = $module_item; + + $search_in_history_db = db_search_in_history_db($datelimit); + + $temp[$module] = modules_get_agentmodule($module); $query_last_value = sprintf(' SELECT datos FROM tagente_datos @@ -1545,291 +1578,281 @@ function graphic_combined_module ($module_list, $weight_list, $period, ORDER BY utimestamp DESC', $module, $date); $temp_data = db_get_value_sql($query_last_value); - if ($acumulador < $temp_data){ - $acumulador = $temp_data; + + if ($temp_data) { + if (is_numeric($temp_data)) + $value = $temp_data; + else + $value = count($value); } - } - } - foreach ($module_list as $module_item) { - $automatic_custom_graph_meta = false; - if ($config['metaconsole']) { - // Automatic custom graph from the report template in metaconsole - if (is_array($module_list[$i])) { - $server = metaconsole_get_connection_by_id ($module_item['server']); - metaconsole_connect($server); - $automatic_custom_graph_meta = true; + else { + if ($flash_charts === false) + $value = 0; + else + $value = false; } - } - - if ($automatic_custom_graph_meta) - $module = $module_item['module']; - else - $module = $module_item; - - $search_in_history_db = db_search_in_history_db($datelimit); - - $temp[$module] = modules_get_agentmodule($module); - $query_last_value = sprintf(' - SELECT datos - FROM tagente_datos - WHERE id_agente_modulo = %d - AND utimestamp < %d - ORDER BY utimestamp DESC', - $module, $date); - $temp_data = db_get_value_sql($query_last_value); - - if ($temp_data) { - if (is_numeric($temp_data)) - $value = $temp_data; - else - $value = count($value); - } - else { - if ($flash_charts === false) - $value = 0; - else - $value = false; - } - - if ( !empty($labels) && isset($labels[$module]) ){ - $label = io_safe_input($labels[$module]); - }else{ - $alias = db_get_value ("alias","tagente","id_agente",$temp[$module]['id_agente']); - $label = $alias . ': ' . $temp[$module]['nombre']; - } - - $temp[$module]['label'] = $label; - $temp[$module]['value'] = $value; - $temp_max = reporting_get_agentmodule_data_max($module,$period,$date); - if ($temp_max < 0) - $temp_max = 0; - if (isset($acumulador)){ - $temp[$module]['max'] = $acumulador; - }else{ - $temp[$module]['max'] = ($temp_max === false) ? 0 : $temp_max; - } + if ( !empty($labels) && isset($labels[$module]) ){ + $label = io_safe_input($labels[$module]); + }else{ + $alias = db_get_value ("alias","tagente","id_agente",$temp[$module]['id_agente']); + $label = $alias . ': ' . $temp[$module]['nombre']; + } + + + $temp[$module]['label'] = $label; + $temp[$module]['value'] = $value; + $temp_max = reporting_get_agentmodule_data_max($module,$period,$date); + if ($temp_max < 0) + $temp_max = 0; + if (isset($acumulador)){ + $temp[$module]['max'] = $acumulador; + }else{ + $temp[$module]['max'] = ($temp_max === false) ? 0 : $temp_max; + } - $temp_min = reporting_get_agentmodule_data_min($module,$period,$date); - if ($temp_min < 0) - $temp_min = 0; - $temp[$module]['min'] = ($temp_min === false) ? 0 : $temp_min; - - if ($config['metaconsole']) { - // Automatic custom graph from the report template in metaconsole - if (is_array($module_list[0])) { - metaconsole_restore_db(); - } - } - - } - - break; - case CUSTOM_GRAPH_HBARS: - case CUSTOM_GRAPH_VBARS: - $datelimit = $date - $period; - - $label = ''; - foreach ($module_list as $module_item) { - $automatic_custom_graph_meta = false; - if ($config['metaconsole']) { - // Automatic custom graph from the report template in metaconsole - if (is_array($module_list[$i])) { - $server = metaconsole_get_connection_by_id ($module_item['server']); - metaconsole_connect($server); - $automatic_custom_graph_meta = true; - } - } - - if ($automatic_custom_graph_meta) - $module = $module_item['module']; - else - $module = $module_item; - - - $module_data = modules_get_agentmodule($module); - $query_last_value = sprintf(' - SELECT datos - FROM tagente_datos - WHERE id_agente_modulo = %d - AND utimestamp < %d - ORDER BY utimestamp DESC', - $module, $date); - $temp_data = db_get_value_sql($query_last_value); - - $agent_name = io_safe_output( - modules_get_agentmodule_agent_name ($module)); - - if (!empty($labels) && isset($labels[$module]) ){ - $label = $labels[$module]; - }else { - $alias = db_get_value ("alias","tagente","id_agente",$module_data['id_agente']); - $label = $alias . " - " .$module_data['nombre']; - } + $temp_min = reporting_get_agentmodule_data_min($module,$period,$date); + if ($temp_min < 0) + $temp_min = 0; + $temp[$module]['min'] = ($temp_min === false) ? 0 : $temp_min; - $temp[$label]['g'] = round($temp_data,4); - - - if ($config['metaconsole']) { - // Automatic custom graph from the report template in metaconsole - if (is_array($module_list[0])) { - metaconsole_restore_db(); - } - } - - } - break; - case CUSTOM_GRAPH_PIE: - $datelimit = $date - $period; - $total_modules = 0; - foreach ($module_list as $module_item) { - $automatic_custom_graph_meta = false; - if ($config['metaconsole']) { - // Automatic custom graph from the report template in metaconsole - if (is_array($module_list[$i])) { - $server = metaconsole_get_connection_by_id ($module_item['server']); - metaconsole_connect($server); - $automatic_custom_graph_meta = true; - } - } - - if ($automatic_custom_graph_meta) - $module = $module_item['module']; - else - $module = $module_item; - - $data_module = modules_get_agentmodule($module); - $query_last_value = sprintf(' - SELECT datos - FROM tagente_datos - WHERE id_agente_modulo = %d - AND utimestamp > %d - AND utimestamp < %d - ORDER BY utimestamp DESC', - $module, $datelimit, $date); - $temp_data = db_get_value_sql($query_last_value); - - if ( $temp_data ){ - if (is_numeric($temp_data)) - $value = $temp_data; - else - $value = count($value); - } - else { - $value = false; - } - $total_modules += $value; - - if ( !empty($labels) && isset($labels[$module]) ){ - $label = io_safe_output($labels[$module]); - }else { - $alias = db_get_value ("alias","tagente","id_agente",$data_module['id_agente']); - $label = io_safe_output($alias . ": " . $data_module['nombre']); - } - - $temp[$label] = array('value'=>$value, - 'unit'=>$data_module['unit']); - if ($config['metaconsole']) { - // Automatic custom graph from the report template in metaconsole - if (is_array($module_list[0])) { - metaconsole_restore_db(); - } - } - } - $temp['total_modules'] = $total_modules; - - break; - case CUSTOM_GRAPH_GAUGE: - $datelimit = $date - $period; - $i = 0; - foreach ($module_list as $module_item) { - $automatic_custom_graph_meta = false; - if ($config['metaconsole']) { - // Automatic custom graph from the report template in metaconsole - if (is_array($module_list[$i])) { - $server = metaconsole_get_connection_by_id ($module_item['server']); - metaconsole_connect($server); - $automatic_custom_graph_meta = true; - } - } - - if ($automatic_custom_graph_meta) - $module = $module_item['module']; - else - $module = $module_item; - - $temp[$module] = modules_get_agentmodule($module); - $query_last_value = sprintf(' - SELECT datos - FROM tagente_datos - WHERE id_agente_modulo = %d - AND utimestamp < %d - ORDER BY utimestamp DESC', - $module, $date); - $temp_data = db_get_value_sql($query_last_value); - if ( $temp_data ) { - if (is_numeric($temp_data)) - $value = $temp_data; - else - $value = count($value); - } - else { - $value = false; - } - $temp[$module]['label'] = ($labels[$module] != '') ? $labels[$module] : $temp[$module]['nombre']; - - $temp[$module]['value'] = $value; - $temp[$module]['label'] = ui_print_truncate_text($temp[$module]['label'],"module_small",false,true,false,".."); - - if ($temp[$module]['unit'] == '%') { - $temp[$module]['min'] = 0; - $temp[$module]['max'] = 100; - } - else { - $min = $temp[$module]['min']; - if ($temp[$module]['max'] == 0) - $max = reporting_get_agentmodule_data_max($module,$period,$date); - else - $max = $temp[$module]['max']; - $temp[$module]['min'] = ($min == 0 ) ? 0 : $min; - $temp[$module]['max'] = ($max == 0 ) ? 100 : $max; - } - $temp[$module]['gauge'] = uniqid('gauge_'); - - if ($config['metaconsole']) { - // Automatic custom graph from the report template in metaconsole - if (is_array($module_list[0])) { - metaconsole_restore_db(); - } - } - $i++; - } - break; - default: - if (!is_null($percentil) && $percentil) { - foreach ($graph_values as $graph_group => $point) { - foreach ($point as $timestamp_point => $point_value) { - $temp[$timestamp_point][$graph_group] = $point_value; + if ($config['metaconsole']) { + // Automatic custom graph from the report template in metaconsole + if (is_array($module_list[0])) { + metaconsole_restore_db(); + } } - $percentile_value = get_percentile($config['percentil'], $point); - $percentil_result[$graph_group] = array_fill ( 0, count($point), $percentile_value); - $series_type[$graph_group] = 'line'; + } + + break; + case CUSTOM_GRAPH_HBARS: + case CUSTOM_GRAPH_VBARS: + $datelimit = $date - $period; + + $label = ''; + foreach ($module_list as $module_item) { + $automatic_custom_graph_meta = false; + if ($config['metaconsole']) { + // Automatic custom graph from the report template in metaconsole + if (is_array($module_list[$i])) { + $server = metaconsole_get_connection_by_id ($module_item['server']); + metaconsole_connect($server); + $automatic_custom_graph_meta = true; + } + } + + if ($automatic_custom_graph_meta) + $module = $module_item['module']; + else + $module = $module_item; + + + $module_data = modules_get_agentmodule($module); + $query_last_value = sprintf(' + SELECT datos + FROM tagente_datos + WHERE id_agente_modulo = %d + AND utimestamp < %d + ORDER BY utimestamp DESC', + $module, $date); + $temp_data = db_get_value_sql($query_last_value); + $agent_name = io_safe_output( - modules_get_agentmodule_agent_alias ($module_list[$graph_group])); - $module_name = io_safe_output( - modules_get_agentmodule_name ($module_list[$graph_group])); - $module_name_list['percentil'.$graph_group] = __('Percentile %dº', $config['percentil']) . __(' of module ') . $agent_name .' / ' . $module_name . ' (' . $percentile_value . ' ' . $unit . ') '; + modules_get_agentmodule_agent_name ($module)); + + if (!empty($labels) && isset($labels[$module]) ){ + $label = $labels[$module]; + }else { + $alias = db_get_value ("alias","tagente","id_agente",$module_data['id_agente']); + $label = $alias . " - " .$module_data['nombre']; + } + + $temp[$label]['g'] = round($temp_data,4); + + + if ($config['metaconsole']) { + // Automatic custom graph from the report template in metaconsole + if (is_array($module_list[0])) { + metaconsole_restore_db(); + } + } + } - } - else { - foreach ($graph_values as $graph_group => $point) { - foreach ($point as $timestamp_point => $point_value) { - $temp[$timestamp_point][$graph_group] = $point_value; + break; + case CUSTOM_GRAPH_PIE: + $datelimit = $date - $period; + $total_modules = 0; + foreach ($module_list as $module_item) { + $automatic_custom_graph_meta = false; + if ($config['metaconsole']) { + // Automatic custom graph from the report template in metaconsole + if (is_array($module_list[$i])) { + $server = metaconsole_get_connection_by_id ($module_item['server']); + metaconsole_connect($server); + $automatic_custom_graph_meta = true; + } + } + + if ($automatic_custom_graph_meta) + $module = $module_item['module']; + else + $module = $module_item; + + $data_module = modules_get_agentmodule($module); + $query_last_value = sprintf(' + SELECT datos + FROM tagente_datos + WHERE id_agente_modulo = %d + AND utimestamp > %d + AND utimestamp < %d + ORDER BY utimestamp DESC', + $module, $datelimit, $date); + $temp_data = db_get_value_sql($query_last_value); + + if ( $temp_data ){ + if (is_numeric($temp_data)) + $value = $temp_data; + else + $value = count($value); + } + else { + $value = false; + } + $total_modules += $value; + + if ( !empty($labels) && isset($labels[$module]) ){ + $label = io_safe_output($labels[$module]); + }else { + $alias = db_get_value ("alias","tagente","id_agente",$data_module['id_agente']); + $label = io_safe_output($alias . ": " . $data_module['nombre']); + } + + $temp[$label] = array('value'=>$value, + 'unit'=>$data_module['unit']); + if ($config['metaconsole']) { + // Automatic custom graph from the report template in metaconsole + if (is_array($module_list[0])) { + metaconsole_restore_db(); + } } } + $temp['total_modules'] = $total_modules; + + break; + case CUSTOM_GRAPH_GAUGE: + $datelimit = $date - $period; + $i = 0; + foreach ($module_list as $module_item) { + $automatic_custom_graph_meta = false; + if ($config['metaconsole']) { + // Automatic custom graph from the report template in metaconsole + if (is_array($module_list[$i])) { + $server = metaconsole_get_connection_by_id ($module_item['server']); + metaconsole_connect($server); + $automatic_custom_graph_meta = true; + } + } + + if ($automatic_custom_graph_meta) + $module = $module_item['module']; + else + $module = $module_item; + + $temp[$module] = modules_get_agentmodule($module); + $query_last_value = sprintf(' + SELECT datos + FROM tagente_datos + WHERE id_agente_modulo = %d + AND utimestamp < %d + ORDER BY utimestamp DESC', + $module, $date); + $temp_data = db_get_value_sql($query_last_value); + if ( $temp_data ) { + if (is_numeric($temp_data)) + $value = $temp_data; + else + $value = count($value); + } + else { + $value = false; + } + $temp[$module]['label'] = ($labels[$module] != '') ? $labels[$module] : $temp[$module]['nombre']; + + $temp[$module]['value'] = $value; + $temp[$module]['label'] = ui_print_truncate_text($temp[$module]['label'],"module_small",false,true,false,".."); + + if ($temp[$module]['unit'] == '%') { + $temp[$module]['min'] = 0; + $temp[$module]['max'] = 100; + } + else { + $min = $temp[$module]['min']; + if ($temp[$module]['max'] == 0) + $max = reporting_get_agentmodule_data_max($module,$period,$date); + else + $max = $temp[$module]['max']; + $temp[$module]['min'] = ($min == 0 ) ? 0 : $min; + $temp[$module]['max'] = ($max == 0 ) ? 100 : $max; + } + $temp[$module]['gauge'] = uniqid('gauge_'); + + if ($config['metaconsole']) { + // Automatic custom graph from the report template in metaconsole + if (is_array($module_list[0])) { + metaconsole_restore_db(); + } + } + $i++; + } + break; + default: + if (!is_null($percentil) && $percentil) { + foreach ($graph_values as $graph_group => $point) { + foreach ($point as $timestamp_point => $point_value) { + $temp[$timestamp_point][$graph_group] = $point_value; + } + + $percentile_value = get_percentile($config['percentil'], $point); + $percentil_result[$graph_group] = array_fill ( 0, count($point), $percentile_value); + $series_type[$graph_group] = 'line'; + $agent_name = io_safe_output( + modules_get_agentmodule_agent_alias ($module_list[$graph_group])); + $module_name = io_safe_output( + modules_get_agentmodule_name ($module_list[$graph_group])); + $module_name_list['percentil'.$graph_group] = __('Percentile %dº', $config['percentil']) . __(' of module ') . $agent_name .' / ' . $module_name . ' (' . $percentile_value . ' ' . $unit . ') '; + } + } + else { + foreach ($graph_values as $graph_group => $point) { + foreach ($point as $timestamp_point => $point_value) { + $temp[$timestamp_point][$graph_group] = $point_value; + } + } + } + break; + } + } + else{ + $temp = fullscale_data_combined($module_list, $period, $date); + + $resolution = count($temp); //Number of points of the graph + $interval = (int) ($period / $resolution); + $module_name_list = array(); + $flash_charts = true; + + 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] = '' . $alias . " / " . $module_name. ''; } - break; + else{ + $module_name_list[$key] = $alias . " / " . $module_name; + } + } } $graph_values = $temp; @@ -2081,6 +2104,41 @@ function graphic_combined_module ($module_list, $weight_list, $period, } } +function fullscale_data_combined($module_list, $period, $date){ + + // 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) { + $real_date = date("Y M d H:i:s", $v['utimestamp']); + $data_all[$real_date][$key_module] = $v['datos']; + } + } + } + + $data_prev = array(); + + 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 * @@ -4331,7 +4389,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, diff --git a/pandora_console/operation/agentes/interface_traffic_graph_win.php b/pandora_console/operation/agentes/interface_traffic_graph_win.php index 8d676b4340..1a0a1343f9 100644 --- a/pandora_console/operation/agentes/interface_traffic_graph_win.php +++ b/pandora_console/operation/agentes/interface_traffic_graph_win.php @@ -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 '
'; @@ -258,6 +261,12 @@ $interface_traffic_modules = array( $data[1] = html_print_checkbox ("show_percentil", 1, (bool) $show_percentil, true); $table->data[] = $data; $table->rowclass[] =''; + + $data = array(); + $data[0] = __('Full scale'); + $data[1] = html_print_checkbox ("fullscale", 1, (bool) $fullscale, true); + $table->data[] = $data; + $table->rowclass[] =''; $data = array(); $data[0] = __('Zoom factor'); From d86d62234078e6aac718f5f81ca9540315832770 Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 21 Sep 2017 15:53:45 +0200 Subject: [PATCH 41/55] fixed error bad merge ldap --- pandora_console/include/auth/mysql.php | 30 ++++++++++++++++++-------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/pandora_console/include/auth/mysql.php b/pandora_console/include/auth/mysql.php index a7e710dcb2..97fb142a8d 100644 --- a/pandora_console/include/auth/mysql.php +++ b/pandora_console/include/auth/mysql.php @@ -645,15 +645,27 @@ function ldap_process_user_login ($login, $password) { } } - $ldap_login_attr = isset($config["ldap_login_attr"]) ? io_safe_output($config["ldap_login_attr"]) . "=" : ''; - $ldap_base_dn = isset($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : ''; - - if (strlen($password) == 0 || - !@ldap_bind($ds, io_safe_output($login), $password) ) { - $config["auth_error"] = 'User not found in database or incorrect password'; - @ldap_close ($ds); - - return false; + $ldap_login_attr = !empty($config["ldap_login_attr"]) ? io_safe_output($config["ldap_login_attr"]) . "=" : ''; + + $ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : ''; + + if(!empty($ldap_base_dn)){ + if (strlen($password) == 0 || + !@ldap_bind($ds, $ldap_login_attr.io_safe_output($login).$ldap_base_dn, $password) ) { + $config["auth_error"] = 'User not found in database or incorrect password'; + @ldap_close ($ds); + + return false; + + } + } else { + if (strlen($password) == 0 || + !@ldap_bind($ds, io_safe_output($login), $password) ) { + $config["auth_error"] = 'User not found in database or incorrect password'; + @ldap_close ($ds); + + return false; + } } @ldap_close ($ds); From 3613d1c1fc82d4aff5ac10528079a61bfc8f5ab1 Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 21 Sep 2017 18:37:57 +0200 Subject: [PATCH 42/55] fixed minor errors tips --- pandora_console/include/functions_graph.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 0bc6717986..11450fbbf5 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -2125,6 +2125,7 @@ function fullscale_data_combined($module_list, $period, $date){ $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])){ @@ -4287,7 +4288,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']; From c50c7b70daaad47100e11d59229008652bfff6a1 Mon Sep 17 00:00:00 2001 From: artica Date: Fri, 22 Sep 2017 00:01:16 +0200 Subject: [PATCH 43/55] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index be2d8f1e9c..156bf03a54 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.712-170921 +Version: 7.0NG.712-170922 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 15318f6506..a8e279594a 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -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-170922" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 8564cba04e..84618aa09f 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -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 => '170922'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index aa1c2448ce..82523886d9 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.712 -%define release 170921 +%define release 170922 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index f3a7255999..d5ddf392ef 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.712 -%define release 170921 +%define release 170922 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 71523b5060..9294bc0827 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.712" -PI_BUILD="170921" +PI_BUILD="170922" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 8978afc781..912571443b 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{170921} +{170922} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 429da76deb..672e030417 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -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 170922)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 25eafde1e9..7642530b6e 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -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 170922))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index cfcbbfa475..a937b5e1fc 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.712-170921 +Version: 7.0NG.712-170922 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 208098ba56..00aa8ee291 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -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-170922" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 3abbb6f9a1..d5318e01e7 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC170921'; +$build_version = 'PC170922'; $pandora_version = 'v7.0NG.712'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index c2ee3f7e41..127c06ce8d 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
Date: Fri, 22 Sep 2017 10:18:18 +0200 Subject: [PATCH 44/55] Added minor changes to duplicate and export functions --- pandora_server/util/pandora_manage.pl | 120 +++++++++++++++----------- 1 file changed, 68 insertions(+), 52 deletions(-) diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 1ba5ad6b07..761b3d4cd4 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -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,55 +5400,57 @@ sub cli_duplicate_visual_console () { $name_count = 1; } - my $exist = 1; - while ($exist == 1) { - my $name_in_db = get_db_single_row ($dbh, "SELECT name FROM tlayout WHERE name = '$new_name'"); + 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'"); + + if (defined($name_in_db->{'name'}) && ($name_in_db->{'name'} eq $new_name)) { + $new_name = $name_to_compare . "_" . $name_count; + $name_count++; + } + else { + $exist = 0; + } + } + + my $new_console_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout (name, id_group, background, width, height, background_color) + VALUES (?, ?, ?, ?, ?, ?)', $new_name, $console->{'id_group'}, $console->{'background'}, $console->{'width'}, $console->{'height'}, $console->{'background_color'}); - if (defined($name_in_db->{'name'}) && ($name_in_db->{'name'} eq $new_name)) { - $new_name = $name_to_compare . "_" . $name_count; - $name_count++; + print_log "[INFO] The new visual console '$new_name' has been created. The new ID is '$new_console_id' \n\n"; + + my @console_elements = get_db_rows ($dbh, "SELECT * + FROM tlayout_data + WHERE id_layout = $id_console"); + + foreach my $element (@console_elements) { + my $pos_x = $element->{'pos_x'}; + my $pos_y = $element->{'pos_y'}; + my $width = $element->{'width'}; + my $height = $element->{'height'}; + my $label = $element->{'label'}; + my $image = $element->{'image'}; + my $type = $element->{'type'}; + my $period = $element->{'period'}; + my $id_agente_modulo = $element->{'id_agente_modulo'}; + my $id_agent = $element->{'id_agent'}; + my $id_layout_linked = $element->{'id_layout_linked'}; + my $parent_item = $element->{'parent_item'}; + my $enable_link = $element->{'enable_link'}; + my $id_metaconsole = $element->{'id_metaconsole'}; + my $id_group = $element->{'id_group'}; + my $id_custom_graph = $element->{'id_custom_graph'}; + my $border_width = $element->{'border_width'}; + my $type_graph = $element->{'type_graph'}; + my $label_position = $element->{'label_position'}; + my $border_color = $element->{'border_color'}; + my $fill_color = $element->{'fill_color'}; + + my $element_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $new_console_id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0); + + print_log "[INFO] Element with ID " . $element->{"id"} . " has been duplicated to the new console \n\n"; } - else { - $exist = 0; - } - } - - my $new_console_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout (name, id_group, background, width, height, background_color) - VALUES (?, ?, ?, ?, ?, ?)', $new_name, $console->{'id_group'}, $console->{'background'}, $console->{'width'}, $console->{'height'}, $console->{'background_color'}); - - print_log "[INFO] The new visual console '$new_name' has been created. The new ID is '$new_console_id' \n\n"; - - my @console_elements = get_db_rows ($dbh, "SELECT * - FROM tlayout_data - WHERE id_layout = $id_console"); - - foreach my $element (@console_elements) { - my $pos_x = $element->{'pos_x'}; - my $pos_y = $element->{'pos_y'}; - my $width = $element->{'width'}; - my $height = $element->{'height'}; - my $label = $element->{'label'}; - my $image = $element->{'image'}; - my $type = $element->{'type'}; - my $period = $element->{'period'}; - my $id_agente_modulo = $element->{'id_agente_modulo'}; - my $id_agent = $element->{'id_agent'}; - my $id_layout_linked = $element->{'id_layout_linked'}; - my $parent_item = $element->{'parent_item'}; - my $enable_link = $element->{'enable_link'}; - my $id_metaconsole = $element->{'id_metaconsole'}; - my $id_group = $element->{'id_group'}; - my $id_custom_graph = $element->{'id_custom_graph'}; - my $border_width = $element->{'border_width'}; - my $type_graph = $element->{'type_graph'}; - my $label_position = $element->{'label_position'}; - my $border_color = $element->{'border_color'}; - my $fill_color = $element->{'fill_color'}; - - my $element_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $new_console_id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0); - - print_log "[INFO] Element with ID " . $element->{"id"} . " has been duplicated to the new console \n\n"; } } @@ -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'}; @@ -5989,7 +6005,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') { From feae62f11ca4a200fe44f1206f912beee04ab98d Mon Sep 17 00:00:00 2001 From: daniel Date: Fri, 22 Sep 2017 11:39:54 +0200 Subject: [PATCH 45/55] add tip reports simple graph --- .../godmode/reporting/reporting_builder.item_editor.php | 8 ++++++++ pandora_console/godmode/reporting/reporting_builder.php | 6 ++++-- pandora_console/include/functions_reporting.php | 9 ++++++--- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 00df36a2c7..094199349f 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -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': @@ -1353,6 +1355,10 @@ You can of course remove the warnings, that's why we include the source and do n + + + + @@ -2643,6 +2649,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 +2732,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 diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 705f49c2d0..ead62db0c9 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -1172,8 +1172,9 @@ switch ($action) { case 'simple_graph': // Warning. We are using this column to hold this value to avoid // the modification of the database for compatibility reasons. - $style['only_avg'] = (int) get_parameter('only_avg'); + $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 @@ -1516,8 +1517,9 @@ switch ($action) { case 'simple_graph': // Warning. We are using this column to hold this value to avoid // the modification of the database for compatibility reasons. - $style['only_avg'] = (int) get_parameter('only_avg'); + $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 diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 7209d11094..e68bb9b76f 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -6034,13 +6034,15 @@ function reporting_simple_graph($report, $content, $type = 'dinamic', if (isset($content['style']['only_avg'])) { $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 +6116,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': From 9e01eda73d460617b37213e94b50aa36465da79c Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Fri, 22 Sep 2017 14:42:26 +0200 Subject: [PATCH 46/55] Added change to scape double quotes --- pandora_server/util/pandora_manage.pl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 761b3d4cd4..e92678f027 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -5520,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; From 4c4a89ecf12c90ea70f6cd0f4132fbbae55c3a37 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Fri, 22 Sep 2017 15:01:17 +0200 Subject: [PATCH 47/55] update info of state in events --- .../include/functions_reporting_html.php | 83 +++++++++---------- 1 file changed, 40 insertions(+), 43 deletions(-) diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 22fb6dafac..8d56a42918 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -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: - $data[$cont]['data'] = EVENT_CRIT_CRITICAL; - break; - case 5: - $data[$cont]['data'] = EVENT_CRIT_MINOR; - break; - case 6: - $data[$cont]['data'] = EVENT_CRIT_MAJOR; - break; - case 20: - $data[$cont]['data'] = EVENT_CRIT_NOT_NORMAL; - break; - case 34: - $data[$cont]['data'] = EVENT_CRIT_WARNING_OR_CRITICAL; - break; - default: - $data[$cont]['data'] = 1; - break; - } + $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']); } - else { + + if (!empty($events)) { + if(array_search('4',$events_criticity) !== false){ + $data[$cont]['data'] = EVENT_CRIT_CRITICAL; + }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; + }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; + }else if(array_search('34',$events_criticity) !== false){ + $data[$cont]['data'] = EVENT_CRIT_WARNING_OR_CRITICAL; + }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; + } + + $data[$cont]['utimestamp'] = $periodtime; + + } else { $data[$cont]['utimestamp'] = $periodtime; $data[$cont]['data'] = 1; } From 44a6e39f99e7e07df95c8840620d04816722349b Mon Sep 17 00:00:00 2001 From: daniel Date: Fri, 22 Sep 2017 15:12:53 +0200 Subject: [PATCH 48/55] reajust date in flash graphs --- pandora_console/include/functions_graph.php | 33 ++++++++++++++------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 11450fbbf5..322816c127 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -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; } @@ -3830,7 +3830,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; @@ -3890,7 +3890,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); @@ -4236,7 +4236,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; @@ -4268,7 +4269,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; @@ -4324,6 +4329,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 @@ -4423,7 +4436,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 @@ -4449,7 +4462,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') { From d1c4ce1008a59daf2008b915930c22de3724dd8b Mon Sep 17 00:00:00 2001 From: artica Date: Sat, 23 Sep 2017 00:01:17 +0200 Subject: [PATCH 49/55] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 156bf03a54..b230179be3 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.712-170922 +Version: 7.0NG.712-170923 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index a8e279594a..1390089d5c 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -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-170922" +pandora_version="7.0NG.712-170923" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 84618aa09f..3818fb6ec2 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.712'; -use constant AGENT_BUILD => '170922'; +use constant AGENT_BUILD => '170923'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 82523886d9..745d7c6fe8 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.712 -%define release 170922 +%define release 170923 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index d5ddf392ef..9f601bc08d 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.712 -%define release 170922 +%define release 170923 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 9294bc0827..b9b65adca8 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.712" -PI_BUILD="170922" +PI_BUILD="170923" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 912571443b..d23a6c4c4b 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{170922} +{170923} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 672e030417..7da6045b11 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.712(Build 170922)") +#define PANDORA_VERSION ("7.0NG.712(Build 170923)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 7642530b6e..67242ba5da 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -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 170922))" + VALUE "ProductVersion", "(7.0NG.712(Build 170923))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index a937b5e1fc..6309192a40 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.712-170922 +Version: 7.0NG.712-170923 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 00aa8ee291..dc5b1a86de 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -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-170922" +pandora_version="7.0NG.712-170923" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index d5318e01e7..34f5b9b116 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC170922'; +$build_version = 'PC170923'; $pandora_version = 'v7.0NG.712'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 127c06ce8d..7fd4119725 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
Date: Sun, 24 Sep 2017 00:01:21 +0200 Subject: [PATCH 50/55] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index b230179be3..e5dd0ebe0b 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.712-170923 +Version: 7.0NG.712-170924 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 1390089d5c..eefeca7e53 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -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-170923" +pandora_version="7.0NG.712-170924" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 3818fb6ec2..43547d3981 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.712'; -use constant AGENT_BUILD => '170923'; +use constant AGENT_BUILD => '170924'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 745d7c6fe8..48d6ecd7f4 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.712 -%define release 170923 +%define release 170924 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 9f601bc08d..cc05707a9d 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.712 -%define release 170923 +%define release 170924 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index b9b65adca8..d5da63151a 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.712" -PI_BUILD="170923" +PI_BUILD="170924" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index d23a6c4c4b..540b261629 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{170923} +{170924} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 7da6045b11..518accb707 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.712(Build 170923)") +#define PANDORA_VERSION ("7.0NG.712(Build 170924)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 67242ba5da..9cc90505e0 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -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 170923))" + VALUE "ProductVersion", "(7.0NG.712(Build 170924))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 6309192a40..3046f681f4 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.712-170923 +Version: 7.0NG.712-170924 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index dc5b1a86de..c27487edf2 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -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-170923" +pandora_version="7.0NG.712-170924" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 34f5b9b116..978165d2e1 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC170923'; +$build_version = 'PC170924'; $pandora_version = 'v7.0NG.712'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 7fd4119725..861d0e333d 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
Date: Mon, 25 Sep 2017 00:01:22 +0200 Subject: [PATCH 51/55] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index e5dd0ebe0b..4a5d72dfd7 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.712-170924 +Version: 7.0NG.712-170925 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index eefeca7e53..5eb6b7b67d 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -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-170924" +pandora_version="7.0NG.712-170925" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 43547d3981..ed1036113a 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.712'; -use constant AGENT_BUILD => '170924'; +use constant AGENT_BUILD => '170925'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 48d6ecd7f4..f39c25764f 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.712 -%define release 170924 +%define release 170925 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index cc05707a9d..d8d0ada673 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.712 -%define release 170924 +%define release 170925 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index d5da63151a..9fe601b49a 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.712" -PI_BUILD="170924" +PI_BUILD="170925" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 540b261629..1bdeb79524 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{170924} +{170925} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 518accb707..bf263f13d4 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.712(Build 170924)") +#define PANDORA_VERSION ("7.0NG.712(Build 170925)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 9cc90505e0..197e963689 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -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 170924))" + VALUE "ProductVersion", "(7.0NG.712(Build 170925))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 3046f681f4..f7910714e4 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.712-170924 +Version: 7.0NG.712-170925 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index c27487edf2..02cc7e78a1 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -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-170924" +pandora_version="7.0NG.712-170925" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 978165d2e1..6b20518de4 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC170924'; +$build_version = 'PC170925'; $pandora_version = 'v7.0NG.712'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 861d0e333d..70a9ce80f7 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
Date: Mon, 25 Sep 2017 09:45:58 +0200 Subject: [PATCH 52/55] fixed error merge dani --- pandora_console/godmode/agentes/configurar_agente.php | 2 +- pandora_console/pandoradb.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index bd34c56503..fc42c1f85a 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -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')); } diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 3640357a8f..0d749db694 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -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' , From 83e9276f1b43e79af642c923f54afb0c547fdd24 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Mon, 25 Sep 2017 10:25:12 +0200 Subject: [PATCH 53/55] Added iconin agent view --- .../operation/agentes/estado_generalagente.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php index 111abffeee..8c19bcd284 100755 --- a/pandora_console/operation/agentes/estado_generalagente.php +++ b/pandora_console/operation/agentes/estado_generalagente.php @@ -74,9 +74,15 @@ $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']) { - $agent_name = "" . $agent_name . "" . ui_print_help_tip(__('Disabled'), true); + if ($in_planned_downtime) { + $agent_name = "" . $agent_name . ui_print_help_tip(__('Disabled'), true); + } + else { + $agent_name = "" . $agent_name . "" . ui_print_help_tip(__('Disabled'), true); + } } else if ($agent['quiet']) { $agent_name = "" . $agent_name . " " . html_print_image("images/dot_green.disabled.png", true, array("border" => '0', "title" => __('Quiet'), "alt" => "")) . ""; @@ -85,6 +91,13 @@ else { $agent_name = $agent_name; } +if ($in_planned_downtime && !$agent['disabled']) { + $agent_name .= "" . " " . ui_print_help_tip(__('Agent in planned downtime'), true, 'images/minireloj-16.png') . ""; +} +else if ($in_planned_downtime) { + $agent_name .= " " . ui_print_help_tip(__('Agent in planned downtime'), true, 'images/minireloj-16.png') . ""; +} + if (!$config["show_group_name"]) $data[0] = ui_print_group_icon ($agent["id_grupo"], true); else From 7b437d612a5c9d380f0699420c7e3b48bbb457ca Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Mon, 25 Sep 2017 10:29:34 +0200 Subject: [PATCH 54/55] Added with quiet agent to --- .../operation/agentes/estado_generalagente.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php index 8c19bcd284..80a891b38e 100755 --- a/pandora_console/operation/agentes/estado_generalagente.php +++ b/pandora_console/operation/agentes/estado_generalagente.php @@ -85,16 +85,21 @@ if ($agent['disabled']) { } } else if ($agent['quiet']) { - $agent_name = "" . $agent_name . " " . html_print_image("images/dot_green.disabled.png", true, array("border" => '0', "title" => __('Quiet'), "alt" => "")) . ""; + if ($in_planned_downtime) { + $agent_name = "" . $agent_name . " " . html_print_image("images/dot_green.disabled.png", true, array("border" => '0', "title" => __('Quiet'), "alt" => "")); + } + else { + $agent_name = "" . $agent_name . " " . html_print_image("images/dot_green.disabled.png", true, array("border" => '0', "title" => __('Quiet'), "alt" => "")) . ""; + } } else { $agent_name = $agent_name; } -if ($in_planned_downtime && !$agent['disabled']) { +if ($in_planned_downtime && !$agent['disabled'] && !$agent['quiet']) { $agent_name .= "" . " " . ui_print_help_tip(__('Agent in planned downtime'), true, 'images/minireloj-16.png') . ""; } -else if ($in_planned_downtime) { +else if (($in_planned_downtime && !$agent['disabled']) || ($in_planned_downtime && !$agent['quiet'])) { $agent_name .= " " . ui_print_help_tip(__('Agent in planned downtime'), true, 'images/minireloj-16.png') . ""; } From 00f779817d709cb3a10a6cffaf2c4200c1957c02 Mon Sep 17 00:00:00 2001 From: daniel Date: Mon, 25 Sep 2017 13:26:04 +0200 Subject: [PATCH 55/55] fixed errors in report interfaces --- .../reporting_builder.item_editor.php | 5 +++- .../godmode/reporting/reporting_builder.php | 6 ++++ pandora_console/include/functions_graph.php | 30 +++++++++++++++---- .../include/functions_reporting.php | 20 +++++++++++-- .../agentes/interface_traffic_graph_win.php | 2 +- 5 files changed, 54 insertions(+), 9 deletions(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 094199349f..534bf07a0b 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -482,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']; @@ -1356,7 +1357,8 @@ You can of course remove the warnings, that's why we include the source and do n - + @@ -3130,6 +3132,7 @@ function chooseType() { $("#row_description").show(); $("#row_period").show(); $("#row_historical_db_check").hide(); + $("#row_fullscale").show(); break; case 'top_n': diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index ead62db0c9..4dd13e9af0 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -1180,6 +1180,9 @@ switch ($action) { 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': @@ -1525,6 +1528,9 @@ switch ($action) { 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': diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 322816c127..7e3fe9fbdb 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -1834,13 +1834,28 @@ function graphic_combined_module ($module_list, $weight_list, $period, } } else{ - $temp = fullscale_data_combined($module_list, $period, $date); + $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(); - $flash_charts = true; + 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); @@ -1856,7 +1871,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, } $graph_values = $temp; - + if($config["fixed_graph"] == false){ $water_mark = array( 'file' => $config['homedir'] . "/images/logo_vertical_water.png", @@ -2104,7 +2119,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, } } -function fullscale_data_combined($module_list, $period, $date){ +function fullscale_data_combined($module_list, $period, $date, $flash_charts){ // Set variables if ($date == 0){ @@ -2117,7 +2132,12 @@ function fullscale_data_combined($module_list, $period, $date){ $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) { - $real_date = date("Y M d H:i:s", $v['utimestamp']); + 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']; } } diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index e68bb9b76f..8a47d2c7d2 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -2674,6 +2674,10 @@ function reporting_network_interfaces_report($report, $content, $type = 'dinamic if (empty($content['name'])) { $content['name'] = __('Network interfaces report'); } + + if (isset($content['style']['fullscale'])) { + $fullscale = (bool) $content['style']['fullscale']; + } $group_name = groups_get_name($content['id_group']); @@ -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; } diff --git a/pandora_console/operation/agentes/interface_traffic_graph_win.php b/pandora_console/operation/agentes/interface_traffic_graph_win.php index 1a0a1343f9..0e1c6ae241 100644 --- a/pandora_console/operation/agentes/interface_traffic_graph_win.php +++ b/pandora_console/operation/agentes/interface_traffic_graph_win.php @@ -263,7 +263,7 @@ $interface_traffic_modules = array( $table->rowclass[] =''; $data = array(); - $data[0] = __('Full scale'); + $data[0] = __('Show full scale graph (TIP)'); $data[1] = html_print_checkbox ("fullscale", 1, (bool) $fullscale, true); $table->data[] = $data; $table->rowclass[] ='';