';
if ($flag_groups === true) {
diff --git a/pandora_console/include/lib/Dashboard/Widgets/tactical.php b/pandora_console/include/lib/Dashboard/Widgets/tactical.php
index bee5f4164c..2003a6facb 100755
--- a/pandora_console/include/lib/Dashboard/Widgets/tactical.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/tactical.php
@@ -160,7 +160,7 @@ class TacticalWidget extends Widget
$this->pmAccess = \users_can_manage_group_all('PM');
// Options.
- $this->values = $this->getOptionsWidget();
+ $this->values = $this->decoders($this->getOptionsWidget());
// Positions.
$this->position = $this->getPositionWidget();
@@ -193,6 +193,43 @@ class TacticalWidget extends Widget
}
+ /**
+ * Decoders hack for retrocompability.
+ *
+ * @param array $decoder Values.
+ *
+ * @return array Returns the values with the correct key.
+ */
+ public function decoders(array $decoder): array
+ {
+ $values = [];
+ // Retrieve global - common inputs.
+ $values = parent::decoders($decoder);
+
+ if (isset($decoder['statusmonitors']) === true) {
+ $values['statusMonitor'] = $decoder['statusmonitors'];
+ }
+
+ if (isset($decoder['statusMonitor']) === true) {
+ $values['statusMonitor'] = $decoder['statusMonitor'];
+ }
+
+ if (isset($decoder['serverperf']) === true) {
+ $values['serverPerformance'] = $decoder['serverperf'];
+ }
+
+ if (isset($decoder['serverPerformance']) === true) {
+ $values['serverPerformance'] = $decoder['serverPerformance'];
+ }
+
+ if (isset($decoder['summary']) === true) {
+ $values['summary'] = $decoder['summary'];
+ }
+
+ return $values;
+ }
+
+
/**
* Generates inputs for form (specific).
*
@@ -366,7 +403,7 @@ class TacticalWidget extends Widget
);
}
- if ($this->values['statusMonitor'] === 1) {
+ if ((int) $this->values['statusMonitor'] === 1) {
$table = new \stdClass();
$table->width = '100%';
@@ -396,7 +433,7 @@ class TacticalWidget extends Widget
$output .= \html_print_table($table, true);
}
- if ($this->values['serverPerformance'] === 1
+ if ((int) $this->values['serverPerformance'] === 1
&& $this->pmAccess === true
) {
$table = new \stdClass();
@@ -414,7 +451,7 @@ class TacticalWidget extends Widget
$output .= \html_print_table($table, true);
}
- if ($this->values['summary'] === 1) {
+ if ((int) $this->values['summary'] === 1) {
$table = new \stdClass();
$table->width = '100%';
$table->class = '';
diff --git a/pandora_console/include/lib/Dashboard/Widgets/top_n.php b/pandora_console/include/lib/Dashboard/Widgets/top_n.php
index a7b8198546..7029b07bad 100644
--- a/pandora_console/include/lib/Dashboard/Widgets/top_n.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/top_n.php
@@ -375,7 +375,7 @@ class TopNWidget extends Widget
}
// This function check ACL.
- $agents = agents_get_group_agents(0, ['aliasRegex' => $agentRegex]);
+ $agents = @agents_get_group_agents(0, ['aliasRegex' => $agentRegex]);
$agentsId = \array_keys($agents);
$agentsIdString = \implode(',', $agentsId);
@@ -414,7 +414,7 @@ class TopNWidget extends Widget
$quantity
);
- $modules = \db_get_all_rows_sql(
+ $modules = @db_get_all_rows_sql(
$sql,
$search_in_history_db
);
@@ -422,7 +422,7 @@ class TopNWidget extends Widget
if (empty($modules) === true) {
$output .= '
';
$output .= \ui_print_info_message(
- __('There are no Agent/Modules defined'),
+ __('There are no agents/modules found matching filter set'),
'',
true
);
diff --git a/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_group.php b/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_group.php
index 10ddfb881a..2acd7f32fa 100644
--- a/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_group.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_group.php
@@ -147,7 +147,7 @@ class TopNEventByGroupWidget extends Widget
$this->gridWidth = $gridWidth;
// Options.
- $this->values = $this->getOptionsWidget();
+ $this->values = $this->decoders($this->getOptionsWidget());
// Positions.
$this->position = $this->getPositionWidget();
@@ -177,6 +177,59 @@ class TopNEventByGroupWidget extends Widget
}
+ /**
+ * Decoders hack for retrocompability.
+ *
+ * @param array $decoder Values.
+ *
+ * @return array Returns the values with the correct key.
+ */
+ public function decoders(array $decoder): array
+ {
+ $values = [];
+ // Retrieve global - common inputs.
+ $values = parent::decoders($decoder);
+
+ if (isset($decoder['amount']) === true) {
+ $values['amountShow'] = $decoder['amount'];
+ }
+
+ if (isset($decoder['amountShow']) === true) {
+ $values['amountShow'] = $decoder['amountShow'];
+ }
+
+ if (isset($decoder['event_view_hr']) === true) {
+ $values['maxHours'] = $decoder['event_view_hr'];
+ }
+
+ if (isset($decoder['maxHours']) === true) {
+ $values['maxHours'] = $decoder['maxHours'];
+ }
+
+ if (isset($decoder['id_groups']) === true) {
+ if (is_array($decoder['id_groups']) === true) {
+ $implode = implode(',', $decoder['id_groups']);
+ $values['groupId'] = [];
+ $values['groupId'][0] = $implode;
+ }
+ }
+
+ if (isset($decoder['groupId']) === true) {
+ $values['groupId'] = $decoder['groupId'];
+ }
+
+ if (isset($decoder['legend_position']) === true) {
+ $values['legendPosition'] = $decoder['legend_position'];
+ }
+
+ if (isset($decoder['legendPosition']) === true) {
+ $values['legendPosition'] = $decoder['legendPosition'];
+ }
+
+ return $values;
+ }
+
+
/**
* Generates inputs for form (specific).
*
@@ -320,8 +373,8 @@ class TopNEventByGroupWidget extends Widget
GROUP BY id_agente
ORDER BY count DESC
LIMIT %d',
- implode(',', $this->values['groupId']),
$timestamp,
+ implode(',', $this->values['groupId']),
$this->values['amountShow']
);
} else {
diff --git a/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_module.php b/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_module.php
index 4d9187bf80..4bbaee22a8 100644
--- a/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_module.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_module.php
@@ -147,7 +147,7 @@ class TopNEventByModuleWidget extends Widget
$this->gridWidth = $gridWidth;
// Options.
- $this->values = $this->getOptionsWidget();
+ $this->values = $this->decoders($this->getOptionsWidget());
// Positions.
$this->position = $this->getPositionWidget();
@@ -177,6 +177,59 @@ class TopNEventByModuleWidget extends Widget
}
+ /**
+ * Decoders hack for retrocompability.
+ *
+ * @param array $decoder Values.
+ *
+ * @return array Returns the values with the correct key.
+ */
+ public function decoders(array $decoder): array
+ {
+ $values = [];
+ // Retrieve global - common inputs.
+ $values = parent::decoders($decoder);
+
+ if (isset($decoder['amount']) === true) {
+ $values['amountShow'] = $decoder['amount'];
+ }
+
+ if (isset($decoder['amountShow']) === true) {
+ $values['amountShow'] = $decoder['amountShow'];
+ }
+
+ if (isset($decoder['event_view_hr']) === true) {
+ $values['maxHours'] = $decoder['event_view_hr'];
+ }
+
+ if (isset($decoder['maxHours']) === true) {
+ $values['maxHours'] = $decoder['maxHours'];
+ }
+
+ if (isset($decoder['id_groups']) === true) {
+ if (is_array($decoder['id_groups']) === true) {
+ $decoder['id_groups'][0] = implode(',', $decoder['id_groups']);
+ }
+
+ $values['groupId'] = $decoder['id_groups'];
+ }
+
+ if (isset($decoder['groupId']) === true) {
+ $values['groupId'] = $decoder['groupId'];
+ }
+
+ if (isset($decoder['legend_position']) === true) {
+ $values['legendPosition'] = $decoder['legend_position'];
+ }
+
+ if (isset($decoder['legendPosition']) === true) {
+ $values['legendPosition'] = $decoder['legendPosition'];
+ }
+
+ return $values;
+ }
+
+
/**
* Generates inputs for form (specific).
*
@@ -311,20 +364,26 @@ class TopNEventByModuleWidget extends Widget
if ($all_group === false) {
$sql = sprintf(
- 'SELECT id_agentmodule, COUNT(*) AS count
+ 'SELECT id_agente,
+ id_agentmodule,
+ event_type,
+ COUNT(*) AS count
FROM tevento
WHERE utimestamp >= %d
AND id_grupo IN (%s)
GROUP BY id_agentmodule, event_type
ORDER BY count DESC
LIMIT %d',
- implode(',', $this->values['groupId']),
$timestamp,
+ implode(',', $this->values['groupId']),
$this->values['amountShow']
);
} else {
$sql = sprintf(
- 'SELECT id_agentmodule, COUNT(*) AS count
+ 'SELECT id_agente,
+ id_agentmodule,
+ event_type,
+ COUNT(*) AS count
FROM tevento
WHERE utimestamp >= %d
GROUP BY id_agentmodule, event_type
@@ -353,8 +412,9 @@ class TopNEventByModuleWidget extends Widget
$name = __('System');
} else {
$name_agent = io_safe_output(
- agents_get_alias($row['id_agentmodule'])
+ agents_get_alias($row['id_agente'])
);
+
$name_module = io_safe_output(
modules_get_agentmodule_name($row['id_agentmodule'])
);
diff --git a/pandora_console/include/lib/Dashboard/Widgets/tree_view.php b/pandora_console/include/lib/Dashboard/Widgets/tree_view.php
index 9176bec9ef..994cceac73 100644
--- a/pandora_console/include/lib/Dashboard/Widgets/tree_view.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/tree_view.php
@@ -155,7 +155,7 @@ class TreeViewWidget extends Widget
$this->cellId = $cellId;
// Options.
- $this->values = $this->getOptionsWidget();
+ $this->values = $this->decoders($this->getOptionsWidget());
// Positions.
$this->position = $this->getPositionWidget();
@@ -177,14 +177,136 @@ class TreeViewWidget extends Widget
// This forces at least a first configuration.
$this->configurationRequired = false;
- if (isset($this->values['groupId']) === false) {
- $this->configurationRequired = true;
- }
$this->overflow_scrollbars = false;
}
+ /**
+ * Decoders hack for retrocompability.
+ *
+ * @param array $decoder Values.
+ *
+ * @return array Returns the values with the correct key.
+ */
+ public function decoders(array $decoder): array
+ {
+ $values = [];
+ // Retrieve global - common inputs.
+ $values = parent::decoders($decoder);
+
+ if (isset($decoder['tab']) === true) {
+ $values['typeTree'] = $decoder['tab'];
+ }
+
+ if (isset($decoder['typeTree']) === true) {
+ $values['typeTree'] = $decoder['typeTree'];
+ }
+
+ if (isset($decoder['search_group']) === true) {
+ $values['groupId'] = $decoder['search_group'];
+ }
+
+ if (isset($decoder['groupId']) === true) {
+ $values['groupId'] = $decoder['groupId'];
+ }
+
+ if (isset($decoder['open_all_nodes']) === true) {
+ $values['openAllGroups'] = $decoder['open_all_nodes'];
+ }
+
+ if (isset($decoder['openAllGroups']) === true) {
+ $values['openAllGroups'] = $decoder['openAllGroups'];
+ }
+
+ if (isset($decoder['status_agent']) === true) {
+ switch ((int) $decoder['status_agent']) {
+ case 0:
+ $values['agentStatus'] = AGENT_STATUS_NORMAL;
+ break;
+
+ case 1:
+ $values['agentStatus'] = AGENT_STATUS_CRITICAL;
+ break;
+
+ case 2:
+ $values['agentStatus'] = AGENT_STATUS_WARNING;
+ break;
+
+ case 3:
+ $values['agentStatus'] = AGENT_STATUS_UNKNOWN;
+ break;
+
+ case 5:
+ $values['agentStatus'] = AGENT_STATUS_NOT_INIT;
+ break;
+
+ default:
+ case -1:
+ $values['agentStatus'] = AGENT_STATUS_ALL;
+ break;
+ }
+ }
+
+ if (isset($decoder['agentStatus']) === true) {
+ $values['agentStatus'] = $decoder['agentStatus'];
+ }
+
+ if (isset($decoder['search_agent']) === true) {
+ $values['filterAgent'] = $decoder['search_agent'];
+ }
+
+ if (isset($decoder['filterAgent']) === true) {
+ $values['filterAgent'] = $decoder['filterAgent'];
+ }
+
+ if (isset($decoder['status_module']) === true) {
+ switch ((int) $decoder['status_module']) {
+ case 0:
+ $values['moduleStatus'] = AGENT_MODULE_STATUS_NORMAL;
+ break;
+
+ case 1:
+ $values['moduleStatus'] = AGENT_MODULE_STATUS_CRITICAL_BAD;
+ break;
+
+ case 2:
+ $values['moduleStatus'] = AGENT_MODULE_STATUS_WARNING;
+ break;
+
+ case 3:
+ $values['moduleStatus'] = AGENT_MODULE_STATUS_UNKNOWN;
+ break;
+
+ case 5:
+ $values['moduleStatus'] = AGENT_MODULE_STATUS_NOT_INIT;
+ break;
+
+ default:
+ case -1:
+ $values['moduleStatus'] = -1;
+ break;
+ }
+
+ $values['moduleStatus'] = $decoder['status_module'];
+ }
+
+ if (isset($decoder['moduleStatus']) === true) {
+ $values['moduleStatus'] = $decoder['moduleStatus'];
+ }
+
+ if (isset($decoder['search_module']) === true) {
+ $values['filterModule'] = $decoder['search_module'];
+ }
+
+ if (isset($decoder['filterModule']) === true) {
+ $values['filterModule'] = $decoder['filterModule'];
+ }
+
+ return $values;
+ }
+
+
/**
* Generates inputs for form (specific).
*
diff --git a/pandora_console/include/lib/Dashboard/Widgets/url.php b/pandora_console/include/lib/Dashboard/Widgets/url.php
index 70a841a9fd..4259f1abb1 100644
--- a/pandora_console/include/lib/Dashboard/Widgets/url.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/url.php
@@ -142,7 +142,7 @@ class UrlWidget extends Widget
$this->gridWidth = $gridWidth;
// Options.
- $this->values = $this->getOptionsWidget();
+ $this->values = $this->decoders($this->getOptionsWidget());
// Positions.
$this->position = $this->getPositionWidget();
@@ -172,6 +172,31 @@ class UrlWidget extends Widget
}
+ /**
+ * Decoders hack for retrocompability.
+ *
+ * @param array $decoder Values.
+ *
+ * @return array Returns the values with the correct key.
+ */
+ public function decoders(array $decoder): array
+ {
+ $values = [];
+ // Retrieve global - common inputs.
+ $values = parent::decoders($decoder);
+
+ if (isset($decoder['url']) === true) {
+ $values['urlText'] = $decoder['url'];
+ }
+
+ if (isset($decoder['urlText']) === true) {
+ $values['urlText'] = $decoder['urlText'];
+ }
+
+ return $values;
+ }
+
+
/**
* Generates inputs for form (specific).
*
diff --git a/pandora_console/include/lib/Dashboard/Widgets/wux_transaction.php b/pandora_console/include/lib/Dashboard/Widgets/wux_transaction.php
index 92de8445e2..47c002f2ad 100644
--- a/pandora_console/include/lib/Dashboard/Widgets/wux_transaction.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/wux_transaction.php
@@ -106,6 +106,13 @@ class WuxWidget extends Widget
*/
protected $gridWidth;
+ /**
+ * Cell ID.
+ *
+ * @var integer
+ */
+ protected $cellId;
+
/**
* Construct.
@@ -142,8 +149,11 @@ class WuxWidget extends Widget
// Grid Width.
$this->gridWidth = $gridWidth;
+ // Cell Id.
+ $this->cellId = $cellId;
+
// Options.
- $this->values = $this->getOptionsWidget();
+ $this->values = $this->decoders($this->getOptionsWidget());
// Positions.
$this->position = $this->getPositionWidget();
@@ -173,6 +183,43 @@ class WuxWidget extends Widget
}
+ /**
+ * Decoders hack for retrocompability.
+ *
+ * @param array $decoder Values.
+ *
+ * @return array Returns the values with the correct key.
+ */
+ public function decoders(array $decoder): array
+ {
+ $values = [];
+ // Retrieve global - common inputs.
+ $values = parent::decoders($decoder);
+
+ if (isset($decoder['id_agent_'.$this->cellId]) === true) {
+ $values['agentId'] = $decoder['id_agent_'.$this->cellId];
+ }
+
+ if (isset($decoder['agentId']) === true) {
+ $values['agentId'] = $decoder['agentId'];
+ }
+
+ if (isset($decoder['metaconsoleId']) === true) {
+ $values['metaconsoleId'] = $decoder['metaconsoleId'];
+ }
+
+ if (isset($decoder['wux_transaction_'.$this->cellId]) === true) {
+ $values['transactionId'] = $decoder['wux_transaction_'.$this->cellId];
+ }
+
+ if (isset($decoder['transactionId']) === true) {
+ $values['transactionId'] = $decoder['transactionId'];
+ }
+
+ return $values;
+ }
+
+
/**
* Generates inputs for form (specific).
*
diff --git a/pandora_console/include/lib/Dashboard/Widgets/wux_transaction_stats.php b/pandora_console/include/lib/Dashboard/Widgets/wux_transaction_stats.php
index 25b4270715..49187dcb05 100644
--- a/pandora_console/include/lib/Dashboard/Widgets/wux_transaction_stats.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/wux_transaction_stats.php
@@ -154,7 +154,7 @@ class WuxStatsWidget extends Widget
$this->cellId = $cellId;
// Options.
- $this->values = $this->getOptionsWidget();
+ $this->values = $this->decoders($this->getOptionsWidget());
// Positions.
$this->position = $this->getPositionWidget();
@@ -184,6 +184,51 @@ class WuxStatsWidget extends Widget
}
+ /**
+ * Decoders hack for retrocompability.
+ *
+ * @param array $decoder Values.
+ *
+ * @return array Returns the values with the correct key.
+ */
+ public function decoders(array $decoder): array
+ {
+ $values = [];
+ // Retrieve global - common inputs.
+ $values = parent::decoders($decoder);
+
+ if (isset($decoder['id_agent_'.$this->cellId]) === true) {
+ $values['agentId'] = $decoder['id_agent_'.$this->cellId];
+ }
+
+ if (isset($decoder['agentId']) === true) {
+ $values['agentId'] = $decoder['agentId'];
+ }
+
+ if (isset($decoder['metaconsoleId']) === true) {
+ $values['metaconsoleId'] = $decoder['metaconsoleId'];
+ }
+
+ if (isset($decoder['wux_transaction_'.$this->cellId]) === true) {
+ $values['transactionId'] = $decoder['wux_transaction_'.$this->cellId];
+ }
+
+ if (isset($decoder['transactionId']) === true) {
+ $values['transactionId'] = $decoder['transactionId'];
+ }
+
+ if (isset($decoder['view_all_stats']) === true) {
+ $values['allStats'] = $decoder['view_all_stats'];
+ }
+
+ if (isset($decoder['allStats']) === true) {
+ $values['allStats'] = $decoder['allStats'];
+ }
+
+ return $values;
+ }
+
+
/**
* Generates inputs for form (specific).
*
diff --git a/pandora_console/include/styles/dashboards.css b/pandora_console/include/styles/dashboards.css
index 0db5cd6cb3..f3b41ccb2c 100644
--- a/pandora_console/include/styles/dashboards.css
+++ b/pandora_console/include/styles/dashboards.css
@@ -487,3 +487,7 @@ div#main_pure {
.info_box tbody tr td.icon {
padding-right: 10px !important;
}
+
+.content-widget .databox.filters > tbody > tr > td {
+ padding-right: 30px;
+}
diff --git a/pandora_console/install.php b/pandora_console/install.php
index fdec4bda99..dab768e0c2 100644
--- a/pandora_console/install.php
+++ b/pandora_console/install.php
@@ -129,7 +129,7 @@
".html_print_button(
var first_time = true;
$(document).ready(function() {
+ confirmDialog({
+ title: "Attention",
+ message:
+ "
This feature will be removed from the console in the next version of Pandora FMS.
If you want to keep the history, make a backup.
",
+ cancel: "Cancel",
+ ok: "Ok",
+ onAccept: function() {
+ // Nothing to do.
+ }
+ });
$("input[name=\"message_box\"]").keydown(function(e) {
//Enter key.
if (e.keyCode == 13) {
diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec
index b47fb7aee4..0edbdbe385 100644
--- a/pandora_console/pandora_console.redhat.spec
+++ b/pandora_console/pandora_console.redhat.spec
@@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.745
-%define release 200427
+%define release 200430
# User and Group under which Apache is running
%define httpd_name httpd
diff --git a/pandora_console/pandora_console.rhel7.spec b/pandora_console/pandora_console.rhel7.spec
index 2ca315c8eb..5b75665fa8 100644
--- a/pandora_console/pandora_console.rhel7.spec
+++ b/pandora_console/pandora_console.rhel7.spec
@@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.745
-%define release 200427
+%define release 200430
# User and Group under which Apache is running
%define httpd_name httpd
diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec
index 2837ac9af6..5fbbede06d 100644
--- a/pandora_console/pandora_console.spec
+++ b/pandora_console/pandora_console.spec
@@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.745
-%define release 200427
+%define release 200430
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2
diff --git a/pandora_console/views/dashboard/cell.php b/pandora_console/views/dashboard/cell.php
index ab7a9c4457..bdba1fffe9 100644
--- a/pandora_console/views/dashboard/cell.php
+++ b/pandora_console/views/dashboard/cell.php
@@ -34,6 +34,7 @@ if ($redraw === false) {
$output .= '