Search in sources :

Example 6 with DatabaseConnectionVO

use of org.olat.admin.sysinfo.model.DatabaseConnectionVO in project OpenOLAT by OpenOLAT.

the class DatabaseStatsManager method getConnectionInfos.

public DatabaseConnectionVO getConnectionInfos() {
    DatabaseConnectionVO vo = new DatabaseConnectionVO();
    vo.setActiveConnectionCount(0);
    vo.setCurrentConnectionCount(0);
    try {
        JMXManager jmxManager = CoreSpringFactory.getImpl(JMXManager.class);
        MBeanServer mBeanServer = jmxManager.getMBeanServer();
        boolean found = searchHikariDataSources(mBeanServer, vo) || searchTomcatDataSources(mBeanServer, vo) || searchC3P0DataSources(mBeanServer, vo);
        if (log.isDebug()) {
            log.debug("MBean for datasource found: " + found);
        }
    } catch (Exception e) {
        log.error("", e);
    }
    return vo;
}
Also used : JMXManager(org.olat.core.commons.services.jmx.JMXManager) DatabaseConnectionVO(org.olat.admin.sysinfo.model.DatabaseConnectionVO) MBeanServer(javax.management.MBeanServer)

Example 7 with DatabaseConnectionVO

use of org.olat.admin.sysinfo.model.DatabaseConnectionVO in project openolat by klemens.

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)

Example 8 with DatabaseConnectionVO

use of org.olat.admin.sysinfo.model.DatabaseConnectionVO in project openolat by klemens.

the class DatabaseStatsManager method getConnectionInfos.

public DatabaseConnectionVO getConnectionInfos() {
    DatabaseConnectionVO vo = new DatabaseConnectionVO();
    vo.setActiveConnectionCount(0);
    vo.setCurrentConnectionCount(0);
    try {
        JMXManager jmxManager = CoreSpringFactory.getImpl(JMXManager.class);
        MBeanServer mBeanServer = jmxManager.getMBeanServer();
        boolean found = searchHikariDataSources(mBeanServer, vo) || searchTomcatDataSources(mBeanServer, vo) || searchC3P0DataSources(mBeanServer, vo);
        if (log.isDebug()) {
            log.debug("MBean for datasource found: " + found);
        }
    } catch (Exception e) {
        log.error("", e);
    }
    return vo;
}
Also used : JMXManager(org.olat.core.commons.services.jmx.JMXManager) DatabaseConnectionVO(org.olat.admin.sysinfo.model.DatabaseConnectionVO) MBeanServer(javax.management.MBeanServer)

Aggregations

DatabaseConnectionVO (org.olat.admin.sysinfo.model.DatabaseConnectionVO)8 MBeanServer (javax.management.MBeanServer)2 GET (javax.ws.rs.GET)2 Produces (javax.ws.rs.Produces)2 Statistics (org.hibernate.stat.Statistics)2 DatabaseStatsManager (org.olat.admin.sysinfo.manager.DatabaseStatsManager)2 JMXManager (org.olat.core.commons.services.jmx.JMXManager)2 DatabaseVO (org.olat.restapi.system.vo.DatabaseVO)2 HibernateStatisticsVO (org.olat.restapi.system.vo.HibernateStatisticsVO)2 SessionsVO (org.olat.restapi.system.vo.SessionsVO)2 SearchServiceStatus (org.olat.search.SearchServiceStatus)2 SearchServiceStatusImpl (org.olat.search.service.SearchServiceStatusImpl)2 FullIndexerStatus (org.olat.search.service.indexer.FullIndexerStatus)2