Java Code Examples for org.apache.rocketmq.tools.admin.DefaultMQAdminExt#examineBrokerClusterInfo()

The following examples show how to use org.apache.rocketmq.tools.admin.DefaultMQAdminExt#examineBrokerClusterInfo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MQAdmin.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public static ClusterInfo getCluster(String nameSrvAddr) {
    DefaultMQAdminExt mqAdminExt = new DefaultMQAdminExt();
    mqAdminExt.setNamesrvAddr(nameSrvAddr);
    ClusterInfo clusterInfo = null;
    try {
        mqAdminExt.start();
        clusterInfo = mqAdminExt.examineBrokerClusterInfo();
    } catch (Exception e) {
        e.printStackTrace();
    }
    mqAdminExt.shutdown();
    return clusterInfo;
}
 
Example 2
Source File: MQAdmin.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public static ClusterInfo getCluster(String nameSrvAddr) {
    DefaultMQAdminExt mqAdminExt = new DefaultMQAdminExt();
    mqAdminExt.setNamesrvAddr(nameSrvAddr);
    ClusterInfo clusterInfo = null;
    try {
        mqAdminExt.start();
        clusterInfo = mqAdminExt.examineBrokerClusterInfo();
    } catch (Exception e) {
        e.printStackTrace();
    }
    mqAdminExt.shutdown();
    return clusterInfo;
}
 
Example 3
Source File: MQAdmin.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
public static ClusterInfo getCluster(String nameSrvAddr) {
    DefaultMQAdminExt mqAdminExt = new DefaultMQAdminExt();
    mqAdminExt.setNamesrvAddr(nameSrvAddr);
    ClusterInfo clusterInfo = null;
    try {
        mqAdminExt.start();
        clusterInfo = mqAdminExt.examineBrokerClusterInfo();
    } catch (Exception e) {
        e.printStackTrace();
    }
    mqAdminExt.shutdown();
    return clusterInfo;
}
 
Example 4
Source File: MQAdmin.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
public static ClusterInfo getCluster(String nameSrvAddr) {
    DefaultMQAdminExt mqAdminExt = new DefaultMQAdminExt();
    mqAdminExt.setNamesrvAddr(nameSrvAddr);
    ClusterInfo clusterInfo = null;
    try {
        mqAdminExt.start();
        clusterInfo = mqAdminExt.examineBrokerClusterInfo();
    } catch (Exception e) {
        e.printStackTrace();
    }
    mqAdminExt.shutdown();
    return clusterInfo;
}
 
Example 5
Source File: MQAdmin.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
public static ClusterInfo getCluster(String nameSrvAddr) {
    DefaultMQAdminExt mqAdminExt = new DefaultMQAdminExt();
    mqAdminExt.setNamesrvAddr(nameSrvAddr);
    ClusterInfo clusterInfo = null;
    try {
        mqAdminExt.start();
        clusterInfo = mqAdminExt.examineBrokerClusterInfo();
    } catch (Exception e) {
        e.printStackTrace();
    }
    mqAdminExt.shutdown();
    return clusterInfo;
}
 
Example 6
Source File: MQAdmin.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public static ClusterInfo getCluster(String nameSrvAddr) {
    DefaultMQAdminExt mqAdminExt = new DefaultMQAdminExt();
    mqAdminExt.setNamesrvAddr(nameSrvAddr);
    ClusterInfo clusterInfo = null;
    try {
        mqAdminExt.start();
        clusterInfo = mqAdminExt.examineBrokerClusterInfo();
    } catch (Exception e) {
        e.printStackTrace();
    }
    mqAdminExt.shutdown();
    return clusterInfo;
}
 
Example 7
Source File: MQAdmin.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
public static ClusterInfo getCluster(String nameSrvAddr) {
    DefaultMQAdminExt mqAdminExt = new DefaultMQAdminExt();
    mqAdminExt.setNamesrvAddr(nameSrvAddr);
    ClusterInfo clusterInfo = null;
    try {
        mqAdminExt.start();
        clusterInfo = mqAdminExt.examineBrokerClusterInfo();
    } catch (Exception e) {
        e.printStackTrace();
    }
    mqAdminExt.shutdown();
    return clusterInfo;
}
 
Example 8
Source File: MQAdmin.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public static ClusterInfo getCluster(String nameSrvAddr) {
    DefaultMQAdminExt mqAdminExt = new DefaultMQAdminExt();
    mqAdminExt.setNamesrvAddr(nameSrvAddr);
    ClusterInfo clusterInfo = null;
    try {
        mqAdminExt.start();
        clusterInfo = mqAdminExt.examineBrokerClusterInfo();
    } catch (Exception e) {
        e.printStackTrace();
    }
    mqAdminExt.shutdown();
    return clusterInfo;
}
 
Example 9
Source File: RmqAdminServiceImpl.java    From DDMQ with Apache License 2.0 4 votes vote down vote up
@Override
public ClusterInfo examineBrokerClusterInfo(String nameServer) throws Exception {
    DefaultMQAdminExt defaultMQAdminExt = getMQAdminExt(nameServer);
    return defaultMQAdminExt.examineBrokerClusterInfo();
}
 
Example 10
Source File: ClusterListSubCommand.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
private void printClusterMoreStats(final DefaultMQAdminExt defaultMQAdminExt) throws RemotingConnectException,
    RemotingTimeoutException, RemotingSendRequestException, InterruptedException, MQBrokerException {

    ClusterInfo clusterInfoSerializeWrapper = defaultMQAdminExt.examineBrokerClusterInfo();

    System.out.printf("%-16s  %-32s %14s %14s %14s %14s%n",
        "#Cluster Name",
        "#Broker Name",
        "#InTotalYest",
        "#OutTotalYest",
        "#InTotalToday",
        "#OutTotalToday"
    );

    Iterator<Map.Entry<String, Set<String>>> itCluster = clusterInfoSerializeWrapper.getClusterAddrTable().entrySet().iterator();
    while (itCluster.hasNext()) {
        Map.Entry<String, Set<String>> next = itCluster.next();
        String clusterName = next.getKey();
        TreeSet<String> brokerNameSet = new TreeSet<String>();
        brokerNameSet.addAll(next.getValue());

        for (String brokerName : brokerNameSet) {
            BrokerData brokerData = clusterInfoSerializeWrapper.getBrokerAddrTable().get(brokerName);
            if (brokerData != null) {

                Iterator<Map.Entry<Long, String>> itAddr = brokerData.getBrokerAddrs().entrySet().iterator();
                while (itAddr.hasNext()) {
                    Map.Entry<Long, String> next1 = itAddr.next();
                    long inTotalYest = 0;
                    long outTotalYest = 0;
                    long inTotalToday = 0;
                    long outTotalToday = 0;

                    try {
                        KVTable kvTable = defaultMQAdminExt.fetchBrokerRuntimeStats(next1.getValue());
                        String msgPutTotalYesterdayMorning = kvTable.getTable().get("msgPutTotalYesterdayMorning");
                        String msgPutTotalTodayMorning = kvTable.getTable().get("msgPutTotalTodayMorning");
                        String msgPutTotalTodayNow = kvTable.getTable().get("msgPutTotalTodayNow");
                        String msgGetTotalYesterdayMorning = kvTable.getTable().get("msgGetTotalYesterdayMorning");
                        String msgGetTotalTodayMorning = kvTable.getTable().get("msgGetTotalTodayMorning");
                        String msgGetTotalTodayNow = kvTable.getTable().get("msgGetTotalTodayNow");

                        inTotalYest = Long.parseLong(msgPutTotalTodayMorning) - Long.parseLong(msgPutTotalYesterdayMorning);
                        outTotalYest = Long.parseLong(msgGetTotalTodayMorning) - Long.parseLong(msgGetTotalYesterdayMorning);

                        inTotalToday = Long.parseLong(msgPutTotalTodayNow) - Long.parseLong(msgPutTotalTodayMorning);
                        outTotalToday = Long.parseLong(msgGetTotalTodayNow) - Long.parseLong(msgGetTotalTodayMorning);

                    } catch (Exception e) {
                    }

                    System.out.printf("%-16s  %-32s %14d %14d %14d %14d%n",
                        clusterName,
                        brokerName,
                        inTotalYest,
                        outTotalYest,
                        inTotalToday,
                        outTotalToday
                    );
                }
            }
        }

        if (itCluster.hasNext()) {
            System.out.printf("");
        }
    }
}
 
Example 11
Source File: ClusterListSubCommand.java    From rocketmq_trans_message with Apache License 2.0 4 votes vote down vote up
private void printClusterMoreStats(final DefaultMQAdminExt defaultMQAdminExt) throws RemotingConnectException,
    RemotingTimeoutException, RemotingSendRequestException, InterruptedException, MQBrokerException {

    ClusterInfo clusterInfoSerializeWrapper = defaultMQAdminExt.examineBrokerClusterInfo();

    System.out.printf("%-16s  %-32s %14s %14s %14s %14s%n",
        "#Cluster Name",
        "#Broker Name",
        "#InTotalYest",
        "#OutTotalYest",
        "#InTotalToday",
        "#OutTotalToday"
    );

    Iterator<Map.Entry<String, Set<String>>> itCluster = clusterInfoSerializeWrapper.getClusterAddrTable().entrySet().iterator();
    while (itCluster.hasNext()) {
        Map.Entry<String, Set<String>> next = itCluster.next();
        String clusterName = next.getKey();
        TreeSet<String> brokerNameSet = new TreeSet<String>();
        brokerNameSet.addAll(next.getValue());

        for (String brokerName : brokerNameSet) {
            BrokerData brokerData = clusterInfoSerializeWrapper.getBrokerAddrTable().get(brokerName);
            if (brokerData != null) {

                Iterator<Map.Entry<Long, String>> itAddr = brokerData.getBrokerAddrs().entrySet().iterator();
                while (itAddr.hasNext()) {
                    Map.Entry<Long, String> next1 = itAddr.next();
                    long inTotalYest = 0;
                    long outTotalYest = 0;
                    long inTotalToday = 0;
                    long outTotalToday = 0;

                    try {
                        KVTable kvTable = defaultMQAdminExt.fetchBrokerRuntimeStats(next1.getValue());
                        String msgPutTotalYesterdayMorning = kvTable.getTable().get("msgPutTotalYesterdayMorning");
                        String msgPutTotalTodayMorning = kvTable.getTable().get("msgPutTotalTodayMorning");
                        String msgPutTotalTodayNow = kvTable.getTable().get("msgPutTotalTodayNow");
                        String msgGetTotalYesterdayMorning = kvTable.getTable().get("msgGetTotalYesterdayMorning");
                        String msgGetTotalTodayMorning = kvTable.getTable().get("msgGetTotalTodayMorning");
                        String msgGetTotalTodayNow = kvTable.getTable().get("msgGetTotalTodayNow");

                        inTotalYest = Long.parseLong(msgPutTotalTodayMorning) - Long.parseLong(msgPutTotalYesterdayMorning);
                        outTotalYest = Long.parseLong(msgGetTotalTodayMorning) - Long.parseLong(msgGetTotalYesterdayMorning);

                        inTotalToday = Long.parseLong(msgPutTotalTodayNow) - Long.parseLong(msgPutTotalTodayMorning);
                        outTotalToday = Long.parseLong(msgGetTotalTodayNow) - Long.parseLong(msgGetTotalTodayMorning);

                    } catch (Exception e) {
                    }

                    System.out.printf("%-16s  %-32s %14d %14d %14d %14d%n",
                        clusterName,
                        brokerName,
                        inTotalYest,
                        outTotalYest,
                        inTotalToday,
                        outTotalToday
                    );
                }
            }
        }

        if (itCluster.hasNext()) {
            System.out.printf("");
        }
    }
}
 
Example 12
Source File: ClusterListSubCommand.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 4 votes vote down vote up
private void printClusterMoreStats(final DefaultMQAdminExt defaultMQAdminExt) throws RemotingConnectException,
    RemotingTimeoutException, RemotingSendRequestException, InterruptedException, MQBrokerException {

    ClusterInfo clusterInfoSerializeWrapper = defaultMQAdminExt.examineBrokerClusterInfo();

    System.out.printf("%-16s  %-32s %14s %14s %14s %14s%n",
        "#Cluster Name",
        "#Broker Name",
        "#InTotalYest",
        "#OutTotalYest",
        "#InTotalToday",
        "#OutTotalToday"
    );

    Iterator<Map.Entry<String, Set<String>>> itCluster = clusterInfoSerializeWrapper.getClusterAddrTable().entrySet().iterator();
    while (itCluster.hasNext()) {
        Map.Entry<String, Set<String>> next = itCluster.next();
        String clusterName = next.getKey();
        TreeSet<String> brokerNameSet = new TreeSet<String>();
        brokerNameSet.addAll(next.getValue());

        for (String brokerName : brokerNameSet) {
            BrokerData brokerData = clusterInfoSerializeWrapper.getBrokerAddrTable().get(brokerName);
            if (brokerData != null) {

                Iterator<Map.Entry<Long, String>> itAddr = brokerData.getBrokerAddrs().entrySet().iterator();
                while (itAddr.hasNext()) {
                    Map.Entry<Long, String> next1 = itAddr.next();
                    long inTotalYest = 0;
                    long outTotalYest = 0;
                    long inTotalToday = 0;
                    long outTotalToday = 0;

                    try {
                        KVTable kvTable = defaultMQAdminExt.fetchBrokerRuntimeStats(next1.getValue());
                        String msgPutTotalYesterdayMorning = kvTable.getTable().get("msgPutTotalYesterdayMorning");
                        String msgPutTotalTodayMorning = kvTable.getTable().get("msgPutTotalTodayMorning");
                        String msgPutTotalTodayNow = kvTable.getTable().get("msgPutTotalTodayNow");
                        String msgGetTotalYesterdayMorning = kvTable.getTable().get("msgGetTotalYesterdayMorning");
                        String msgGetTotalTodayMorning = kvTable.getTable().get("msgGetTotalTodayMorning");
                        String msgGetTotalTodayNow = kvTable.getTable().get("msgGetTotalTodayNow");

                        inTotalYest = Long.parseLong(msgPutTotalTodayMorning) - Long.parseLong(msgPutTotalYesterdayMorning);
                        outTotalYest = Long.parseLong(msgGetTotalTodayMorning) - Long.parseLong(msgGetTotalYesterdayMorning);

                        inTotalToday = Long.parseLong(msgPutTotalTodayNow) - Long.parseLong(msgPutTotalTodayMorning);
                        outTotalToday = Long.parseLong(msgGetTotalTodayNow) - Long.parseLong(msgGetTotalTodayMorning);

                    } catch (Exception e) {
                    }

                    System.out.printf("%-16s  %-32s %14d %14d %14d %14d%n",
                        clusterName,
                        brokerName,
                        inTotalYest,
                        outTotalYest,
                        inTotalToday,
                        outTotalToday
                    );
                }
            }
        }

        if (itCluster.hasNext()) {
            System.out.printf("");
        }
    }
}
 
Example 13
Source File: ClusterListSubCommand.java    From DDMQ with Apache License 2.0 4 votes vote down vote up
private void printClusterMoreStats(final DefaultMQAdminExt defaultMQAdminExt) throws RemotingConnectException,
    RemotingTimeoutException, RemotingSendRequestException, InterruptedException, MQBrokerException {

    ClusterInfo clusterInfoSerializeWrapper = defaultMQAdminExt.examineBrokerClusterInfo();

    System.out.printf("%-16s  %-32s %14s %14s %14s %14s%n",
        "#Cluster Name",
        "#Broker Name",
        "#InTotalYest",
        "#OutTotalYest",
        "#InTotalToday",
        "#OutTotalToday"
    );

    Iterator<Map.Entry<String, Set<String>>> itCluster = clusterInfoSerializeWrapper.getClusterAddrTable().entrySet().iterator();
    while (itCluster.hasNext()) {
        Map.Entry<String, Set<String>> next = itCluster.next();
        String clusterName = next.getKey();
        TreeSet<String> brokerNameSet = new TreeSet<String>();
        brokerNameSet.addAll(next.getValue());

        for (String brokerName : brokerNameSet) {
            BrokerData brokerData = clusterInfoSerializeWrapper.getBrokerAddrTable().get(brokerName);
            if (brokerData != null) {

                Iterator<Map.Entry<Long, String>> itAddr = brokerData.getBrokerAddrs().entrySet().iterator();
                while (itAddr.hasNext()) {
                    Map.Entry<Long, String> next1 = itAddr.next();
                    long inTotalYest = 0;
                    long outTotalYest = 0;
                    long inTotalToday = 0;
                    long outTotalToday = 0;

                    try {
                        KVTable kvTable = defaultMQAdminExt.fetchBrokerRuntimeStats(next1.getValue());
                        String msgPutTotalYesterdayMorning = kvTable.getTable().get("msgPutTotalYesterdayMorning");
                        String msgPutTotalTodayMorning = kvTable.getTable().get("msgPutTotalTodayMorning");
                        String msgPutTotalTodayNow = kvTable.getTable().get("msgPutTotalTodayNow");
                        String msgGetTotalYesterdayMorning = kvTable.getTable().get("msgGetTotalYesterdayMorning");
                        String msgGetTotalTodayMorning = kvTable.getTable().get("msgGetTotalTodayMorning");
                        String msgGetTotalTodayNow = kvTable.getTable().get("msgGetTotalTodayNow");

                        inTotalYest = Long.parseLong(msgPutTotalTodayMorning) - Long.parseLong(msgPutTotalYesterdayMorning);
                        outTotalYest = Long.parseLong(msgGetTotalTodayMorning) - Long.parseLong(msgGetTotalYesterdayMorning);

                        inTotalToday = Long.parseLong(msgPutTotalTodayNow) - Long.parseLong(msgPutTotalTodayMorning);
                        outTotalToday = Long.parseLong(msgGetTotalTodayNow) - Long.parseLong(msgGetTotalTodayMorning);

                    } catch (Exception e) {
                    }

                    System.out.printf("%-16s  %-32s %14d %14d %14d %14d%n",
                        clusterName,
                        brokerName,
                        inTotalYest,
                        outTotalYest,
                        inTotalToday,
                        outTotalToday
                    );
                }
            }
        }

        if (itCluster.hasNext()) {
            System.out.printf("");
        }
    }
}
 
Example 14
Source File: RmqAdminServiceImpl.java    From DDMQ with Apache License 2.0 4 votes vote down vote up
@Override
public ClusterInfo examineBrokerClusterInfo(String nameServer) throws Exception {
    DefaultMQAdminExt defaultMQAdminExt = getMQAdminExt(nameServer);
    return defaultMQAdminExt.examineBrokerClusterInfo();
}
 
Example 15
Source File: ClusterListSubCommand.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
private void printClusterMoreStats(final DefaultMQAdminExt defaultMQAdminExt) throws RemotingConnectException,
    RemotingTimeoutException, RemotingSendRequestException, InterruptedException, MQBrokerException {

    ClusterInfo clusterInfoSerializeWrapper = defaultMQAdminExt.examineBrokerClusterInfo();

    System.out.printf("%-16s  %-32s %14s %14s %14s %14s%n",
        "#Cluster Name",
        "#Broker Name",
        "#InTotalYest",
        "#OutTotalYest",
        "#InTotalToday",
        "#OutTotalToday"
    );

    Iterator<Map.Entry<String, Set<String>>> itCluster = clusterInfoSerializeWrapper.getClusterAddrTable().entrySet().iterator();
    while (itCluster.hasNext()) {
        Map.Entry<String, Set<String>> next = itCluster.next();
        String clusterName = next.getKey();
        TreeSet<String> brokerNameSet = new TreeSet<String>();
        brokerNameSet.addAll(next.getValue());

        for (String brokerName : brokerNameSet) {
            BrokerData brokerData = clusterInfoSerializeWrapper.getBrokerAddrTable().get(brokerName);
            if (brokerData != null) {

                Iterator<Map.Entry<Long, String>> itAddr = brokerData.getBrokerAddrs().entrySet().iterator();
                while (itAddr.hasNext()) {
                    Map.Entry<Long, String> next1 = itAddr.next();
                    long inTotalYest = 0;
                    long outTotalYest = 0;
                    long inTotalToday = 0;
                    long outTotalToday = 0;

                    try {
                        KVTable kvTable = defaultMQAdminExt.fetchBrokerRuntimeStats(next1.getValue());
                        String msgPutTotalYesterdayMorning = kvTable.getTable().get("msgPutTotalYesterdayMorning");
                        String msgPutTotalTodayMorning = kvTable.getTable().get("msgPutTotalTodayMorning");
                        String msgPutTotalTodayNow = kvTable.getTable().get("msgPutTotalTodayNow");
                        String msgGetTotalYesterdayMorning = kvTable.getTable().get("msgGetTotalYesterdayMorning");
                        String msgGetTotalTodayMorning = kvTable.getTable().get("msgGetTotalTodayMorning");
                        String msgGetTotalTodayNow = kvTable.getTable().get("msgGetTotalTodayNow");

                        inTotalYest = Long.parseLong(msgPutTotalTodayMorning) - Long.parseLong(msgPutTotalYesterdayMorning);
                        outTotalYest = Long.parseLong(msgGetTotalTodayMorning) - Long.parseLong(msgGetTotalYesterdayMorning);

                        inTotalToday = Long.parseLong(msgPutTotalTodayNow) - Long.parseLong(msgPutTotalTodayMorning);
                        outTotalToday = Long.parseLong(msgGetTotalTodayNow) - Long.parseLong(msgGetTotalTodayMorning);

                    } catch (Exception e) {
                    }

                    System.out.printf("%-16s  %-32s %14d %14d %14d %14d%n",
                        clusterName,
                        brokerName,
                        inTotalYest,
                        outTotalYest,
                        inTotalToday,
                        outTotalToday
                    );
                }
            }
        }

        if (itCluster.hasNext()) {
            System.out.printf("");
        }
    }
}
 
Example 16
Source File: ClusterListSubCommand.java    From rocketmq-read with Apache License 2.0 4 votes vote down vote up
private void printClusterMoreStats(final DefaultMQAdminExt defaultMQAdminExt) throws RemotingConnectException,
    RemotingTimeoutException, RemotingSendRequestException, InterruptedException, MQBrokerException {

    ClusterInfo clusterInfoSerializeWrapper = defaultMQAdminExt.examineBrokerClusterInfo();

    System.out.printf("%-16s  %-32s %14s %14s %14s %14s%n",
        "#Cluster Name",
        "#Broker Name",
        "#InTotalYest",
        "#OutTotalYest",
        "#InTotalToday",
        "#OutTotalToday"
    );

    Iterator<Map.Entry<String, Set<String>>> itCluster = clusterInfoSerializeWrapper.getClusterAddrTable().entrySet().iterator();
    while (itCluster.hasNext()) {
        Map.Entry<String, Set<String>> next = itCluster.next();
        String clusterName = next.getKey();
        TreeSet<String> brokerNameSet = new TreeSet<String>();
        brokerNameSet.addAll(next.getValue());

        for (String brokerName : brokerNameSet) {
            BrokerData brokerData = clusterInfoSerializeWrapper.getBrokerAddrTable().get(brokerName);
            if (brokerData != null) {

                Iterator<Map.Entry<Long, String>> itAddr = brokerData.getBrokerAddrs().entrySet().iterator();
                while (itAddr.hasNext()) {
                    Map.Entry<Long, String> next1 = itAddr.next();
                    long inTotalYest = 0;
                    long outTotalYest = 0;
                    long inTotalToday = 0;
                    long outTotalToday = 0;

                    try {
                        KVTable kvTable = defaultMQAdminExt.fetchBrokerRuntimeStats(next1.getValue());
                        String msgPutTotalYesterdayMorning = kvTable.getTable().get("msgPutTotalYesterdayMorning");
                        String msgPutTotalTodayMorning = kvTable.getTable().get("msgPutTotalTodayMorning");
                        String msgPutTotalTodayNow = kvTable.getTable().get("msgPutTotalTodayNow");
                        String msgGetTotalYesterdayMorning = kvTable.getTable().get("msgGetTotalYesterdayMorning");
                        String msgGetTotalTodayMorning = kvTable.getTable().get("msgGetTotalTodayMorning");
                        String msgGetTotalTodayNow = kvTable.getTable().get("msgGetTotalTodayNow");

                        inTotalYest = Long.parseLong(msgPutTotalTodayMorning) - Long.parseLong(msgPutTotalYesterdayMorning);
                        outTotalYest = Long.parseLong(msgGetTotalTodayMorning) - Long.parseLong(msgGetTotalYesterdayMorning);

                        inTotalToday = Long.parseLong(msgPutTotalTodayNow) - Long.parseLong(msgPutTotalTodayMorning);
                        outTotalToday = Long.parseLong(msgGetTotalTodayNow) - Long.parseLong(msgGetTotalTodayMorning);

                    } catch (Exception e) {
                    }

                    System.out.printf("%-16s  %-32s %14d %14d %14d %14d%n",
                        clusterName,
                        brokerName,
                        inTotalYest,
                        outTotalYest,
                        inTotalToday,
                        outTotalToday
                    );
                }
            }
        }

        if (itCluster.hasNext()) {
            System.out.printf("");
        }
    }
}
 
Example 17
Source File: ClusterListSubCommand.java    From rocketmq-4.3.0 with Apache License 2.0 4 votes vote down vote up
private void printClusterMoreStats(final DefaultMQAdminExt defaultMQAdminExt) throws RemotingConnectException,
    RemotingTimeoutException, RemotingSendRequestException, InterruptedException, MQBrokerException {

    ClusterInfo clusterInfoSerializeWrapper = defaultMQAdminExt.examineBrokerClusterInfo();

    System.out.printf("%-16s  %-32s %14s %14s %14s %14s%n",
        "#Cluster Name",
        "#Broker Name",
        "#InTotalYest",
        "#OutTotalYest",
        "#InTotalToday",
        "#OutTotalToday"
    );

    Iterator<Map.Entry<String, Set<String>>> itCluster = clusterInfoSerializeWrapper.getClusterAddrTable().entrySet().iterator();
    while (itCluster.hasNext()) {
        Map.Entry<String, Set<String>> next = itCluster.next();
        String clusterName = next.getKey();
        TreeSet<String> brokerNameSet = new TreeSet<String>();
        brokerNameSet.addAll(next.getValue());

        for (String brokerName : brokerNameSet) {
            BrokerData brokerData = clusterInfoSerializeWrapper.getBrokerAddrTable().get(brokerName);
            if (brokerData != null) {

                Iterator<Map.Entry<Long, String>> itAddr = brokerData.getBrokerAddrs().entrySet().iterator();
                while (itAddr.hasNext()) {
                    Map.Entry<Long, String> next1 = itAddr.next();
                    long inTotalYest = 0;
                    long outTotalYest = 0;
                    long inTotalToday = 0;
                    long outTotalToday = 0;

                    try {
                        KVTable kvTable = defaultMQAdminExt.fetchBrokerRuntimeStats(next1.getValue());
                        String msgPutTotalYesterdayMorning = kvTable.getTable().get("msgPutTotalYesterdayMorning");
                        String msgPutTotalTodayMorning = kvTable.getTable().get("msgPutTotalTodayMorning");
                        String msgPutTotalTodayNow = kvTable.getTable().get("msgPutTotalTodayNow");
                        String msgGetTotalYesterdayMorning = kvTable.getTable().get("msgGetTotalYesterdayMorning");
                        String msgGetTotalTodayMorning = kvTable.getTable().get("msgGetTotalTodayMorning");
                        String msgGetTotalTodayNow = kvTable.getTable().get("msgGetTotalTodayNow");

                        inTotalYest = Long.parseLong(msgPutTotalTodayMorning) - Long.parseLong(msgPutTotalYesterdayMorning);
                        outTotalYest = Long.parseLong(msgGetTotalTodayMorning) - Long.parseLong(msgGetTotalYesterdayMorning);

                        inTotalToday = Long.parseLong(msgPutTotalTodayNow) - Long.parseLong(msgPutTotalTodayMorning);
                        outTotalToday = Long.parseLong(msgGetTotalTodayNow) - Long.parseLong(msgGetTotalTodayMorning);

                    } catch (Exception e) {
                    }

                    System.out.printf("%-16s  %-32s %14d %14d %14d %14d%n",
                        clusterName,
                        brokerName,
                        inTotalYest,
                        outTotalYest,
                        inTotalToday,
                        outTotalToday
                    );
                }
            }
        }

        if (itCluster.hasNext()) {
            System.out.printf("");
        }
    }
}
 
Example 18
Source File: ClusterListSubCommand.java    From DDMQ with Apache License 2.0 4 votes vote down vote up
private void printClusterMoreStats(final DefaultMQAdminExt defaultMQAdminExt) throws RemotingConnectException,
    RemotingTimeoutException, RemotingSendRequestException, InterruptedException, MQBrokerException {

    ClusterInfo clusterInfoSerializeWrapper = defaultMQAdminExt.examineBrokerClusterInfo();

    System.out.printf("%-16s  %-32s %14s %14s %14s %14s%n",
        "#Cluster Name",
        "#Broker Name",
        "#InTotalYest",
        "#OutTotalYest",
        "#InTotalToday",
        "#OutTotalToday"
    );

    Iterator<Map.Entry<String, Set<String>>> itCluster = clusterInfoSerializeWrapper.getClusterAddrTable().entrySet().iterator();
    while (itCluster.hasNext()) {
        Map.Entry<String, Set<String>> next = itCluster.next();
        String clusterName = next.getKey();
        TreeSet<String> brokerNameSet = new TreeSet<String>();
        brokerNameSet.addAll(next.getValue());

        for (String brokerName : brokerNameSet) {
            BrokerData brokerData = clusterInfoSerializeWrapper.getBrokerAddrTable().get(brokerName);
            if (brokerData != null) {

                Iterator<Map.Entry<Long, String>> itAddr = brokerData.getBrokerAddrs().entrySet().iterator();
                while (itAddr.hasNext()) {
                    Map.Entry<Long, String> next1 = itAddr.next();
                    long inTotalYest = 0;
                    long outTotalYest = 0;
                    long inTotalToday = 0;
                    long outTotalToday = 0;

                    try {
                        KVTable kvTable = defaultMQAdminExt.fetchBrokerRuntimeStats(next1.getValue());
                        String msgPutTotalYesterdayMorning = kvTable.getTable().get("msgPutTotalYesterdayMorning");
                        String msgPutTotalTodayMorning = kvTable.getTable().get("msgPutTotalTodayMorning");
                        String msgPutTotalTodayNow = kvTable.getTable().get("msgPutTotalTodayNow");
                        String msgGetTotalYesterdayMorning = kvTable.getTable().get("msgGetTotalYesterdayMorning");
                        String msgGetTotalTodayMorning = kvTable.getTable().get("msgGetTotalTodayMorning");
                        String msgGetTotalTodayNow = kvTable.getTable().get("msgGetTotalTodayNow");

                        inTotalYest = Long.parseLong(msgPutTotalTodayMorning) - Long.parseLong(msgPutTotalYesterdayMorning);
                        outTotalYest = Long.parseLong(msgGetTotalTodayMorning) - Long.parseLong(msgGetTotalYesterdayMorning);

                        inTotalToday = Long.parseLong(msgPutTotalTodayNow) - Long.parseLong(msgPutTotalTodayMorning);
                        outTotalToday = Long.parseLong(msgGetTotalTodayNow) - Long.parseLong(msgGetTotalTodayMorning);

                    } catch (Exception e) {
                    }

                    System.out.printf("%-16s  %-32s %14d %14d %14d %14d%n",
                        clusterName,
                        brokerName,
                        inTotalYest,
                        outTotalYest,
                        inTotalToday,
                        outTotalToday
                    );
                }
            }
        }

        if (itCluster.hasNext()) {
            System.out.printf("");
        }
    }
}