mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-13 00:45:13 +02:00
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();
|
$this->checkAllowOverrideEnabled();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check if AllowOverride is None or All.
|
||||||
|
* NOTIF.HAMASTER.MESSAGE
|
||||||
|
*/
|
||||||
|
$this->checkHaStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -451,6 +456,11 @@ class ConsoleSupervisor
|
|||||||
*/
|
*/
|
||||||
$this->checkAllowOverrideEnabled();
|
$this->checkAllowOverrideEnabled();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check if HA status.
|
||||||
|
*/
|
||||||
|
$this->checkHaStatus();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -618,6 +628,8 @@ class ConsoleSupervisor
|
|||||||
case 'NOTIF.UPDATEMANAGER.MESSAGES':
|
case 'NOTIF.UPDATEMANAGER.MESSAGES':
|
||||||
case 'NOTIF.CRON.CONFIGURED':
|
case 'NOTIF.CRON.CONFIGURED':
|
||||||
case 'NOTIF.ALLOWOVERRIDE.MESSAGE':
|
case 'NOTIF.ALLOWOVERRIDE.MESSAGE':
|
||||||
|
case 'NOTIF.HAMASTER.MESSAGE':
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// NOTIF.SERVER.STATUS.
|
// NOTIF.SERVER.STATUS.
|
||||||
// NOTIF.SERVER.STATUS.ID_SERVER.
|
// NOTIF.SERVER.STATUS.ID_SERVER.
|
||||||
@ -2344,10 +2356,9 @@ class ConsoleSupervisor
|
|||||||
sprintf(
|
sprintf(
|
||||||
'SELECT `name`, `version`
|
'SELECT `name`, `version`
|
||||||
FROM tserver
|
FROM tserver
|
||||||
WHERE server_type NOT IN ( %d , %d )
|
WHERE server_type != %d
|
||||||
GROUP BY `version`',
|
GROUP BY `version`',
|
||||||
SERVER_TYPE_ENTERPRISE_SATELLITE,
|
SERVER_TYPE_ENTERPRISE_SATELLITE
|
||||||
SERVER_TYPE_MAINFRAME
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -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…
x
Reference in New Issue
Block a user