use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl in project ovirt-engine by oVirt.
the class CertificationValidityChecker method checkCertificate.
private boolean checkCertificate(X509Certificate cert, AuditLogType alertExpirationEventType, AuditLogType alertAboutToExpireEventType, AuditLogType warnAboutToExpireEventType, VDS host) {
Date expirationDate = cert.getNotAfter();
Date certWarnTime = getExpirationDate(expirationDate, ConfigValues.CertExpirationWarnPeriodInDays);
Date certAlertTime = getExpirationDate(expirationDate, ConfigValues.CertExpirationAlertPeriodInDays);
Date now = new Date();
AuditLogType eventType = null;
if (now.compareTo(expirationDate) > 0) {
eventType = alertExpirationEventType;
} else if (now.compareTo(certAlertTime) > 0) {
eventType = alertAboutToExpireEventType;
} else if (now.compareTo(certWarnTime) > 0) {
eventType = warnAboutToExpireEventType;
}
if (eventType != null) {
AuditLogable event = new AuditLogableImpl();
event.addCustomValue("ExpirationDate", new SimpleDateFormat("yyyy-MM-dd").format(expirationDate));
if (host != null) {
event.setVdsName(host.getName());
event.setVdsId(host.getId());
}
auditLogDirector.log(event, eventType);
return false;
}
return true;
}
use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl in project ovirt-engine by oVirt.
the class EngineBackupAwarenessManager method doBackupCheck.
private void doBackupCheck() {
AuditLogable alert = new AuditLogableImpl();
// try to get last backup record
EngineBackupLog lastDbBackup = getLastBackupByScope(BackupScope.DB);
EngineBackupLog lastFilesBackup = getLastBackupByScope(BackupScope.FILES);
if (lastDbBackup == null || lastFilesBackup == null) {
auditLogDirector.log(alert, AuditLogType.ENGINE_NO_FULL_BACKUP);
} else {
// check time elapsed from last full (db and files) backup
Integer backupAlertPeriodInDays = Config.<Integer>getValue(ConfigValues.BackupAlertPeriodInDays);
Date lastDbBackupDate = lastDbBackup.getDoneAt();
Date lastFilesBackupDate = lastFilesBackup.getDoneAt();
Date lastFullBackupDate = lastDbBackupDate.compareTo(lastFilesBackupDate) < 0 ? lastDbBackupDate : lastFilesBackupDate;
long diffInDays = (Calendar.getInstance().getTimeInMillis() - lastFullBackupDate.getTime()) / TimeUnit.DAYS.toMillis(1);
if (diffInDays > backupAlertPeriodInDays) {
alert.addCustomValue("Date", lastFullBackupDate.toString());
auditLogDirector.log(alert, AuditLogType.ENGINE_NO_WARM_BACKUP);
}
}
}
use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl in project ovirt-engine by oVirt.
the class GetVmsFromExternalProviderQuery method logNoProxyAvailable.
private void logNoProxyAvailable(Guid dataCenterId) {
AuditLogable logable = new AuditLogableImpl();
StoragePool dataCenter = storagePoolDao.get(dataCenterId);
logable.setStoragePoolId(dataCenter.getId());
logable.setStoragePoolName(dataCenter.getName());
logable.setUserName(String.format("%s@%s", getUser().getLoginName(), getUser().getDomain()));
auditLogDirector.log(logable, AuditLogType.IMPORTEXPORT_NO_PROXY_HOST_AVAILABLE_IN_DC);
}
use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl in project ovirt-engine by oVirt.
the class GetVmsFromExternalProviderQuery method logHostCannotBeProxy.
private void logHostCannotBeProxy(VDS host) {
AuditLogable logable = new AuditLogableImpl();
logable.setVdsName(host.getName());
logable.setVdsId(host.getId());
logable.setUserName(String.format("%s@%s", getUser().getLoginName(), getUser().getDomain()));
auditLogDirector.log(logable, AuditLogType.IMPORTEXPORT_HOST_CANNOT_SERVE_AS_PROXY);
}
use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl in project ovirt-engine by oVirt.
the class DisplayNetworkClusterHelper method createLoggable.
private AuditLogable createLoggable() {
AuditLogable loggable = new AuditLogableImpl();
loggable.setClusterName(getClusterName());
loggable.addCustomValue("NetworkName", networkName);
return loggable;
}
Aggregations