mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-09 01:05:58 +00:00
check general health for ceph monitors, not only time
we did not check the healthservices array for the monitor widget, this patch does that, and takes the worst health state Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
bd8950b0ea
commit
f3f73cde3b
@ -95,7 +95,10 @@ Ext.define('PVE.ceph.StatusDetail', {
|
|||||||
!record.data.health ||
|
!record.data.health ||
|
||||||
!record.data.health.timechecks ||
|
!record.data.health.timechecks ||
|
||||||
!record.data.monmap ||
|
!record.data.monmap ||
|
||||||
!record.data.monmap.mons) {
|
!record.data.monmap.mons ||
|
||||||
|
!record.data.health.health ||
|
||||||
|
!record.data.health.health.health_services ||
|
||||||
|
!record.data.health.health.health_services[0]) {
|
||||||
// only continue if we have all the data
|
// only continue if we have all the data
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -159,7 +162,9 @@ Ext.define('PVE.ceph.StatusDetail', {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var monTimes = record.data.health.timechecks.mons || [];
|
var monTimes = record.data.health.timechecks.mons || [];
|
||||||
|
var monHealth = record.data.health.health.health_services[0].mons || [];
|
||||||
var timechecks = {};
|
var timechecks = {};
|
||||||
|
var healthchecks = {};
|
||||||
var monContainer = me.getComponent('monitors');
|
var monContainer = me.getComponent('monitors');
|
||||||
var i;
|
var i;
|
||||||
for (i = 0; i < mons.length && i < monTimes.length; i++) {
|
for (i = 0; i < mons.length && i < monTimes.length; i++) {
|
||||||
@ -170,6 +175,10 @@ Ext.define('PVE.ceph.StatusDetail', {
|
|||||||
timechecks[mons[0].name] = "HEALTH_OK";
|
timechecks[mons[0].name] = "HEALTH_OK";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < mons.length && i < monHealth.length; i++) {
|
||||||
|
healthchecks[monHealth[i].name] = monHealth[i].health;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < mons.length; i++) {
|
for (i = 0; i < mons.length; i++) {
|
||||||
var monitor = monContainer.getComponent('mon.' + mons[i].name);
|
var monitor = monContainer.getComponent('mon.' + mons[i].name);
|
||||||
if (!monitor) {
|
if (!monitor) {
|
||||||
@ -181,7 +190,7 @@ Ext.define('PVE.ceph.StatusDetail', {
|
|||||||
itemId: 'mon.' + mons[i].name
|
itemId: 'mon.' + mons[i].name
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
monitor.updateMonitor(timechecks[mons[i].name], mons[i], record.data.quorum_names);
|
monitor.updateMonitor(timechecks[mons[i].name], mons[i], record.data.quorum_names, healthchecks[mons[i].name]);
|
||||||
}
|
}
|
||||||
me.suspendLayout = false;
|
me.suspendLayout = false;
|
||||||
me.updateLayout();
|
me.updateLayout();
|
||||||
@ -209,16 +218,22 @@ Ext.define('PVE.ceph.MonitorWidget', {
|
|||||||
// timestate: the status from timechecks.mons
|
// timestate: the status from timechecks.mons
|
||||||
// data: the monmap.mons data
|
// data: the monmap.mons data
|
||||||
// quorum_names: the quorum_names array
|
// quorum_names: the quorum_names array
|
||||||
updateMonitor: function(timestate, data, quorum_names) {
|
updateMonitor: function(timestate, data, quorum_names, health) {
|
||||||
var me = this;
|
var me = this;
|
||||||
var state = 'HEALTH_ERR';
|
var state = 'HEALTH_ERR';
|
||||||
|
var healthstates = {
|
||||||
|
'HEALTH_OK': 3,
|
||||||
|
'HEALTH_WARN': 2,
|
||||||
|
'HEALTH_ERR': 1
|
||||||
|
};
|
||||||
|
|
||||||
// if the monitor is part of the quorum
|
// if the monitor is part of the quorum
|
||||||
// and has a timestate, get the timestate,
|
// and has a timestate, get the timestate,
|
||||||
// otherwise the state is ERR
|
// otherwise the state is ERR
|
||||||
if (timestate && quorum_names &&
|
if (timestate && health && quorum_names &&
|
||||||
quorum_names.indexOf(data.name) !== -1) {
|
quorum_names.indexOf(data.name) !== -1) {
|
||||||
state = timestate;
|
state = (healthstates[health] < healthstates[timestate])?
|
||||||
|
health : timestate;
|
||||||
}
|
}
|
||||||
|
|
||||||
me.update(Ext.apply(me.data, {
|
me.update(Ext.apply(me.data, {
|
||||||
|
Loading…
Reference in New Issue
Block a user