use of org.ovirt.engine.core.common.AuditLogType in project ovirt-engine by oVirt.
the class GlusterUtil method alertVolumeLimitReached.
private boolean alertVolumeLimitReached(final GlusterVolumeEntity volume, boolean checkHardLimit) {
AuditLogType logType = checkHardLimit ? AuditLogType.GLUSTER_VOLUME_SNAPSHOT_HARD_LIMIT_REACHED : AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SOFT_LIMIT_REACHED;
List<AuditLog> limitAlerts = auditLogDao.getByVolumeIdAndType(volume.getId(), logType.getValue());
if (!limitAlerts.isEmpty()) {
for (AuditLog alert : limitAlerts) {
if (!alert.isDeleted()) {
return true;
}
}
}
// Alert
boolean limitReached = checkHardLimit ? glusterDBUtils.isVolumeSnapshotHardLimitReached(volume.getId()) : glusterDBUtils.isVolumeSnapshotSoftLimitReached(volume.getId());
if (limitReached) {
glusterAuditLogUtil.logAuditMessage(volume.getClusterId(), volume.getClusterName(), volume, null, logType, volumeAsMap(volume));
return true;
}
return false;
}
use of org.ovirt.engine.core.common.AuditLogType in project ovirt-engine by oVirt.
the class HostMonitoring method checkVdsSwapThreshold.
/**
* check if value is less than configurable threshold , if yes , generated event list message
*/
private void checkVdsSwapThreshold(VdsStatistics stat) {
final double THRESHOLD = 0.98;
Integer minAvailableThreshold = Config.getValue(ConfigValues.LogSwapMemoryThresholdInMB);
Integer maxUsedPercentageThreshold = Config.getValue(ConfigValues.LogMaxSwapMemoryUsedThresholdInPercentage);
if (stat.getSwapTotal() == null || stat.getSwapFree() == null || stat.getSwapTotal() == 0) {
return;
}
Long swapUsedPercent = (stat.getSwapTotal() - stat.getSwapFree()) / stat.getSwapTotal();
// Allow the space to be up to 2% lower than as defined in configuration
Long allowedMinAvailableThreshold = Math.round(minAvailableThreshold.doubleValue() * THRESHOLD);
AuditLogType valueToLog = stat.getSwapFree() < allowedMinAvailableThreshold ? AuditLogType.VDS_LOW_SWAP : AuditLogType.VDS_HIGH_SWAP_USE;
if (stat.getSwapFree() < allowedMinAvailableThreshold || swapUsedPercent > maxUsedPercentageThreshold) {
AuditLogable logable = createAuditLogableForHost();
logable.addCustomValue("HostName", vds.getName());
logable.addCustomValue("UsedSwap", swapUsedPercent.toString());
logable.addCustomValue("AvailableSwapMemory", stat.getSwapFree().toString());
logable.addCustomValue("Threshold", stat.getSwapFree() < allowedMinAvailableThreshold ? minAvailableThreshold.toString() : maxUsedPercentageThreshold.toString());
auditLog(logable, valueToLog);
}
}
use of org.ovirt.engine.core.common.AuditLogType in project ovirt-engine by oVirt.
the class HostMonitoring method checkVdsMemoryThreshold.
/**
* check if value is less than configurable threshold , if yes , generated event list message
*/
private void checkVdsMemoryThreshold(VdsStatistics stat) {
Integer minAvailableThreshold = Config.getValue(ConfigValues.LogPhysicalMemoryThresholdInMB);
Integer maxUsedPercentageThreshold = Config.getValue(ConfigValues.LogMaxPhysicalMemoryUsedThresholdInPercentage);
if (stat.getMemFree() == null || stat.getUsageMemPercent() == null) {
return;
}
AuditLogType valueToLog = stat.getMemFree() < minAvailableThreshold ? AuditLogType.VDS_LOW_MEM : AuditLogType.VDS_HIGH_MEM_USE;
if (stat.getMemFree() < minAvailableThreshold || stat.getUsageMemPercent() > maxUsedPercentageThreshold) {
AuditLogable logable = createAuditLogableForHost();
logable.addCustomValue("HostName", vds.getName());
logable.addCustomValue("AvailableMemory", stat.getMemFree().toString());
logable.addCustomValue("UsedMemory", stat.getUsageMemPercent().toString());
logable.addCustomValue("Threshold", stat.getMemFree() < minAvailableThreshold ? minAvailableThreshold.toString() : maxUsedPercentageThreshold.toString());
auditLog(logable, valueToLog);
}
}
Aggregations