Search in sources :

Example 1 with ServerStatus

use of com.serotonin.m2m2.ServerStatus in project weblogic-kubernetes-operator by oracle.

the class DomainStatusUpdater method compare.

private static boolean compare(List<ServerStatus> currentServerStatuses, Map<String, ServerStatus> serverStatuses) {
    if (currentServerStatuses.size() == serverStatuses.size()) {
        for (ServerStatus c : currentServerStatuses) {
            String serverName = c.getServerName();
            ServerStatus u = serverStatuses.get(serverName);
            if (u == null || !c.equals(u)) {
                return false;
            }
        }
        return true;
    }
    return false;
}
Also used : ServerStatus(oracle.kubernetes.weblogic.domain.v1.ServerStatus)

Example 2 with ServerStatus

use of com.serotonin.m2m2.ServerStatus in project ma-core-public by infiniteautomation.

the class ServerMonitoringService method doPoll.

@Override
protected void doPoll() {
    ServerStatus status = lifecycle.getServerStatus();
    threads.setValue(status.getThreads());
    idleThreads.setValue(status.getIdleThreads());
    queueSize.setValue(status.getQueueSize());
    if (Common.backgroundProcessing != null) {
        highPriorityActive.setValue(Common.backgroundProcessing.getHighPriorityServiceActiveCount());
        highPriorityScheduled.setValue(Common.backgroundProcessing.getHighPriorityServiceScheduledTaskCount());
        highPriorityWaiting.setValue(Common.backgroundProcessing.getHighPriorityServiceQueueSize());
        mediumPriorityActive.setValue(Common.backgroundProcessing.getMediumPriorityServiceActiveCount());
        mediumPriorityWaiting.setValue(Common.backgroundProcessing.getMediumPriorityServiceQueueSize());
        lowPriorityActive.setValue(Common.backgroundProcessing.getLowPriorityServiceActiveCount());
        lowPriorityWaiting.setValue(Common.backgroundProcessing.getLowPriorityServiceQueueSize());
    }
    dbActiveConnections.setValue(databaseProxy.getActiveConnections());
    dbIdleConnections.setValue(databaseProxy.getIdleConnections());
    // In MiB
    javaMaxMemory.setValue((int) (runtime.maxMemory() / mib));
    javaUsedMemory.setValue((int) (runtime.totalMemory() / mib) - (int) (runtime.freeMemory() / mib));
    javaFreeMemory.setValue(javaMaxMemory.getValue() - javaUsedMemory.getValue());
    // Uptime in HRS
    long uptimeMs = runtimeBean.getUptime();
    Double uptimeHrs = uptimeMs / 3600000.0D;
    BigDecimal bd = new BigDecimal(uptimeHrs);
    bd = bd.setScale(2, RoundingMode.HALF_UP);
    uptime.setValue(bd.doubleValue());
    // Collect Active User Sessions
    ConfigurableApplicationContext context = (ConfigurableApplicationContext) Common.getRootWebContext();
    if (context != null && context.isActive()) {
        MangoSessionRegistry sessionRegistry = context.getBean(MangoSessionRegistry.class);
        userSessions.setValue(sessionRegistry.getActiveSessionCount());
    } else {
        userSessions.setValue(0);
    }
    long ts = System.currentTimeMillis();
    for (ValueMonitor<?> monitor : monitors) {
        try {
            if (monitor instanceof PollableMonitor) {
                ((PollableMonitor<?>) monitor).poll(ts);
            }
        } catch (Exception e) {
            log.warn("Failed to poll monitor {}", monitor.getId(), e);
        }
    }
}
Also used : ConfigurableApplicationContext(org.springframework.context.ConfigurableApplicationContext) MangoSessionRegistry(com.serotonin.m2m2.web.mvc.spring.security.MangoSessionRegistry) ServerStatus(com.serotonin.m2m2.ServerStatus) PollableMonitor(com.infiniteautomation.mango.monitor.PollableMonitor) BigDecimal(java.math.BigDecimal)

Aggregations

PollableMonitor (com.infiniteautomation.mango.monitor.PollableMonitor)1 ServerStatus (com.serotonin.m2m2.ServerStatus)1 MangoSessionRegistry (com.serotonin.m2m2.web.mvc.spring.security.MangoSessionRegistry)1 BigDecimal (java.math.BigDecimal)1 ServerStatus (oracle.kubernetes.weblogic.domain.v1.ServerStatus)1 ConfigurableApplicationContext (org.springframework.context.ConfigurableApplicationContext)1