diff --git a/pandora_console/include/lib/Dashboard/Widgets/module_icon.php b/pandora_console/include/lib/Dashboard/Widgets/module_icon.php
index 6790d70616..e561a1eb86 100644
--- a/pandora_console/include/lib/Dashboard/Widgets/module_icon.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/module_icon.php
@@ -540,12 +540,6 @@ class ModuleIconWidget extends Widget
$output = '';
- $id_group = \agents_get_agent_group($this->values['agentId']);
-
- $modulesAgent = \modules_get_agentmodule_agent(
- $this->values['moduleId']
- );
-
$data_module = \modules_get_last_value(
$this->values['moduleId']
);
@@ -572,33 +566,37 @@ class ModuleIconWidget extends Widget
// General div.
$output .= '
';
- $sql = 'SELECT min_warning,
- max_warning,
- min_critical,
- max_critical,
- str_warning,
- str_critical
- FROM tagente_modulo
- WHERE id_agente_modulo = '.(int) $this->values['moduleId'];
- $sql_data = db_get_row_sql($sql);
+ $status = \modules_get_agentmodule_status($this->values['moduleId']);
- $last = modules_get_last_value($this->values['moduleId']);
+ switch ($status) {
+ case 1:
+ case 4:
+ // Critical or critical alert (BAD).
+ $color_icon .= '_bad.png';
+ break;
- $color_icon = '_ok';
- if (($last >= $sql_data['min_warning']) && ($last < $sql_data['max_warning'])) {
- $color_icon = '_warning';
+ case 0:
+ // Normal (OK).
+ $color_icon .= '_ok.png';
+ break;
+
+ case 2:
+ case 10:
+ // Warning or warning alert.
+ $color_icon .= '_warning.png';
+ break;
+
+ case 3:
+ // Unknown.
+ default:
+ $color_icon .= '.png';
+ // Default is Grey (Other).
+ break;
}
- if ($last >= $sql_data['max_warning']) {
- $color_icon = '_bad';
- }
-
- // Div image.
- $style_icon = 'flex: 0 1 '.$sizeIcon.'px;';
-
$output .= '
';
$output .= html_print_image(
- 'images/console/icons/'.$icon.$color_icon.'.png',
+ 'images/console/icons/'.$icon.$color_icon,
true,
['width' => $sizeIcon]
);