Package com.netflix.priam.utils

Examples of com.netflix.priam.utils.JMXNodeTool


    @GET
    @Path("/version")
    public Response version() throws IOException, ExecutionException, InterruptedException
    {
        JMXNodeTool nodetool = null;
    try {
      nodetool = JMXNodeTool.instance(config);
    } catch (JMXConnectionException e) {
      return Response.status(503).entity("JMXConnectionException")
          .build();
    }
        return Response.ok(new JSONArray().put(nodetool.getReleaseVersion()), MediaType.APPLICATION_JSON).build();
    }
View Full Code Here


    @GET
    @Path("/tpstats")
    public Response tpstats() throws IOException, ExecutionException, InterruptedException, JSONException
    {
        JMXNodeTool nodetool = null;
    try {
      nodetool = JMXNodeTool.instance(config);
    } catch (JMXConnectionException e) {
      return Response.status(503).entity("JMXConnectionException")
          .build();
    }
        Iterator<Map.Entry<String, JMXEnabledThreadPoolExecutorMBean>> threads = nodetool.getThreadPoolMBeanProxies();
        JSONArray threadPoolArray = new JSONArray();
        while (threads.hasNext())
        {
            Entry<String, JMXEnabledThreadPoolExecutorMBean> thread = threads.next();
            JMXEnabledThreadPoolExecutorMBean threadPoolProxy = thread.getValue();
            JSONObject tpObj = new JSONObject();// "Pool Name", "Active",
                                                // "Pending", "Completed",
                                                // "Blocked", "All time blocked"
            tpObj.put("pool name", thread.getKey());
            tpObj.put("active", threadPoolProxy.getActiveCount());
            tpObj.put("pending", threadPoolProxy.getPendingTasks());
            tpObj.put("completed", threadPoolProxy.getCompletedTasks());
            tpObj.put("blocked", threadPoolProxy.getCurrentlyBlockedTasks());
            tpObj.put("total blocked", threadPoolProxy.getTotalBlockedTasks());
            threadPoolArray.put(tpObj);
        }
        JSONObject droppedMsgs = new JSONObject();
        for (Entry<String, Integer> entry : nodetool.getDroppedMessages().entrySet())
            droppedMsgs.put(entry.getKey(), entry.getValue());

        JSONObject rootObj = new JSONObject();
        rootObj.put("thread pool", threadPoolArray);
        rootObj.put("dropped messages", droppedMsgs);
View Full Code Here

    @GET
    @Path("/compactionstats")
    public Response compactionStats() throws IOException, ExecutionException, InterruptedException, JSONException
    {
        JMXNodeTool nodetool = null;
    try {
      nodetool = JMXNodeTool.instance(config);
    } catch (JMXConnectionException e) {
      return Response.status(503).entity("JMXConnectionException")
          .build();
    }
        JSONObject rootObj = new JSONObject();
        CompactionManagerMBean cm = nodetool.getCompactionManagerProxy();
        rootObj.put("pending tasks", cm.getPendingTasks());
        JSONArray compStats = new JSONArray();
        for (Map<String, String> c : cm.getCompactions())
        {
            JSONObject cObj = new JSONObject();
View Full Code Here

    @GET
    @Path("/disablegossip")
    public Response disablegossip() throws IOException, ExecutionException, InterruptedException
    {
        JMXNodeTool nodetool = null;
    try {
      nodetool = JMXNodeTool.instance(config);
    } catch (JMXConnectionException e) {
      return Response.status(503).entity("JMXConnectionException")
          .build();
    }
        nodetool.stopGossiping();
        return Response.ok(REST_SUCCESS, MediaType.APPLICATION_JSON).build();
    }
View Full Code Here

    @GET
    @Path("/enablegossip")
    public Response enablegossip() throws IOException, ExecutionException, InterruptedException
    {
        JMXNodeTool nodetool = null;
    try {
      nodetool = JMXNodeTool.instance(config);
    } catch (JMXConnectionException e) {
      return Response.status(503).entity("JMXConnectionException")
          .build();
    }
        nodetool.startGossiping();
        return Response.ok(REST_SUCCESS, MediaType.APPLICATION_JSON).build();
    }
View Full Code Here

    @GET
    @Path("/disablethrift")
    public Response disablethrift() throws IOException, ExecutionException, InterruptedException
    {
        JMXNodeTool nodetool = null;
    try {
      nodetool = JMXNodeTool.instance(config);
    } catch (JMXConnectionException e) {
      return Response.status(503).entity("JMXConnectionException")
          .build();
    }
        nodetool.stopThriftServer();
        return Response.ok(REST_SUCCESS, MediaType.APPLICATION_JSON).build();
    }
View Full Code Here

    @GET
    @Path("/enablethrift")
    public Response enablethrift() throws IOException, ExecutionException, InterruptedException
    {
        JMXNodeTool nodetool = null;
    try {
      nodetool = JMXNodeTool.instance(config);
    } catch (JMXConnectionException e) {
      return Response.status(503).entity("JMXConnectionException")
          .build();
    }
        nodetool.startThriftServer();
        return Response.ok(REST_SUCCESS, MediaType.APPLICATION_JSON).build();
    }
View Full Code Here

    @GET
    @Path("/statusthrift")
    public Response statusthrift() throws IOException, ExecutionException, InterruptedException, JSONException
    {
        JMXNodeTool nodetool = null;
    try {
      nodetool = JMXNodeTool.instance(config);
    } catch (JMXConnectionException e) {
      return Response.status(503).entity("JMXConnectionException")
          .build();
    }
        return Response.ok(new JSONObject().put("status", (nodetool.isThriftServerRunning() ? "running" : "not running")), MediaType.APPLICATION_JSON).build();
    }
View Full Code Here

    @GET
    @Path("/gossipinfo")
    public Response gossipinfo() throws IOException, ExecutionException, InterruptedException, JSONException
    {
        JMXNodeTool nodetool = null;
    try {
      nodetool = JMXNodeTool.instance(config);
    } catch (JMXConnectionException e) {
      return Response.status(503).entity("JMXConnectionException")
          .build();
    }
        JSONObject rootObj = new JSONObject();
        String[] ginfo = nodetool.getGossipInfo().split("/");
        for (String info : ginfo)
        {
            String[] data = info.split("\n");
            String key = "";
            JSONObject obj = new JSONObject();
View Full Code Here

    @GET
    @Path("/netstats")
    public Response netstats(@QueryParam("host") String hostname) throws IOException, ExecutionException, InterruptedException, JSONException
    {
        JMXNodeTool nodetool = null;
    try {
      nodetool = JMXNodeTool.instance(config);
    } catch (JMXConnectionException e) {
      return Response.status(503).entity("JMXConnectionException")
          .build();
    }
        JSONObject rootObj = new JSONObject();
        rootObj.put("mode", nodetool.getOperationMode());
        final InetAddress addr = (hostname == null) ? null : InetAddress.getByName(hostname);
        Set<InetAddress> hosts = addr == null ? nodetool.getStreamDestinations() : new HashSet<InetAddress>()
        {
            {
                add(addr);
            }
        };
        if (hosts.size() == 0)
            rootObj.put("sending", "Not sending any streams.");

        JSONObject hostSendStats = new JSONObject();
        for (InetAddress host : hosts)
        {
            try
            {
                List<String> files = nodetool.getFilesDestinedFor(host);
                if (files.size() > 0)
                {
                    JSONArray fObj = new JSONArray();
                    for (String file : files)
                        fObj.put(file);
                    hostSendStats.put(host.getHostAddress(), fObj);
                }
            }
            catch (IOException ex)
            {
                hostSendStats.put(host.getHostAddress(), "Error retrieving file data");
            }
        }

        rootObj.put("hosts sending", hostSendStats);
        hosts = addr == null ? nodetool.getStreamSources() : new HashSet<InetAddress>()
        {
            {
                add(addr);
            }
        };
        if (hosts.size() == 0)
            rootObj.put("receiving", "Not receiving any streams.");

        JSONObject hostRecvStats = new JSONObject();
        for (InetAddress host : hosts)
        {
            try
            {
                List<String> files = nodetool.getIncomingFiles(host);
                if (files.size() > 0)
                {
                    JSONArray fObj = new JSONArray();
                    for (String file : files)
                        fObj.put(file);
View Full Code Here

TOP

Related Classes of com.netflix.priam.utils.JMXNodeTool

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.