use of org.olat.search.service.indexer.FullIndexerStatus in project openolat by klemens.
the class ProcSamplerJob method writeProcFile.
public void writeProcFile(File xmlFile) {
try {
Statistics statistics = CoreSpringFactory.getImpl(MonitoringService.class).getStatistics();
Document doc = loadDocument(xmlFile);
if (doc == null)
return;
Element rootEl = doc.getDocumentElement();
// sessions
SessionsVO sessionsVo = statistics.getSessionsVo();
addValue("secureAuthenticatedCount", sessionsVo.getSecureAuthenticatedCount(), rootEl, doc);
addValue("secureRestCount", sessionsVo.getSecureRestCount(), rootEl, doc);
addValue("secureWebdavCount", sessionsVo.getSecureWebdavCount(), rootEl, doc);
// clicks
addValue("authenticatedClickCountLastFiveMinutes", sessionsVo.getAuthenticatedClickCountLastFiveMinutes(), rootEl, doc);
addValue("concurrentDispatchThreads", sessionsVo.getConcurrentDispatchThreads(), rootEl, doc);
addValue("requestLastFiveMinutes", sessionsVo.getRequestLastFiveMinutes(), rootEl, doc);
addValue("requestLastMinute", sessionsVo.getRequestLastMinute(), rootEl, doc);
// openolat
addValue("activeUserCount", statistics.getActiveUserCount(), rootEl, doc);
addValue("totalGroupCount", statistics.getTotalGroupCount(), rootEl, doc);
addValue("publishedCourses", statistics.getPublishedCourses(), rootEl, doc);
// indexer
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
format.setTimeZone(TimeZones.getUtcTimeZone());
SearchServiceStatus status = SearchServiceFactory.getService().getStatus();
if (status instanceof SearchServiceStatusImpl) {
SearchServiceStatusImpl statusImpl = (SearchServiceStatusImpl) status;
FullIndexerStatus fStatus = statusImpl.getFullIndexerStatus();
String date = format.format(new Date(fStatus.getLastFullIndexTime()));
addValue("lastFullIndexTime", date, rootEl, doc);
}
// marker
addValue("lastOpenOLATSampling", format.format(new Date()), rootEl, doc);
// Use a Transformer for output
try (OutputStream out = new FileOutputStream(xmlFile)) {
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.transform(new DOMSource(doc), new StreamResult(out));
} catch (IOException e) {
log.error("", e);
}
} catch (Exception e) {
log.error("", e);
}
}
Aggregations