Package com.netflix.priam.utils

Examples of com.netflix.priam.utils.JMXNodeTool


    @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

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

    @GET
    @Path("/scrub")
    public Response scrub(@QueryParam(REST_HEADER_KEYSPACES) String keyspaces, @QueryParam(REST_HEADER_CFS) String cfnames) throws IOException, ExecutionException, InterruptedException,
            ConfigurationException
    {
        JMXNodeTool nodetool = null;
    try {
      nodetool = JMXNodeTool.instance(config);
    } catch (JMXConnectionException e) {
      return Response.status(503).entity("JMXConnectionException")
          .build();
    }
        String[] cfs = null;
        if (StringUtils.isNotBlank(cfnames))
            cfs = cfnames.split(",");
        if (cfs == null)
            nodetool.scrub(keyspaces);
        else
            nodetool.scrub(keyspaces, cfs);
        return Response.ok(REST_SUCCESS, MediaType.APPLICATION_JSON).build();
    }
View Full Code Here

    @GET
    @Path("/cfhistograms")
    public Response cfhistograms(@QueryParam(REST_HEADER_KEYSPACES) String keyspace, @QueryParam(REST_HEADER_CFS) String cfname) throws IOException, ExecutionException, InterruptedException,
            JSONException
    {
        JMXNodeTool nodetool = null;
    try {
      nodetool = JMXNodeTool.instance(config);
    } catch (JMXConnectionException e) {
      return Response.status(503).entity("JMXConnectionException")
          .build();
    }
        if (StringUtils.isBlank(keyspace) || StringUtils.isBlank(cfname))
            return Response.status(400).entity("Missing keyspace/cfname in request").build();

        ColumnFamilyStoreMBean store = nodetool.getCfsProxy(keyspace, cfname);

        // default is 90 offsets
        long[] offsets = new EstimatedHistogram().getBucketOffsets();

        long[] rrlh = store.getRecentReadLatencyHistogramMicros();
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.