Search in sources :

Example 1 with MessagingServiceMBean

use of org.apache.cassandra.net.MessagingServiceMBean in project eiger by wlloyd.

the class NodeCmd method printNetworkStats.

public void printNetworkStats(final InetAddress addr, PrintStream outs) {
    outs.printf("Mode: %s%n", probe.getOperationMode());
    Set<InetAddress> hosts = addr == null ? probe.getStreamDestinations() : new HashSet<InetAddress>() {

        {
            add(addr);
        }
    };
    if (hosts.size() == 0)
        outs.println("Not sending any streams.");
    for (InetAddress host : hosts) {
        try {
            List<String> files = probe.getFilesDestinedFor(host);
            if (files.size() > 0) {
                outs.printf("Streaming to: %s%n", host);
                for (String file : files) outs.printf("   %s%n", file);
            } else {
                outs.printf(" Nothing streaming to %s%n", host);
            }
        } catch (IOException ex) {
            outs.printf("   Error retrieving file data for %s%n", host);
        }
    }
    hosts = addr == null ? probe.getStreamSources() : new HashSet<InetAddress>() {

        {
            add(addr);
        }
    };
    if (hosts.size() == 0)
        outs.println("Not receiving any streams.");
    for (InetAddress host : hosts) {
        try {
            List<String> files = probe.getIncomingFiles(host);
            if (files.size() > 0) {
                outs.printf("Streaming from: %s%n", host);
                for (String file : files) outs.printf("   %s%n", file);
            } else {
                outs.printf(" Nothing streaming from %s%n", host);
            }
        } catch (IOException ex) {
            outs.printf("   Error retrieving file data for %s%n", host);
        }
    }
    MessagingServiceMBean ms = probe.msProxy;
    outs.printf("%-25s", "Pool Name");
    outs.printf("%10s", "Active");
    outs.printf("%10s", "Pending");
    outs.printf("%15s%n", "Completed");
    int pending;
    long completed;
    pending = 0;
    for (int n : ms.getCommandPendingTasks().values()) pending += n;
    completed = 0;
    for (long n : ms.getCommandCompletedTasks().values()) completed += n;
    outs.printf("%-25s%10s%10s%15s%n", "Commands", "n/a", pending, completed);
    pending = 0;
    for (int n : ms.getResponsePendingTasks().values()) pending += n;
    completed = 0;
    for (long n : ms.getResponseCompletedTasks().values()) completed += n;
    outs.printf("%-25s%10s%10s%15s%n", "Responses", "n/a", pending, completed);
}
Also used : MessagingServiceMBean(org.apache.cassandra.net.MessagingServiceMBean) IOException(java.io.IOException) InetAddress(java.net.InetAddress)

Example 2 with MessagingServiceMBean

use of org.apache.cassandra.net.MessagingServiceMBean in project cassandra by apache.

the class NetStats method execute.

@Override
public void execute(NodeProbe probe) {
    PrintStream out = probe.output().out;
    out.printf("Mode: %s%n", probe.getOperationMode());
    Set<StreamState> statuses = probe.getStreamStatus();
    if (statuses.isEmpty())
        out.println("Not sending any streams.");
    for (StreamState status : statuses) {
        out.printf("%s %s%n", status.streamOperation.getDescription(), status.planId.toString());
        for (SessionInfo info : status.sessions) {
            out.printf("    %s", InetAddressAndPort.toString(info.peer, printPort));
            // print private IP when it is used
            if (!info.peer.equals(info.connecting)) {
                out.printf(" (using %s)", InetAddressAndPort.toString(info.connecting, printPort));
            }
            out.printf("%n");
            if (!info.receivingSummaries.isEmpty()) {
                printReceivingSummaries(out, info, humanReadable);
            }
            if (!info.sendingSummaries.isEmpty()) {
                printSendingSummaries(out, info, humanReadable);
            }
        }
    }
    if (!probe.isStarting()) {
        out.printf("Read Repair Statistics:%nAttempted: %d%nMismatch (Blocking): %d%nMismatch (Background): %d%n", probe.getReadRepairAttempted(), probe.getReadRepairRepairedBlocking(), probe.getReadRepairRepairedBackground());
        MessagingServiceMBean ms = probe.getMessagingServiceProxy();
        out.printf("%-25s", "Pool Name");
        out.printf("%10s", "Active");
        out.printf("%10s", "Pending");
        out.printf("%15s", "Completed");
        out.printf("%10s%n", "Dropped");
        int pending;
        long completed;
        long dropped;
        pending = 0;
        for (int n : ms.getLargeMessagePendingTasksWithPort().values()) pending += n;
        completed = 0;
        for (long n : ms.getLargeMessageCompletedTasksWithPort().values()) completed += n;
        dropped = 0;
        for (long n : ms.getLargeMessageDroppedTasksWithPort().values()) dropped += n;
        out.printf("%-25s%10s%10s%15s%10s%n", "Large messages", "n/a", pending, completed, dropped);
        pending = 0;
        for (int n : ms.getSmallMessagePendingTasksWithPort().values()) pending += n;
        completed = 0;
        for (long n : ms.getSmallMessageCompletedTasksWithPort().values()) completed += n;
        dropped = 0;
        for (long n : ms.getSmallMessageDroppedTasksWithPort().values()) dropped += n;
        out.printf("%-25s%10s%10s%15s%10s%n", "Small messages", "n/a", pending, completed, dropped);
        pending = 0;
        for (int n : ms.getGossipMessagePendingTasksWithPort().values()) pending += n;
        completed = 0;
        for (long n : ms.getGossipMessageCompletedTasksWithPort().values()) completed += n;
        dropped = 0;
        for (long n : ms.getGossipMessageDroppedTasksWithPort().values()) dropped += n;
        out.printf("%-25s%10s%10s%15s%10s%n", "Gossip messages", "n/a", pending, completed, dropped);
    }
}
Also used : StreamState(org.apache.cassandra.streaming.StreamState) PrintStream(java.io.PrintStream) MessagingServiceMBean(org.apache.cassandra.net.MessagingServiceMBean) SessionInfo(org.apache.cassandra.streaming.SessionInfo)

Aggregations

MessagingServiceMBean (org.apache.cassandra.net.MessagingServiceMBean)2 IOException (java.io.IOException)1 PrintStream (java.io.PrintStream)1 InetAddress (java.net.InetAddress)1 SessionInfo (org.apache.cassandra.streaming.SessionInfo)1 StreamState (org.apache.cassandra.streaming.StreamState)1