diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php
index 3b659a30e8..0be3a8dffe 100644
--- a/pandora_console/include/functions_groups.php
+++ b/pandora_console/include/functions_groups.php
@@ -2648,14 +2648,16 @@ function groups_get_heat_map_agents(array $id_group, float $width=0, float $heig
*
* @return string Html
*/
-function tactical_groups_get_agents_and_monitoring($id_groups)
+function tactical_groups_get_agents_and_monitoring($id_groups, $data='')
{
global $config;
- $data = [
- 'total_agents' => groups_agents_total_counters($id_groups, false)['total'],
- 'monitor_total' => groups_get_total_monitors($id_groups, [], [], false, false, false, false),
- ];
+ if ($data === '') {
+ $data = [
+ 'total_agents' => groups_agents_total_counters($id_groups, false)['total'],
+ 'monitor_total' => groups_get_total_monitors($id_groups, [], [], false, false, false, false),
+ ];
+ }
// Link URLS
$urls = [];
@@ -2703,16 +2705,18 @@ function tactical_groups_get_agents_and_monitoring($id_groups)
* @param [type] $id_groups
* @return string Html.
*/
-function tactical_groups_get_stats_alerts($id_groups)
+function tactical_groups_get_stats_alerts($id_groups, $data='')
{
global $config;
- $alerts = groups_monitor_alerts_total_counters($id_groups, false);
- $data = [
- 'monitor_alerts' => $alerts['total'],
- 'monitor_alerts_fired' => $alerts['fired'],
+ if ($data === '') {
+ $alerts = groups_monitor_alerts_total_counters($id_groups, false);
+ $data = [
+ 'monitor_alerts' => $alerts['total'],
+ 'monitor_alerts_fired' => $alerts['fired'],
- ];
+ ];
+ }
$urls = [];
$urls['monitor_alerts'] = $config['homeurl'].'index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=60&ag_group='.$id_groups[0];
@@ -2780,17 +2784,19 @@ function tactical_groups_get_stats_alerts($id_groups)
* @param boolean $data_agents
* @return void
*/
-function groups_get_stats_modules_status($id_groups, $graph_width=250, $graph_height=150, $links=false, $data_agents=false)
+function groups_get_stats_modules_status($id_groups, $graph_width=250, $graph_height=150, $links=false, $data_agents=false, $data='')
{
global $config;
- $data = [
- 'monitor_critical' => groups_get_critical_monitors($id_groups, [], [], false, false, false, false),
- 'monitor_warning' => groups_get_warning_monitors($id_groups, [], [], false, false, false, false),
- 'monitor_ok' => groups_get_normal_monitors($id_groups, [], [], false, false, false, false),
- 'monitor_unknown' => groups_get_unknown_monitors($id_groups, [], [], false, false, false, false),
- 'monitor_not_init' => groups_get_not_init_monitors($id_groups, [], [], false, false, false, false),
- ];
+ if ($data === '') {
+ $data = [
+ 'monitor_critical' => groups_get_critical_monitors($id_groups, [], [], false, false, false, false),
+ 'monitor_warning' => groups_get_warning_monitors($id_groups, [], [], false, false, false, false),
+ 'monitor_ok' => groups_get_normal_monitors($id_groups, [], [], false, false, false, false),
+ 'monitor_unknown' => groups_get_unknown_monitors($id_groups, [], [], false, false, false, false),
+ 'monitor_not_init' => groups_get_not_init_monitors($id_groups, [], [], false, false, false, false),
+ ];
+ }
// Link URLS.
if ($links === false) {
diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php
index 91d8a9e5a5..eb7c555fb9 100644
--- a/pandora_console/include/functions_reporting_html.php
+++ b/pandora_console/include/functions_reporting_html.php
@@ -2581,7 +2581,237 @@ function reporting_html_group_report($table, $item, $pdf=0)
$table->colspan['group_report']['cell'] = 3;
$table->cellstyle['group_report']['cell'] = 'text-align: center;';
- $data = "
+ $metaconsole_connected = false;
+ if (is_metaconsole() === true) {
+ $connection = metaconsole_get_connection($item['server_name']);
+ if (metaconsole_connect($connection) == NOERR) {
+ $metaconsole_connected = true;
+ }
+ }
+
+ if ($item['subtitle'] === 'All') {
+ $group_id = [];
+ $all_group_id = db_get_all_rows_sql('SELECT id_grupo FROM tgrupo');
+
+ foreach ($all_group_id as $group) {
+ $group_id[] = $group['id_grupo'];
+ }
+
+ $description = __('Data view of all groups');
+ $icon = '';
+
+ $group_events = db_get_all_rows_sql(
+ 'SELECT COUNT(te.id_evento) as count_events, ta.alias
+ FROM tevento as te
+ INNER JOIN tagente as ta ON te.id_agente = ta.id_agente
+ GROUP BY te.id_agente'
+ );
+
+ $group_os = db_get_all_rows_sql(
+ 'SELECT COUNT(os.name) as count_os, os.name as name_os, ta.id_grupo
+ FROM tconfig_os as os
+ INNER JOIN tagente as ta ON ta.id_os = os.id_os GROUP by os.name'
+ );
+ } else {
+ $group_id = db_get_value('id_grupo', 'tgrupo', 'nombre', $item['subtitle']);
+ $description = db_get_value('description', 'tgrupo', 'id_grupo', $group_id);
+ $icon_url = db_get_value('icon', 'tgrupo', 'id_grupo', $group_id);
+ $icon = html_print_image(
+ 'images/'.$icon_url,
+ true,
+ [
+ 'title' => $item['subtitle'],
+ 'class' => 'main_menu_icon invert_filter',
+ ]
+ );
+
+ $childrens = db_get_all_rows_sql('SELECT id_grupo FROM tgrupo WHERE parent = '.$group_id);
+ $total_agents = db_get_all_rows_sql('SELECT COUNT(id_agente) as total FROM tagente where id_grupo = '.$group_id);
+
+ if ($childrens !== false && (int) $total_agents[0]['total'] !== $item['data']['group_stats']['total_agents']) {
+ $array_group_id = [];
+ $array_group_id[] = $group_id;
+ foreach ($childrens as $group) {
+ $array_group_id[] = $group['id_grupo'];
+ }
+
+ $group_id = $array_group_id;
+ $explode_group_id = implode(',', $group_id);
+ } else {
+ $explode_group_id = $group_id;
+ }
+
+ $group_events = db_get_all_rows_sql(
+ 'SELECT COUNT(te.id_evento) as count_events, ta.alias
+ FROM tevento as te
+ INNER JOIN tagente as ta ON te.id_agente = ta.id_agente WHERE te.id_grupo IN ('.$explode_group_id.')
+ GROUP BY te.id_agente'
+ );
+
+ $group_os = db_get_all_rows_sql(
+ 'SELECT COUNT(os.name) as count_os, os.name as name_os, ta.id_grupo
+ FROM tconfig_os as os
+ INNER JOIN tagente as ta ON ta.id_os = os.id_os
+ WHERE ta.id_grupo IN ('.$explode_group_id.') GROUP by os.name'
+ );
+ }
+
+ if ($metaconsole_connected === true) {
+ metaconsole_restore_db();
+ }
+
+ $graph_width = 280;
+ $graph_height = 250;
+
+ $out = '';
+ $out .= '';
+ $out .= '';
+
+ $out .= '';
+ $out .= '';
+ $out .= ' | ';
+ $out .= '';
+ $out .= ' | ';
+ $out .= '';
+ $out .= '
';
+ $out .= '';
+ $out .= '
';
+
+ /*
+ $data = "
|
".__('Total')." |
@@ -2624,12 +2854,12 @@ function reporting_html_group_report($table, $item, $pdf=0)
".__('Events (not validated)')." |
".$item['data']['count_events'].' |
-
';
+
';*/
- $table->data['group_report']['cell'] = $data;
+ $table->data['group_report']['cell'] = $out;
if ($pdf !== 0) {
- return $data;
+ return $out;
}
}
diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css
index 4f507df377..7b25e2b700 100644
--- a/pandora_console/include/styles/pandora.css
+++ b/pandora_console/include/styles/pandora.css
@@ -12362,6 +12362,10 @@ tr[id^="network_component-plugin-snmp-fields-dynamicMacroRow-"] input {
width: 100% !important;
}
+.group_view_table > tbody > tr > td {
+ width: 350px !important;
+}
+
.notificaion_menu_container {
display: flex;
padding-top: 10px;
diff --git a/pandora_console/operation/agentes/group_view.php b/pandora_console/operation/agentes/group_view.php
index 34c3fc6936..08066014e0 100644
--- a/pandora_console/operation/agentes/group_view.php
+++ b/pandora_console/operation/agentes/group_view.php
@@ -8,7 +8,7 @@
* @version 1.0.0
* @license See below
*
- * ______ ___ _______ _______ ________
+ * ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
diff --git a/pandora_server/extras/pandoraPlugintools/README.md b/pandora_server/extras/pandoraPlugintools/README.md
index 735fcc78fd..9ec2c37d53 100644
--- a/pandora_server/extras/pandoraPlugintools/README.md
+++ b/pandora_server/extras/pandoraPlugintools/README.md
@@ -4,7 +4,7 @@ pandoraPluginTools is a library that aims to help the creation of scripts and th
[PluginTools Reference Documentation](https://pandorafms.com/guides/public/books/plugintools)
-The package includes the following modules. Each one has different functions that facilitate and automate the data integration in Pandora FMS:
+The package includes the following modules. Each one has different functions that facilitate and automate the data integration in Pandora FMS:
**general**
Module containing general purpose functions, useful in the creation of plugins for PandoraFMS.
@@ -27,9 +27,9 @@ Module containing functions oriented to the creation of Pandora FMS discovery pl
**http**
Module containing functions oriented to HTTP API calls.
-## Example
+## Example
-``` python
+```python
import pandoraPluginTools as ppt
## Define agent
@@ -65,6 +65,7 @@ ppt.transfer_xml(
```
The package has the following dependencies:
+
- Hashlib
- datetime.datetime
- hashlib