Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

engine: Fix incorrect value in audit log warning #531

Merged
merged 1 commit into from
Jul 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ private void checkVdsMemoryThresholdPercentage(Cluster cluster, VdsStatistics st
long memUsage = 100 - Math.round(100 * memFree / (double) memTotal);

if (memUsage > maxUsedPercentageThreshold) {
logMemoryAuditLog(vds, cluster, stat, AuditLogType.VDS_HIGH_MEM_USE, maxUsedPercentageThreshold);
logMemoryAuditLog(vds, cluster, memUsage, AuditLogType.VDS_HIGH_MEM_USE, maxUsedPercentageThreshold);
}
}

Expand All @@ -348,6 +348,19 @@ private void checkVdsMemoryThresholdAbsoluteValue(Cluster cluster, VdsStatistics
}
}

private void logMemoryAuditLog(VDS vds,
Cluster cluster,
Long memUsage,
AuditLogType valueToLog,
Integer threshold) {
AuditLogable logable = createAuditLogableForHost();
logable.addCustomValue("HostName", vds.getName());
logable.addCustomValue("Cluster", cluster.getName());
logable.addCustomValue("UsedMemory", memUsage.toString());
logable.addCustomValue("Threshold", threshold.toString());
auditLog(logable, valueToLog);
}

private void logMemoryAuditLog(VDS vds,
Cluster cluster,
VdsStatistics stat,
Expand Down