Merge branch 'ent-5605-9833-error-maestro-maestro-en-ha-de-percona-2' into 'develop'
add notify to HA See merge request artica/pandorafms!3235
This commit is contained in:
commit
910c20fbcf
|
@ -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,41 @@ class ConsoleSupervisor
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if AllowOveride is None or All.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function checkHaStatus()
|
||||
{
|
||||
global $config;
|
||||
enterprise_include_once('include/class/DatabaseHA.class.php');
|
||||
|
||||
$cluster = new DatabaseHA();
|
||||
$nodes = $cluster->getNodes();
|
||||
|
||||
foreach ($nodes as $node) {
|
||||
$cluster_master = $cluster->isClusterMaster($node);
|
||||
$db_master = $cluster->isDBMaster($node);
|
||||
|
||||
$message = '<pre>The roles played by node '.$node['host'].' are out of sync:
|
||||
Role in the cluster: Master
|
||||
Role in the database: Slave Desynchronized operation in the node';
|
||||
|
||||
if ((int) $db_master !== (int) $cluster_master) {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.HAMASTER.MESSAGE',
|
||||
'title' => __('Desynchronized operation on the node '.$node['host']),
|
||||
'message' => __($message),
|
||||
'url' => ui_get_full_url('index.php?sec=gservers&sec2=enterprise/godmode/servers/HA_cluster'),
|
||||
]
|
||||
);
|
||||
} else {
|
||||
$this->cleanNotifications('NOTIF.HAMASTER.MESSAGE');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue