|
@@ -5925,6 +5961,7 @@ function chooseType() {
$("#row_agent_not_assigned_to_ip").hide();
$("#row_show_summary").hide();
$("#row_group_by").hide();
+ $("#row_type_show").hide();
// SLA list default state.
$("#sla_list").hide();
@@ -6438,6 +6475,7 @@ function chooseType() {
case 'agent_module':
$("#row_module_group").show();
+ $("#row_type_show").show();
case 'agent_module_status':
$("#row_description").show();
$("#row_group").show();
diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php
index fbad042ef1..7fc89b6267 100755
--- a/pandora_console/godmode/reporting/reporting_builder.php
+++ b/pandora_console/godmode/reporting/reporting_builder.php
@@ -1677,6 +1677,7 @@ switch ($action) {
// Encode json modules and agents.
$es['module'] = base64_encode(json_encode($es['module']));
$es['id_agents'] = base64_encode(json_encode($agents_to_report));
+ $es['show_type'] = get_parameter('show_type', 0);
$values['external_source'] = json_encode($es);
$good_format = true;
@@ -2480,6 +2481,7 @@ switch ($action) {
// Encode json modules and agents.
$es['module'] = base64_encode(json_encode($es['module']));
$es['id_agents'] = base64_encode(json_encode($agents_to_report));
+ $es['show_type'] = get_parameter('show_type', 0);
$values['external_source'] = json_encode($es);
$good_format = true;
diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php
index a53246c071..944733ffd0 100644
--- a/pandora_console/include/functions_html.php
+++ b/pandora_console/include/functions_html.php
@@ -1697,13 +1697,19 @@ function html_print_select_multiple_modules_filtered(array $data):string
$all_modules = [];
}
+ if (is_array($data['mModules']) === false) {
+ $result = explode(((is_metaconsole() === true) ? SEPARATOR_META_MODULE : ','), $data['mModules']);
+ } else {
+ $result = $data['mModules'];
+ }
+
$output .= html_print_input(
[
'label' => __('Modules'),
'type' => 'select',
'fields' => $all_modules,
'name' => 'filtered-module-modules-'.$uniqId,
- 'selected' => explode((is_metaconsole() === true) ? SEPARATOR_META_MODULE : ',', $data['mModules']),
+ 'selected' => $result,
'return' => true,
'multiple' => true,
'style' => 'min-width: 200px;max-width:200px;',
diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php
index a9f2f71b3e..5eb016c3b0 100755
--- a/pandora_console/include/functions_reporting.php
+++ b/pandora_console/include/functions_reporting.php
@@ -2802,6 +2802,12 @@ function reporting_agent_module($report, $content)
true
);
+ if (isset($external_source['show_type']) === true) {
+ $show_type = $external_source['show_type'];
+ } else {
+ $show_type = 0;
+ }
+
$return['type'] = 'agent_module';
if (empty($content['name'])) {
@@ -2838,6 +2844,10 @@ function reporting_agent_module($report, $content)
modules_get_agentmodule_name($modul_id)
);
$modules_by_name[$cont]['id'] = $modul_id;
+ if ($show_type === '1') {
+ $modules_by_name[$cont]['unit'] = modules_get_unit($modul_id);
+ }
+
$cont++;
}
@@ -2853,7 +2863,18 @@ function reporting_agent_module($report, $content)
$row['modules'] = [];
foreach ($modules_by_name as $module) {
if (array_key_exists($module['id'], $agent_modules)) {
- $row['modules'][$module['name']] = modules_get_agentmodule_status($module['id']);
+ if ($show_type === '1') {
+ $module_last_value = modules_get_last_value($module['id']);
+ if (!is_numeric($module_last_value)) {
+ $module_last_value = htmlspecialchars($module_last_value);
+ }
+
+ $module['datos'] = $module_last_value;
+ $row['modules'][$module['name']] = modules_get_agentmodule_data_for_humans($module);
+ $row['show_type'] = $show_type;
+ } else {
+ $row['modules'][$module['name']] = modules_get_agentmodule_status($module['id']);
+ }
} else {
if (!array_key_exists($module['name'], $row['modules'])) {
$row['modules'][$module['name']] = null;
diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php
index b18b2a4b91..9973e9df55 100644
--- a/pandora_console/include/functions_reporting_html.php
+++ b/pandora_console/include/functions_reporting_html.php
@@ -1807,9 +1807,9 @@ function reporting_html_agent_module($table, $item)
if (!empty($item['failed'])) {
$table->data['agent_module']['cell'] = $item['failed'];
} else {
- $table_data = '';
-
- $table_data .= ''.__('Agents').' / '.__('Modules').' | ';
+ $table_data = '';
+ $table_data .= '';
+ $table_data .= ''.__('Agents').' / '.__('Modules').' | ';
$first = reset($item['data']);
$list_modules = $first['modules'];
@@ -1823,11 +1823,14 @@ function reporting_html_agent_module($table, $item)
false,
'...'
);
- $table_data .= ''.$file_name.' | ';
+
+ $table_data .= ''.$file_name.' | ';
}
+ $table_data .= ' ';
+
foreach ($item['data'] as $row) {
- $table_data .= "";
+ $table_data .= " ";
switch ($row['agent_status']) {
case AGENT_STATUS_ALERT_FIRED:
$rowcolor = COL_ALERTFIRED;
@@ -1865,118 +1868,122 @@ function reporting_html_agent_module($table, $item)
false,
'...'
);
- $table_data .= "".$file_name.' | ';
+ $table_data .= ''.$file_name.' | ';
foreach ($row['modules'] as $module_name => $module) {
if ($module === null) {
- $table_data .= " | ";
+ $table_data .= ' | ';
} else {
- $table_data .= "";
- switch ($module) {
- default:
- case AGENT_STATUS_NORMAL:
- $table_data .= ui_print_status_image(
- 'module_ok.png',
- __(
- '%s in %s : NORMAL',
- $module_name,
- $row['agent_name']
- ),
- true,
- [
- 'width' => '20px',
- 'height' => '20px',
- ],
- 'images/status_sets/default/'
- );
- break;
+ $table_data .= " | ";
+ if (isset($row['show_type']) === true && $row['show_type'] === '1') {
+ $table_data .= $module;
+ } else {
+ switch ($module) {
+ case AGENT_STATUS_CRITICAL:
+ $table_data .= ui_print_status_image(
+ 'module_critical.png',
+ __(
+ '%s in %s : CRITICAL',
+ $module_name,
+ $row['agent_name']
+ ),
+ true,
+ [
+ 'width' => '20px',
+ 'height' => '20px',
+ ],
+ 'images/status_sets/default/'
+ );
+ break;
- case AGENT_STATUS_CRITICAL:
- $table_data .= ui_print_status_image(
- 'module_critical.png',
- __(
- '%s in %s : CRITICAL',
- $module_name,
- $row['agent_name']
- ),
- true,
- [
- 'width' => '20px',
- 'height' => '20px',
- ],
- 'images/status_sets/default/'
- );
- break;
+ case AGENT_STATUS_WARNING:
+ $table_data .= ui_print_status_image(
+ 'module_warning.png',
+ __(
+ '%s in %s : WARNING',
+ $module_name,
+ $row['agent_name']
+ ),
+ true,
+ [
+ 'width' => '20px',
+ 'height' => '20px',
+ ],
+ 'images/status_sets/default/'
+ );
+ break;
- case AGENT_STATUS_WARNING:
- $table_data .= ui_print_status_image(
- 'module_warning.png',
- __(
- '%s in %s : WARNING',
- $module_name,
- $row['agent_name']
- ),
- true,
- [
- 'width' => '20px',
- 'height' => '20px',
- ],
- 'images/status_sets/default/'
- );
- break;
+ case AGENT_STATUS_UNKNOWN:
+ $table_data .= ui_print_status_image(
+ 'module_unknown.png',
+ __(
+ '%s in %s : UNKNOWN',
+ $module_name,
+ $row['agent_name']
+ ),
+ true,
+ [
+ 'width' => '20px',
+ 'height' => '20px',
+ ],
+ 'images/status_sets/default/'
+ );
+ break;
- case AGENT_STATUS_UNKNOWN:
- $table_data .= ui_print_status_image(
- 'module_unknown.png',
- __(
- '%s in %s : UNKNOWN',
- $module_name,
- $row['agent_name']
- ),
- true,
- [
- 'width' => '20px',
- 'height' => '20px',
- ],
- 'images/status_sets/default/'
- );
- break;
+ case AGENT_MODULE_STATUS_NORMAL_ALERT:
+ case AGENT_MODULE_STATUS_WARNING_ALERT:
+ case AGENT_MODULE_STATUS_CRITICAL_ALERT:
+ $table_data .= ui_print_status_image(
+ 'module_alertsfired.png',
+ __(
+ '%s in %s : ALERTS FIRED',
+ $module_name,
+ $row['agent_name']
+ ),
+ true,
+ [
+ 'width' => '20px',
+ 'height' => '20px',
+ ],
+ 'images/status_sets/default/'
+ );
+ break;
- case AGENT_MODULE_STATUS_NORMAL_ALERT:
- case AGENT_MODULE_STATUS_WARNING_ALERT:
- case AGENT_MODULE_STATUS_CRITICAL_ALERT:
- $table_data .= ui_print_status_image(
- 'module_alertsfired.png',
- __(
- '%s in %s : ALERTS FIRED',
- $module_name,
- $row['agent_name']
- ),
- true,
- [
- 'width' => '20px',
- 'height' => '20px',
- ],
- 'images/status_sets/default/'
- );
- break;
+ case 4:
+ $table_data .= ui_print_status_image(
+ 'module_no_data.png',
+ __(
+ '%s in %s : Not initialize',
+ $module_name,
+ $row['agent_name']
+ ),
+ true,
+ [
+ 'width' => '20px',
+ 'height' => '20px',
+ ],
+ 'images/status_sets/default/'
+ );
+ break;
- case 4:
- $table_data .= ui_print_status_image(
- 'module_no_data.png',
- __(
- '%s in %s : Not initialize',
- $module_name,
- $row['agent_name']
- ),
- true,
- [
- 'width' => '20px',
- 'height' => '20px',
- ],
- 'images/status_sets/default/'
- );
- break;
+ default:
+ case AGENT_STATUS_NORMAL:
+ $table_data .= ui_print_status_image(
+ 'module_ok.png',
+ __(
+ '%s in %s : NORMAL',
+ $module_name,
+ $row['agent_name']
+ ),
+ true,
+ [
+ 'width' => '20px',
+ 'height' => '20px',
+ ],
+ 'images/status_sets/default/'
+ );
+ break;
+ }
}
$table_data .= ' | ';
@@ -1986,18 +1993,19 @@ function reporting_html_agent_module($table, $item)
$table_data .= ' ';
- $table_data .= "";
-
- $table_data .= ' ';
- $table_data .= "".__('Legend').' | ';
- $table_data .= " | ".__('Orange cell when the module has fired alerts').' | ';
- $table_data .= " | ".__('Red cell when the module has a critical status').' | ';
- $table_data .= " | ".__('Yellow cell when the module has a warning status').' | ';
- $table_data .= " | ".__('Green cell when the module has a normal status').' | ';
- $table_data .= " | ".__('Grey cell when the module has an unknown status').' | ';
- $table_data .= " | ".__("Cell turns grey when the module is in 'not initialize' status").' | ';
- $table_data .= ' ';
- $table_data .= ' ';
+ if (isset($row['show_type']) === false) {
+ $table_data .= "";
+ $table_data .= ' ';
+ $table_data .= "".__('Legend').' | ';
+ $table_data .= " | ".__('Orange cell when the module has fired alerts').' | ';
+ $table_data .= " | ".__('Red cell when the module has a critical status').' | ';
+ $table_data .= " | ".__('Yellow cell when the module has a warning status').' | ';
+ $table_data .= " | ".__('Green cell when the module has a normal status').' | ';
+ $table_data .= " | ".__('Grey cell when the module has an unknown status').' | ';
+ $table_data .= " | ".__("Cell turns grey when the module is in 'not initialize' status").' | ';
+ $table_data .= ' ';
+ $table_data .= ' ';
+ }
$table->data['agent_module']['cell'] = $table_data;
}
diff --git a/pandora_console/include/lib/Dashboard/Widgets/agent_module.php b/pandora_console/include/lib/Dashboard/Widgets/agent_module.php
index 6a0a71ca1f..dbc0c1dcf5 100644
--- a/pandora_console/include/lib/Dashboard/Widgets/agent_module.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/agent_module.php
@@ -200,6 +200,10 @@ class AgentModuleWidget extends Widget
// Retrieve global - common inputs.
$values = parent::decoders($decoder);
+ if (isset($decoder['mTypeShow']) === true) {
+ $values['mTypeShow'] = $decoder['mTypeShow'];
+ }
+
if (isset($decoder['mGroup']) === true) {
$values['mGroup'] = $decoder['mGroup'];
}
@@ -246,6 +250,29 @@ class AgentModuleWidget extends Widget
'label' => __('Filter modules'),
];
+ // Type show.
+ $show_select = [
+ 0 => __('Show module status'),
+ 1 => __('Show module data'),
+ ];
+
+ if (empty($this->values['mModules']) === true && empty($this->values['mTypeShow'])) {
+ $this->values['mTypeShow'] = 1;
+ }
+
+ $inputs[] = [
+ 'class' => 'flex flex-row',
+ 'label' => __('Information to be shown'),
+ 'arguments' => [
+ 'type' => 'select',
+ 'fields' => $show_select,
+ 'name' => 'filtered-type-show-'.$this->cellId,
+ 'return' => true,
+ 'id' => 'filtered-type-show-'.$this->cellId,
+ 'selected' => ($this->values['mTypeShow'] === null) ? 0 : $this->values['mTypeShow'],
+ ],
+ ];
+
$return_all_group = false;
if (users_can_manage_group_all('RM') || $this->values['mGroup'] == 0) {
@@ -285,6 +312,10 @@ class AgentModuleWidget extends Widget
// Retrieve global - common inputs.
$values = parent::getPost();
+ $values['mTypeShow'] = \get_parameter(
+ 'filtered-type-show-'.$this->cellId
+ );
+
$values['mGroup'] = \get_parameter(
'filtered-module-group-'.$this->cellId
);
@@ -409,7 +440,7 @@ class AgentModuleWidget extends Widget
array $visualData,
array $allModules
):string {
- $style = 'display:flex; width:100%; margin: 10px;';
+ $style = 'display:flex; width:96%; margin-top: 10px;';
$table_data = '';
$table_data .= ' ';
@@ -478,118 +509,126 @@ class AgentModuleWidget extends Widget
}
foreach ($row['modules'] as $module_name => $module) {
- if ($module === null) {
- if (in_array($module_name, $allModules) === true) {
- $style = 'background-color: transparent;';
- $table_data .= "";
- $table_data .= ' | ';
- } else {
- continue;
- }
- } else {
+ if ($this->values['mTypeShow'] === '1') {
$style = 'text-align: center;';
$style .= ' background-color: transparent;';
$table_data .= "";
- switch ($module) {
- case AGENT_STATUS_NORMAL:
- $table_data .= \ui_print_status_image(
- 'module_ok.png',
- __(
- '%s in %s : NORMAL',
- $module_name,
- $row['agent_alias']
- ),
- true,
- [
- 'width' => '20px',
- 'height' => '20px',
- ]
- );
- break;
-
- case AGENT_STATUS_CRITICAL:
- $table_data .= \ui_print_status_image(
- 'module_critical.png',
- __(
- '%s in %s : CRITICAL',
- $module_name,
- $row['agent_alias']
- ),
- true,
- [
- 'width' => '20px',
- 'height' => '20px',
- ]
- );
- break;
-
- case AGENT_STATUS_WARNING:
- $table_data .= \ui_print_status_image(
- 'module_warning.png',
- __(
- '%s in %s : WARNING',
- $module_name,
- $row['agent_alias']
- ),
- true,
- [
- 'width' => '20px',
- 'height' => '20px',
- ]
- );
- break;
-
- case AGENT_STATUS_UNKNOWN:
- $table_data .= \ui_print_status_image(
- 'module_unknown.png',
- __(
- '%s in %s : UNKNOWN',
- $module_name,
- $row['agent_alias']
- ),
- true,
- [
- 'width' => '20px',
- 'height' => '20px',
- ]
- );
- break;
-
- case 4:
- $table_data .= \ui_print_status_image(
- 'module_no_data.png',
- __(
- '%s in %s : Not initialize',
- $module_name,
- $row['agent_alias']
- ),
- true,
- [
- 'width' => '20px',
- 'height' => '20px',
- ]
- );
- break;
-
- case AGENT_STATUS_ALERT_FIRED:
- default:
- $table_data .= \ui_print_status_image(
- 'module_alertsfired.png',
- __(
- '%s in %s : ALERTS FIRED',
- $module_name,
- $row['agent_alias']
- ),
- true,
- [
- 'width' => '20px',
- 'height' => '20px',
- ]
- );
- break;
- }
-
+ $table_data .= $module;
$table_data .= ' | ';
+ } else {
+ if ($module === null) {
+ if (in_array($module_name, $allModules) === true) {
+ $style = 'background-color: transparent;';
+ $table_data .= "";
+ $table_data .= ' | ';
+ } else {
+ continue;
+ }
+ } else {
+ $style = 'text-align: center;';
+ $style .= ' background-color: transparent;';
+ $table_data .= "";
+ switch ($module) {
+ case AGENT_STATUS_NORMAL:
+ $table_data .= \ui_print_status_image(
+ 'module_ok.png',
+ __(
+ '%s in %s : NORMAL',
+ $module_name,
+ $row['agent_alias']
+ ),
+ true,
+ [
+ 'width' => '20px',
+ 'height' => '20px',
+ ]
+ );
+ break;
+
+ case AGENT_STATUS_CRITICAL:
+ $table_data .= \ui_print_status_image(
+ 'module_critical.png',
+ __(
+ '%s in %s : CRITICAL',
+ $module_name,
+ $row['agent_alias']
+ ),
+ true,
+ [
+ 'width' => '20px',
+ 'height' => '20px',
+ ]
+ );
+ break;
+
+ case AGENT_STATUS_WARNING:
+ $table_data .= \ui_print_status_image(
+ 'module_warning.png',
+ __(
+ '%s in %s : WARNING',
+ $module_name,
+ $row['agent_alias']
+ ),
+ true,
+ [
+ 'width' => '20px',
+ 'height' => '20px',
+ ]
+ );
+ break;
+
+ case AGENT_STATUS_UNKNOWN:
+ $table_data .= \ui_print_status_image(
+ 'module_unknown.png',
+ __(
+ '%s in %s : UNKNOWN',
+ $module_name,
+ $row['agent_alias']
+ ),
+ true,
+ [
+ 'width' => '20px',
+ 'height' => '20px',
+ ]
+ );
+ break;
+
+ case 4:
+ $table_data .= \ui_print_status_image(
+ 'module_no_data.png',
+ __(
+ '%s in %s : Not initialize',
+ $module_name,
+ $row['agent_alias']
+ ),
+ true,
+ [
+ 'width' => '20px',
+ 'height' => '20px',
+ ]
+ );
+ break;
+
+ case AGENT_STATUS_ALERT_FIRED:
+ default:
+ $table_data .= \ui_print_status_image(
+ 'module_alertsfired.png',
+ __(
+ '%s in %s : ALERTS FIRED',
+ $module_name,
+ $row['agent_alias']
+ ),
+ true,
+ [
+ 'width' => '20px',
+ 'height' => '20px',
+ ]
+ );
+ break;
+ }
+
+ $table_data .= ' | ';
+ }
}
}
@@ -743,9 +782,11 @@ class AgentModuleWidget extends Widget
}
}
} else {
- $modules = $agent->searchModules(
- ['nombre' => array_keys($reduceAllModules)]
- );
+ if (empty($reduceAllModules) === false) {
+ $modules = $agent->searchModules(
+ ['nombre' => array_keys($reduceAllModules)]
+ );
+ }
}
$visualData[$agent_id]['modules'] = $reduceAllModules;
@@ -754,7 +795,14 @@ class AgentModuleWidget extends Widget
continue;
}
- $visualData[$agent_id]['modules'][$module->name()] = $module->getStatus()->estado();
+ if ($this->values['mTypeShow'] === '1') {
+ $mod = $module->toArray();
+ $mod['datos'] = $module->lastValue();
+ $module_last_value = modules_get_agentmodule_data_for_humans($mod);
+ $visualData[$agent_id]['modules'][$module->name()] = $module_last_value;
+ } else {
+ $visualData[$agent_id]['modules'][$module->name()] = $module->getStatus()->estado();
+ }
}
if ((bool) is_metaconsole() === true) {
@@ -765,7 +813,10 @@ class AgentModuleWidget extends Widget
}
}
- $allModules = array_keys($reduceAllModules);
+ if (empty($reduceAllModules) === false) {
+ $allModules = array_keys($reduceAllModules);
+ }
+
if ($allModules === null) {
$allModules = [];
}
diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css
index a6ddcd02b9..743568eb46 100644
--- a/pandora_console/include/styles/pandora.css
+++ b/pandora_console/include/styles/pandora.css
@@ -1265,6 +1265,25 @@ input.datos {
.bg_caca {
background-color: #cacaca;
}
+
+.bg_th {
+ background-color: #efeff0 !important;
+ color: #000;
+ font-weight: bold;
+}
+
+.border_table {
+ border-collapse: collapse !important;
+}
+
+.border_th {
+ border-bottom: 2px solid #bfbfbf !important;
+}
+
+.border_tr {
+ border: 1px solid #dbdbdb !important;
+}
+
/* margins */
.mgn-lf-50 {
margin-left: 50px;
|