From c44593be8aa5c01e291a272f527293c85894cf67 Mon Sep 17 00:00:00 2001 From: Calvo Date: Tue, 6 Jul 2021 10:14:59 +0200 Subject: [PATCH 01/23] Revomved autorefresh views than does not exists on meta --- pandora_console/operation/users/user_edit.php | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/pandora_console/operation/users/user_edit.php b/pandora_console/operation/users/user_edit.php index 5a944f81b1..7b0b73d703 100644 --- a/pandora_console/operation/users/user_edit.php +++ b/pandora_console/operation/users/user_edit.php @@ -438,24 +438,26 @@ if (is_metaconsole()) { } else { $autorefresh_list_out['operation/agentes/tactical'] = 'Tactical view'; $autorefresh_list_out['operation/agentes/group_view'] = 'Group view'; + $autorefresh_list_out['operation/agentes/estado_agente'] = 'Agent detail'; + $autorefresh_list_out['operation/agentes/alerts_status'] = 'Alert detail'; + $autorefresh_list_out['enterprise/operation/cluster/cluster'] = 'Cluster view'; + $autorefresh_list_out['operation/gis_maps/render_view'] = 'Gis Map'; + $autorefresh_list_out['operation/reporting/graph_viewer'] = 'Graph Viewer'; + $autorefresh_list_out['operation/snmpconsole/snmp_view'] = 'SNMP console'; + + if (enterprise_installed()) { + $autorefresh_list_out['general/sap_view'] = 'SAP view'; + } } -$autorefresh_list_out['operation/agentes/estado_agente'] = 'Agent detail'; -$autorefresh_list_out['operation/agentes/alerts_status'] = 'Alert detail'; $autorefresh_list_out['operation/agentes/status_monitor'] = 'Monitor detail'; -$autorefresh_list_out['operation/operation/services/services'] = 'Services'; +$autorefresh_list_out['enterprise/operation/services/services'] = 'Services'; $autorefresh_list_out['operation/dashboard/dashboard'] = 'Dashboard'; -$autorefresh_list_out['operation/reporting/graph_viewer'] = 'Graph Viewer'; -$autorefresh_list_out['operation/gis_maps/render_view'] = 'Gis Map'; -$autorefresh_list_out['operation/snmpconsole/snmp_view'] = 'SNMP console'; $autorefresh_list_out['operation/agentes/pandora_networkmap'] = 'Network map'; $autorefresh_list_out['operation/visual_console/render_view'] = 'Visual console'; $autorefresh_list_out['operation/events/events'] = 'Events'; -$autorefresh_list_out['enterprise/operation/cluster/cluster'] = 'Cluster view'; -if (enterprise_installed()) { - $autorefresh_list_out['general/sap_view'] = 'SAP view'; -} + if (!isset($autorefresh_list)) { $select = db_process_sql("SELECT autorefresh_white_list FROM tusuario WHERE id_user = '".$config['id_user']."'"); From 19e9613e3e6da00cb1926d3a4f595c61ab95147f Mon Sep 17 00:00:00 2001 From: Calvo Date: Mon, 12 Jul 2021 12:17:38 +0200 Subject: [PATCH 02/23] WMI remote componente add text _field_wmi_n_ --- .../include/javascript/pandora_modules.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/javascript/pandora_modules.js b/pandora_console/include/javascript/pandora_modules.js index 1a0f2c00a8..d1b4df6ea5 100644 --- a/pandora_console/include/javascript/pandora_modules.js +++ b/pandora_console/include/javascript/pandora_modules.js @@ -1327,12 +1327,23 @@ function filterByText(selectbox, textbox, textNoData) { function manageComponentFields(action, type) { var fieldLines = $("tr[id*=network_component-" + type + "]").length; var protocol = $("#module_protocol").val(); + let textForAdd = ""; + if (action === "add") { let lineNumber = fieldLines + 1; - let textForAdd = - type === "oid-list-pluginRow-snmpRow" - ? "_oid_" + lineNumber + "_" - : lineNumber; + + switch (type) { + case "oid-list-pluginRow-snmpRow": + textForAdd = "_oid_" + lineNumber + "_"; + break; + + case "oid-list-wmiRow": + textForAdd = "_field_wmi_" + lineNumber + "_"; + break; + + default: + textForAdd = lineNumber; + } $("#network_component-manage-" + type).before( $("#network_component-" + type + "-row-1") From 7890c4269cae537e21c3053ff2dc0669c04978c4 Mon Sep 17 00:00:00 2001 From: Calvo Date: Wed, 14 Jul 2021 18:00:07 +0200 Subject: [PATCH 03/23] Added checkbox for group recursion in network maps --- pandora_console/include/class/NetworkMap.class.php | 10 ++++++++++ .../include/javascript/functions_pandora_networkmap.js | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/class/NetworkMap.class.php b/pandora_console/include/class/NetworkMap.class.php index fb17914079..c974ef10eb 100644 --- a/pandora_console/include/class/NetworkMap.class.php +++ b/pandora_console/include/class/NetworkMap.class.php @@ -3216,6 +3216,16 @@ class NetworkMap -1, true ); + + $table->data[0][2] = html_print_checkbox( + 'group_recursion', + 0, + false, + true, + false, + 'choose_group_for_show_agents()' + ).__('Recursion'); + $table->data[1][0] = __('Agents'); $table->data[1][1] = html_print_select( [-1 => __('None')], diff --git a/pandora_console/include/javascript/functions_pandora_networkmap.js b/pandora_console/include/javascript/functions_pandora_networkmap.js index 23e7f0cb57..70c630eb4b 100644 --- a/pandora_console/include/javascript/functions_pandora_networkmap.js +++ b/pandora_console/include/javascript/functions_pandora_networkmap.js @@ -4119,7 +4119,9 @@ function get_node_name_ov(data) { function choose_group_for_show_agents() { if (enterprise_installed) { - group = $("#group_for_show_agents option:selected").val(); + var group = $("#group_for_show_agents option:selected").val(); + var group_recursion = + $("#checkbox-group_recursion").prop("checked") === true ? 1 : 0; $("#agents_filter_group").attr("disabled", true); $("#spinner_group").css("display", ""); @@ -4135,6 +4137,7 @@ function choose_group_for_show_agents() { params.push("get_agents_in_group=1"); params.push("id=" + networkmap_id); params.push("group=" + group); + params.push("group_recursion=" + group_recursion); params.push("page=enterprise/operation/agentes/pandora_networkmap.view"); jQuery.ajax({ data: params.join("&"), From 1e845cb5e3da13c32b7f0f1afc7254c03ea6e70b Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Mon, 30 Aug 2021 12:13:33 +0200 Subject: [PATCH 04/23] #7867 Fixed id_agent --- pandora_console/include/functions_agents.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 9f0512fa09..fd121a28e2 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -3072,7 +3072,7 @@ function agents_get_network_interfaces($agents=false, $agents_filter=false) $ni_by_agents = []; foreach ($agents as $agent) { - $agent_id = $agent['id_agente']; + $agent_id = (isset($agent['id_agente'])) ? $agent['id_agente'] : $agent; $agent_group_id = $agent['id_grupo']; $agent_name = $agent['alias']; $agent_interfaces = []; From 2e764afac7ca3e8055ce8fbdf5a13e027a51df11 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Wed, 15 Sep 2021 21:38:10 +0200 Subject: [PATCH 05/23] PandoraHA Splitbrain autorecovery --- pandora_server/conf/pandora_server.conf.new | 4 ++++ pandora_server/lib/PandoraFMS/Config.pm | 3 +++ pandora_server/util/pandora_ha.pl | 13 ------------- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/pandora_server/conf/pandora_server.conf.new b/pandora_server/conf/pandora_server.conf.new index d9ea96e6b7..979ac60d04 100644 --- a/pandora_server/conf/pandora_server.conf.new +++ b/pandora_server/conf/pandora_server.conf.new @@ -707,3 +707,7 @@ alertserver_threads 4 # Generate an hourly warning event if alert execution is being delayed more than alertserver_warn seconds. alertserver_warn 180 +# Pandora FMS HA MySQL cluster splitbrain auto-recovery (PANDORA FMS ENTERPRISE ONLY) +# IMPORTANT! Please understand and configure all settings from pandora_console/index.php?sec=gservers&sec2=enterprise/godmode/servers/HA_cluster&tab=setup +# before enable this feature. +#splitbrain_autofix 0 diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index 47c1c5c660..b718e381d7 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -1290,6 +1290,9 @@ sub pandora_load_config { elsif ($parametro =~ m/^pandora_service_cmd\s(.*)/i) { $pa_config->{'pandora_service_cmd'} = clean_blank($1); } + elsif ($parametro =~ m/^splitbrain_autofix\s(.*)/i) { + $pa_config->{'splitbrain_autofix'} = clean_blank($1); + } } # end of loop for parameter # diff --git a/pandora_server/util/pandora_ha.pl b/pandora_server/util/pandora_ha.pl index ac8774972c..8794d38c9d 100755 --- a/pandora_server/util/pandora_ha.pl +++ b/pandora_server/util/pandora_ha.pl @@ -403,19 +403,6 @@ END { stop(); } -############################################################################### -# Aux. get module id -############################################################################### -my %module_id; -sub __get_module_id { - my ($dbh, $module_type) = @_; - - if (!defined($module_id{$module_type})) { - $module_id{$module_type} = get_module_id($dbh, $module_type); - } - - return $module_id{$module_type} -} $SIG{INT} = \&stop; $SIG{TERM} = \&stop; From b33be80be3f7a545419cef111984fc7dcc417b99 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Thu, 16 Sep 2021 21:16:49 +0200 Subject: [PATCH 06/23] Entity dynamic method calling improved --- pandora_console/include/lib/Entity.php | 54 ++++++++++++++++---------- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/pandora_console/include/lib/Entity.php b/pandora_console/include/lib/Entity.php index d7f55ed780..c22076505d 100644 --- a/pandora_console/include/lib/Entity.php +++ b/pandora_console/include/lib/Entity.php @@ -153,6 +153,17 @@ abstract class Entity /** * Dynamically call methods in this object. * + * To dynamically switch between community methods and prioritize + * enterprise ones, define method visibility as 'protected' in both + * classes. + * + * For instance, in following situation: + * protected PandoraFMS\Agent::test() + * protected PandoraFMS\Enterprise\Agent::test() + * + * If enterprise is available, then PandoraFMS\Enterprise\Agent::test() + * will be executed, community method otherwise. + * * @param string $methodName Name of target method or attribute. * @param array $params Arguments for target method. * @@ -161,41 +172,42 @@ abstract class Entity */ public function __call(string $methodName, ?array $params=null) { - // Prioritize written methods over dynamic ones. - if (method_exists($this, $methodName) === true) { - return call_user_func_array( - $this->{$methodName}, - $params - ); - } - // Enterprise capabilities. + // Prioritize enterprise written methods over dynamic fields. if (\enterprise_installed() === true && $this->enterprise !== null && method_exists($this->enterprise, $methodName) === true ) { + $obj = $this->enterprise; + $callback = function (...$parameters) use ($obj, $methodName) { + return $obj->$methodName(...$parameters); + }; + return call_user_func_array( - [ - $this->enterprise, - $methodName, - ], + $callback, $params ); } - if (array_key_exists($methodName, $this->fields) === true) { - if (empty($params) === true) { - return $this->fields[$methodName]; - } else { - $this->fields[$methodName] = $params[0]; + if (method_exists($this, $methodName) === false) { + if (array_key_exists($methodName, $this->fields) === true) { + if (empty($params) === true) { + return $this->fields[$methodName]; + } else { + $this->fields[$methodName] = $params[0]; + } + + return null; } - return null; + throw new \Exception( + get_class($this).' error, method '.$methodName.' does not exist' + ); } - throw new \Exception( - get_class($this).' error, method '.$methodName.' does not exist' - ); + // Do not return nor throw exceptions after this point, allow php + // default __call behaviour to continue working with object method + // defined. } From 187c6700b1e77130f45a3904a3d8bd31ba7f2e34 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Thu, 16 Sep 2021 21:54:12 +0200 Subject: [PATCH 07/23] Simplified Entity --- pandora_console/include/lib/Entity.php | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/pandora_console/include/lib/Entity.php b/pandora_console/include/lib/Entity.php index c22076505d..3304c9e805 100644 --- a/pandora_console/include/lib/Entity.php +++ b/pandora_console/include/lib/Entity.php @@ -178,15 +178,7 @@ abstract class Entity && $this->enterprise !== null && method_exists($this->enterprise, $methodName) === true ) { - $obj = $this->enterprise; - $callback = function (...$parameters) use ($obj, $methodName) { - return $obj->$methodName(...$parameters); - }; - - return call_user_func_array( - $callback, - $params - ); + return $this->enterprise->$methodName(...$params); } if (method_exists($this, $methodName) === false) { From 47633b479495f97f7242281bdb704fd2e441e9e0 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Thu, 16 Sep 2021 21:57:23 +0200 Subject: [PATCH 08/23] A better explanation --- pandora_console/include/lib/Entity.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pandora_console/include/lib/Entity.php b/pandora_console/include/lib/Entity.php index 3304c9e805..98b9aa8600 100644 --- a/pandora_console/include/lib/Entity.php +++ b/pandora_console/include/lib/Entity.php @@ -200,6 +200,10 @@ abstract class Entity // Do not return nor throw exceptions after this point, allow php // default __call behaviour to continue working with object method // defined. + // If you're receiving NULL as result of the method invocation, ensure + // it is not private, take in mind this method will mask any access + // level error or notification since it is public and has limited access + // to the object (public|protected). } From ddbb06a967f8ea792846ec4b44d2d442dd2a60b2 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Fri, 17 Sep 2021 11:46:59 +0200 Subject: [PATCH 09/23] Merged policies conf fixer tool --- .../tools/merged_policies_conf_fixer.php | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 pandora_console/tools/merged_policies_conf_fixer.php diff --git a/pandora_console/tools/merged_policies_conf_fixer.php b/pandora_console/tools/merged_policies_conf_fixer.php new file mode 100644 index 0000000000..3198b663d7 --- /dev/null +++ b/pandora_console/tools/merged_policies_conf_fixer.php @@ -0,0 +1,62 @@ +hasRemoteCapabilities() === true) { + $agent_policies = $agent->getConfPolicies(); + + $oldIds = []; + $newIds = []; + foreach ($agent_policies as $oldId => $name) { + $oldIds[] = $oldId; + $newIds[] = $policies[io_safe_input($name)]; + } + + $res_update_con_policy = $agent->updatePolicyIds( + $oldIds, + $newIds + ); + if ($res_update_con_policy === false) { + echo 'Failed ['.$agent->name()."]\n"; + } else { + echo 'Agent '.io_safe_output($agent->alias())." updated successfully\n"; + } + } else { + echo 'Agent '.io_safe_output($agent->alias())." skipped\n"; + } + } catch (Exception $e) { + echo $e->getMessage()."\n"; + } +} From b3114262c5736c39d15f5d5288db0e77b106a437 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Tue, 21 Sep 2021 12:15:34 +0200 Subject: [PATCH 10/23] Discovery logs improvement --- .../lib/PandoraFMS/DiscoveryServer.pm | 54 ++++++++++++++++++- pandora_server/lib/PandoraFMS/Omnishell.pm | 1 + 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm index 286d5633ce..559da0151c 100644 --- a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm +++ b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm @@ -29,6 +29,8 @@ use POSIX qw(strftime ceil); use JSON; use Encode qw(encode_utf8); use MIME::Base64; +use File::Basename qw(dirname); +use File::Copy; # Default lib dir for RPM and DEB packages use lib '/usr/lib/perl5'; @@ -378,7 +380,8 @@ sub exec_recon_script ($$$) { } if (-x $command) { - my $exec_output = `$command $args`; + my $exec_output = `$command $args 2>&1`; + log_execution($pa_config, $task->{'id_rt'}, "$command $args", $exec_output); logger($pa_config, "Execution output: \n". $exec_output, 10); } else { logger($pa_config, "Cannot execute recon task command $command.", 10); @@ -1778,5 +1781,54 @@ sub PandoraFMS::Recon::Base::update_progress ($$) { } } +################################################################################ +# Store a log with execution details. +################################################################################ +sub log_execution($$$$) { + my ($pa_config, $task_id, $cmd, $output) = @_; + + return unless $pa_config->{'verbosity'} eq 10; + + my $discovery_log_path = dirname($pa_config->{'log_file'}).'/discovery/'; + mkdir($discovery_log_path) unless -d $discovery_log_path; + + eval { + local $SIG{__DIE__}; + + open (my $f, ">", $discovery_log_path.'task.'.$task_id.'.cmd'); + print $f $cmd; + close ($f); + + open ($f, ">", $discovery_log_path.'task.'.$task_id.'.out'); + print $f $output; + close ($f); + + }; + +} + +################################################################################ +# Store configuration files. +################################################################################ +sub log_conf_files($$@) { + my $pa_config = shift; + my $task_id = shift; + my @files = @_; + + return unless $pa_config->{'verbosity'} eq 10; + + my $discovery_log_path = dirname($pa_config->{'log_file'}).'/discovery/'; + mkdir($discovery_log_path) unless -d $discovery_log_path; + + eval { + local $SIG{__DIE__}; + + foreach my $f (@files) { + copy($f, $discovery_log_path); + } + }; + +} + 1; __END__ diff --git a/pandora_server/lib/PandoraFMS/Omnishell.pm b/pandora_server/lib/PandoraFMS/Omnishell.pm index 5d9dd1db0c..5bfaf561a4 100644 --- a/pandora_server/lib/PandoraFMS/Omnishell.pm +++ b/pandora_server/lib/PandoraFMS/Omnishell.pm @@ -9,6 +9,7 @@ use strict; use warnings; use File::Copy; +use File::Basename qw(dirname basename); use Scalar::Util qw(looks_like_number); use lib '/usr/lib/perl5'; use PandoraFMS::PluginTools qw/init read_configuration read_file empty trim/; From e9c5d89fdcc994a5845ce20792067c2b79d0e9f9 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Tue, 21 Sep 2021 12:48:57 +0200 Subject: [PATCH 11/23] Added level to log_message (pandora_ha) --- pandora_server/util/pandora_ha.pl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pandora_server/util/pandora_ha.pl b/pandora_server/util/pandora_ha.pl index 8794d38c9d..a9d07ca66a 100755 --- a/pandora_server/util/pandora_ha.pl +++ b/pandora_server/util/pandora_ha.pl @@ -49,11 +49,14 @@ my $Running = 0; ######################################################################## # Print the given message with a preceding timestamp. ######################################################################## -sub log_message($$$) { - my ($conf, $source, $message) = @_; +sub log_message($$$;$) { + my ($conf, $source, $message, $verbosity_level) = @_; + + my $level = $verbosity_level; + $level = 5 unless defined($level); if (ref($conf) eq "HASH") { - logger($conf, 'HA (' . $source . ') ' . "$message", 5); + logger($conf, 'HA (' . $source . ') ' . "$message", $level); } if ($source eq '') { From fc959f0bc642b235e9a0ae82ceb11a2da86151c2 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Tue, 21 Sep 2021 15:59:14 +0200 Subject: [PATCH 12/23] created report for ipam networks --- pandora_console/extras/mr/50.sql | 10 +++ .../pandoradb_migrate_6.0_to_7.0.mysql.sql | 6 ++ .../reporting_builder.item_editor.php | 63 ++++++++++++++++++- .../godmode/reporting/reporting_builder.php | 25 ++++++++ .../include/functions_reporting.php | 7 +++ .../include/functions_reporting_html.php | 4 ++ pandora_console/include/functions_reports.php | 7 +++ pandora_console/pandoradb.sql | 6 ++ 8 files changed, 127 insertions(+), 1 deletion(-) create mode 100644 pandora_console/extras/mr/50.sql diff --git a/pandora_console/extras/mr/50.sql b/pandora_console/extras/mr/50.sql new file mode 100644 index 0000000000..2ccefefd6b --- /dev/null +++ b/pandora_console/extras/mr/50.sql @@ -0,0 +1,10 @@ +START TRANSACTION; + +ALTER TABLE `treport_content` ADD COLUMN `ipam_network_filter` int(10) UNSIGNED DEFAULT 0; +ALTER TABLE `treport_content` ADD COLUMN `ipam_alive_ips` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0; +ALTER TABLE `treport_content` ADD COLUMN `ipam_ip_not_assigned_to_agent` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0; +ALTER TABLE `treport_content_template` ADD COLUMN `ipam_network_filter` int(10) UNSIGNED DEFAULT 0; +ALTER TABLE `treport_content_template` ADD COLUMN `ipam_alive_ips` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0; +ALTER TABLE `treport_content_template` ADD COLUMN `ipam_ip_not_assigned_to_agent` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0; + +COMMIT; diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index e506d2f688..b39332a10d 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -896,6 +896,9 @@ ALTER TABLE `treport_content_template` ADD COLUMN `landscape` tinyint(1) UNSIGNE ALTER TABLE `treport_content_template` ADD COLUMN `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0; ALTER TABLE `treport_content_template` ADD COLUMN `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0; ALTER TABLE `treport_content_template` ADD COLUMN `graph_render` tinyint(1) UNSIGNED NOT NULL default 0; +ALTER TABLE `treport_content_template` ADD COLUMN `ipam_network_filter` int(10) UNSIGNED DEFAULT 0; +ALTER TABLE `treport_content_template` ADD COLUMN `ipam_alive_ips` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0; +ALTER TABLE `treport_content_template` ADD COLUMN `ipam_ip_not_assigned_to_agent` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0; -- ---------------------------------------------------------------------- -- Table `tnews` @@ -1774,6 +1777,9 @@ ALTER TABLE `treport_content` ADD COLUMN `pagebreak` tinyint(1) UNSIGNED NOT NUL ALTER TABLE `treport_content` ADD COLUMN `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0; ALTER TABLE `treport_content` ADD COLUMN `graph_render` tinyint(1) UNSIGNED NOT NULL default 0; ALTER TABLE `treport_content` MODIFY `external_source` MEDIUMTEXT; +ALTER TABLE `treport_content` ADD COLUMN `ipam_network_filter` int(10) UNSIGNED DEFAULT 0; +ALTER TABLE `treport_content` ADD COLUMN `ipam_alive_ips` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0; +ALTER TABLE `treport_content` ADD COLUMN `ipam_ip_not_assigned_to_agent` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0; -- --------------------------------------------------------------------- -- Table `tmodule_relationship` diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index e5b47dd219..c62a6afcea 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -399,6 +399,12 @@ switch ($action) { $sla_sorted_by = $item['top_n']; break; + case 'IPAM_network': + $network_filter = $item['ipam_network_filter']; + $alive_ip = $item['ipam_alive_ips']; + $agent_not_assigned_to_ip = $item['ipam_ip_not_assigned_to_agent']; + break; + case 'monitor_report': $description = $item['description']; $idAgentModule = $item['id_agent_module']; @@ -1068,6 +1074,51 @@ $class = 'databox filters'; + + + + + + + + + + + + + + + + + + + + + __('Module Histogram graph'), ]; + if ($config['enterprise_installed'] && is_metaconsole() === false) { + $types['IPAM_network'] = [ + 'optgroup' => __('IPAM'), + 'name' => __('IPAM networks'), + ]; + } + $types['SLA'] = [ 'optgroup' => __('SLA'), 'name' => __('S.L.A.'), diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 3b49b2b97e..b0b5b467a8 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1580,6 +1580,9 @@ CREATE TABLE IF NOT EXISTS `treport_content` ( `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0, `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0, `graph_render` tinyint(1) UNSIGNED NOT NULL default 0, + `ipam_network_filter` int(10) UNSIGNED DEFAULT 0, + `ipam_alive_ips` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, + `ipam_ip_not_assigned_to_agent` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY(`id_rc`), FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`) ON UPDATE CASCADE ON DELETE CASCADE @@ -3193,6 +3196,9 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` ( `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0, `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0, `graph_render` tinyint(1) UNSIGNED NOT NULL default 0, + `ipam_network_filter` int(10) UNSIGNED DEFAULT 0, + `ipam_alive_ips` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, + `ipam_ip_not_assigned_to_agent` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY(`id_rc`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; From d9dd7f211eda51dced75aed863b6394f321be99a Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Tue, 21 Sep 2021 16:02:17 +0200 Subject: [PATCH 13/23] created report for ipam networks --- .../godmode/reporting/reporting_builder.item_editor.php | 1 - 1 file changed, 1 deletion(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index c62a6afcea..2fd42028e6 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -5581,7 +5581,6 @@ function chooseType() { $('#agent_autocomplete_events').show(); -console.log(type); switch (type) { case 'event_report_group': $("#row_description").show(); From 5b8a391f9995e5412e06a35c9a2f0cbac2ef15e5 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Tue, 21 Sep 2021 18:51:50 +0200 Subject: [PATCH 14/23] Extra options pandora_ha auto-resync --- pandora_server/conf/pandora_server.conf.new | 8 ++++++++ pandora_server/lib/PandoraFMS/Config.pm | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/pandora_server/conf/pandora_server.conf.new b/pandora_server/conf/pandora_server.conf.new index 979ac60d04..92c5034e50 100644 --- a/pandora_server/conf/pandora_server.conf.new +++ b/pandora_server/conf/pandora_server.conf.new @@ -711,3 +711,11 @@ alertserver_warn 180 # IMPORTANT! Please understand and configure all settings from pandora_console/index.php?sec=gservers&sec2=enterprise/godmode/servers/HA_cluster&tab=setup # before enable this feature. #splitbrain_autofix 0 + +# Pandora FMS HA MySQL cluster splitbrain auto-recovery settings (PANDORA FMS ENTERPRISE ONLY) +# Maximum number of retries +#ha_max_splitbrain_retries 2 +# Maximum number of retries to verify resync status. +#ha_max_resync_wait_retries 3 +# Maximum number of seconds waiting while verifying resync status. +#ha_resync_sleep 10 diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index b718e381d7..981ff79407 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -1293,6 +1293,15 @@ sub pandora_load_config { elsif ($parametro =~ m/^splitbrain_autofix\s(.*)/i) { $pa_config->{'splitbrain_autofix'} = clean_blank($1); } + elsif ($parametro =~ m/^ha_max_resync_wait_retries\s(.*)/i) { + $pa_config->{'ha_max_resync_wait_retries'} = clean_blank($1); + } + elsif ($parametro =~ m/^ha_resync_sleep\s(.*)/i) { + $pa_config->{'ha_resync_sleep'} = clean_blank($1); + } + elsif ($parametro =~ m/^ha_max_splitbrain_retries\s(.*)/i) { + $pa_config->{'ha_max_splitbrain_retries'} = clean_blank($1); + } } # end of loop for parameter # From f8ea92923a4695feea54d54ed9d3eadde9dff01c Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Wed, 22 Sep 2021 11:44:32 +0200 Subject: [PATCH 15/23] minor fixes --- pandora_server/lib/PandoraFMS/Config.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index 981ff79407..a011b42020 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -1290,16 +1290,16 @@ sub pandora_load_config { elsif ($parametro =~ m/^pandora_service_cmd\s(.*)/i) { $pa_config->{'pandora_service_cmd'} = clean_blank($1); } - elsif ($parametro =~ m/^splitbrain_autofix\s(.*)/i) { + elsif ($parametro =~ m/^splitbrain_autofix\s+([0-9]*)/i) { $pa_config->{'splitbrain_autofix'} = clean_blank($1); } - elsif ($parametro =~ m/^ha_max_resync_wait_retries\s(.*)/i) { + elsif ($parametro =~ m/^ha_max_resync_wait_retries\s+([0-9]*)/i) { $pa_config->{'ha_max_resync_wait_retries'} = clean_blank($1); } - elsif ($parametro =~ m/^ha_resync_sleep\s(.*)/i) { + elsif ($parametro =~ m/^ha_resync_sleep\s+([0-9]*)/i) { $pa_config->{'ha_resync_sleep'} = clean_blank($1); } - elsif ($parametro =~ m/^ha_max_splitbrain_retries\s(.*)/i) { + elsif ($parametro =~ m/^ha_max_splitbrain_retries\s+([0-9]*)/i) { $pa_config->{'ha_max_splitbrain_retries'} = clean_blank($1); } From 8eababe2f6df2bdc3696e86436b0a0465b65cf2d Mon Sep 17 00:00:00 2001 From: Calvo Date: Wed, 22 Sep 2021 17:29:14 +0200 Subject: [PATCH 16/23] Autorefresh changes on centralized node and metaconsole --- pandora_console/operation/users/user_edit.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pandora_console/operation/users/user_edit.php b/pandora_console/operation/users/user_edit.php index 88e34a4ca0..40b898fae2 100644 --- a/pandora_console/operation/users/user_edit.php +++ b/pandora_console/operation/users/user_edit.php @@ -445,12 +445,7 @@ if (check_acl($config['id_user'], 0, 'ER')) { $autorefresh_list_out = []; -if (is_metaconsole()) { - $autorefresh_list_out['monitoring/tactical'] = 'Tactical view'; - $autorefresh_list_out['monitoring/group_view'] = 'Group view'; -} else { - $autorefresh_list_out['operation/agentes/tactical'] = 'Tactical view'; - $autorefresh_list_out['operation/agentes/group_view'] = 'Group view'; +if (is_metaconsole() === false || is_centrallised() === true) { $autorefresh_list_out['operation/agentes/estado_agente'] = 'Agent detail'; $autorefresh_list_out['operation/agentes/alerts_status'] = 'Alert detail'; $autorefresh_list_out['enterprise/operation/cluster/cluster'] = 'Cluster view'; @@ -463,6 +458,8 @@ if (is_metaconsole()) { } } +$autorefresh_list_out['operation/agentes/tactical'] = 'Tactical view'; +$autorefresh_list_out['operation/agentes/group_view'] = 'Group view'; $autorefresh_list_out['operation/agentes/status_monitor'] = 'Monitor detail'; $autorefresh_list_out['enterprise/operation/services/services'] = 'Services'; $autorefresh_list_out['operation/dashboard/dashboard'] = 'Dashboard'; From 4a9f52346873671781109050b6ea34d8b9b0bf98 Mon Sep 17 00:00:00 2001 From: Calvo Date: Thu, 23 Sep 2021 19:02:31 +0200 Subject: [PATCH 17/23] Added unlinked icon to alerts in unlinked module --- pandora_console/godmode/alerts/alert_list.list.php | 14 ++++++++++---- pandora_console/include/functions_ui.php | 11 +++++++++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/pandora_console/godmode/alerts/alert_list.list.php b/pandora_console/godmode/alerts/alert_list.list.php index a9de8608e7..8e2e01aa2d 100644 --- a/pandora_console/godmode/alerts/alert_list.list.php +++ b/pandora_console/godmode/alerts/alert_list.list.php @@ -861,10 +861,16 @@ foreach ($simple_alerts as $alert) { if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) { if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { $policyInfo = policies_is_alert_in_policy2($alert['id'], false); - if ($policyInfo === false) { - $data[1] .= ''; + $module_linked = policies_is_module_linked($alert['id_agent_module']); + if (is_array($policyInfo) === false && $module_linked === false) { + $data[$index['policy']] = ''; } else { - $img = 'images/policies_mc.png'; + $module_linked = policies_is_module_linked($alert['id_agent_module']); + if ($module_linked === '0') { + $img = 'images/unlinkpolicy.png'; + } else { + $img = 'images/policies_mc.png'; + } $data[1] .= '  '.html_print_image($img, true, ['title' => $policyInfo['name']]).''; } @@ -886,7 +892,7 @@ foreach ($simple_alerts as $alert) { ] ); } else { - if ((int) $alert['id_policy_alerts'] === 0) { + if ((int) $alert['id_policy_alerts'] === 0 || $module_linked === '0') { $data[4] .= ''; $data[4] .= html_print_image('images/add.png', true, ['title' => __('Add action'), 'class' => 'invert_filter']); $data[4] .= ''; diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index ed6f55824e..a02fd3baf7 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -1117,10 +1117,17 @@ function ui_format_alert_row( } $policyInfo = policies_is_alert_in_policy2($alert['id'], false); - if ($policyInfo === false) { + $module_linked = policies_is_module_linked($alert['id_agent_module']); + if (is_array($policyInfo) === false && $module_linked === false) { $data[$index['policy']] = ''; } else { - $img = 'images/policies_mc.png'; + $module_linked = policies_is_module_linked($alert['id_agent_module']); + if ($module_linked === '0') { + $img = 'images/unlinkpolicy.png'; + } else { + $img = 'images/policies_mc.png'; + } + if (is_metaconsole() === false) { $data[$index['policy']] = ''.html_print_image($img, true, ['title' => $policyInfo['name']]).''; } else { From 91cd12c715c6fdeeb649b55fd95d73cfad67919c Mon Sep 17 00:00:00 2001 From: Calvo Date: Mon, 27 Sep 2021 11:25:54 +0200 Subject: [PATCH 18/23] fix networkmap node group recursion --- pandora_console/include/functions_networkmap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php index 805f8853bb..ed99ee7781 100644 --- a/pandora_console/include/functions_networkmap.php +++ b/pandora_console/include/functions_networkmap.php @@ -4062,7 +4062,7 @@ function networkmap_get_new_nodes_and_links($networkmap, $x, $y) true ); } else { - if ($map_filter['dont_show_subgroups'] == 'true') { + if ($map_filter['dont_show_subgroups'] == 'true' && $map_filter['dont_show_subgroups'] !== 0) { // Show only current selected group. $filter['id_grupo'] = $networkmap['id_group']; } else { From 90ac62c0cc40b9b1571c1ecc6d68cba1014a1fdf Mon Sep 17 00:00:00 2001 From: Calvo Date: Mon, 27 Sep 2021 16:14:07 +0200 Subject: [PATCH 19/23] Fix recursion on networkmap nodes --- .../agentes/pandora_networkmap.view.php | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/pandora_console/operation/agentes/pandora_networkmap.view.php b/pandora_console/operation/agentes/pandora_networkmap.view.php index 09baf79f6b..4f8ba82521 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.view.php +++ b/pandora_console/operation/agentes/pandora_networkmap.view.php @@ -55,6 +55,7 @@ if (is_ajax()) { $process_migration = (bool) get_parameter('process_migration', false); $get_agent_info = (bool) get_parameter('get_agent_info', false); $update_node = (bool) get_parameter('update_node', false); + $get_agents_in_group = (bool) get_parameter('get_agents_in_group', false); if ($update_node) { $node_json = io_safe_output(get_parameter('node', '')); @@ -80,6 +81,65 @@ if (is_ajax()) { return; } + + if ($get_agents_in_group) { + $id = (int) get_parameter('id', 0); + $group = (int) get_parameter('group', -1); + $group_recursion = (int) get_parameter('group_recursion', 0); + + $return = []; + $return['correct'] = false; + + if ($group != -1) { + $where_id_agente = ' 1=1 '; + + $agents_in_networkmap = db_get_all_rows_filter( + 'titem', + [ + 'id_map' => $id, + 'deleted' => 0, + ] + ); + if ($agents_in_networkmap !== false) { + $ids = []; + foreach ($agents_in_networkmap as $agent) { + if ($agent['type'] == 0) { + $ids[] = $agent['source_data']; + } + } + + if (empty($ids) === false) { + $where_id_agente = 'AND id_agente NOT IN ('.implode(',', $ids).')'; + } + } + + if ($group_recursion !== 0) { + $group_tree = groups_get_children_ids($group); + $group = implode(',', $group_tree); + } + + $sql = 'SELECT id_agente, alias + FROM tagente + WHERE id_grupo IN ('.$group.') AND '.$where_id_agente.' + ORDER BY alias ASC'; + + $agents = db_get_all_rows_sql($sql); + + if ($agents !== false) { + $return['agents'] = []; + foreach ($agents as $agent) { + $return['agents'][$agent['id_agente']] = $agent['alias']; + } + + $return['correct'] = true; + } + } + + echo json_encode($return); + + return; + } + if ($module_get_status) { $id = (int) get_parameter('id', 0); From 201fea9378e66f136e4bd0b08b63d52a46dd6413 Mon Sep 17 00:00:00 2001 From: artica Date: Tue, 28 Sep 2021 01:00:21 +0200 Subject: [PATCH 20/23] 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.rhel7.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/lib/PandoraFMS/PluginTools.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 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index e6a6d98175..6c51843fd9 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.757-210927 +Version: 7.0NG.757-210928 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 acf593ceeb..8780e88ae7 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.757-210927" +pandora_version="7.0NG.757-210928" 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 38fb364524..7db55e0dde 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1015,7 +1015,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.757'; -use constant AGENT_BUILD => '210927'; +use constant AGENT_BUILD => '210928'; # 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 c1d5a5368b..99b2ebb0fb 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.757 -%define release 210927 +%define release 210928 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 5bdac1f020..5505f84b99 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.757 -%define release 210927 +%define release 210928 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 edd674d18e..f290ffafcc 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.757" -PI_BUILD="210927" +PI_BUILD="210928" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 938000f0a2..fcdf4d9e2c 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{210927} +{210928} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 6adada1f0c..d03acb97c6 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.757 Build 210927") +#define PANDORA_VERSION ("7.0NG.757 Build 210928") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index ef7ec55cb8..485ba15816 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.757(Build 210927))" + VALUE "ProductVersion", "(7.0NG.757(Build 210928))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 2fb60f4c68..c6cf5044b2 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.757-210927 +Version: 7.0NG.757-210928 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 a5235823f0..00f172ea52 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.757-210927" +pandora_version="7.0NG.757-210928" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 892a61f4cf..444b5d1b4b 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC210927'; +$build_version = 'PC210928'; $pandora_version = 'v7.0NG.757'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 82f5d13b13..c69a5e484f 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@
[ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 7c58162e86..5ca0d13fdc 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.757 -%define release 210927 +%define release 210928 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 02a7e09a60..b211a0aaed 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.757 -%define release 210927 +%define release 210928 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 61cbbf9757..95022b7588 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.757" -PI_BUILD="210927" +PI_BUILD="210928" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 7ad97b271d..7bb71acd83 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -35,7 +35,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.757 Build 210927"; +my $version = "7.0NG.757 Build 210928"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 06deb91173..bb06267085 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.757 Build 210927"; +my $version = "7.0NG.757 Build 210928"; # save program name for logging my $progname = basename($0); From 849ce30da5f273d01d61e021697b4117b7b58983 Mon Sep 17 00:00:00 2001 From: Luis Date: Tue, 28 Sep 2021 08:50:00 +0000 Subject: [PATCH 21/23] Update pandora_networkmap.view.php --- pandora_console/operation/agentes/pandora_networkmap.view.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/operation/agentes/pandora_networkmap.view.php b/pandora_console/operation/agentes/pandora_networkmap.view.php index 4f8ba82521..3316c1c765 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.view.php +++ b/pandora_console/operation/agentes/pandora_networkmap.view.php @@ -109,7 +109,7 @@ if (is_ajax()) { } if (empty($ids) === false) { - $where_id_agente = 'AND id_agente NOT IN ('.implode(',', $ids).')'; + $where_id_agente = 'id_agente NOT IN ('.implode(',', $ids).')'; } } From 87ec5970a1a09c8ddfbe16eb056dac5548e34b23 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Tue, 28 Sep 2021 13:44:12 +0200 Subject: [PATCH 22/23] implemented supernet treeview --- pandora_console/include/ajax/tree.ajax.php | 13 ++ .../include/javascript/tree/TreeController.js | 211 +++++++++++++++++- pandora_console/include/styles/tree.css | 4 + 3 files changed, 227 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/ajax/tree.ajax.php b/pandora_console/include/ajax/tree.ajax.php index 448b4cfb71..c6e9670df8 100644 --- a/pandora_console/include/ajax/tree.ajax.php +++ b/pandora_console/include/ajax/tree.ajax.php @@ -40,6 +40,7 @@ if (is_ajax() === true) { include_once $config['homedir'].'/include/class/TreeGroup.class.php'; include_once $config['homedir'].'/include/class/TreeService.class.php'; include_once $config['homedir'].'/include/class/TreeGroupEdition.class.php'; + enterprise_include_once('include/class/TreeIPAMSupernet.class.php'); enterprise_include_once('include/class/TreePolicies.class.php'); enterprise_include_once('include/class/TreeGroupMeta.class.php'); include_once $config['homedir'].'/include/functions_reporting.php'; @@ -190,6 +191,18 @@ if (is_ajax() === true) { ); break; + case 'IPAM_supernets': + $tree = new TreeIPAMSupernet( + $type, + $rootType, + $id, + $rootID, + $serverID, + $childrenMethod, + $access + ); + break; + default: // No error handler. return; diff --git a/pandora_console/include/javascript/tree/TreeController.js b/pandora_console/include/javascript/tree/TreeController.js index 898f389891..bc30d87f8c 100644 --- a/pandora_console/include/javascript/tree/TreeController.js +++ b/pandora_console/include/javascript/tree/TreeController.js @@ -159,6 +159,21 @@ var TreeController = { } }; + var IPAMSupernetCounterTitles = { + total_networks: { + totals: "Networks" + } + }; + + var IPAMNetworkCounterTitles = { + alive_ips: { + totals: "Alive IPs" + }, + total_ips: { + totals: "Total IPs" + } + }; + try { var title = ""; @@ -192,6 +207,12 @@ var TreeController = { case "services": title = serviceCounterTitles[counterType].totals; break; + case "IPAM_supernets": + title = IPAMSupernetCounterTitles[counterType].totals; + break; + case "IPAM_networks": + title = IPAMNetworkCounterTitles[counterType].totals; + break; default: if ( typeof controller.counterTitles != "undefined" && @@ -333,6 +354,113 @@ var TreeController = { hasCounters = true; } + } else if (type == "IPAM_supernets") { + var $counters = $("
"); + $counters.addClass("tree-node-counters"); + + if (counters.total_networks > 0) { + // Open the parentheses + $counters.append(" ("); + + if ( + typeof counters.total_networks !== "undefined" && + counters.total_networks >= 0 + ) { + var $networksCounter = $("
"); + $networksCounter + .addClass("tree-node-counter") + .addClass("total") + .html(counters.total_networks); + + _processNodeCounterTitle( + $networksCounter, + type, + "total_networks" + ); + + $counters.append($networksCounter); + } else { + var $networksCounter = $("
"); + $networksCounter + .addClass("tree-node-counter") + .addClass("total") + .html("0"); + + _processNodeCounterTitle( + $networksCounter, + type, + "total_networks" + ); + + $counters.append($networksCounter); + } + + // Close the parentheses + $counters.append(")"); + + hasCounters = true; + } + } else if (type == "IPAM_networks") { + var $counters = $("
"); + $counters.addClass("tree-node-counters"); + + // Open the parentheses + $counters.append(" ("); + + if ( + typeof counters.alive_ips !== "undefined" && + counters.alive_ips >= 0 + ) { + var $aliveCounter = $("
"); + $aliveCounter + .addClass("tree-node-counter") + .addClass("total") + .html(counters.alive_ips); + + _processNodeCounterTitle($aliveCounter, type, "alive_ips"); + + $counters.append($aliveCounter); + } else { + var $aliveCounter = $("
"); + $aliveCounter + .addClass("tree-node-counter") + .addClass("total") + .html("0"); + + _processNodeCounterTitle($aliveCounter, type, "alive_ips"); + + $counters.append($aliveCounter); + } + + if ( + typeof counters.total_ips !== "undefined" && + counters.total_ips >= 0 + ) { + var $totalCounter = $("
"); + $totalCounter + .addClass("tree-node-counter") + .addClass("total") + .html(counters.total_ips); + + _processNodeCounterTitle($totalCounter, type, "total_ips"); + + $counters.append(" : ").append($totalCounter); + } else { + var $totalCounter = $("
"); + $totalCounter + .addClass("tree-node-counter") + .addClass("total") + .html("0"); + + _processNodeCounterTitle($totalCounter, type, "total_ips"); + + $counters.append(" : ").append($totalCounter); + } + + // Close the parentheses + $counters.append(")"); + + hasCounters = true; } else { var $counters = $("
"); $counters.addClass("tree-node-counters"); @@ -637,6 +765,87 @@ var TreeController = { } $content.append(" " + element.alias); + break; + case "IPAM_supernets": + var IPAMSupernetDetailImage = $( + ' ' + ); + + if (typeof element.id !== "undefined") { + IPAMSupernetDetailImage.click(function(e) { + e.preventDefault(); + + var postData = { + page: "enterprise/include/ajax/ipam.ajax", + show_networkmap_statistics: 1, + "node_data[id_net]": element.id, + "node_data[type_net]": "supernet" + }; + + $.ajax({ + url: controller.ajaxURL, + type: "POST", + dataType: "html", + data: postData, + success: function(data, textStatus, xhr) { + controller.detailRecipient + .render("IPAMsupernets", data) + .open(); + } + }); + }).css("cursor", "pointer"); + + $content.append(IPAMSupernetDetailImage); + } + + if (element.name !== null) { + $content.append("   " + element.name); + } + + break; + case "IPAM_networks": + $content.addClass("ipam-network"); + + var IPAMNetworkDetailImage = $( + ' ' + ); + + if (typeof element.id !== "undefined") { + IPAMNetworkDetailImage.click(function(e) { + e.preventDefault(); + + //window.location.href = element.IPAMNetworkDetail; + var postData = { + page: "enterprise/include/ajax/ipam.ajax", + show_networkmap_statistics: 1, + "node_data[id_net]": element.id, + "node_data[type_net]": "network" + }; + + $.ajax({ + url: controller.ajaxURL, + type: "POST", + dataType: "html", + data: postData, + success: function(data, textStatus, xhr) { + controller.detailRecipient + .render("IPAMnetwork", data) + .open(); + } + }); + }).css("cursor", "pointer"); + + $content.append(IPAMNetworkDetailImage); + } + + if (element.name !== null) { + $content.append("   " + element.name); + } + break; case "services": if ( @@ -960,7 +1169,7 @@ var TreeController = { return; } } - // If exist the detail container, show the data + // If detail container exists, show the data. if ( typeof controller.detailRecipient !== "undefined" || disabled == false diff --git a/pandora_console/include/styles/tree.css b/pandora_console/include/styles/tree.css index 6a0cc7b19f..46834565d9 100644 --- a/pandora_console/include/styles/tree.css +++ b/pandora_console/include/styles/tree.css @@ -183,3 +183,7 @@ div#tree-controller-recipient { .tree-node .disabled { filter: opacity(0.3); } + +.ipam-network { + font-size: 9pt; +} From 06c42a051dc387a49d9c3618c33a8dbd91785e54 Mon Sep 17 00:00:00 2001 From: artica Date: Wed, 29 Sep 2021 01:00:20 +0200 Subject: [PATCH 23/23] 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.rhel7.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/lib/PandoraFMS/PluginTools.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 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 6c51843fd9..a3be5ce30c 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.757-210928 +Version: 7.0NG.757-210929 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 8780e88ae7..3581699a48 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.757-210928" +pandora_version="7.0NG.757-210929" 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 7db55e0dde..45dc1ff702 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1015,7 +1015,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.757'; -use constant AGENT_BUILD => '210928'; +use constant AGENT_BUILD => '210929'; # 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 99b2ebb0fb..15d1e5bfd3 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.757 -%define release 210928 +%define release 210929 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 5505f84b99..56eb1c4da8 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.757 -%define release 210928 +%define release 210929 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 f290ffafcc..34df6c9122 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.757" -PI_BUILD="210928" +PI_BUILD="210929" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index fcdf4d9e2c..e795dda6c6 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{210928} +{210929} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index d03acb97c6..1336b2b22b 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.757 Build 210928") +#define PANDORA_VERSION ("7.0NG.757 Build 210929") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 485ba15816..041b633c85 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.757(Build 210928))" + VALUE "ProductVersion", "(7.0NG.757(Build 210929))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index c6cf5044b2..b6daadb2d3 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.757-210928 +Version: 7.0NG.757-210929 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 00f172ea52..3eab055198 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.757-210928" +pandora_version="7.0NG.757-210929" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 444b5d1b4b..7e9708066f 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC210928'; +$build_version = 'PC210929'; $pandora_version = 'v7.0NG.757'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index c69a5e484f..850db93e0d 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@
[ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 5ca0d13fdc..b9bb62f13e 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.757 -%define release 210928 +%define release 210929 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index b211a0aaed..6f2b04122e 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.757 -%define release 210928 +%define release 210929 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 95022b7588..a90dc1b9a1 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.757" -PI_BUILD="210928" +PI_BUILD="210929" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 7bb71acd83..71484020b6 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -35,7 +35,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.757 Build 210928"; +my $version = "7.0NG.757 Build 210929"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index bb06267085..8dabf8ce22 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.757 Build 210928"; +my $version = "7.0NG.757 Build 210929"; # save program name for logging my $progname = basename($0);