use of org.gluu.oxtrust.model.GluuOxTrustStat in project oxTrust by GluuFederation.
the class StatusCheckerDaily method processInt.
/**
* Gather periodically site and server status
*
* @param when
* Date
* @param interval
* Interval
*/
private void processInt() {
log.debug("Starting daily status checker");
AppConfiguration appConfiguration = configurationFactory.getAppConfiguration();
if (!appConfiguration.isUpdateStatus()) {
return;
}
log.debug("Getting data from ldap");
GluuConfiguration configuration = configurationService.getConfiguration();
GluuOxTrustStat oxTrustStat = configurationService.getOxtrustStat();
oxTrustStat.setGroupCount(String.valueOf(groupService.countGroups()));
oxTrustStat.setPersonCount(String.valueOf(personService.countPersons()));
Date currentDateTime = new Date();
configuration.setLastUpdate(currentDateTime);
configurationService.updateConfiguration(configuration);
configurationService.updateOxtrustStat(oxTrustStat);
log.debug("Daily Configuration status update finished");
}
use of org.gluu.oxtrust.model.GluuOxTrustStat in project oxTrust by GluuFederation.
the class ConfigurationService method getOxtrustStat.
public GluuOxTrustStat getOxtrustStat(String[] returnAttributes) {
Date statDate = new Date();
String statDn = metricService.buildDn(LocalDateTime.now().format(formatter), statDate, ApplicationType.OX_TRUST);
GluuOxTrustStat result = new GluuOxTrustStat();
if (persistenceEntryManager.contains(statDn, GluuOxTrustStat.class)) {
result = persistenceEntryManager.find(statDn, GluuOxTrustStat.class, returnAttributes);
} else {
result.setDn(statDn);
metricService.prepareBranch(statDate, ApplicationType.OX_TRUST);
persistenceEntryManager.persist(result);
}
return result;
}
use of org.gluu.oxtrust.model.GluuOxTrustStat in project oxTrust by GluuFederation.
the class StatusCheckerTimer method processInt.
/**
* Gather periodically site and server status
*
* @param when
* Date
* @param interval
* Interval
*/
private void processInt() {
log.debug("Starting update of configuration status");
AppConfiguration appConfiguration = configurationFactory.getAppConfiguration();
if (!appConfiguration.isUpdateStatus()) {
log.debug("isUpdateStatus");
return;
}
ConfigurationStatus configurationStatus = new ConfigurationStatus();
OxtrustStat oxtrustStatObject = new OxtrustStat();
oxtrustStatObject.setGroupCount(String.valueOf(groupService.countGroups()));
oxtrustStatObject.setPersonCount(String.valueOf(personService.countPersons()));
log.debug("Setting FactorAttributes");
FacterData facterData = getFacterData();
configurationStatus.setHostname(facterData.getHostname());
oxtrustStatObject.setIpAddress(facterData.getIpaddress());
oxtrustStatObject.setLoadAvg(facterData.getLoadAverage());
oxtrustStatObject.setSystemUptime(facterData.getUptime());
oxtrustStatObject.setFreeDiskSpace(facterData.getFreeDiskSpace());
oxtrustStatObject.setFreeMemory(facterData.getMemoryfree());
setHttpdAttributes(configurationStatus);
try {
setCertificateExpiryAttributes(configurationStatus);
} catch (Exception ex) {
log.error("Failed to check certificate expiration", ex);
}
GluuConfiguration configuration = configurationService.getConfiguration();
GluuOxTrustStat gluuOxTrustStat = configurationService.getOxtrustStat();
try {
BeanUtils.copyProperties(configuration, configurationStatus);
BeanUtils.copyProperties(gluuOxTrustStat, oxtrustStatObject);
} catch (Exception ex) {
log.error("Failed to copy status attributes", ex);
}
Date currentDateTime = new Date();
configuration.setLastUpdate(currentDateTime);
configurationService.updateConfiguration(configuration);
configurationService.updateOxtrustStat(gluuOxTrustStat);
log.debug("Configuration status update finished");
}
Aggregations