Search in sources :

Example 1 with SessionsVO

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();
}
Also used : SessionsVO(org.olat.restapi.system.vo.SessionsVO) URI(java.net.URI) Test(org.junit.Test)

Example 2 with SessionsVO

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();
}
Also used : SessionsVO(org.olat.restapi.system.vo.SessionsVO) URI(java.net.URI) Test(org.junit.Test)

Example 3 with SessionsVO

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;
}
Also used : UserSessionManager(org.olat.core.util.session.UserSessionManager) SessionsStats(org.olat.admin.sysinfo.model.SessionsStats) SessionsVO(org.olat.restapi.system.vo.SessionsVO) UserSession(org.olat.core.util.UserSession) SessionInfo(org.olat.core.util.SessionInfo) SessionStatsManager(org.olat.admin.sysinfo.manager.SessionStatsManager)

Example 4 with SessionsVO

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;
}
Also used : UserSessionManager(org.olat.core.util.session.UserSessionManager) SessionsStats(org.olat.admin.sysinfo.model.SessionsStats) SessionsVO(org.olat.restapi.system.vo.SessionsVO) UserSession(org.olat.core.util.UserSession) SessionInfo(org.olat.core.util.SessionInfo) SessionStatsManager(org.olat.admin.sysinfo.manager.SessionStatsManager)

Example 5 with SessionsVO

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;
}
Also used : SessionsVO(org.olat.restapi.system.vo.SessionsVO) FullIndexerStatus(org.olat.search.service.indexer.FullIndexerStatus) SearchServiceStatusImpl(org.olat.search.service.SearchServiceStatusImpl) SearchServiceStatus(org.olat.search.SearchServiceStatus) DatabaseConnectionVO(org.olat.admin.sysinfo.model.DatabaseConnectionVO)

Aggregations

SessionsVO (org.olat.restapi.system.vo.SessionsVO)8 SearchServiceStatus (org.olat.search.SearchServiceStatus)4 SearchServiceStatusImpl (org.olat.search.service.SearchServiceStatusImpl)4 FullIndexerStatus (org.olat.search.service.indexer.FullIndexerStatus)4 FileOutputStream (java.io.FileOutputStream)2 IOException (java.io.IOException)2 OutputStream (java.io.OutputStream)2 URI (java.net.URI)2 SimpleDateFormat (java.text.SimpleDateFormat)2 Date (java.util.Date)2 Transformer (javax.xml.transform.Transformer)2 TransformerFactory (javax.xml.transform.TransformerFactory)2 DOMSource (javax.xml.transform.dom.DOMSource)2 StreamResult (javax.xml.transform.stream.StreamResult)2 Test (org.junit.Test)2 SessionStatsManager (org.olat.admin.sysinfo.manager.SessionStatsManager)2 DatabaseConnectionVO (org.olat.admin.sysinfo.model.DatabaseConnectionVO)2 SessionsStats (org.olat.admin.sysinfo.model.SessionsStats)2 SessionInfo (org.olat.core.util.SessionInfo)2 UserSession (org.olat.core.util.UserSession)2