".__('Add summatory series')."" .
+ ui_print_help_tip (__("This will add a synthetic series to the graph,
+ using all series to give a SUM or an average of all present series values
+ in each interval. This feature could be used instead synthetic modules
+ if you only want to see a graph"), true)."
';
+
$event_times = array(86400 => __('24h'),
28800 => __('8h'),
7200 => __('2h'),
@@ -645,6 +657,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$(".line_color").attachColorPicker();
$(".percentile_color").attachColorPicker();
$(".percentile_label_color").attachColorPicker();
+ $(".resume_color").attachColorPicker();
$("input[name=radio_choice]").change(function(){
$('#count_items').html(1);
diff --git a/pandora_console/include/graphs/functions_d3.php b/pandora_console/include/graphs/functions_d3.php
index e4e53f2f1d..3a1cf73bbd 100644
--- a/pandora_console/include/graphs/functions_d3.php
+++ b/pandora_console/include/graphs/functions_d3.php
@@ -384,7 +384,7 @@ function progress_circular_bar_interior ($id, $percentile, $width, $height, $col
return $output;
}
-function d3_donut_graph ($id, $width, $height, $module_data) {
+function d3_donut_graph ($id, $width, $height, $module_data, $resume_color) {
global $config;
$module_data = json_encode($module_data);
@@ -402,7 +402,7 @@ function d3_donut_graph ($id, $width, $height, $module_data) {
";
$output .= "";
return $output;
diff --git a/pandora_console/include/graphs/pandora.d3.js b/pandora_console/include/graphs/pandora.d3.js
index 1c2ab88b59..e60baa90d6 100644
--- a/pandora_console/include/graphs/pandora.d3.js
+++ b/pandora_console/include/graphs/pandora.d3.js
@@ -1972,7 +1972,7 @@ function print_interior_circular_progress_bar (recipient, percentile, width, hei
})();
}
-function print_donut_graph (recipient, width, height, module_data) {
+function print_donut_graph (recipient, width, height, module_data, resume_color) {
var svg = d3.select(recipient)
.append("svg")
.attr("width", width)
@@ -2041,10 +2041,11 @@ function print_donut_graph (recipient, width, height, module_data) {
.value(function(d) {
return parseFloat(d.percent);
});
-
+console.log(resume_color);
jQuery.each(module_data, function (key, m_d) {
svg.append("g")
.append("text")
+ .attr('fill', resume_color)
.attr("transform", "translate(" + (((width / 2) - (radius + decrement_x_padding))) + "," + (((height / 2) - radius) - increment_y) + ")")
.text(m_d.tag_name)
.style("font-family", "Verdana")
From ab03a6b71ca9fe21a45e79e0eaaaa4cd70f2bda0 Mon Sep 17 00:00:00 2001
From: Ramon Novoa
Date: Wed, 8 Nov 2017 10:37:15 +0100
Subject: [PATCH 54/82] Change the default number of ICMP packets and retries
for ping modules.
Ref pandora_enterprise#1562.
---
pandora_server/conf/pandora_server.conf.new | 4 ++--
pandora_server/conf/pandora_server.conf.windows | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/pandora_server/conf/pandora_server.conf.new b/pandora_server/conf/pandora_server.conf.new
index 3182f359e0..4c906c7eb6 100644
--- a/pandora_server/conf/pandora_server.conf.new
+++ b/pandora_server/conf/pandora_server.conf.new
@@ -161,10 +161,10 @@ network_threads 4
# that ping should be 1 to report 1. Setting this to 1 will make all icmp montioring faster but
# with more probability of failure.
-icmp_checks 3
+icmp_checks 1
# Number of ICMP packets to send per request.
-icmp_packets 1
+icmp_packets 2
# tcp specific options :
# tcp_checks: number of tcp retries if first attempt fails.
diff --git a/pandora_server/conf/pandora_server.conf.windows b/pandora_server/conf/pandora_server.conf.windows
index 94b764de40..a1429970b1 100644
--- a/pandora_server/conf/pandora_server.conf.windows
+++ b/pandora_server/conf/pandora_server.conf.windows
@@ -164,10 +164,10 @@ network_threads 5
# that ping should be 1 to report 1. Lower value have better performance, but more probability
# of false positives
-icmp_checks 3
+icmp_checks 1
# Number of ICMP packets to send per request.
-icmp_packets 1
+icmp_packets 2
# tcp specific options :
# tcp_checks: number of tcp retries if first attempt fails.
From 1d7df38b61b8305db6bc226176c5837f4ce24b30 Mon Sep 17 00:00:00 2001
From: danielmaya
Date: Wed, 8 Nov 2017 11:55:23 +0100
Subject: [PATCH 55/82] Fixed entities in networkserver.pm
---
pandora_server/lib/PandoraFMS/NetworkServer.pm | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pandora_server/lib/PandoraFMS/NetworkServer.pm b/pandora_server/lib/PandoraFMS/NetworkServer.pm
index 0901add896..f52b6e8a72 100644
--- a/pandora_server/lib/PandoraFMS/NetworkServer.pm
+++ b/pandora_server/lib/PandoraFMS/NetworkServer.pm
@@ -344,10 +344,10 @@ sub pandora_query_snmp ($$$$) {
my $snmp_version = $module->{"tcp_send"}; # (1, 2, 2c or 3)
my $snmp3_privacy_method = $module->{"custom_string_1"}; # DES/AES
- my $snmp3_privacy_pass = pandora_output_password($pa_config, $module->{"custom_string_2"});
+ my $snmp3_privacy_pass = safe_output(pandora_output_password($pa_config, $module->{"custom_string_2"}));
my $snmp3_security_level = $module->{"custom_string_3"}; # noAuthNoPriv|authNoPriv|authPriv
- my $snmp3_auth_user = $module->{"plugin_user"};
- my $snmp3_auth_pass = pandora_output_password($pa_config, $module->{"plugin_pass"});
+ my $snmp3_auth_user = safe_output($module->{"plugin_user"});
+ my $snmp3_auth_pass = safe_output(pandora_output_password($pa_config, $module->{"plugin_pass"}));
my $snmp3_auth_method = $module->{"plugin_parameter"}; #MD5/SHA1
my $snmp_community = $module->{"snmp_community"};
my $snmp_target = $ip_target;
@@ -412,7 +412,7 @@ sub pandora_query_snmp ($$$$) {
if ($snmp3_security_level eq "authPriv"){
$snmp3_extra = " -a $snmp3_auth_method -u '$snmp3_auth_user' -A '$snmp3_auth_pass' -x $snmp3_privacy_method -X '$snmp3_privacy_pass' ";
}
-
+
$output = pandora_snmp_get_command ($snmpget_cmd, $snmp_version, $snmp_retries, $snmp_timeout, $snmp_community, $snmp_target, $snmp_oid, $snmp3_security_level, $snmp3_extra, $snmp_port, $pa_config);
if (defined ($output) && $output ne ""){
$module_result = 0;
From c9d1fab03690d85e5408cbdda60a121eb5f7d1d5 Mon Sep 17 00:00:00 2001
From: Arturo Gonzalez
Date: Wed, 8 Nov 2017 12:49:03 +0100
Subject: [PATCH 56/82] Added new system of calculate status if user set a
parent weight
---
.../pandoradb_migrate_6.0_to_7.0.mysql.sql | 1 +
.../visual_console_builder.editor.js | 7 ++
.../ajax/visual_console_builder.ajax.php | 12 +++-
.../include/functions_visual_map.php | 67 ++++++++++++++++---
.../include/functions_visual_map_editor.php | 44 +++++++++++-
pandora_console/pandoradb.sql | 1 +
6 files changed, 119 insertions(+), 13 deletions(-)
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 159eb466f9..52299f75c9 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
@@ -1239,6 +1239,7 @@ ALTER TABLE tlayout ADD `background_color` varchar(50) NOT NULL default '#FFF';
ALTER TABLE tlayout_data ADD `type_graph` varchar(50) NOT NULL default 'area';
ALTER TABLE tlayout_data ADD `label_position` varchar(50) NOT NULL default 'down';
ALTER TABLE tlayout_data ADD COLUMN `show_statistics` tinyint(2) NOT NULL default '0';
+ALTER TABLE tlayout_data ADD COLUMN `id_layout_linked_weight` int(10) NOT NULL default '0';
-- ---------------------------------------------------------------------
-- Table `tagent_custom_fields`
diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js
index ebd2427ce3..8adb70be5f 100755
--- a/pandora_console/godmode/reporting/visual_console_builder.editor.js
+++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js
@@ -815,6 +815,7 @@ function readFields() {
values['bars_graph_type'] = $("select[name=bars_graph_type]").val();
values['parent'] = $("select[name=parent]").val();
values['map_linked'] = $("select[name=map_linked]").val();
+ values['map_linked_weight'] = $("select[name=map_linked_weight]").val();
values['width_percentile'] = $("input[name=width_percentile]").val();
values['max_percentile'] = parseInt($("input[name=max_percentile]").val());
values['width_module_graph'] = $("input[name=width_module_graph]").val();
@@ -1489,6 +1490,8 @@ function loadFieldsFromDB(item) {
$("select[name=parent]").val(val);
if (key == 'id_layout_linked')
$("select[name=map_linked]").val(val);
+ if (key == 'id_layout_linked_weight')
+ $("select[name=map_linked_weight]").val(val);
if (key == 'width_percentile')
$("input[name=width_percentile]").val(val);
if (key == 'max_percentile')
@@ -1771,6 +1774,9 @@ function hiddenFields(item) {
$("#map_linked_row").css('display', 'none');
$("#map_linked_row." + item).css('display', '');
+ $("#map_linked_weight").css('display', 'none');
+ $("#map_linked_weight." + item).css('display', '');
+
$("#module_graph_size_row").css('display', 'none');
$("#module_graph_size_row." + item).css('display', '');
@@ -1848,6 +1854,7 @@ function cleanFields(item) {
$("input[name=height]").val(0);
$("select[name=parent]").val('');
$("select[name=map_linked]").val('');
+ $("select[name=map_linked_weight]").val('');
$("input[name=width_module_graph]").val(300);
$("input[name=height_module_graph]").val(180);
$("input[name='width_box']").val(300);
diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php
index c7e4484a27..33044a53fd 100755
--- a/pandora_console/include/ajax/visual_console_builder.ajax.php
+++ b/pandora_console/include/ajax/visual_console_builder.ajax.php
@@ -100,6 +100,7 @@ $width = get_parameter('width', null);
$height = get_parameter('height', null);
$parent = get_parameter('parent', null);
$map_linked = get_parameter('map_linked', null);
+$map_linked_weight = get_parameter('map_linked_weight', null);
$width_percentile = get_parameter('width_percentile', null);
$max_percentile = get_parameter('max_percentile', null);
$height_module_graph = get_parameter('height_module_graph', null);
@@ -378,7 +379,7 @@ switch ($action) {
// Linked to other layout ?? - Only if not module defined
if ($layoutData['id_layout_linked'] != 0) {
- $status = visual_map_get_layout_status ($layoutData['id_layout_linked']);
+ $status = visual_map_get_layout_status ($layoutData['id_layout_linked'], $layoutData['id_layout_linked_weight']);
// Single object
}
@@ -552,8 +553,6 @@ switch ($action) {
break;
}
-
-
if (defined('METACONSOLE') && $metaconsole) {
if ($server_name !== null) {
$values['id_metaconsole'] = db_get_value('id',
@@ -568,6 +567,9 @@ switch ($action) {
$values['id_agent'] = $id_agent;
}
}
+ else if ($id_agent == 0) {
+ $values['id_agent'] = 0;
+ }
else if (!empty($id_agent)) {
$values['id_agent'] = $id_agent;
}
@@ -584,6 +586,9 @@ switch ($action) {
if ($map_linked !== null) {
$values['id_layout_linked'] = $map_linked;
}
+ if ($map_linked_weight !== null) {
+ $values['id_layout_linked_weight'] = $map_linked_weight;
+ }
switch ($type) {
// -- line_item ------------------------------------
case 'handler_start':
@@ -982,6 +987,7 @@ switch ($action) {
}
$values['id_agente_modulo'] = $id_module;
$values['id_layout_linked'] = $map_linked;
+ $values['id_layout_linked_weight'] = $map_linked_weight;
$values['parent_item'] = $parent;
$values['enable_link'] = $enable_link;
$values['image'] = $background_color;
diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php
index f6293d8743..9388356be4 100755
--- a/pandora_console/include/functions_visual_map.php
+++ b/pandora_console/include/functions_visual_map.php
@@ -2923,7 +2923,26 @@ function visual_map_get_status_element($layoutData) {
//Linked to other layout ?? - Only if not module defined
if ($layoutData['id_layout_linked'] != 0) {
- $status = visual_map_get_layout_status ($layoutData['id_layout_linked']);
+ if ($layoutData['id_layout_linked_weight'] != 0) {
+ $calculate_weight = true;
+ }
+ else {
+ $calculate_weight = false;
+ }
+ $status = visual_map_get_layout_status ($layoutData['id_layout_linked'], 0, 0, $calculate_weight);
+
+ if ($layoutData['id_layout_linked_weight'] > 0) {
+ $elements_to_compare = db_get_all_rows_sql("SELECT id FROM tlayout_data WHERE type = 0 AND id_layout = " . $layoutData['id_layout_linked']);
+
+ $aux_weight = ($status['elements_in_critical'] / count($elements_to_compare)) * 100;
+
+ if ($aux_weight >= $layoutData['id_layout_linked_weight']) {
+ $status = $status['temp_total'];
+ }
+ else {
+ $status = VISUAL_MAP_STATUS_NORMAL;
+ }
+ }
}
else {
switch ($layoutData["type"]) {
@@ -3367,7 +3386,7 @@ function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter
*
* @return bool The status of the given layout. True if it's OK, false if not.
*/
-function visual_map_get_layout_status ($id_layout = 0, $depth = 0) {
+function visual_map_get_layout_status ($id_layout = 0, $depth = 0, $elements_in_critical = 0, $calculate_weight = false) {
$temp_status = VISUAL_MAP_STATUS_NORMAL;
$temp_total = VISUAL_MAP_STATUS_NORMAL;
$depth++; // For recursion depth checking
@@ -3387,7 +3406,10 @@ function visual_map_get_layout_status ($id_layout = 0, $depth = 0) {
'parent_item',
'id_layout_linked',
'id_agent',
- 'type'));
+ 'type',
+ 'id_layout_linked_weight',
+ 'id',
+ 'id_layout'));
if ($result === false)
return VISUAL_MAP_STATUS_NORMAL;
@@ -3429,12 +3451,29 @@ function visual_map_get_layout_status ($id_layout = 0, $depth = 0) {
// Other Layout (Recursive!)
if (($data["id_layout_linked"] != 0) && ($data["id_agente_modulo"] == 0)) {
- $status = visual_map_get_layout_status($data["id_layout_linked"], $depth);
+ if ($data['id_layout_linked_weight'] > 0) {
+ $calculate_weight_c = true;
+ }
+ else {
+ $calculate_weight_c = false;
+ }
+ $status = visual_map_get_layout_status($data["id_layout_linked"], $depth, 0, $calculate_weight_c);
+
+ $elements_in_child = db_get_all_rows_sql("SELECT id FROM tlayout_data WHERE type = 0 AND id_layout = " . $data['id_layout_linked']);
+ if ($calculate_weight_c) {
+ $aux_weight = ($status['elements_in_critical'] / count($elements_in_child)) * 100;
+
+ if ($aux_weight >= $data['id_layout_linked_weight']) {
+ $status = $status['temp_total'];
+ }
+ else {
+ $status = VISUAL_MAP_STATUS_NORMAL;
+ }
+ }
}
// Module
elseif ($data["id_agente_modulo"] != 0) {
$status = modules_get_agentmodule_status($data["id_agente_modulo"]);
-
}
// Agent
else {
@@ -3448,11 +3487,23 @@ function visual_map_get_layout_status ($id_layout = 0, $depth = 0) {
break;
}
- if ($status == VISUAL_MAP_STATUS_CRITICAL_BAD)
- return VISUAL_MAP_STATUS_CRITICAL_BAD;
+ if ($calculate_weight) {
+ if ($status == VISUAL_MAP_STATUS_CRITICAL_BAD || $status == VISUAL_MAP_STATUS_WARNING) {
+ $elements_in_critical++;
+ }
+ }
+ else {
+ if ($status == VISUAL_MAP_STATUS_CRITICAL_BAD) {
+ return VISUAL_MAP_STATUS_CRITICAL_BAD;
+ }
- if ($status > $temp_total)
+ }
+ if ($status > $temp_total) {
$temp_total = $status;
+ }
+ }
+ if ($calculate_weight) {
+ return array('elements_in_critical' => $elements_in_critical, 'temp_total' => $temp_total);
}
return $temp_total;
diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php
index 513c6ccc32..48f13e3022 100755
--- a/pandora_console/include/functions_visual_map_editor.php
+++ b/pandora_console/include/functions_visual_map_editor.php
@@ -621,11 +621,37 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
WHERE id != ' . $visualConsole_id, 'map_linked', '', '', 'None', '0', true) .
'';
+ $form_items_advance['map_linked_weight'] = array();
+ $form_items_advance['map_linked_weight']['items'] = array('static_graph');
+ $form_items_advance['map_linked_weight']['html'] = '
'.
+ __('Map linked weight') . '
' .
+ '
' . html_print_select(array('10' => '10%',
+ '20' => '20%',
+ '30' => '30%',
+ '40' => '40%',
+ '50' => '50%',
+ '60' => '60%',
+ '70' => '70%',
+ '80' => '80%',
+ '90' => '90%',
+ '100' => '100%'),
+ 'map_linked_weight', '', '', __('By default'), 0, true) .
+ ui_print_help_tip (
+ __("This percentage value specifies the number of items that must be present in the visual
+ console for it to transmit its status to the icon linked here. For example, if 20% is
+ specified and there are five elements in the console, it would be enough if you were in
+ WARNING or CRITICAL to pass that value to the icon. If it were 40%, you would need at
+ least two elements to be in CRITICAL or WARNING to go into that status. If it had one
+ element in critical and another in warning, it would not forward any status to the icon
+ associated with the visual console. If we had three in warning and one in critical,
+ it would only convey the warning status. If there were two in warning and two in critical,
+ it would show the CRITICAL because it is more serious. The same applies to unknown status."), true) .
+ '
".__('Add summatory series')."" .
- ui_print_help_tip (__("This will add a synthetic series to the graph,
- using all series to give a SUM or an average of all present series values
- in each interval. This feature could be used instead synthetic modules
- if you only want to see a graph"), true)."