diff --git a/pandora_console/include/class/ConsoleSupervisor.php b/pandora_console/include/class/ConsoleSupervisor.php index 3fded27dec..15b2607e1e 100644 --- a/pandora_console/include/class/ConsoleSupervisor.php +++ b/pandora_console/include/class/ConsoleSupervisor.php @@ -221,6 +221,11 @@ class ConsoleSupervisor */ $this->checkAllowOverrideEnabled(); + /* + * Check if AllowOverride is None or All. + * NOTIF.HAMASTER.MESSAGE + */ + $this->checkHaStatus(); } @@ -451,6 +456,11 @@ class ConsoleSupervisor */ $this->checkAllowOverrideEnabled(); + /* + * Check if HA status. + */ + $this->checkHaStatus(); + } @@ -618,6 +628,8 @@ class ConsoleSupervisor case 'NOTIF.UPDATEMANAGER.MESSAGES': case 'NOTIF.CRON.CONFIGURED': case 'NOTIF.ALLOWOVERRIDE.MESSAGE': + case 'NOTIF.HAMASTER.MESSAGE': + default: // NOTIF.SERVER.STATUS. // NOTIF.SERVER.STATUS.ID_SERVER. @@ -2344,10 +2356,9 @@ class ConsoleSupervisor sprintf( 'SELECT `name`, `version` FROM tserver - WHERE server_type NOT IN ( %d , %d ) + WHERE server_type != %d GROUP BY `version`', - SERVER_TYPE_ENTERPRISE_SATELLITE, - SERVER_TYPE_MAINFRAME + SERVER_TYPE_ENTERPRISE_SATELLITE ) ); @@ -2435,4 +2446,52 @@ class ConsoleSupervisor } + /** + * Check if AllowOveride is None or All. + * + * @return void + */ + public function checkHaStatus() + { + global $config; + + $dbh = @get_dbconnection( + [ + 'dbhost' => $node['host'], + 'dbport' => $node['db_port'], + 'dbname' => '', + 'dbuser' => $config['pandora_db_repl_user'], + 'dbpass' => $config['pandora_db_repl_pass'], + ] + ); + + $message = '
One or more nodes have a master role in DB and Cluster'; + $db = db_process_sql( + 'SELECT @@global.read_only', + 'info', + $dbh + ); + + $cluster = db_process_sql( + 'SHOW SLAVE STATUS ', + 'info', + $dbh + ); + + if ($cluster == 0 && $cluster != false) { + $this->notify( + [ + 'type' => 'NOTIF.HAMASTER.MESSAGE', + 'title' => __('Database HA has problem '), + 'message' => __($message), + 'url' => ui_get_full_url('index.php'), + ] + ); + } else { + $this->cleanNotifications('NOTIF.HAMASTER.MESSAGE'); + } + + } + + }