From 3280ad479f7c2ffa05e538f2a1ab7f859e45be56 Mon Sep 17 00:00:00 2001 From: Daniel Barbero Martin Date: Mon, 13 Apr 2020 15:01:18 +0200 Subject: [PATCH] Fix dashboards --- pandora_console/extras/mr/37.sql | 4 ++++ .../extras/pandoradb_migrate_6.0_to_7.0.mysql.sql | 6 ++++++ .../include/lib/Dashboard/Widgets/events_list.php | 7 ++++++- .../lib/Dashboard/Widgets/graph_module_histogram.php | 6 ------ .../include/lib/Dashboard/Widgets/maps_made_by_user.php | 4 ++-- .../include/lib/Dashboard/Widgets/system_group_status.php | 2 +- pandora_console/include/styles/dashboards.css | 4 +--- 7 files changed, 20 insertions(+), 13 deletions(-) diff --git a/pandora_console/extras/mr/37.sql b/pandora_console/extras/mr/37.sql index dd25fe2e98..85d3beb6d7 100644 --- a/pandora_console/extras/mr/37.sql +++ b/pandora_console/extras/mr/37.sql @@ -10,4 +10,8 @@ ALTER TABLE `talert_templates` ADD COLUMN `disable_event` tinyint(1) DEFAULT 0; ALTER TABLE `tevent_alert` ADD COLUMN `disable_event` tinyint(1) DEFAULT 0; ALTER TABLE `talert_snmp` ADD COLUMN `disable_event` tinyint(1) DEFAULT 0; +UPDATE twidget SET description='Show a visual console' WHERE class_name='MapsMadeByUser'; +UPDATE twidget SET description='Clock' WHERE class_name='ClockWidget'; +UPDATE twidget SET description='Group status' WHERE class_name='SystemGroupStatusWidget'; + COMMIT; diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 5a06360de8..0f8d0fefee 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -2536,3 +2536,9 @@ INSERT INTO `tnetwork_component` (`name`, `description`, `id_group`, `type`, `ma INSERT INTO `tnetwork_component` (`name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `max_critical`, `str_warning`, `min_ff_event`, `min_critical`, `custom_string_2`, `str_critical`, `custom_integer_1`, `custom_string_1`, `post_process`, `custom_string_3`, `wizard_level`, `custom_integer_2`, `critical_instructions`, `unit`, `unknown_instructions`, `macros`, `warning_inverse`, `warning_instructions`, `tags`, `critical_inverse`, `module_macros`, `id_category`, `min_ff_event_warning`, `disabled_types_event`, `ff_type`, `min_ff_event_normal`, `dynamic_interval`, `min_ff_event_critical`, `dynamic_min`, `each_ff`, `dynamic_two_tailed`, `dynamic_max`, `dynamic_next`) VALUES ('Linux system load','Current load (5 min)',43,34,0,0,300,0,'uptime | awk '{print $(NF-1)}' | tr -d ','','','','',6,2,0,'','','',0,0,1,0.00,0.00,'',0.00,0.00,'',0,'','linux','',0,0,0.000000000000000,'','nowizard','','','','',0,0,0,'','{\"going_unknown\":1}','',0,0,0,0,0,0,0,0,0,0); INSERT INTO `tnetwork_component` (`name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `max_critical`, `str_warning`, `min_ff_event`, `min_critical`, `custom_string_2`, `str_critical`, `custom_integer_1`, `custom_string_1`, `post_process`, `custom_string_3`, `wizard_level`, `custom_integer_2`, `critical_instructions`, `unit`, `unknown_instructions`, `macros`, `warning_inverse`, `warning_instructions`, `tags`, `critical_inverse`, `module_macros`, `id_category`, `min_ff_event_warning`, `disabled_types_event`, `ff_type`, `min_ff_event_normal`, `dynamic_interval`, `min_ff_event_critical`, `dynamic_min`, `each_ff`, `dynamic_two_tailed`, `dynamic_max`, `dynamic_next`) VALUES ('Linux available memory percent','Available memory %',43,34,0,0,300,0,'free | grep Mem | awk '{print $NF/$2 * 100}'','','','',4,2,0,'','','',0,0,1,0.00,0.00,'',0.00,0.00,'',0,'','linux','',0,0,0.000000000000000,'%','nowizard','','','','',0,0,0,'','{\"going_unknown\":1}','',0,0,0,0,0,0,0,0,0,0); INSERT INTO `tnetwork_component` (`name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `max_critical`, `str_warning`, `min_ff_event`, `min_critical`, `custom_string_2`, `str_critical`, `custom_integer_1`, `custom_string_1`, `post_process`, `custom_string_3`, `wizard_level`, `custom_integer_2`, `critical_instructions`, `unit`, `unknown_instructions`, `macros`, `warning_inverse`, `warning_instructions`, `tags`, `critical_inverse`, `module_macros`, `id_category`, `min_ff_event_warning`, `disabled_types_event`, `ff_type`, `min_ff_event_normal`, `dynamic_interval`, `min_ff_event_critical`, `dynamic_min`, `each_ff`, `dynamic_two_tailed`, `dynamic_max`, `dynamic_next`) VALUES ('Linux available disk /','Available free space in mountpoint /',43,34,0,0,300,0,'df / | tail -n +2 | awk '{print $(NF-1)}' | tr -d '%'','','','',4,2,0,'','','',0,0,1,0.00,0.00,'0.00',0.00,0.00,'',0,'','inherited','',0,0,0.000000000000000,'','nowizard','','nowizard','0','',0,0,0,'','{\"going_unknown\":1}','',0,0,0,0,0,0,0,0,0,0); + +-- Update widget. + +UPDATE twidget SET description='Show a visual console' WHERE class_name='MapsMadeByUser'; +UPDATE twidget SET description='Clock' WHERE class_name='ClockWidget'; +UPDATE twidget SET description='Group status' WHERE class_name='SystemGroupStatusWidget'; diff --git a/pandora_console/include/lib/Dashboard/Widgets/events_list.php b/pandora_console/include/lib/Dashboard/Widgets/events_list.php index 31e66dd3fe..1d0d4a3563 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/events_list.php +++ b/pandora_console/include/lib/Dashboard/Widgets/events_list.php @@ -416,7 +416,12 @@ class EventsListWidget extends Widget $filter['limit'] = $this->values['limit']; $filter['order'] = '`utimestamp` DESC'; - if ((int) $this->values['severity'] !== -1) { + if ((int) $this->values['severity'] === 20) { + $filter['criticity'] = [ + EVENT_CRIT_WARNING, + EVENT_CRIT_CRITICAL, + ]; + } else if ((int) $this->values['severity'] !== -1) { $filter['criticity'] = $this->values['severity']; } diff --git a/pandora_console/include/lib/Dashboard/Widgets/graph_module_histogram.php b/pandora_console/include/lib/Dashboard/Widgets/graph_module_histogram.php index 7e99294311..067bbef1fd 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/graph_module_histogram.php +++ b/pandora_console/include/lib/Dashboard/Widgets/graph_module_histogram.php @@ -309,12 +309,6 @@ class GraphModuleHistogramWidget extends Widget $size = parent::getSize(); // Desactive scroll bars only this item. - $output .= ''; $id_agent = $this->values['agentId']; $id_module = $this->values['moduleId']; $period = $this->values['period']; diff --git a/pandora_console/include/lib/Dashboard/Widgets/maps_made_by_user.php b/pandora_console/include/lib/Dashboard/Widgets/maps_made_by_user.php index baa6765789..f285abdc08 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/maps_made_by_user.php +++ b/pandora_console/include/lib/Dashboard/Widgets/maps_made_by_user.php @@ -206,9 +206,9 @@ class MapsMadeByUser extends Widget $fields = \visual_map_get_user_layouts($config['id_user'], true); - // Event Type. + // Visual console. $inputs[] = [ - 'label' => __('Event type'), + 'label' => __('Visual console'), 'arguments' => [ 'type' => 'select', 'fields' => $fields, diff --git a/pandora_console/include/lib/Dashboard/Widgets/system_group_status.php b/pandora_console/include/lib/Dashboard/Widgets/system_group_status.php index 9691c3e81a..65df0b83d4 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/system_group_status.php +++ b/pandora_console/include/lib/Dashboard/Widgets/system_group_status.php @@ -439,7 +439,7 @@ class SystemGroupStatusWidget extends Widget } } - $height = (count($result_groups) * 30); + $height = (count($table->data) * 30); $style = 'min-width:200px; min-height:'.$height.'px;'; $output = '
'; if ($flag_groups === true) { diff --git a/pandora_console/include/styles/dashboards.css b/pandora_console/include/styles/dashboards.css index e77b016359..0db5cd6cb3 100644 --- a/pandora_console/include/styles/dashboards.css +++ b/pandora_console/include/styles/dashboards.css @@ -339,10 +339,8 @@ table.widget_maps_status tr td:first-child { table.widget_maps_status tr td a { font-family: "lato-lighter", "Open Sans", sans-serif; letter-spacing: 0.03pt; - font-size: 11pt; + font-size: 9pt; text-decoration: none; - color: #3f3f3f; - font-weight: bolder; } table.widget_maps_status tr td img {