mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
bug 7216: show capacity alerts at pod level instead of zone
status 7216: resolved fixed
This commit is contained in:
parent
18e248605c
commit
0b76c26ce9
@ -382,9 +382,16 @@ public class AlertManagerImpl implements AlertManager {
|
||||
Map<String, List<CapacityVO>> capacityDcTypeMap = new HashMap<String, List<CapacityVO>>();
|
||||
|
||||
for (CapacityVO capacity : capacityList) {
|
||||
long dataCenterId = capacity.getDataCenterId();
|
||||
long dataCenterId = capacity.getDataCenterId();
|
||||
long podId = capacity.getPodId();
|
||||
short type = capacity.getCapacityType();
|
||||
String key = "dc" + dataCenterId + "t" + type;
|
||||
String key = null;
|
||||
if((type == CapacityVO.CAPACITY_TYPE_PUBLIC_IP) || (type == CapacityVO.CAPACITY_TYPE_SECONDARY_STORAGE)){
|
||||
key = "dc" + dataCenterId + "t" + type;
|
||||
} else {
|
||||
key = "pod" + podId + "t" + type;
|
||||
}
|
||||
|
||||
List<CapacityVO> list = capacityDcTypeMap.get(key);
|
||||
if (list == null) {
|
||||
list = new ArrayList<CapacityVO>();
|
||||
@ -399,7 +406,8 @@ public class AlertManagerImpl implements AlertManager {
|
||||
double usedCapacity = 0d;
|
||||
CapacityVO cap = capacities.get(0);
|
||||
short capacityType = cap.getCapacityType();
|
||||
long dataCenterId = cap.getDataCenterId();
|
||||
long dataCenterId = cap.getDataCenterId();
|
||||
long podId = cap.getPodId();
|
||||
|
||||
for (CapacityVO capacity : capacities) {
|
||||
totalCapacity += capacity.getTotalCapacity();
|
||||
@ -409,7 +417,9 @@ public class AlertManagerImpl implements AlertManager {
|
||||
double capacityPct = (usedCapacity / totalCapacity);
|
||||
double thresholdLimit = 1.0;
|
||||
DataCenterVO dcVO = _dcDao.findById(dataCenterId);
|
||||
String dcName = ((dcVO == null) ? "unknown" : dcVO.getName());
|
||||
String dcName = ((dcVO == null) ? "unknown" : dcVO.getName());
|
||||
HostPodVO pod = _podDao.findById(podId);
|
||||
String podName = ((pod == null) ? "unknown" : pod.getName());
|
||||
String msgSubject = "";
|
||||
String msgContent = "";
|
||||
String totalStr = "";
|
||||
@ -420,28 +430,28 @@ public class AlertManagerImpl implements AlertManager {
|
||||
switch (capacityType) {
|
||||
case CapacityVO.CAPACITY_TYPE_MEMORY:
|
||||
thresholdLimit = _memoryCapacityThreshold;
|
||||
msgSubject = "System Alert: Low Available Memory in availablity zone " + dcName;
|
||||
msgSubject = "System Alert: Low Available Memory in pod "+podName+" of availablity zone " + dcName;
|
||||
totalStr = formatBytesToMegabytes(totalCapacity);
|
||||
usedStr = formatBytesToMegabytes(usedCapacity);
|
||||
msgContent = "System memory is low, total: " + totalStr + " MB, used: " + usedStr + " MB (" + pctStr + "%)";
|
||||
break;
|
||||
case CapacityVO.CAPACITY_TYPE_CPU:
|
||||
thresholdLimit = _cpuCapacityThreshold;
|
||||
msgSubject = "System Alert: Low Unallocated CPU in availablity zone " + dcName;
|
||||
msgSubject = "System Alert: Low Unallocated CPU in pod "+podName+" of availablity zone " + dcName;
|
||||
totalStr = _dfWhole.format(totalCapacity);
|
||||
usedStr = _dfWhole.format(usedCapacity);
|
||||
msgContent = "Unallocated CPU is low, total: " + totalStr + " Mhz, used: " + usedStr + " Mhz (" + pctStr + "%)";
|
||||
break;
|
||||
case CapacityVO.CAPACITY_TYPE_STORAGE:
|
||||
thresholdLimit = _storageCapacityThreshold;
|
||||
msgSubject = "System Alert: Low Available Storage in availablity zone " + dcName;
|
||||
msgSubject = "System Alert: Low Available Storage in pod "+podName+" of availablity zone " + dcName;
|
||||
totalStr = formatBytesToMegabytes(totalCapacity);
|
||||
usedStr = formatBytesToMegabytes(usedCapacity);
|
||||
msgContent = "Available storage space is low, total: " + totalStr + " MB, used: " + usedStr + " MB (" + pctStr + "%)";
|
||||
break;
|
||||
case CapacityVO.CAPACITY_TYPE_STORAGE_ALLOCATED:
|
||||
thresholdLimit = _storageAllocCapacityThreshold;
|
||||
msgSubject = "System Alert: Remaining unallocated Storage is low in availablity zone " + dcName;
|
||||
msgSubject = "System Alert: Remaining unallocated Storage is low in pod "+podName+" of availablity zone " + dcName;
|
||||
totalStr = formatBytesToMegabytes(totalCapacity);
|
||||
usedStr = formatBytesToMegabytes(usedCapacity);
|
||||
msgContent = "Unallocated storage space is low, total: " + totalStr + " MB, allocated: " + usedStr + " MB (" + pctStr + "%)";
|
||||
@ -455,7 +465,7 @@ public class AlertManagerImpl implements AlertManager {
|
||||
break;
|
||||
case CapacityVO.CAPACITY_TYPE_PRIVATE_IP:
|
||||
thresholdLimit = _privateIPCapacityThreshold;
|
||||
msgSubject = "System Alert: Number of unallocated private IPs is low in availablity zone " + dcName;
|
||||
msgSubject = "System Alert: Number of unallocated private IPs is low in pod "+podName+" of availablity zone " + dcName;
|
||||
totalStr = Double.toString(totalCapacity);
|
||||
usedStr = Double.toString(usedCapacity);
|
||||
msgContent = "Number of unallocated private IPs is low, total: " + totalStr + ", allocated: " + usedStr + " (" + pctStr + "%)";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user