mirror of https://github.com/apache/cloudstack.git
plugins: Consider maintenance mode as offline for promethues stats (#4366)
If the resource state of hypervisor in "Maintenance" then it should be considered as offline even though the agent state is "Up". Since its in maintenance mode, it cant be used to allocate VM's and hence can't be considered towards resource allocation
This commit is contained in:
parent
191dbf7ea7
commit
2333d97098
|
|
@ -117,9 +117,10 @@ public class PrometheusExporterImpl extends ManagerBase implements PrometheusExp
|
|||
continue;
|
||||
}
|
||||
total++;
|
||||
if (host.getStatus() == Status.Up) {
|
||||
if (host.getStatus() == Status.Up && !host.isInMaintenanceStates()) {
|
||||
up++;
|
||||
} else if (host.getStatus() == Status.Disconnected || host.getStatus() == Status.Down) {
|
||||
} else if (host.getStatus() == Status.Disconnected || host.getStatus() == Status.Down ||
|
||||
host.isInMaintenanceStates()) {
|
||||
down++;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
// under the License.
|
||||
package com.cloud.api.query.vo;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Column;
|
||||
|
|
@ -402,4 +403,10 @@ public class HostJoinVO extends BaseViewVO implements InternalIdentity, Identity
|
|||
public boolean isAnnotated() {
|
||||
return StringUtils.isNotBlank(annotation);
|
||||
}
|
||||
|
||||
public boolean isInMaintenanceStates() {
|
||||
return Arrays.asList(
|
||||
ResourceState.Maintenance, ResourceState.ErrorInMaintenance, ResourceState.PrepareForMaintenance)
|
||||
.contains(getResourceState());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue