diff --git a/pandora_console/extras/mr/68.sql b/pandora_console/extras/mr/68.sql index 55a21d961c..f472683b86 100644 --- a/pandora_console/extras/mr/68.sql +++ b/pandora_console/extras/mr/68.sql @@ -2,4 +2,7 @@ START TRANSACTION; ALTER TABLE `tusuario` CHANGE COLUMN `metaconsole_data_section` `metaconsole_data_section` TEXT NOT NULL DEFAULT '' ; +ALTER TABLE `tmensajes` ADD COLUMN `icon_notification` VARCHAR(250) NULL DEFAULT NULL AFTER `url`; + + COMMIT; \ No newline at end of file diff --git a/pandora_console/images/notification/congrats.svg b/pandora_console/images/notification/congrats.svg new file mode 100644 index 0000000000..2f744df78d --- /dev/null +++ b/pandora_console/images/notification/congrats.svg @@ -0,0 +1,21 @@ + + + Icons/Dark/40/Alert icon congrats + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pandora_console/images/notification/disable.svg b/pandora_console/images/notification/disable.svg new file mode 100644 index 0000000000..ac34ab01b3 --- /dev/null +++ b/pandora_console/images/notification/disable.svg @@ -0,0 +1,18 @@ + + + Icons/Dark/40/Alert icon disable + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pandora_console/images/notification/error.svg b/pandora_console/images/notification/error.svg new file mode 100644 index 0000000000..05b07ebfb9 --- /dev/null +++ b/pandora_console/images/notification/error.svg @@ -0,0 +1,21 @@ + + + Icons/Dark/40/Alert icon error + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pandora_console/images/notification/favorite.svg b/pandora_console/images/notification/favorite.svg new file mode 100644 index 0000000000..eff171b67f --- /dev/null +++ b/pandora_console/images/notification/favorite.svg @@ -0,0 +1,21 @@ + + + Icons/Dark/40/Alert icon favorite + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pandora_console/images/notification/headsup.svg b/pandora_console/images/notification/headsup.svg new file mode 100644 index 0000000000..57e26bc4d9 --- /dev/null +++ b/pandora_console/images/notification/headsup.svg @@ -0,0 +1,21 @@ + + + Icons/Dark/40/Alert icon heads up + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pandora_console/images/notification/information.svg b/pandora_console/images/notification/information.svg new file mode 100644 index 0000000000..11319a4bb5 --- /dev/null +++ b/pandora_console/images/notification/information.svg @@ -0,0 +1,17 @@ + + + Icons/Dark/40/Alert icon information + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pandora_console/images/notification/popular.svg b/pandora_console/images/notification/popular.svg new file mode 100644 index 0000000000..20b00a83ad --- /dev/null +++ b/pandora_console/images/notification/popular.svg @@ -0,0 +1,18 @@ + + + Icons/Dark/40/Alert icon popular + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pandora_console/images/notification/question.svg b/pandora_console/images/notification/question.svg new file mode 100644 index 0000000000..5694e5d9b2 --- /dev/null +++ b/pandora_console/images/notification/question.svg @@ -0,0 +1,18 @@ + + + Icons/Dark/40/Alert icon question + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pandora_console/include/class/ConsoleSupervisor.php b/pandora_console/include/class/ConsoleSupervisor.php index f60c4dc241..1b1d06d8b9 100644 --- a/pandora_console/include/class/ConsoleSupervisor.php +++ b/pandora_console/include/class/ConsoleSupervisor.php @@ -58,6 +58,18 @@ class ConsoleSupervisor */ public const MIN_SYNC_QUEUE_LENGTH = 200; + /** + * Icons for notifications. + */ + public const ICON_CONGRATS = 'images/notification/congrats.svg'; + public const ICON_DISABLE = 'images/notification/disable.svg'; + public const ICON_ERROR = 'images/notification/error.svg'; + public const ICON_FAVORITE = 'images/notification/favorite.svg'; + public const ICON_HEADSUP = 'images/notification/headsup.svg'; + public const ICON_INFORMATION = 'images/notification/information.svg'; + public const ICON_POPULAR = 'images/notification/popular.svg'; + public const ICON_QUESTION = 'images/notification/question.svg'; + /** * Show if console supervisor is enabled or not. * @@ -666,14 +678,15 @@ class ConsoleSupervisor $this->notify( [ - 'type' => 'NOTIF.VARIABLES.PERFORMANCE.'.$variable, - 'title' => __('Incorrect config value'), - 'message' => __( + 'type' => 'NOTIF.VARIABLES.PERFORMANCE.'.$variable, + 'title' => __('Incorrect config value'), + 'message' => __( $message, $names[$variable], $limit_value ), - 'url' => $url, + 'url' => $url, + 'icon_notification' => self::ICON_HEADSUP, ] ); } @@ -710,12 +723,13 @@ class ConsoleSupervisor db_process_sql_update('tconfig', ['value' => 0], ['token' => 'agentaccess']); $this->notify( [ - 'type' => 'NOTIF.ACCESSSTASTICS.PERFORMANCE', - 'title' => __('Access statistics performance'), - 'message' => __( + 'type' => 'NOTIF.ACCESSSTASTICS.PERFORMANCE', + 'title' => __('Access statistics performance'), + 'message' => __( 'Usage of agent access statistics IS NOT RECOMMENDED on systems with more than 200 agents due performance penalty' ), - 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf', + 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf', + 'icon_notification' => self::ICON_HEADSUP, ] ); } else { @@ -962,6 +976,9 @@ class ConsoleSupervisor $notification['subject'] = io_safe_input($data['title']); $notification['subtype'] = $data['type']; $notification['url'] = io_safe_input($data['url']); + if (isset($data['icon_notification']) === true) { + $notification['icon_notification'] = $data['icon_notification']; + } $id = db_process_sql_insert('tmensajes', $notification); @@ -1055,13 +1072,14 @@ class ConsoleSupervisor // Warn user if license is going to expire in 15 days or less. $this->notify( [ - 'type' => 'NOTIF.LICENSE.EXPIRATION', - 'title' => $title, - 'message' => __( + 'type' => 'NOTIF.LICENSE.EXPIRATION', + 'title' => $title, + 'message' => __( $msg, $days_to_expiry ), - 'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/license', + 'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/license', + 'icon_notification' => self::ICON_HEADSUP, ] ); } else if (($days_to_expiry <= 0) && ((is_user_admin($config['id_user'])) || (check_acl($config['id_user'], 0, 'PM')))) { @@ -1076,10 +1094,11 @@ class ConsoleSupervisor // Warn user, license has expired. $this->notify( [ - 'type' => 'NOTIF.LICENSE.EXPIRATION', - 'title' => $title, - 'message' => $msg, - 'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/license', + 'type' => 'NOTIF.LICENSE.EXPIRATION', + 'title' => $title, + 'message' => $msg, + 'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/license', + 'icon_notification' => self::ICON_HEADSUP, ] ); return false; @@ -1150,13 +1169,14 @@ class ConsoleSupervisor if (is_writable($config['attachment_store']) !== true) { $this->notify( [ - 'type' => 'NOTIF.WRITABLE.ATTACHMENT', - 'title' => __('Attachment directory is not writable'), - 'message' => __( + 'type' => 'NOTIF.WRITABLE.ATTACHMENT', + 'title' => __('Attachment directory is not writable'), + 'message' => __( 'Directory %s is not writable. Please, configure corresponding permissions.', $config['attachment_store'] ), - 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general', + 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general', + 'icon_notification' => self::ICON_ERROR, ] ); return; @@ -1206,13 +1226,14 @@ class ConsoleSupervisor if (is_readable($remote_config_dir) !== true) { $this->notify( [ - 'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG', - 'title' => __('Remote configuration directory is not readable'), - 'message' => __( + 'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG', + 'title' => __('Remote configuration directory is not readable'), + 'message' => __( 'Remote configuration directory %s is not readable. Please, adjust configuration.', $remote_config_dir ), - 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general', + 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general', + 'icon_notification' => self::ICON_ERROR, ] ); return; @@ -1225,13 +1246,14 @@ class ConsoleSupervisor if (is_writable($remote_config_dir.'/conf') !== true) { $this->notify( [ - 'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG.CONF', - 'title' => __('Remote configuration directory is not writable'), - 'message' => __( + 'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG.CONF', + 'title' => __('Remote configuration directory is not writable'), + 'message' => __( 'Remote configuration directory %s is not writable. Please, adjust configuration.', $remote_config_dir.'/conf' ), - 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general', + 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general', + 'icon_notification' => self::ICON_ERROR, ] ); } else { @@ -1243,13 +1265,14 @@ class ConsoleSupervisor if (is_writable($remote_config_dir.'/collections') !== true) { $this->notify( [ - 'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG.COLLECTIONS', - 'title' => __('Remote collections directory is not writable'), - 'message' => __( + 'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG.COLLECTIONS', + 'title' => __('Remote collections directory is not writable'), + 'message' => __( 'Collections directory %s is not writable. Please, adjust configuration.', $remote_config_dir.'/collections' ), - 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general', + 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general', + 'icon_notification' => self::ICON_ERROR, ] ); } else { @@ -1261,13 +1284,14 @@ class ConsoleSupervisor if (is_writable($remote_config_dir.'/md5') !== true) { $this->notify( [ - 'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG.MD5', - 'title' => __('Remote md5 directory is not writable'), - 'message' => __( + 'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG.MD5', + 'title' => __('Remote md5 directory is not writable'), + 'message' => __( 'MD5 directory %s is not writable. Please, adjust configuration.', $remote_config_dir.'/md5' ), - 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general', + 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general', + 'icon_notification' => self::ICON_ERROR, ] ); } else { @@ -1291,14 +1315,15 @@ class ConsoleSupervisor if ($filecount > $MAX_FILES_DATA_IN) { $this->notify( [ - 'type' => 'NOTIF.FILES.DATAIN', - 'title' => __('There are too much files in spool').'.', - 'message' => __( + 'type' => 'NOTIF.FILES.DATAIN', + 'title' => __('There are too much files in spool').'.', + 'message' => __( 'There are more than %d files in %s. Consider checking DataServer performance', $MAX_FILES_DATA_IN, $remote_config_dir ), - 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf', + 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf', + 'icon_notification' => self::ICON_HEADSUP, ] ); } else { @@ -1314,14 +1339,15 @@ class ConsoleSupervisor if ($filecount > $MAX_BADXML_FILES_DATA_IN) { $this->notify( [ - 'type' => 'NOTIF.FILES.DATAIN.BADXML', - 'title' => __('There are too many BADXML files in spool'), - 'message' => __( + 'type' => 'NOTIF.FILES.DATAIN.BADXML', + 'title' => __('There are too many BADXML files in spool'), + 'message' => __( 'There are more than %d files in %s. Consider checking software agents.', $MAX_BADXML_FILES_DATA_IN, $remote_config_dir ), - 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf', + 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf', + 'icon_notification' => self::ICON_HEADSUP, ] ); } else { @@ -1402,18 +1428,19 @@ class ConsoleSupervisor $this->notify( [ - 'type' => 'NOTIF.SERVER.QUEUE.'.$key, - 'title' => __( + 'type' => 'NOTIF.SERVER.QUEUE.'.$key, + 'title' => __( '%s (%s) is lacking performance.', servers_get_server_string_name($type), $queue['name'] ), - 'message' => __( + 'message' => __( $msg, $modules_queued, $queue['queued_modules'] ), - 'url' => '__url__/index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60', + 'url' => '__url__/index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60', + 'icon_notification' => self::ICON_HEADSUP, ] ); } else { @@ -1471,10 +1498,11 @@ class ConsoleSupervisor $this->notify( [ - 'type' => 'NOTIF.SERVER.STATUS', - 'title' => __('No servers available.'), - 'message' => __('There are no servers registered in this console. Please, check installation guide.'), - 'url' => $url, + 'type' => 'NOTIF.SERVER.STATUS', + 'title' => __('No servers available.'), + 'message' => __('There are no servers registered in this console. Please, check installation guide.'), + 'url' => $url, + 'icon_notification' => self::ICON_ERROR, ] ); } @@ -1515,6 +1543,7 @@ class ConsoleSupervisor } } + $icon_notification = self::ICON_QUESTION; if ($server['status'] == 1) { // Fatal error. Component has die. $msg = __( @@ -1528,6 +1557,8 @@ class ConsoleSupervisor servers_get_server_string_name($server['server_type']), $server['name'] ); + + $icon_notification = self::ICON_ERROR; } else { // Non-fatal error. Controlated exit. Component is not running. $msg = __( @@ -1544,10 +1575,11 @@ class ConsoleSupervisor $this->notify( [ - 'type' => 'NOTIF.SERVER.STATUS.'.$server['id_server'], - 'title' => $msg, - 'message' => $description, - 'url' => '__url__/index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60', + 'type' => 'NOTIF.SERVER.STATUS.'.$server['id_server'], + 'title' => $msg, + 'message' => $description, + 'url' => '__url__/index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60', + 'icon_notification' => $icon_notification, ] ); } @@ -1587,10 +1619,11 @@ class ConsoleSupervisor $this->notify( [ - 'type' => 'NOTIF.SERVER.MASTER', - 'title' => __('No master servers found.'), - 'message' => __('At least one server must be defined to run as master. Please, check documentation.'), - 'url' => $url, + 'type' => 'NOTIF.SERVER.MASTER', + 'title' => __('No master servers found.'), + 'message' => __('At least one server must be defined to run as master. Please, check documentation.'), + 'url' => $url, + 'icon_notification' => self::ICON_INFORMATION, ] ); } else { @@ -1643,10 +1676,11 @@ class ConsoleSupervisor $this->notify( [ - 'type' => 'NOTIF.PHP.SAFE_MODE', - 'title' => __('PHP safe mode is enabled. Some features may not work properly'), - 'message' => __('To disable it, go to your PHP configuration file (php.ini) and put safe_mode = Off (Do not forget to restart apache process after changes)'), - 'url' => $url, + 'type' => 'NOTIF.PHP.SAFE_MODE', + 'title' => __('PHP safe mode is enabled. Some features may not work properly'), + 'message' => __('To disable it, go to your PHP configuration file (php.ini) and put safe_mode = Off (Do not forget to restart apache process after changes)'), + 'url' => $url, + 'icon_notification' => self::ICON_HEADSUP, ] ); } else { @@ -1661,16 +1695,17 @@ class ConsoleSupervisor $this->notify( [ - 'type' => 'NOTIF.PHP.INPUT_TIME', - 'title' => sprintf( + 'type' => 'NOTIF.PHP.INPUT_TIME', + 'title' => sprintf( __('%s value in PHP configuration is not recommended'), 'max_input_time' ), - 'message' => sprintf( + 'message' => sprintf( __('Recommended value is %s'), '-1 ('.__('Unlimited').')' ).'

'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Do not forget to restart Apache process after)'), - 'url' => $url, + 'url' => $url, + 'icon_notification' => self::ICON_INFORMATION, ] ); } else { @@ -1685,16 +1720,17 @@ class ConsoleSupervisor $this->notify( [ - 'type' => 'NOTIF.PHP.EXECUTION_TIME', - 'title' => sprintf( + 'type' => 'NOTIF.PHP.EXECUTION_TIME', + 'title' => sprintf( __("Not recommended '%s' value in PHP configuration"), 'max_execution_time' ), - 'message' => sprintf( + 'message' => sprintf( __('Recommended value is: %s'), '0 ('.__('Unlimited').')' ).'

'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Dont forget restart apache process after changes)'), - 'url' => $url, + 'url' => $url, + 'icon_notification' => self::ICON_INFORMATION, ] ); } else { @@ -1709,16 +1745,17 @@ class ConsoleSupervisor $this->notify( [ - 'type' => 'NOTIF.PHP.UPLOAD_MAX_FILESIZE', - 'title' => sprintf( + 'type' => 'NOTIF.PHP.UPLOAD_MAX_FILESIZE', + 'title' => sprintf( __("Not recommended '%s' value in PHP configuration"), 'upload_max_filesize' ), - 'message' => sprintf( + 'message' => sprintf( __('Recommended value is: %s'), sprintf(__('%s or greater'), '800M') ).'

'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Dont forget restart apache process after changes)'), - 'url' => $url, + 'url' => $url, + 'icon_notification' => self::ICON_INFORMATION, ] ); } else { @@ -1738,16 +1775,17 @@ class ConsoleSupervisor $this->notify( [ - 'type' => 'NOTIF.PHP.MEMORY_LIMIT', - 'title' => sprintf( + 'type' => 'NOTIF.PHP.MEMORY_LIMIT', + 'title' => sprintf( __("Not recommended '%s' value in PHP configuration"), 'memory_limit' ), - 'message' => sprintf( + 'message' => sprintf( __('Recommended value is: %s'), sprintf(__('%s or greater'), $recommended_memory) ).'

'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator'), - 'url' => $url, + 'url' => $url, + 'icon_notification' => self::ICON_INFORMATION, ] ); } else { @@ -1762,10 +1800,11 @@ class ConsoleSupervisor $this->notify( [ - 'type' => 'NOTIF.PHP.DISABLE_FUNCTIONS', - 'title' => __('Problems with disable_functions in php.ini'), - 'message' => __('The variable disable_functions contains functions system() or exec() in PHP configuration file (php.ini)').'

'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Dont forget restart apache process after changes)'), - 'url' => $url, + 'type' => 'NOTIF.PHP.DISABLE_FUNCTIONS', + 'title' => __('Problems with disable_functions in php.ini'), + 'message' => __('The variable disable_functions contains functions system() or exec() in PHP configuration file (php.ini)').'

'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Dont forget restart apache process after changes)'), + 'url' => $url, + 'icon_notification' => self::ICON_HEADSUP, ] ); } else { @@ -1779,10 +1818,11 @@ class ConsoleSupervisor // } $this->notify( [ - 'type' => 'NOTIF.PHP.CHROMIUM', - 'title' => __('chromium is not installed'), - 'message' => __('To be able to create images of the graphs for PDFs, please install the chromium extension. For that, it is necessary to follow these steps:'), - 'url' => $url, + 'type' => 'NOTIF.PHP.CHROMIUM', + 'title' => __('chromium is not installed'), + 'message' => __('To be able to create images of the graphs for PDFs, please install the chromium extension. For that, it is necessary to follow these steps:'), + 'url' => $url, + 'icon_notification' => self::ICON_HEADSUP, ] ); } else { @@ -1840,10 +1880,11 @@ class ConsoleSupervisor $url = 'https://www.php.net/supported-versions.php'; $this->notify( [ - 'type' => 'NOTIF.PHP.VERSION.SUPPORT', - 'title' => __('PHP UPDATE REQUIRED'), - 'message' => __('You should update your PHP version because it will be out of official support').'
'.__('Current PHP version: ').PHP_VERSION, - 'url' => $url, + 'type' => 'NOTIF.PHP.VERSION.SUPPORT', + 'title' => __('PHP UPDATE REQUIRED'), + 'message' => __('You should update your PHP version because it will be out of official support').'
'.__('Current PHP version: ').PHP_VERSION, + 'url' => $url, + 'icon_notification' => self::ICON_HEADSUP, ] ); } else { @@ -1866,10 +1907,11 @@ class ConsoleSupervisor $url = 'https://www.mysql.com/support/eol-notice.html'; $this->notify( [ - 'type' => 'NOTIF.MYSQL.VERSION', - 'title' => __('MYSQL UPDATE REQUIRED'), - 'message' => __('You should update your MYSQL version because it will be out of official support').'
'.__('Current MYSQL version: ').$mysql_version, - 'url' => $url, + 'type' => 'NOTIF.MYSQL.VERSION', + 'title' => __('MYSQL UPDATE REQUIRED'), + 'message' => __('You should update your MYSQL version because it will be out of official support').'
'.__('Current MYSQL version: ').$mysql_version, + 'url' => $url, + 'icon_notification' => self::ICON_HEADSUP, ] ); } else { @@ -1908,10 +1950,11 @@ class ConsoleSupervisor if ($config['history_db_connection'] === false) { $this->notify( [ - 'type' => 'NOTIF.HISTORYDB', - 'title' => __('Historical database not available'), - 'message' => __('Historical database is enabled, though not accessible with the current configuration.'), - 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=hist_db', + 'type' => 'NOTIF.HISTORYDB', + 'title' => __('Historical database not available'), + 'message' => __('Historical database is enabled, though not accessible with the current configuration.'), + 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=hist_db', + 'icon_notification' => self::ICON_QUESTION, ] ); } else { @@ -1952,13 +1995,14 @@ class ConsoleSupervisor if ($last_maintance > 172800) { $this->notify( [ - 'type' => 'NOTIF.PANDORADB', - 'title' => __('Database maintenance problem'), - 'message' => __( + 'type' => 'NOTIF.PANDORADB', + 'title' => __('Database maintenance problem'), + 'message' => __( 'Your database hasn\'t been through maintenance for 48hrs. Please, check documentation on how to perform this maintenance process on %s and enable it as soon as possible.', io_safe_output(get_product_name()) ), - 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf', + 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf', + 'icon_notification' => self::ICON_HEADSUP, ] ); } else { @@ -2013,12 +2057,13 @@ class ConsoleSupervisor if ($last_maintance > 172800) { $this->notify( [ - 'type' => 'NOTIF.PANDORADB.HISTORY', - 'title' => __( + 'type' => 'NOTIF.PANDORADB.HISTORY', + 'title' => __( 'Historical database maintenance problem.' ), - 'message' => __('Your historical database hasn\'t been through maintenance for 48hrs. Please, check documentation on how to perform this maintenance process on %s and enable it as soon as possible.', get_product_name()), - 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf', + 'message' => __('Your historical database hasn\'t been through maintenance for 48hrs. Please, check documentation on how to perform this maintenance process on %s and enable it as soon as possible.', get_product_name()), + 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf', + 'icon_notification' => self::ICON_ERROR, ] ); } else { @@ -2054,10 +2099,11 @@ class ConsoleSupervisor if ($mrh_version != $config['MR']) { $this->notify( [ - 'type' => 'NOTIF.HISTORYDB.MR', - 'title' => __('Historical database MR mismatch'), - 'message' => __('Your historical database is not using the same schema as the main DB. This could produce anomalies while storing historical data.'), - 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=hist_db', + 'type' => 'NOTIF.HISTORYDB.MR', + 'title' => __('Historical database MR mismatch'), + 'message' => __('Your historical database is not using the same schema as the main DB. This could produce anomalies while storing historical data.'), + 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=hist_db', + 'icon_notification' => self::ICON_QUESTION, ] ); } else { @@ -2095,10 +2141,11 @@ class ConsoleSupervisor if ($elasticsearch === false) { $this->notify( [ - 'type' => 'NOTIF.EXT.ELASTICSEARCH', - 'title' => __('Log collector cannot connect to OpenSearch'), - 'message' => __('OpenSearch is not available using current configuration.'), - 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=log', + 'type' => 'NOTIF.EXT.ELASTICSEARCH', + 'title' => __('Log collector cannot connect to OpenSearch'), + 'message' => __('OpenSearch is not available using current configuration.'), + 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=log', + 'icon_notification' => self::ICON_ERROR, ] ); } else { @@ -2165,10 +2212,11 @@ class ConsoleSupervisor } else { $this->notify( [ - 'type' => 'NOTIF.METACONSOLE.DB_CONNECTION', - 'title' => __('Metaconsole DB is not available.'), - 'message' => __('Cannot connect with Metaconsole DB using current configuration.'), - 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=enterprise', + 'type' => 'NOTIF.METACONSOLE.DB_CONNECTION', + 'title' => __('Metaconsole DB is not available.'), + 'message' => __('Cannot connect with Metaconsole DB using current configuration.'), + 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=enterprise', + 'icon_notification' => self::ICON_ERROR, ] ); } @@ -2384,10 +2432,11 @@ class ConsoleSupervisor if (update_manager_verify_registration() === false) { $this->notify( [ - 'type' => 'NOTIF.UPDATEMANAGER.REGISTRATION', - 'title' => __('This instance is not registered in the Warp Update section'), - 'message' => __('Click here to start the registration process'), - 'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online', + 'type' => 'NOTIF.UPDATEMANAGER.REGISTRATION', + 'title' => __('This instance is not registered in the Warp Update section'), + 'message' => __('Click here to start the registration process'), + 'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online', + 'icon_notification' => self::ICON_QUESTION, ] ); } else { @@ -2414,9 +2463,10 @@ class ConsoleSupervisor if (update_manager_verify_api() === false) { $this->notify( [ - 'type' => 'NOTIF.API.ACCESS', - 'title' => __('Cannot access the Pandora FMS API '), - 'message' => __('Please check the configuration, some components may fail due to this misconfiguration in '.$server_name.' ('.$config['public_url'].')'), + 'type' => 'NOTIF.API.ACCESS', + 'title' => __('Cannot access the Pandora FMS API '), + 'message' => __('Please check the configuration, some components may fail due to this misconfiguration in '.$server_name.' ('.$config['public_url'].')'), + 'icon_notification' => self::ICON_ERROR, ] ); } else { @@ -2447,10 +2497,11 @@ class ConsoleSupervisor if ($admin_with_default_pass > 0) { $this->notify( [ - 'type' => 'NOTIF.SECURITY.DEFAULT_PASSWORD', - 'title' => __('Default password for "Admin" user has not been changed'), - 'message' => __('Please, change the default password since it is a commonly reported vulnerability.'), - 'url' => '__url__/index.php?sec=gusuarios&sec2=godmode/users/user_list', + 'type' => 'NOTIF.SECURITY.DEFAULT_PASSWORD', + 'title' => __('Default password for "Admin" user has not been changed'), + 'message' => __('Please, change the default password since it is a commonly reported vulnerability.'), + 'url' => '__url__/index.php?sec=gusuarios&sec2=godmode/users/user_list', + 'icon_notification' => self::ICON_HEADSUP, ] ); } else { @@ -2562,10 +2613,11 @@ class ConsoleSupervisor foreach ($_SESSION['return_installation_open']['text'] as $message) { $this->notify( [ - 'type' => 'NOTIF.UPDATEMANAGER.OPENSETUP', - 'title' => __('Failed to retrieve updates, please configure utility'), - 'message' => $message, - 'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/setup§ion=general', + 'type' => 'NOTIF.UPDATEMANAGER.OPENSETUP', + 'title' => __('Failed to retrieve updates, please configure utility'), + 'message' => $message, + 'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/setup§ion=general', + 'icon_notification' => self::ICON_ERROR, ] ); } @@ -2579,13 +2631,14 @@ class ConsoleSupervisor if ($_SESSION['new_update'] == 'new') { $this->notify( [ - 'type' => 'NOTIF.UPDATEMANAGER.UPDATE', - 'title' => __( + 'type' => 'NOTIF.UPDATEMANAGER.UPDATE', + 'title' => __( 'New %s Console update', get_product_name() ), - 'message' => __('There is a new update available. Please go to Administration:Setup:Update Manager for more details.'), - 'url' => '__url__/index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online', + 'message' => __('There is a new update available. Please go to Administration:Setup:Update Manager for more details.'), + 'url' => '__url__/index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online', + 'icon_notification' => self::ICON_CONGRATS, ] ); } else { @@ -2617,13 +2670,14 @@ class ConsoleSupervisor $this->notify( [ - 'type' => 'NOTIF.UPDATEMANAGER.MINOR', - 'title' => __('Minor release/s available'), - 'message' => __( + 'type' => 'NOTIF.UPDATEMANAGER.MINOR', + 'title' => __('Minor release/s available'), + 'message' => __( 'There is one or more minor releases available. .About minor release update.', $url ), - 'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online', + 'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online', + 'icon_notification' => self::ICON_CONGRATS, ] ); } else { @@ -2680,10 +2734,11 @@ class ConsoleSupervisor $this->notify( [ - 'type' => 'NOTIF.CRON.CONFIGURED', - 'title' => __('DiscoveryConsoleTasks is not configured.'), - 'message' => __($message_conf_cron), - 'url' => $url, + 'type' => 'NOTIF.CRON.CONFIGURED', + 'title' => __('DiscoveryConsoleTasks is not configured.'), + 'message' => __($message_conf_cron), + 'url' => $url, + 'icon_notification' => self::ICON_QUESTION, ] ); } else { @@ -2782,10 +2837,11 @@ class ConsoleSupervisor $this->notify( [ - 'type' => 'NOTIF.SERVER.MISALIGNED', - 'title' => __($title_ver_misaligned), - 'message' => __($message_ver_misaligned), - 'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online', + 'type' => 'NOTIF.SERVER.MISALIGNED', + 'title' => __($title_ver_misaligned), + 'message' => __($message_ver_misaligned), + 'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online', + 'icon_notification' => self::ICON_HEADSUP, ] ); @@ -2838,10 +2894,11 @@ class ConsoleSupervisor $is_none = true; $this->notify( [ - 'type' => 'NOTIF.ALLOWOVERRIDE.MESSAGE', - 'title' => __('AllowOverride is disabled'), - 'message' => __($message), - 'url' => '__url__/index.php', + 'type' => 'NOTIF.ALLOWOVERRIDE.MESSAGE', + 'title' => __('AllowOverride is disabled'), + 'message' => __($message), + 'url' => '__url__/index.php', + 'icon_notification' => self::ICON_HEADSUP, ] ); } @@ -2884,10 +2941,11 @@ class ConsoleSupervisor if ((int) $db_master !== (int) $cluster_master) { $this->notify( [ - 'type' => 'NOTIF.HAMASTER.MESSAGE', - 'title' => __('Desynchronized operation on the node '.$node['host']), - 'message' => __($message), - 'url' => '__url__/index.php?sec=gservers&sec2=enterprise/godmode/servers/HA_cluster', + 'type' => 'NOTIF.HAMASTER.MESSAGE', + 'title' => __('Desynchronized operation on the node '.$node['host']), + 'message' => __($message), + 'url' => '__url__/index.php?sec=gservers&sec2=enterprise/godmode/servers/HA_cluster', + 'icon_notification' => self::ICON_ERROR, ] ); } else { @@ -2924,10 +2982,11 @@ class ConsoleSupervisor $this->notify( [ - 'type' => 'NOTIF.PANDORACONSOLE.LOG.OLD', - 'title' => __($title_pandoraconsole_old_log), - 'message' => __($message_pandoraconsole_old_log), - 'url' => $url, + 'type' => 'NOTIF.PANDORACONSOLE.LOG.OLD', + 'title' => __($title_pandoraconsole_old_log), + 'message' => __($message_pandoraconsole_old_log), + 'url' => $url, + 'icon_notification' => self::ICON_QUESTION, ] ); } else { @@ -3008,15 +3067,16 @@ class ConsoleSupervisor $this->notify( [ - 'type' => 'NOTIF.SYNCQUEUE.LENGTH.'.$node_id, - 'title' => __('Node %s sync queue length exceeded, ', $node->server_name()), - 'message' => __( + 'type' => 'NOTIF.SYNCQUEUE.LENGTH.'.$node_id, + 'title' => __('Node %s sync queue length exceeded, ', $node->server_name()), + 'message' => __( 'Synchronization queue lenght for node %s is %d items, this value should be 0 or lower than %d, please check the queue status.', $node->server_name(), $count, $items_min ), - 'url' => $url, + 'url' => $url, + 'icon_notification' => self::ICON_HEADSUP, ] ); } catch (\Exception $e) { @@ -3063,14 +3123,15 @@ class ConsoleSupervisor $this->notify( [ - 'type' => 'NOTIF.SYNCQUEUE.STATUS.'.$node_id, - 'title' => __('Node %s sync queue failed, ', $node->server_name()), - 'message' => __( + 'type' => 'NOTIF.SYNCQUEUE.STATUS.'.$node_id, + 'title' => __('Node %s sync queue failed, ', $node->server_name()), + 'message' => __( 'Node %s cannot process synchronization queue due %s, please check the queue status.', $node->server_name(), $item->error() ), - 'url' => $url, + 'url' => $url, + 'icon_notification' => self::ICON_ERROR, ] ); } catch (\Exception $e) { @@ -3096,13 +3157,14 @@ class ConsoleSupervisor if ($error_dependecies > 0) { $this->notify( [ - 'type' => 'NOTIF.AGENT.LIBRARY', - 'title' => __('Agent dependency error'), - 'message' => __( + 'type' => 'NOTIF.AGENT.LIBRARY', + 'title' => __('Agent dependency error'), + 'message' => __( 'There are omnishell agents with dependency errors', ), - 'url' => '__url__/index.php?sec=gextensions&sec2=enterprise/tools/omnishell', + 'url' => '__url__/index.php?sec=gextensions&sec2=enterprise/tools/omnishell', + 'icon_notification' => self::ICON_ERROR, ] ); } diff --git a/pandora_console/include/functions_notifications.php b/pandora_console/include/functions_notifications.php index 2c378cdb10..61330b66f7 100644 --- a/pandora_console/include/functions_notifications.php +++ b/pandora_console/include/functions_notifications.php @@ -27,6 +27,7 @@ */ require_once $config['homedir'].'/include/functions_messages.php'; +require_once __DIR__.'/class/ConsoleSupervisor.php'; define('NOTIFICATIONS_POSTPONE_FOREVER', -1); @@ -1265,6 +1266,12 @@ function notifications_print_dropdown_element($message_info) $body_preview .= __('. Read More...'); } + $icon_notification = ConsoleSupervisor::ICON_INFORMATION; + + if (isset($message_info['icon_notification']) === true && empty($message_info['icon_notification']) === false) { + $icon_notification = $message_info['icon_notification']; + } + return sprintf( " 'height: 40px;margin-left: -20px;margin-top: -40px;']), + html_print_image($icon_notification, true, ['style' => 'height: 56px; padding: 0px;']), io_safe_output($message_info['subject']), $body_preview ); diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index bd0064bd59..fec8feef43 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -4992,7 +4992,7 @@ div#dialog_messages table th:last-child { } .notification-item > * { - padding-left: 15px; + padding-left: 7px; pointer-events: none; } @@ -5018,6 +5018,10 @@ div#dialog_messages table th:last-child { margin: 0; } +.notification-subtitle { + margin-top: 2px; +} + .notification-subtitle, .color-black-grey { color: #373737; diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 792ca2770c..0c2f58120c 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1395,6 +1395,7 @@ CREATE TABLE IF NOT EXISTS `tmensajes` ( `subject` VARCHAR(255) NOT NULL DEFAULT '', `estado` INT UNSIGNED NOT NULL DEFAULT 0, `url` TEXT, + `icon_notification` VARCHAR(250) DEFAULT NULL, `response_mode` VARCHAR(200) DEFAULT NULL, `citicity` INT UNSIGNED DEFAULT 0, `id_source` BIGINT UNSIGNED NOT NULL,