use of org.olat.restapi.system.vo.SessionsVO in project OpenOLAT by OpenOLAT.
the class SystemTest method testSystemSessions.
@Test
public void testSystemSessions() throws IOException, URISyntaxException {
RestConnection conn = new RestConnection();
assertTrue(conn.login("administrator", "openolat"));
URI systemUri = conn.getContextURI().path("system").path("monitoring").path("openolat").path("sessions").build();
SessionsVO sessionInfos = conn.get(systemUri, SessionsVO.class);
assertNotNull(sessionInfos);
assertTrue(sessionInfos.getCount() > 0);
assertTrue(sessionInfos.getAuthenticatedCount() >= 0);
assertTrue(sessionInfos.getSecureAuthenticatedCount() >= 0);
assertTrue(sessionInfos.getSecureWebdavCount() >= 0);
assertTrue(sessionInfos.getWebdavCount() >= 0);
assertTrue(sessionInfos.getRestCount() >= 0);
assertTrue(sessionInfos.getSecureRestCount() >= 0);
conn.shutdown();
}
use of org.olat.restapi.system.vo.SessionsVO in project openolat by klemens.
the class SystemTest method testSystemSessions.
@Test
public void testSystemSessions() throws IOException, URISyntaxException {
RestConnection conn = new RestConnection();
assertTrue(conn.login("administrator", "openolat"));
URI systemUri = conn.getContextURI().path("system").path("monitoring").path("openolat").path("sessions").build();
SessionsVO sessionInfos = conn.get(systemUri, SessionsVO.class);
assertNotNull(sessionInfos);
assertTrue(sessionInfos.getCount() > 0);
assertTrue(sessionInfos.getAuthenticatedCount() >= 0);
assertTrue(sessionInfos.getSecureAuthenticatedCount() >= 0);
assertTrue(sessionInfos.getSecureWebdavCount() >= 0);
assertTrue(sessionInfos.getWebdavCount() >= 0);
assertTrue(sessionInfos.getRestCount() >= 0);
assertTrue(sessionInfos.getSecureRestCount() >= 0);
conn.shutdown();
}
use of org.olat.restapi.system.vo.SessionsVO in project openolat by klemens.
the class OpenOLATStatisticsWebService method getSessionsVO.
protected SessionsVO getSessionsVO() {
SessionsVO vo = new SessionsVO();
SessionStatsManager sessionStatsManager = CoreSpringFactory.getImpl(SessionStatsManager.class);
UserSessionManager sessionManager = CoreSpringFactory.getImpl(UserSessionManager.class);
vo.setCount(sessionManager.getUserSessionsCnt());
Set<UserSession> userSessions = sessionManager.getAuthenticatedUserSessions();
int webdavcount = 0;
int secureWebdavCount = 0;
int authenticatedcount = 0;
int secureAuthenticatedCount = 0;
int restCount = 0;
int secureRestCount = 0;
for (UserSession usess : userSessions) {
SessionInfo sessInfo = usess.getSessionInfo();
if (sessInfo.isWebDAV()) {
webdavcount++;
if (sessInfo.isSecure()) {
secureWebdavCount++;
}
} else if (sessInfo.isREST()) {
restCount++;
if (sessInfo.isSecure()) {
secureRestCount++;
}
} else {
authenticatedcount++;
if (sessInfo.isSecure()) {
secureAuthenticatedCount++;
}
}
}
vo.setAuthenticatedCount(authenticatedcount);
vo.setSecureAuthenticatedCount(secureAuthenticatedCount);
vo.setWebdavCount(webdavcount);
vo.setSecureWebdavCount(secureWebdavCount);
vo.setRestCount(restCount);
vo.setSecureRestCount(secureRestCount);
// Instant messaging
vo.setInstantMessagingCount(-1);
SessionsStats statsLastMinute = sessionStatsManager.getSessionsStatsLast(60);
SessionsStats statsLast5Minutes = sessionStatsManager.getSessionsStatsLast(300);
vo.setAuthenticatedClickCountLastMinute(statsLastMinute.getAuthenticatedClickCalls());
vo.setAuthenticatedClickCountLastFiveMinutes(statsLast5Minutes.getAuthenticatedPollerCalls());
vo.setAuthenticatedPollCountLastMinute(statsLastMinute.getAuthenticatedPollerCalls());
vo.setAuthenticatedPollCountLastFiveMinutes(statsLast5Minutes.getAuthenticatedPollerCalls());
vo.setRequestLastMinute(statsLastMinute.getRequests());
vo.setRequestLastFiveMinutes(statsLast5Minutes.getRequests());
vo.setConcurrentDispatchThreads(sessionStatsManager.getConcurrentCounter());
return vo;
}
use of org.olat.restapi.system.vo.SessionsVO in project OpenOLAT by OpenOLAT.
the class OpenOLATStatisticsWebService method getSessionsVO.
protected SessionsVO getSessionsVO() {
SessionsVO vo = new SessionsVO();
SessionStatsManager sessionStatsManager = CoreSpringFactory.getImpl(SessionStatsManager.class);
UserSessionManager sessionManager = CoreSpringFactory.getImpl(UserSessionManager.class);
vo.setCount(sessionManager.getUserSessionsCnt());
Set<UserSession> userSessions = sessionManager.getAuthenticatedUserSessions();
int webdavcount = 0;
int secureWebdavCount = 0;
int authenticatedcount = 0;
int secureAuthenticatedCount = 0;
int restCount = 0;
int secureRestCount = 0;
for (UserSession usess : userSessions) {
SessionInfo sessInfo = usess.getSessionInfo();
if (sessInfo.isWebDAV()) {
webdavcount++;
if (sessInfo.isSecure()) {
secureWebdavCount++;
}
} else if (sessInfo.isREST()) {
restCount++;
if (sessInfo.isSecure()) {
secureRestCount++;
}
} else {
authenticatedcount++;
if (sessInfo.isSecure()) {
secureAuthenticatedCount++;
}
}
}
vo.setAuthenticatedCount(authenticatedcount);
vo.setSecureAuthenticatedCount(secureAuthenticatedCount);
vo.setWebdavCount(webdavcount);
vo.setSecureWebdavCount(secureWebdavCount);
vo.setRestCount(restCount);
vo.setSecureRestCount(secureRestCount);
// Instant messaging
vo.setInstantMessagingCount(-1);
SessionsStats statsLastMinute = sessionStatsManager.getSessionsStatsLast(60);
SessionsStats statsLast5Minutes = sessionStatsManager.getSessionsStatsLast(300);
vo.setAuthenticatedClickCountLastMinute(statsLastMinute.getAuthenticatedClickCalls());
vo.setAuthenticatedClickCountLastFiveMinutes(statsLast5Minutes.getAuthenticatedPollerCalls());
vo.setAuthenticatedPollCountLastMinute(statsLastMinute.getAuthenticatedPollerCalls());
vo.setAuthenticatedPollCountLastFiveMinutes(statsLast5Minutes.getAuthenticatedPollerCalls());
vo.setRequestLastMinute(statsLastMinute.getRequests());
vo.setRequestLastFiveMinutes(statsLast5Minutes.getRequests());
vo.setConcurrentDispatchThreads(sessionStatsManager.getConcurrentCounter());
return vo;
}
use of org.olat.restapi.system.vo.SessionsVO in project OpenOLAT by OpenOLAT.
the class MonitoringService method getStatistics.
public Statistics getStatistics() {
Statistics statistics = new Statistics();
SessionsVO sessionsVo = new OpenOLATStatisticsWebService().getSessionsVO();
statistics.setSessionsVo(sessionsVo);
SearchServiceStatus status = SearchServiceFactory.getService().getStatus();
if (status instanceof SearchServiceStatusImpl) {
SearchServiceStatusImpl statusImpl = (SearchServiceStatusImpl) status;
FullIndexerStatus fStatus = statusImpl.getFullIndexerStatus();
statistics.setLastFullIndexTime(fStatus.getLastFullIndexDateString());
}
// activeUserCount="88" // registered and activated identities, same as in GUI
if (start < 1 || (System.currentTimeMillis() - start) > RENEW_RATE) {
start = System.currentTimeMillis();
activeUserCount = securityManager.countIdentitiesByPowerSearch(null, null, false, null, null, null, null, null, null, null, Constants.USERSTATUS_ACTIVE);
totalGroupCount = businessGroupService.countBusinessGroups(null, null);
publishedCourses = repositoryManager.countPublished(CourseModule.ORES_TYPE_COURSE);
}
statistics.setActiveUserCount(activeUserCount);
statistics.setTotalGroupCount(totalGroupCount);
statistics.setPublishedCourses(publishedCourses);
DatabaseConnectionVO connections = databaseStatsManager.getConnectionInfos();
if (connections != null) {
statistics.setActiveConnectionCount(connections.getActiveConnectionCount());
statistics.setCurrentConnectionCount(connections.getCurrentConnectionCount());
}
return statistics;
}
Aggregations