Package com.alibaba.otter.shared.common.model.autokeeper

Examples of com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperServerStat


    public void testCollectorServerStat() {
        autoKeeperCollector.collectorServerStat(ADDRESS);
        autoKeeperCollector.collectorConnectionStat(ADDRESS);
        autoKeeperCollector.collectorWatchStat(ADDRESS);
        autoKeeperCollector.collectorEphemeralStat(ADDRESS);
        AutoKeeperServerStat stat = autoKeeperStatService.findServerStat(ADDRESS);
        Set<AutoKeeperConnectionStat> conns = stat.getConnectionStats();
        for (AutoKeeperConnectionStat autoKeeperConnectionStat : conns) {
            autoKeeperStatService.findConnectionBySessionId(autoKeeperConnectionStat.getSessionId());
            autoKeeperStatService.findServerStatBySessionId(autoKeeperConnectionStat.getSessionId());
            String path = autoKeeperConnectionStat.getClientAddress();
            System.out.println(path);
View Full Code Here


    public void execute(@Param("clusterId") String clusterId, Context context) throws Exception {

        Map<String, AutoKeeperServerStat> statMap = new HashMap<String, AutoKeeperServerStat>();
        AutoKeeperCluster autoKeeperCluster = autoKeeperClusterService.findAutoKeeperClusterById(Long.valueOf(clusterId));
        for (String address : autoKeeperCluster.getServerList()) {
            AutoKeeperServerStat autoKeeperServerStat = autoKeeperStatService.findServerStat(address);
            statMap.put(address, autoKeeperServerStat);
        }
        context.put("clusterId", clusterId);
        context.put("statMap", statMap);
    }
View Full Code Here

        AutoKeeperCluster autoKeeperCluster = autoKeeperClusterService.findAutoKeeperClusterById(Long.valueOf(clusterId));
        Set<AutoKeeperConnectionStat> autoKeeperConnectionStats = new HashSet<AutoKeeperConnectionStat>();
        for (String ipAddress : autoKeeperCluster.getServerList()) {
            if (ipAddress.equalsIgnoreCase(address)) {
                AutoKeeperServerStat autoKeeperServerStat = autoKeeperStatService.findServerStat(ipAddress);
                if (autoKeeperServerStat != null) {
                    autoKeeperConnectionStats = autoKeeperServerStat.getConnectionStats();
                } else {
                    autoKeeperConnectionStats = new HashSet<AutoKeeperConnectionStat>();
                }
            }
        }
View Full Code Here

        String ip = netAddress.get(0);
        String port = netAddress.get(1);
        String[] cmd = { "/bin/bash", "-c", String.format(CMD_STAT, ip, port) };
        String cmdresult = collector(cmd);
        String[] result = cmdresult.split(WRAP);
        AutoKeeperServerStat summary = new AutoKeeperServerStat();
        summary.setOriginalContent(cmdresult);
        for (String line : result) {

            if (line.contains(MODE_FOLLOWER)) {
                summary.setQuorumType(AutoKeeperQuorumType.FOLLOWER);
            } else if (line.contains(MODE_LEADERER)) {
                summary.setQuorumType(AutoKeeperQuorumType.LEADER);
            } else if (line.contains(MODE_STANDALONE)) {
                summary.setQuorumType(AutoKeeperQuorumType.STANDALONE);
            } else if (line.contains(MODE_OBSERVER)) {
                summary.setQuorumType(AutoKeeperQuorumType.OBSERVER);
            } else if (line.contains(STRING_LATENCY)) {
                List<String> latency = Arrays.asList(StringUtils.trimToEmpty(line.replace(STRING_LATENCY,
                                                                                          StringUtils.EMPTY)).split("/"));
                summary.setMinLatency(Long.parseLong(latency.get(0)));
                summary.setAvgLatency(Long.parseLong(latency.get(1)));
                summary.setMaxLatency(Long.parseLong(latency.get(2)));
            } else if (line.contains(STRING_OUTSTANDING)) {
                summary.setQueued(Long.parseLong(StringUtils.trimToEmpty(line.replace(STRING_OUTSTANDING,
                                                                                      StringUtils.EMPTY))));
            } else if (line.contains(NODE_COUNT)) {
                summary.setNodeCount(Long.parseLong(StringUtils.trimToEmpty(line.replace(NODE_COUNT, StringUtils.EMPTY))));
            } else if (line.contains(STRING_SENT)) {
                summary.setSent(Long.parseLong(StringUtils.trimToEmpty(line.replace(STRING_SENT, StringUtils.EMPTY))));
            } else if (line.contains(STRING_RECEIVED)) {
                summary.setRecved(Long.parseLong(StringUtils.trimToEmpty(line.replace(STRING_RECEIVED,
                                                                                      StringUtils.EMPTY))));
            }
        }

        autoKeeperData.joinServer(address, summary);
View Full Code Here

TOP

Related Classes of com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperServerStat

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.