diff --git a/pandora_agents/pc/Win32/pandora_agent.conf b/pandora_agents/pc/Win32/pandora_agent.conf
index e90b28cb63..edf5a7847a 100644
--- a/pandora_agents/pc/Win32/pandora_agent.conf
+++ b/pandora_agents/pc/Win32/pandora_agent.conf
@@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2023 Pandora FMS
-# Version 7.0NG.773.3
+# Version 7.0NG.773.3
# This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software
# Foundation; either version 2 of the Licence or any later version
diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control
index fa007e26c5..8a0a4c6858 100644
--- a/pandora_agents/unix/DEBIAN/control
+++ b/pandora_agents/unix/DEBIAN/control
@@ -1,5 +1,5 @@
package: pandorafms-agent-unix
-Version: 7.0NG.773.3-230905
+Version: 7.0NG.773.3-230906
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 0e1ee31b9c..4a39e9db11 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.773.3-230905"
+pandora_version="7.0NG.773.3-230906"
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 8a1fa430db..f794d4e871 100755
--- a/pandora_agents/unix/pandora_agent
+++ b/pandora_agents/unix/pandora_agent
@@ -1031,7 +1031,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.773.3';
-use constant AGENT_BUILD => '230905';
+use constant AGENT_BUILD => '230906';
# 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 08a167c305..60257077ee 100644
--- a/pandora_agents/unix/pandora_agent.redhat.spec
+++ b/pandora_agents/unix/pandora_agent.redhat.spec
@@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.773.3
-%define release 230905
+%define release 230906
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}
diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.spec b/pandora_agents/unix/pandora_agent.redhat_bin.spec
index adf2c178a3..b4bf9ffbab 100644
--- a/pandora_agents/unix/pandora_agent.redhat_bin.spec
+++ b/pandora_agents/unix/pandora_agent.redhat_bin.spec
@@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.773.3
-%define release 230905
+%define release 230906
Summary: Pandora FMS Linux agent, binary version
Name: %{name}
diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec
index 54e969e6f4..feba268ab9 100644
--- a/pandora_agents/unix/pandora_agent.spec
+++ b/pandora_agents/unix/pandora_agent.spec
@@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.773.3
-%define release 230905
+%define release 230906
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 51fc2f84c5..ae7a7abbee 100755
--- a/pandora_agents/unix/pandora_agent_installer
+++ b/pandora_agents/unix/pandora_agent_installer
@@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.773.3"
-PI_BUILD="230905"
+PI_BUILD="230906"
OS_NAME=`uname -s`
FORCE=0
diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi
index cf781ede3c..6eafb3e1e7 100644
--- a/pandora_agents/win32/installer/pandora.mpi
+++ b/pandora_agents/win32/installer/pandora.mpi
@@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
-{230905}
+{230906}
ViewReadme
{Yes}
diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc
index f1b6c611df..ed8662a8b8 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.773.3 Build 230905")
+#define PANDORA_VERSION ("7.0NG.773.3 Build 230906")
string pandora_path;
string pandora_dir;
diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc
index 93923f6e30..7be40eb488 100644
--- a/pandora_agents/win32/versioninfo.rc
+++ b/pandora_agents/win32/versioninfo.rc
@@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Pandora FMS"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
- VALUE "ProductVersion", "(7.0NG.773.3(Build 230905))"
+ VALUE "ProductVersion", "(7.0NG.773.3(Build 230906))"
VALUE "FileVersion", "1.0.0.0"
END
END
diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control
index d4b0f6563f..eab9ac19cb 100644
--- a/pandora_console/DEBIAN/control
+++ b/pandora_console/DEBIAN/control
@@ -1,5 +1,5 @@
package: pandorafms-console
-Version: 7.0NG.773.3-230905
+Version: 7.0NG.773.3-230906
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 a2037000f0..1a7d9a4406 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.773.3-230905"
+pandora_version="7.0NG.773.3-230906"
package_pear=0
package_pandora=1
diff --git a/pandora_console/images/widgets/inventory.png b/pandora_console/images/widgets/inventory.png
new file mode 100644
index 0000000000..9d3b198b7c
Binary files /dev/null and b/pandora_console/images/widgets/inventory.png differ
diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php
index 921a1e1bc0..1e529c487c 100755
--- a/pandora_console/include/ajax/module.php
+++ b/pandora_console/include/ajax/module.php
@@ -1486,27 +1486,53 @@ if (check_login()) {
metaconsole_connect($server);
}
- if ($params['histogram'] === true) {
- $params['id_agent_module'] = $params['agent_module_id'];
- $params['dinamic_proc'] = 1;
+ if ($params['enable_projected_period'] === '1') {
+ $params_graphic = [
+ 'period' => $params['period'],
+ 'date' => strtotime(date('Y-m-d H:i:s')),
+ 'only_image' => false,
+ 'homeurl' => ui_get_full_url(false, false, false, false).'/',
+ 'ttl' => false,
+ 'height' => $config['graph_image_height'],
+ 'landscape' => $content['landscape'],
+ 'return_img_base_64' => true,
+ ];
+ $params_combined = [
+ 'projection' => $params['period_projected'],
+ ];
+
+ $return['chart'] = graphic_combined_module(
+ [$params['agent_module_id']],
+ $params_graphic,
+ $params_combined
+ );
$output .= '
';
- if ($params['compare'] === 'separated') {
+ $output .= $return['chart'];
+ $output .= '
';
+ } else {
+ if ($params['histogram'] === true) {
+ $params['id_agent_module'] = $params['agent_module_id'];
+ $params['dinamic_proc'] = 1;
+
+ $output .= '';
+ if ($params['compare'] === 'separated') {
+ $graph = \reporting_module_histogram_graph(
+ ['datetime' => ($params['begin_date'] - $params['period'])],
+ $params
+ );
+ $output .= $graph['chart'];
+ }
+
$graph = \reporting_module_histogram_graph(
- ['datetime' => ($params['begin_date'] - $params['period'])],
+ ['datetime' => $params['begin_date']],
$params
);
$output .= $graph['chart'];
+ $output .= '
';
+ } else {
+ $output .= grafico_modulo_sparse($params);
}
-
- $graph = \reporting_module_histogram_graph(
- ['datetime' => $params['begin_date']],
- $params
- );
- $output .= $graph['chart'];
- $output .= '';
- } else {
- $output .= grafico_modulo_sparse($params);
}
if (is_metaconsole() === true && empty($server_id) === false) {
diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php
index d7b7fba714..b7ddd509b8 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 = 'PC230905';
+$build_version = 'PC230906';
$pandora_version = 'v7.0NG.773.3';
// Do not overwrite default timezone set if defined.
diff --git a/pandora_console/include/functions_menu.php b/pandora_console/include/functions_menu.php
index 614c0df43e..a1927bb60a 100644
--- a/pandora_console/include/functions_menu.php
+++ b/pandora_console/include/functions_menu.php
@@ -143,6 +143,10 @@ function menu_print_menu(&$menu)
if (empty($new_msg) === false) {
$sec2 = 'operation/messages/message_edit&new_msg='.$new_msg;
}
+ } else if ($sec2 === 'enterprise/godmode/servers/credential_boxes_satellite'
+ || $sec2 === 'enterprise/godmode/servers/manage_credential_boxes'
+ ) {
+ $sec2 = 'enterprise/godmode/servers/list_satellite';
} else {
$sec2 = (string) get_parameter('sec2');
}
diff --git a/pandora_console/include/javascript/pandora_dashboards.js b/pandora_console/include/javascript/pandora_dashboards.js
index 14704b3dca..79fde538b4 100644
--- a/pandora_console/include/javascript/pandora_dashboards.js
+++ b/pandora_console/include/javascript/pandora_dashboards.js
@@ -1613,3 +1613,12 @@ function type_change() {
break;
}
}
+
+// Show/Hide period for projection on agent module graph.
+function show_projection_period() {
+ if ($("#projection_switch").is(":checked")) {
+ $("#div_projection_period").show();
+ } else {
+ $("#div_projection_period").hide();
+ }
+}
diff --git a/pandora_console/include/lib/Dashboard/Widget.php b/pandora_console/include/lib/Dashboard/Widget.php
index b9364fcd31..9bedc71f50 100644
--- a/pandora_console/include/lib/Dashboard/Widget.php
+++ b/pandora_console/include/lib/Dashboard/Widget.php
@@ -416,6 +416,10 @@ class Widget
$className .= '\WuxWidget';
break;
+ case 'inventory':
+ $className .= '\InventoryWidget';
+ break;
+
case 'os_quick_report':
$className .= '\OsQuickReportWidget';
break;
diff --git a/pandora_console/include/lib/Dashboard/Widgets/inventory.php b/pandora_console/include/lib/Dashboard/Widgets/inventory.php
new file mode 100644
index 0000000000..67e527dcf0
--- /dev/null
+++ b/pandora_console/include/lib/Dashboard/Widgets/inventory.php
@@ -0,0 +1,1270 @@
+width = $width;
+
+ // Height.
+ $this->height = $height;
+
+ // Grid Width.
+ $this->gridWidth = $gridWidth;
+
+ // Cell Id.
+ $this->cellId = $cellId;
+
+ // Options.
+ $this->values = $this->decoders($this->getOptionsWidget());
+
+ // Positions.
+ $this->position = $this->getPositionWidget();
+
+ // Page.
+ $this->page = basename(__FILE__);
+
+ // ClassName.
+ $class = new \ReflectionClass($this);
+ $this->className = $class->getShortName();
+
+ // Title.
+ $this->title = __('Inventory');
+
+ // Name.
+ if (empty($this->name) === true) {
+ $this->name = 'inventory';
+ }
+
+ // Must be configured before using.
+ $this->configurationRequired = 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['agentId']) === true) {
+ $values['agentId'] = $decoder['agentId'];
+ }
+
+ if (isset($decoder['agentAlias']) === true) {
+ $values['agentAlias'] = $decoder['agentAlias'];
+ }
+
+ if (isset($decoder['metaconsoleId']) === true) {
+ $values['metaconsoleId'] = $decoder['metaconsoleId'];
+ }
+
+ if (isset($decoder['inventoryModuleId']) === true) {
+ $values['inventoryModuleId'] = $decoder['inventoryModuleId'];
+ }
+
+ if (isset($decoder['freeSearch']) === true) {
+ $values['freeSearch'] = $decoder['freeSearch'];
+ }
+
+ if (isset($decoder['orderByAgent']) === true) {
+ $values['orderByAgent'] = $decoder['orderByAgent'];
+ }
+
+ if (isset($decoder['idGroup']) === true) {
+ $values['idGroup'] = $decoder['idGroup'];
+ }
+
+ if (isset($decoder['utimestamp']) === true) {
+ $values['utimestamp'] = $decoder['utimestamp'];
+ }
+
+ return $values;
+ }
+
+
+ /**
+ * Generates inputs for form (specific).
+ *
+ * @return array Of inputs.
+ *
+ * @throws Exception On error.
+ */
+ public function getFormInputs(): array
+ {
+ $values = $this->values;
+
+ // Retrieve global - common inputs.
+ $inputs = parent::getFormInputs();
+
+ // Format Data.
+ $inputs[] = [
+ 'label' => __('Order by agent'),
+ 'arguments' => [
+ 'name' => 'order_by_agent',
+ 'type' => 'switch',
+ 'value' => $values['orderByAgent'],
+ ],
+ ];
+
+ $inputs[] = [
+ 'label' => __('Free search'),
+ 'arguments' => [
+ 'name' => 'free_search',
+ 'type' => 'text',
+ 'class' => 'w100p',
+ 'input_class' => 'flex-row',
+ 'value' => $values['freeSearch'],
+ 'return' => true,
+ ],
+ ];
+
+ $inputs[] = [
+ 'label' => __('Group'),
+ 'arguments' => [
+ 'type' => 'select_groups',
+ 'privilege' => 'AR',
+ 'name' => 'id_group',
+ 'selected' => $values['idGroup'],
+ 'nothing_value' => __('All'),
+ 'return' => true,
+ 'multiple' => false,
+ ],
+ ];
+
+ $inputs[] = [
+ 'label' => __('Agent'),
+ 'arguments' => [
+ 'type' => 'autocomplete_agent',
+ 'name' => 'agentAlias',
+ 'id_agent_hidden' => $values['agentId'],
+ 'name_agent_hidden' => 'agentId',
+ 'server_id_hidden' => $values['metaconsoleId'],
+ 'name_server_hidden' => 'metaconsoleId',
+ 'return' => true,
+ 'module_input' => true,
+ 'module_name' => 'moduleId',
+ 'module_none' => false,
+ 'size' => 0,
+ ],
+ ];
+
+ $fields = [];
+
+ array_unshift($fields, __('All'));
+
+ $inputs[] = [
+ 'label' => __('Module'),
+ 'arguments' => [
+ 'name' => 'module_inventory',
+ 'id' => 'module_inventory',
+ 'input_class' => 'flex-row',
+ 'type' => 'select',
+ 'selected' => io_safe_output($values['inventoryModuleId']),
+ 'nothing' => __('Basic info'),
+ 'nothing_value' => 'basic',
+ 'fields' => $fields,
+ 'class' => '',
+ 'return' => true,
+ 'sort' => true,
+ ],
+ ];
+
+ // Agent select.
+ if ($is_metaconsole === false) {
+ $agents = [];
+ $sql = 'SELECT id_agente, nombre FROM tagente';
+ if ($inventory_id_group > 0) {
+ $sql .= ' WHERE id_grupo = '.$inventory_id_group;
+ } else {
+ $user_groups = implode(',', array_keys(users_get_groups($config['id_user'])));
+
+ // Avoid errors if there are no groups.
+ if (empty($user_groups) === true) {
+ $user_groups = '"0"';
+ }
+
+ $sql .= ' WHERE id_grupo IN ('.$user_groups.')';
+ }
+
+ $result = db_get_all_rows_sql($sql);
+ if ($result) {
+ foreach ($result as $row) {
+ $agents[$row['id_agente']] = $row['nombre'];
+ }
+ }
+ }
+
+ // Date filter.
+ if (is_metaconsole() === false) {
+ $inputs[] = [
+ 'label' => \__('Date'),
+ 'arguments' => [
+ 'type' => 'select',
+ 'fields' => [],
+ 'name' => 'utimestamp',
+ 'selected' => $values['utimestamp'],
+ 'return' => true,
+ 'nothing' => \__('Last'),
+ 'nothing_value' => 0,
+ 'class' => 'fullwidth',
+ ],
+ ];
+ }
+
+ return $inputs;
+ }
+
+
+ /**
+ * Get Post for widget.
+ *
+ * @return array
+ */
+ public function getPost():array
+ {
+ // Retrieve global - common inputs.
+ $values = parent::getPost();
+
+ $values['agentId'] = (int) \get_parameter('agentId', 0);
+ $values['metaconsoleId'] = (int) \get_parameter('metaconsoleId', 0);
+ $values['inventoryModuleId'] = io_safe_output(\get_parameter('module_inventory', 'basic'));
+ $values['agentAlias'] = \get_parameter('agentAlias', '');
+ $values['freeSearch'] = (string) \get_parameter('free_search', '');
+ $values['orderByAgent'] = \get_parameter('order_by_agent', 0);
+ $values['idGroup'] = \get_parameter('id_group', 0);
+ $values['utimestamp'] = (int) get_parameter('utimestamp');
+
+ return $values;
+ }
+
+
+ /**
+ * Draw widget.
+ *
+ * @return string;
+ */
+ public function load()
+ {
+ global $config;
+
+ $inventory_id_agent = $this->values['agentId'];
+ $inventory_agent = $this->values['agentAlias'];
+
+ if (strlen($inventory_agent) === 0) {
+ $inventory_id_agent = -1;
+ $inventory_agent = __('All');
+ } else if ($inventory_agent == __('All')) {
+ $inventory_id_agent = 0;
+ }
+
+ $inventory_module = io_safe_input($this->values['inventoryModuleId']);
+
+ $inventory_id_group = (int) $this->values['idGroup'];
+ $inventory_search_string = (string) $this->values['freeSearch'];
+ $order_by_agent = (bool) $this->values['orderByAgent'];
+ $utimestamp = (int) $this->values['utimestamp'];
+
+ $pagination_url_parameters = [
+ 'inventory_id_agent' => $inventory_id_agent,
+ 'inventory_agent' => $inventory_agent,
+ 'inventory_id_group' => $inventory_id_group,
+ ];
+
+ $noFilterSelected = false;
+
+ // Get variables.
+ if (is_metaconsole() === true) {
+ $nodes_connection = metaconsole_get_connections();
+ $id_server = (int) $this->values['metaconsoleId'];
+
+ $pagination_url_parameters['id_server'] = $id_server;
+
+ if ($inventory_id_agent > 0) {
+ $inventory_id_server = (int) get_parameter('id_server_agent', -1);
+ $pagination_url_parameters['inventory_id_server'] = $inventory_id_server;
+
+ if ($inventory_id_server !== -1) {
+ $id_server = $inventory_id_server;
+ $pagination_url_parameters['id_server'] = $id_server;
+ }
+ }
+
+ // No filter selected.
+ $noFilterSelected = $inventory_id_agent === -1 && $inventory_id_group === 0 && $id_server === 0;
+
+ $nodo_image_url = $config['homeurl'].'/images/node.png';
+ if ($id_server > 0) {
+ $connection = metaconsole_get_connection_by_id($id_server);
+ $agents_node = metaconsole_get_agents_servers($connection['server_name'], $inventory_id_group);
+ $node = metaconsole_get_servers($id_server);
+ $nodos = [];
+
+ if (metaconsole_connect($connection) !== NOERR) {
+ ui_print_error_message(
+ __('There was a problem connecting with the node')
+ );
+ }
+
+ $sql = 'SELECT DISTINCT name as indexname, name
+ FROM tmodule_inventory, tagent_module_inventory
+ WHERE tmodule_inventory.id_module_inventory = tagent_module_inventory.id_module_inventory';
+
+ if ($inventory_id_agent > 0) {
+ $sql .= ' AND id_agente = '.$inventory_id_agent;
+ $agents_node = [$inventory_id_agent => $inventory_id_agent];
+ }
+
+ $result_module = db_get_all_rows_sql($sql);
+ // Get the data.
+ $rows_meta = inventory_get_datatable(
+ array_keys($agents_node),
+ $inventory_module,
+ $utimestamp,
+ $inventory_search_string,
+ false,
+ false,
+ $order_by_agent,
+ $server,
+ $pagination_url_parameters
+ );
+
+ $data_tmp['server_name'] = $connection['server_name'];
+ $data_tmp['dbhost'] = $connection['dbhost'];
+ $data_tmp['server_uid'] = $connection['server_uid'];
+ $data_tmp['data'] = $rows_meta;
+
+ $nodos[$connection['id']] = $data_tmp;
+ if ($result_data !== ERR_NODATA) {
+ $inventory_data .= $result_data;
+ }
+
+ // Restore db connection.
+ metaconsole_restore_db();
+ } else {
+ $result_module = [];
+ $nodos = [];
+ foreach ($nodes_connection as $key => $server) {
+ $agents_node = metaconsole_get_agents_servers($server['server_name'], $inventory_id_group);
+ $connection = metaconsole_get_connection($server['server_name']);
+ if (metaconsole_connect($connection) !== NOERR) {
+ continue;
+ }
+
+ $sql = 'SELECT DISTINCT name as indexname, name
+ FROM tmodule_inventory, tagent_module_inventory
+ WHERE tmodule_inventory.id_module_inventory = tagent_module_inventory.id_module_inventory';
+ if ($inventory_id_agent > 0) {
+ $sql .= ' AND id_agente = '.$inventory_id_agent;
+ $agents_node = [$inventory_id_agent => $inventory_id_agent];
+ }
+
+ $result = db_get_all_rows_sql($sql);
+ if ($result !== false) {
+ $result_module = array_merge($result_module, $result);
+ // Get the data.
+ $rows_meta = inventory_get_datatable(
+ array_keys($agents_node),
+ $inventory_module,
+ $utimestamp,
+ $inventory_search_string,
+ false,
+ false,
+ $order_by_agent,
+ $server,
+ $pagination_url_parameters
+ );
+
+ $data_tmp['server_name'] = $server['server_name'];
+ $data_tmp['dbhost'] = $server['dbhost'];
+ $data_tmp['server_uid'] = $server['server_uid'];
+ $data_tmp['data'] = $rows_meta;
+ $nodos[$server['id']] = $data_tmp;
+ if ($result_data !== ERR_NODATA) {
+ $inventory_data .= $result_data;
+ }
+ }
+
+ // Restore db connection.
+ metaconsole_restore_db();
+ }
+ }
+
+ $fields = [];
+ foreach ($result_module as $row) {
+ $id = array_shift($row);
+ $value = array_shift($row);
+ $fields[$id] = $value;
+ }
+ }
+
+ // Agent select.
+ if (is_metaconsole() === false) {
+ $agents = [];
+ $sql = 'SELECT id_agente, nombre FROM tagente';
+ if ($inventory_id_group > 0) {
+ $sql .= ' WHERE id_grupo = '.$inventory_id_group;
+ } else {
+ $user_groups = implode(',', array_keys(users_get_groups($config['id_user'])));
+
+ // Avoid errors if there are no groups.
+ if (empty($user_groups) === true) {
+ $user_groups = '"0"';
+ }
+
+ $sql .= ' WHERE id_grupo IN ('.$user_groups.')';
+ }
+
+ $result = db_get_all_rows_sql($sql);
+ if ($result) {
+ foreach ($result as $row) {
+ $agents[$row['id_agente']] = $row['nombre'];
+ }
+ }
+ }
+
+ $filteringFunction = '';
+ if ($inventory_module !== 'basic') {
+ if (is_metaconsole() === true) {
+ if ($order_by_agent === true) {
+ $count_nodos_tmp = [];
+ foreach ($nodos as $count_value) {
+ array_push($count_nodos_tmp, $count_value['server_name']);
+ }
+
+ $count = array_count_values($count_nodos_tmp);
+
+ foreach ($nodos as $nodo) {
+ $agents = '';
+
+ foreach ($nodo['data'] as $agent_rows) {
+ $modules = '';
+
+ foreach ($agent_rows['row'] as $key => $row) {
+ $columns = explode(';', io_safe_output($row['data_format']));
+ array_push($columns, 'Timestamp');
+ $data = [];
+ $data_rows = explode(PHP_EOL, $row['data']);
+ foreach ($data_rows as $data_row) {
+ // Exclude results don't match filter.
+ if ($inventory_search_string && preg_match('/'.io_safe_output($inventory_search_string).'/', ($data_row)) == 0) {
+ continue;
+ }
+
+ $column_data = explode(';', io_safe_output($data_row));
+
+ if ($column_data[0] !== '') {
+ $row_tmp = [];
+ foreach ($column_data as $key => $value) {
+ $row_tmp[$columns[$key]] = $value;
+ }
+
+ $row_tmp['Timestamp'] = $row['timestamp'];
+ array_push($data, (object) $row_tmp);
+ }
+ }
+
+ $id_table = 'id_'.$row['id_module_inventory'].'_'.$nodo['server_uid'];
+ $table = ui_print_datatable(
+ [
+ 'id' => $id_table,
+ 'class' => 'info_table w100p',
+ 'style' => 'width: 100%',
+ 'columns' => $columns,
+ 'column_names' => $columns,
+ 'no_sortable_columns' => [],
+ 'data_element' => $data,
+ 'searching' => true,
+ 'dom_elements' => 'frtilp',
+ 'order' => [
+ 'field' => $columns[0],
+ 'direction' => 'asc',
+ ],
+ 'zeroRecords' => __('No inventory found'),
+ 'emptyTable' => __('No inventory found'),
+ 'return' => true,
+ 'no_sortable_columns' => [-1],
+ 'csv' => 0,
+ 'mini_pagination' => true,
+ 'mini_search' => true,
+ ]
+ );
+
+ $modules .= ui_toggle(
+ $table,
+ ''.$row['name'].'',
+ '',
+ '',
+ true,
+ true,
+ '',
+ 'white-box-content w100p',
+ 'box-shadow white_table_graph w100p',
+ 'images/arrow_down_green.png',
+ 'images/arrow_right_green.png',
+ false,
+ false,
+ false,
+ '',
+ '',
+ null,
+ null,
+ false,
+ $id_table
+ );
+ }
+
+ $agents .= ui_toggle(
+ $modules,
+ $agent_rows['agent'],
+ '',
+ '',
+ true,
+ true,
+ '',
+ 'white-box-content w100p',
+ 'box-shadow white_table_graph w100p',
+ );
+ }
+
+ $node_name = $nodo['server_name'];
+ if ($count[$nodo['server_name']] > 1) {
+ $node_name .= ' ('.$nodo['dbhost'].')';
+ }
+
+ ui_toggle(
+ $agents,
+ ''.$node_name.'',
+ '',
+ '',
+ false,
+ false
+ );
+ }
+ } else {
+ $count_nodos_tmp = [];
+ foreach ($nodos as $count_value) {
+ array_push($count_nodos_tmp, $count_value['server_name']);
+ }
+
+ $count = array_count_values($count_nodos_tmp);
+
+ foreach ($nodos as $nodo_key => $nodo) {
+ $agents = '';
+
+ foreach ($nodo['data'] as $module_key => $module_rows) {
+ $agent = '';
+ $data = [];
+ foreach ($module_rows as $row) {
+ $columns = explode(';', io_safe_output($row['data_format']));
+ array_push($columns, 'Timestamp');
+
+ $data_explode = explode(PHP_EOL, $row['data']);
+ foreach ($data_explode as $values) {
+ // Exclude results don't match filter.
+ if ($inventory_search_string && preg_match('/'.io_safe_output($inventory_search_string).'/', ($values)) == 0) {
+ continue;
+ }
+
+ $data_tmp = [];
+ if ($values !== '') {
+ $values_explode = explode(';', io_safe_output($values));
+
+ foreach ($values_explode as $key => $value) {
+ $data_tmp[$columns[$key]] = $value;
+ }
+
+ $data_tmp['Timestamp'] = $row['timestamp'];
+ array_push($data, $data_tmp);
+ }
+ }
+ }
+
+ $id_table = 'id_'.$row['id_module_inventory'].'_'.$nodo['server_uid'];
+
+ $table = ui_print_datatable(
+ [
+ 'id' => $id_table,
+ 'class' => 'info_table w100p',
+ 'style' => 'width: 100%',
+ 'columns' => $columns,
+ 'column_names' => $columns,
+ 'no_sortable_columns' => [],
+ 'data_element' => $data,
+ 'searching' => true,
+ 'dom_elements' => 'frtilp',
+ 'order' => [
+ 'field' => $columns[0],
+ 'direction' => 'asc',
+ ],
+ 'zeroRecords' => __('No inventory found'),
+ 'emptyTable' => __('No inventory found'),
+ 'return' => true,
+ 'no_sortable_columns' => [-1],
+ 'csv' => 0,
+ 'mini_pagination' => true,
+ 'mini_search' => true,
+ ]
+ );
+
+ $agent .= ui_toggle(
+ $table,
+ ''.$row['name_agent'].'',
+ '',
+ '',
+ true,
+ true,
+ '',
+ 'white-box-content w100p',
+ 'box-shadow white_table_graph w100p',
+ 'images/arrow_down_green.png',
+ 'images/arrow_right_green.png',
+ false,
+ false,
+ false,
+ '',
+ '',
+ null,
+ null,
+ false,
+ $id_table
+ );
+
+ $agents .= ui_toggle(
+ $agent,
+ $module_key,
+ '',
+ '',
+ true,
+ true,
+ '',
+ 'white-box-content w100p',
+ 'box-shadow white_table_graph w100p',
+ );
+ }
+
+ $node_name = $nodo['server_name'];
+ if ($count[$nodo['server_name']] > 1) {
+ $node_name .= ' ('.$nodo['dbhost'].')';
+ }
+
+ ui_toggle(
+ $agents,
+ ''.$node_name.'',
+ '',
+ '',
+ false,
+ false
+ );
+ }
+ }
+ } else {
+ // Single agent selected.
+ if ($inventory_id_agent > 0 && isset($agents[$inventory_id_agent]) === true) {
+ $agents = [$inventory_id_agent => $agents[$inventory_id_agent]];
+ }
+
+ $agents_ids = array_keys($agents);
+ if (count($agents_ids) > 0) {
+ $rows = inventory_get_datatable(
+ $agents_ids,
+ $inventory_module,
+ $utimestamp,
+ $inventory_search_string,
+ false,
+ false,
+ $order_by_agent
+ );
+ }
+
+ if (count($agents_ids) === 0 || (int) $rows === ERR_NODATA) {
+ ui_print_info_message(
+ [
+ 'no_close' => true,
+ 'message' => __('No data found.'),
+ ]
+ );
+
+ return;
+ }
+
+ echo "".html_print_image('images/spinner.gif', true).'
';
+ ?>
+
+ $row) {
+ $data = [];
+ $columns = explode(';', io_safe_output($row['data_format']));
+ array_push($columns, 'Timestamp');
+
+ $data_rows = explode(PHP_EOL, $row['data']);
+ foreach ($data_rows as $data_row) {
+ // Exclude results don't match filter.
+ if ($inventory_search_string && preg_match('/'.io_safe_output($inventory_search_string).'/', ($data_row)) == 0) {
+ continue;
+ }
+
+ $column_data = explode(';', io_safe_output($data_row));
+
+ if ($column_data[0] !== '') {
+ $row_tmp = [];
+ foreach ($column_data as $key => $value) {
+ $row_tmp[$columns[$key]] = $value;
+ }
+
+ $row_tmp['Timestamp'] = $row['timestamp'];
+ array_push($data, (object) $row_tmp);
+ }
+ }
+
+ $id_table = 'id_'.$key_row.'_'.$row['id_module_inventory'].'_'.$row['id_agente'];
+
+ $table = ui_print_datatable(
+ [
+ 'id' => $id_table,
+ 'class' => 'info_table w100p',
+ 'style' => 'width: 100%',
+ 'columns' => $columns,
+ 'column_names' => $columns,
+ 'no_sortable_columns' => [],
+ 'data_element' => $data,
+ 'searching' => true,
+ 'dom_elements' => 'frtilp',
+ 'order' => [
+ 'field' => $columns[0],
+ 'direction' => 'asc',
+ ],
+ 'zeroRecords' => __('No inventory found'),
+ 'emptyTable' => __('No inventory found'),
+ 'return' => true,
+ 'no_sortable_columns' => [-1],
+ 'csv' => 0,
+ 'mini_pagination' => true,
+ 'mini_search' => true,
+ ]
+ );
+
+ $modules .= ui_toggle(
+ $table,
+ ''.$row['name'].'',
+ '',
+ '',
+ true,
+ true,
+ '',
+ 'white-box-content w100p',
+ 'box-shadow white_table_graph w100p',
+ 'images/arrow_down_green.png',
+ 'images/arrow_right_green.png',
+ false,
+ false,
+ false,
+ '',
+ '',
+ null,
+ null,
+ false,
+ $id_table
+ );
+ }
+
+ ui_toggle(
+ $modules,
+ $agent_rows['agent'],
+ '',
+ '',
+ false,
+ false
+ );
+ }
+ } else {
+ $count_rows = count($rows);
+ foreach ($rows as $module_rows) {
+ $agent = '';
+ $data = [];
+
+ foreach ($module_rows as $row) {
+ $columns = explode(';', io_safe_output($row['data_format']));
+ array_push($columns, 'Timestamp');
+ array_push($columns, 'Agent');
+
+ // Exclude results don't match filter.
+ if ($inventory_search_string && preg_match('/'.io_safe_output($inventory_search_string).'/', ($row['data'])) == 0) {
+ continue;
+ }
+
+ $data_tmp = [];
+ if ($row['data'] !== '') {
+ $values_explode = explode(';', io_safe_output($row['data']));
+
+ foreach ($values_explode as $key => $value) {
+ $data_tmp[$columns[$key]] = $value;
+ }
+
+ $data_tmp['Timestamp'] = $row['timestamp'];
+ $data_tmp['Agent'] = $row['name_agent'];
+ array_push($data, $data_tmp);
+ }
+
+ $id_table = 'id_'.$row['id_module_inventory'];
+ }
+
+ if ($count_rows > 1) {
+ $table = ui_print_datatable(
+ [
+ 'id' => $id_table,
+ 'class' => 'info_table w100p',
+ 'style' => 'width: 100%',
+ 'columns' => $columns,
+ 'column_names' => $columns,
+ 'no_sortable_columns' => [],
+ 'data_element' => $data,
+ 'searching' => true,
+ 'dom_elements' => 'frtilp',
+ 'order' => [
+ 'field' => $columns[0],
+ 'direction' => 'asc',
+ ],
+ 'zeroRecords' => __('No inventory found'),
+ 'emptyTable' => __('No inventory found'),
+ 'return' => true,
+ 'no_sortable_columns' => [],
+ 'mini_search' => true,
+ 'mini_pagination' => true,
+ 'csv' => 0,
+ 'mini_pagination' => true,
+ 'mini_search' => true,
+ ]
+ );
+
+ ui_toggle(
+ $table,
+ array_shift($module_rows)['name'],
+ '',
+ '',
+ false,
+ false
+ );
+ } else {
+ $table = ui_print_datatable(
+ [
+ 'id' => $id_table,
+ 'class' => 'info_table w100p',
+ 'style' => 'width: 100%',
+ 'columns' => $columns,
+ 'column_names' => $columns,
+ 'no_sortable_columns' => [],
+ 'data_element' => $data,
+ 'searching' => true,
+ 'dom_elements' => 'frtilp',
+ 'order' => [
+ 'field' => $columns[0],
+ 'direction' => 'asc',
+ ],
+ 'zeroRecords' => __('No inventory found'),
+ 'emptyTable' => __('No inventory found'),
+ 'csv' => 0,
+ 'mini_pagination' => true,
+ 'mini_search' => true,
+ ]
+ );
+ }
+ }
+ }
+ }
+ } else {
+ $id_agente = $inventory_id_agent;
+ $agentes = [];
+ $data = [];
+ $class = 'info_table w100p';
+ $style = 'width: 100%; font-size: 100px !important;';
+ $ordering = true;
+ $searching = false;
+
+ $columns = [
+ 'alias',
+ 'ip',
+ 'secondoaryIp',
+ 'group',
+ 'secondaryGroups',
+ 'description',
+ 'os',
+ 'interval',
+ 'lastContact',
+ 'lastStatusChange',
+ 'customFields',
+ 'valuesCustomFields',
+ ];
+
+ $columns_names = [
+ __('Alias'),
+ __('IP'),
+ __('Secondary IP'),
+ __('Group'),
+ __('Secondary groups'),
+ __('Description'),
+ __('OS'),
+ __('Interval'),
+ __('Last contact'),
+ __('Last status change'),
+ __('Custom fields'),
+ __('Values Custom Fields'),
+ ];
+
+ ui_print_datatable(
+ [
+ 'id' => 'basic_info',
+ 'class' => $class,
+ 'style' => $style,
+ 'columns' => $columns,
+ 'column_names' => $columns_names,
+ 'ordering' => $ordering,
+ 'dom_elements' => 'frtilp',
+ 'searching' => $searching,
+ 'order' => [
+ 'field' => $columns[0],
+ 'direction' => 'asc',
+ ],
+ 'ajax_url' => 'operation/inventory/inventory',
+ 'ajax_data' => [
+ 'get_data_basic_info' => 1,
+ 'id_agent' => $id_agente,
+ 'id_group' => $inventory_id_group,
+ ],
+ 'zeroRecords' => __('Agent info not found'),
+ 'emptyTable' => __('Agent info not found'),
+ 'return' => false,
+ 'csv' => 0,
+ 'mini_pagination' => true,
+ 'mini_search' => true,
+ ]
+ );
+ echo '';
+ }
+
+ ui_require_jquery_file('pandora.controls');
+ ui_require_jquery_file('ajaxqueue');
+ ui_require_jquery_file('bgiframe');
+ }
+
+
+ /**
+ * Aux javascript to be run after form load.
+ *
+ * @return string
+ */
+ public function getFormJS(): string
+ {
+ $javascript_ajax_page = ui_get_full_url('ajax.php', false, false, false);
+ $selectbox_id = 'module_inventory';
+
+ return '
+ $(document).ready(function() {
+ if ($("#hidden-agentId").val() < 1) {
+ $("#text-agentAlias").val("'.__('All').'");
+ }
+ getInventoryModules();
+
+ let clickedOnDynamicElement = false;
+
+ $("[id^=\'ui-id-\']").on("click", function() {
+ clickedOnDynamicElement = true;
+ getInventoryModules();
+ });
+
+ $("#text-agentAlias").on("keyup", function(event) {
+ if (!clickedOnDynamicElement || $("#text-agentAlias").val() === "") {
+ getInventoryModules();
+ } else {
+ clickedOnDynamicElement = false;
+ }
+ });
+
+ $("#text-agentAlias").focus(function() {
+ $("#hidden-agentId").val("0");
+ });
+ });
+
+ function getInventoryModules() {
+ const clickedId = $(this).attr(\'id\');
+
+ $("#'.$selectbox_id.'").empty();
+
+ if ($("#hidden-agentId").val() > 0 || $("#text-agentAlias").val() === "'.__('All').'") {
+ $("#module_inventory").enable();
+ var inputs = [];
+ var metaconsoleID = $("#hidden-metaconsoleId").val();
+ if (isNaN(metaconsoleID) === true) {
+ metaconsoleID = 0;
+ }
+ inputs.push("id_agent=" + $("#hidden-agentId").val());
+ inputs.push("get_agent_inventory_modules=1");
+ inputs.push("id_node=" + metaconsoleID);
+ inputs.push("page=operation/agentes/ver_agente");
+
+ jQuery.ajax({
+ data: inputs.join("&"),
+ type: "POST",
+ url: action="'.$javascript_ajax_page.'",
+ dataType: "json",
+ success: function (data) {
+ if (data) {
+ $("#'.$selectbox_id.'").append($(""));
+ $("#'.$selectbox_id.'").append($(""));
+ jQuery.each (data, function(id, value) {
+ $("#'.$selectbox_id.'").append($(""));
+ });
+ $("#'.$selectbox_id.'").val("'.$this->values['inventoryModuleId'].'");
+
+ }
+ }
+ });
+ } else {
+ $("#module_inventory").disable();
+ }
+
+ return false;
+ }
+
+ $("#module_inventory").change(function() {
+ var inputs = [];
+
+ $("#utimestamp").empty();
+ $("#utimestamp").append($(""));
+
+ inputs.push("module=" + $(this).val());
+ inputs.push("id_agent=" + $("#hidden-agentId").val());
+ inputs.push("id_group=" + $("#id_group").val());
+ inputs.push("get_agent_inventory_dates=1");
+ inputs.push("page=operation/agentes/ver_agente");
+
+ jQuery.ajax({
+ data: inputs.join("&"),
+ type: "POST",
+ url: action="'.$javascript_ajax_page.'",
+ dataType: "json",
+ success: function (data) {
+ if (data) {
+ jQuery.each (data, function(id, value) {
+ $("#utimestamp").append($(""));
+ });
+ }
+ }
+ });
+ });
+ ';
+ }
+
+
+ /**
+ * Get description.
+ *
+ * @return string.
+ */
+ public static function getDescription()
+ {
+ return __('Inventory');
+ }
+
+
+ /**
+ * Get Name.
+ *
+ * @return string.
+ */
+ public static function getName()
+ {
+ return 'inventory';
+ }
+
+
+ /**
+ * Get size Modal Configuration.
+ *
+ * @return array
+ */
+ public function getSizeModalConfiguration(): array
+ {
+ $size = [
+ 'width' => 450,
+ 'height' => 330,
+ ];
+
+ return $size;
+ }
+
+
+}
diff --git a/pandora_console/include/lib/Dashboard/Widgets/single_graph.php b/pandora_console/include/lib/Dashboard/Widgets/single_graph.php
index 72ad55309b..957159824c 100644
--- a/pandora_console/include/lib/Dashboard/Widgets/single_graph.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/single_graph.php
@@ -269,6 +269,14 @@ class SingleGraphWidget extends Widget
$values['showLegend'] = $decoder['showLegend'];
}
+ if (isset($decoder['projection_switch']) === true) {
+ $values['projection_switch'] = $decoder['projection_switch'];
+ }
+
+ if (isset($decoder['period_projection']) === true) {
+ $values['period_projection'] = $decoder['period_projection'];
+ }
+
return $values;
}
@@ -357,6 +365,33 @@ class SingleGraphWidget extends Widget
],
];
+ // Projection.
+ $inputs[] = [
+ 'label' => __('Projection Graph'),
+ 'arguments' => [
+ 'name' => 'projection_switch',
+ 'id' => 'projection_switch',
+ 'type' => 'switch',
+ 'value' => $values['projection_switch'],
+ 'onclick' => 'show_projection_period()',
+ ],
+ ];
+
+ // Period Projection.
+ $display_projection = ($values['projection_switch'] === true) ? '' : 'display:none';
+ $inputs[] = [
+ 'label' => __('Period Projection'),
+ 'id' => 'div_projection_period',
+ 'style' => $display_projection,
+ 'arguments' => [
+ 'name' => 'period_projection',
+ 'type' => 'interval',
+ 'value' => $values['period_projection'],
+ 'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
+ 'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
+ ],
+ ];
+
return $inputs;
}
@@ -376,6 +411,8 @@ class SingleGraphWidget extends Widget
$values['moduleId'] = \get_parameter('moduleId', 0);
$values['period'] = \get_parameter('period', 0);
$values['showLegend'] = \get_parameter_switch('showLegend');
+ $values['projection_switch'] = (boolean) get_parameter_switch('projection_switch');
+ $values['period_projection'] = \get_parameter('period_projection', 0);
return $values;
}
@@ -405,23 +442,46 @@ class SingleGraphWidget extends Widget
$trickHight = 40;
}
- $params = [
- 'agent_module_id' => $this->values['moduleId'],
- 'width' => '100%',
- 'height' => ((int) $size['height'] - $trickHight),
- 'period' => $this->values['period'],
- 'title' => $module_name,
- 'unit' => $units_name,
- 'homeurl' => $config['homeurl'],
- 'backgroundColor' => 'transparent',
- 'show_legend' => $this->values['showLegend'],
- 'show_title' => $module_name,
- 'menu' => false,
- 'dashboard' => true,
- ];
-
$output = '';
- $output .= \grafico_modulo_sparse($params);
+ if ($this->values['projection_switch'] === true) {
+ $params_graphic = [
+ 'period' => $this->values['period'],
+ 'date' => strtotime(date('Y-m-d H:i:s')),
+ 'only_image' => false,
+ 'homeurl' => ui_get_full_url(false, false, false, false).'/',
+ 'height' => ((int) $size['height'] - $trickHight),
+ 'landscape' => $content['landscape'],
+ 'return_img_base_64' => true,
+ ];
+
+ $params_combined = [
+ 'projection' => $this->values['period_projection'],
+ ];
+
+ $return['chart'] = graphic_combined_module(
+ [$this->values['moduleId']],
+ $params_graphic,
+ $params_combined
+ );
+ $output .= $return['chart'];
+ } else {
+ $params = [
+ 'agent_module_id' => $this->values['moduleId'],
+ 'width' => '100%',
+ 'height' => ((int) $size['height'] - $trickHight),
+ 'period' => $this->values['period'],
+ 'title' => $module_name,
+ 'unit' => $units_name,
+ 'homeurl' => $config['homeurl'],
+ 'backgroundColor' => 'transparent',
+ 'show_legend' => $this->values['showLegend'],
+ 'show_title' => $module_name,
+ 'menu' => false,
+ 'dashboard' => true,
+ ];
+ $output .= \grafico_modulo_sparse($params);
+ }
+
$output .= '
';
return $output;
}
diff --git a/pandora_console/install.php b/pandora_console/install.php
index 6b4b293a0c..dc3e1e582d 100644
--- a/pandora_console/install.php
+++ b/pandora_console/install.php
@@ -131,7 +131,7 @@
data[6][3] = html_print_checkbox_switch(
- 'fullscale',
+ 'fullscalee',
1,
(bool) $fullscale,
true,
false
);
+
+ $table->data[7][0] = __('Projection graph');
+ $table->data[7][0] .= ui_print_help_tip(
+ __('Projection graph take as begin date the current time'),
+ true
+ );
+ $table->data[7][1] = html_print_checkbox_switch(
+ 'enable_projected_period',
+ 1,
+ (bool) $enable_projected_period,
+ true
+ );
+
+ $table->data[7][2] = __('Projection period');
+ $table->data[7][3] = '
'.html_print_extended_select_for_time(
+ 'period_projected',
+ $period_projected,
+ '',
+ '',
+ 0,
+ 7,
+ true
+ ).'
';
} else {
$table->data[0][0] = __('Begin date');
$table->data[0][1] = html_print_input_text(
@@ -514,27 +539,29 @@ ui_print_message_dialog(
);
$params = [
- 'agent_module_id' => $id,
- 'period' => $period,
- 'show_events' => $draw_events,
- 'title' => $label,
- 'unit_name' => $unit,
- 'show_alerts' => $draw_alerts,
- 'date' => $date,
- 'unit' => $unit,
- 'baseline' => $baseline,
- 'homeurl' => $urlImage,
- 'adapt_key' => 'adapter_'.$graph_type,
- 'compare' => $time_compare,
- 'show_unknown' => $unknown_graph,
- 'percentil' => (($show_percentil) ? $config['percentil'] : null),
- 'type_graph' => $config['type_module_charts'],
- 'fullscale' => $fullscale,
- 'zoom' => $zoom,
- 'height' => 300,
- 'type_mode_graph' => $type_mode_graph,
- 'histogram' => $histogram,
- 'begin_date' => strtotime($start_date.' '.$start_time),
+ 'agent_module_id' => $id,
+ 'period' => $period,
+ 'show_events' => $draw_events,
+ 'title' => $label,
+ 'unit_name' => $unit,
+ 'show_alerts' => $draw_alerts,
+ 'date' => $date,
+ 'unit' => $unit,
+ 'baseline' => $baseline,
+ 'homeurl' => $urlImage,
+ 'adapt_key' => 'adapter_'.$graph_type,
+ 'compare' => $time_compare,
+ 'show_unknown' => $unknown_graph,
+ 'percentil' => (($show_percentil) ? $config['percentil'] : null),
+ 'type_graph' => $config['type_module_charts'],
+ 'fullscale' => $fullscale,
+ 'zoom' => $zoom,
+ 'height' => 300,
+ 'type_mode_graph' => $type_mode_graph,
+ 'histogram' => $histogram,
+ 'begin_date' => strtotime($start_date.' '.$start_time),
+ 'enable_projected_period' => $enable_projected_period,
+ 'period_projected' => $period_projected,
];
// Graph.
diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php
index 6f5154a42c..8d033185af 100644
--- a/pandora_console/operation/agentes/ver_agente.php
+++ b/pandora_console/operation/agentes/ver_agente.php
@@ -69,6 +69,8 @@ if (is_ajax()) {
$id_group = (int) get_parameter('id_group');
$pendingdelete = (bool) get_parameter('pendingdelete');
$get_node_agent = (bool) get_parameter('get_node_agent', false);
+ $get_agent_inventory_modules = (bool) get_parameter('get_agent_inventory_modules', false);
+ $get_agent_inventory_dates = (bool) get_parameter('get_agent_inventory_dates', false);
$refresh_contact = get_parameter('refresh_contact', 0);
@@ -1328,6 +1330,102 @@ if (is_ajax()) {
}
}
+ if ($get_agent_inventory_modules) {
+ $inventory_id_agent = get_parameter('id_agent');
+ $id_node = (int) get_parameter('id_node');
+
+ $sql = 'SELECT DISTINCT(`name`)
+ FROM tmodule_inventory, tagent_module_inventory
+ WHERE tmodule_inventory.id_module_inventory = tagent_module_inventory.id_module_inventory';
+
+ if ($inventory_id_agent > 0) {
+ $sql .= ' AND id_agente = '.$inventory_id_agent;
+ }
+
+ $fields = [];
+
+ // Get results from all nodes if id_node equals to 0.
+ if ($id_node === 0 && is_metaconsole() === true) {
+ $result = [];
+ $nodes_connection = metaconsole_get_connections();
+
+ foreach ($nodes_connection as $key => $server) {
+ $id_node = $server['id'];
+
+ try {
+ if (is_metaconsole() === true) {
+ $node = new Node($id_node);
+ $node->connect();
+ }
+
+ $node_result = db_get_all_rows_sql($sql);
+
+ if ($node_result === false) {
+ continue;
+ }
+
+ $result = array_merge(
+ $result,
+ $node_result
+ );
+
+ if (is_metaconsole() === true) {
+ $node->disconnect();
+ }
+ } catch (Exception $e) {
+ if ($node !== null) {
+ $node->disconnect();
+ }
+
+ return;
+ }
+ }
+ } else {
+ try {
+ if (is_metaconsole() === true) {
+ $node = new Node($id_node);
+ $node->connect();
+ }
+
+ $result = db_get_all_rows_sql($sql);
+
+ if (is_metaconsole() === true) {
+ $node->disconnect();
+ }
+ } catch (Exception $e) {
+ if ($node !== null) {
+ $node->disconnect();
+ }
+
+ return;
+ }
+ }
+
+ if ($result === false) {
+ $result = [];
+ }
+
+ echo json_encode($result);
+
+ return;
+ }
+
+ if ($get_agent_inventory_dates) {
+ $inventory_module = get_parameter('module', 0);
+ $inventory_id_agent = (int) get_parameter('id_agent', 0);
+ $inventory_id_group = (int) get_parameter('id_group', 0);
+
+ $dates = inventory_get_dates(
+ $inventory_module,
+ $inventory_id_agent,
+ $inventory_id_group
+ );
+
+ echo json_encode($dates);
+
+ return;
+ }
+
return;
}
diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec
index bc3184f6ea..3823d30ad6 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.773.3
-%define release 230905
+%define release 230906
# 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 dee4bc02e8..308686eff8 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.773.3
-%define release 230905
+%define release 230906
# 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 ce151be738..a0022361c6 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.773.3
-%define release 230905
+%define release 230906
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2
diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control
index e5a7e1c71f..df72528214 100644
--- a/pandora_server/DEBIAN/control
+++ b/pandora_server/DEBIAN/control
@@ -1,5 +1,5 @@
package: pandorafms-server
-Version: 7.0NG.773.3-230905
+Version: 7.0NG.773.3-230906
Architecture: all
Priority: optional
Section: admin
diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh
index 3b3376eade..7c68242ec8 100644
--- a/pandora_server/DEBIAN/make_deb_package.sh
+++ b/pandora_server/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.773.3-230905"
+pandora_version="7.0NG.773.3-230906"
package_cpan=0
package_pandora=1
diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm
index f4e44f9605..d830591889 100644
--- a/pandora_server/lib/PandoraFMS/Config.pm
+++ b/pandora_server/lib/PandoraFMS/Config.pm
@@ -46,7 +46,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.773.3";
-my $pandora_build = "230905";
+my $pandora_build = "230906";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash
diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm
index 782447fdc4..0aa20fcffb 100644
--- a/pandora_server/lib/PandoraFMS/PluginTools.pm
+++ b/pandora_server/lib/PandoraFMS/PluginTools.pm
@@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.773.3";
-my $pandora_build = "230905";
+my $pandora_build = "230906";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec
index e6af575ed6..38e15b7842 100644
--- a/pandora_server/pandora_server.redhat.spec
+++ b/pandora_server/pandora_server.redhat.spec
@@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_server
%define version 7.0NG.773.3
-%define release 230905
+%define release 230906
Summary: Pandora FMS Server
Name: %{name}
diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec
index 0c7de5a3c3..722d9d2f43 100644
--- a/pandora_server/pandora_server.spec
+++ b/pandora_server/pandora_server.spec
@@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_server
%define version 7.0NG.773.3
-%define release 230905
+%define release 230906
Summary: Pandora FMS Server
Name: %{name}
diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer
index 0d3c5d81e9..7b3751cb8b 100755
--- a/pandora_server/pandora_server_installer
+++ b/pandora_server/pandora_server_installer
@@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.773.3"
-PI_BUILD="230905"
+PI_BUILD="230906"
MODE=$1
if [ $# -gt 1 ]; then
diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl
index 02161fe7f3..08b79de11a 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.773.3 Build 230905";
+my $version = "7.0NG.773.3 Build 230906";
# Pandora server configuration
my %conf;
diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl
index 2f20be3928..1a36be5ab9 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.773.3 Build 230905";
+my $version = "7.0NG.773.3 Build 230906";
# save program name for logging
my $progname = basename($0);