Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 45447200CBD for ; Thu, 6 Jul 2017 22:43:06 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 43C6E167648; Thu, 6 Jul 2017 20:43:06 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 3B9E4167638 for ; Thu, 6 Jul 2017 22:43:02 +0200 (CEST) Received: (qmail 67233 invoked by uid 500); 6 Jul 2017 20:43:01 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 64828 invoked by uid 99); 6 Jul 2017 20:42:58 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Jul 2017 20:42:58 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E0099F5533; Thu, 6 Jul 2017 20:42:56 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ctubbsii@apache.org To: commits@accumulo.apache.org Date: Thu, 06 Jul 2017 20:43:42 -0000 Message-Id: In-Reply-To: <3b8d0f56f4e142fcbb35fd820ce25ed9@git.apache.org> References: <3b8d0f56f4e142fcbb35fd820ce25ed9@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [48/54] [abbrv] accumulo git commit: ACCUMULO-2181 Fixed from PR archived-at: Thu, 06 Jul 2017 20:43:06 -0000 http://git-wip-us.apache.org/repos/asf/accumulo/blob/680b3a21/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServerInformation.java ---------------------------------------------------------------------- diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServerInformation.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServerInformation.java index b4f481c..f641c57 100644 --- a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServerInformation.java +++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServerInformation.java @@ -50,7 +50,10 @@ public class TabletServerInformation { public CompactionsTypes compactions; public int tablets; - public double ingest, query, ingestMB, queryMB; + public double ingest; + public double query; + public double ingestMB; + public double queryMB; public Integer scans; // For backwards compatibility, has same information as scansRunning public Double scansessions; public Double scanssessions; // For backwards compatibility @@ -59,10 +62,23 @@ public class TabletServerInformation { // New variables public String ip; - private Integer scansRunning, scansQueued, minorRunning, minorQueued, majorRunning, majorQueued; - private CompactionsList scansCompacting, major, minor; // if scans is removed, change scansCompacting to scans - public long entries, lookups, indexCacheHits, indexCacheRequests, dataCacheHits, dataCacheRequests; - public double indexCacheHitRate, dataCacheHitRate; + private Integer scansRunning; + private Integer scansQueued; + private Integer minorRunning; + private Integer minorQueued; + private Integer majorRunning; + private Integer majorQueued; + private CompactionsList scansCompacting; // if scans is removed, change scansCompacting to scans + private CompactionsList major; + private CompactionsList minor; + public long entries; + public long lookups; + public long indexCacheHits; + public long indexCacheRequests; + public long dataCacheHits; + public long dataCacheRequests; + public double indexCacheHitRate; + public double dataCacheHitRate; public List logRecoveries; public TabletServerInformation() {} http://git-wip-us.apache.org/repos/asf/accumulo/blob/680b3a21/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServerRecoveryInformation.java ---------------------------------------------------------------------- diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServerRecoveryInformation.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServerRecoveryInformation.java new file mode 100644 index 0000000..f0aea49 --- /dev/null +++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServerRecoveryInformation.java @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.accumulo.monitor.rest.tservers; + +/** + * + * Generates a tserver recovery information + * + * @since 2.0.0 + * + */ +public class TabletServerRecoveryInformation { + + // Variable names become JSON keys + public String server = ""; + public String log = ""; + public int time = 0; + public double copySort = 0d; + + public TabletServerRecoveryInformation() {} + + /** + * Stores a tserver recovery + * + * @param server + * Name of the tserver + * @param log + * Log of the tserver + * @param time + * Recovery runtime + * @param copySort + * Recovery progress + */ + public TabletServerRecoveryInformation(String server, String log, int time, double copySort) { + this.server = server; + this.log = log; + this.time = time; + this.copySort = copySort; + } +} http://git-wip-us.apache.org/repos/asf/accumulo/blob/680b3a21/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServerResource.java ---------------------------------------------------------------------- diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServerResource.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServerResource.java index bc50666..a7bafc1 100644 --- a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServerResource.java +++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServerResource.java @@ -20,7 +20,6 @@ import java.lang.management.ManagementFactory; import java.security.MessageDigest; import java.util.ArrayList; import java.util.Base64; -import java.util.HashMap; import java.util.List; import java.util.Map; @@ -70,7 +69,8 @@ import com.google.common.net.HostAndPort; public class TabletServerResource { // Variable names become JSON keys - private TabletStats total, historical; + private TabletStats total; + private TabletStats historical; /** * Generates tserver summary @@ -114,11 +114,8 @@ public class TabletServerResource { */ @Path("recovery") @GET - public Map>> getTserverRecovery() { - - Map>> jsonObj = new HashMap>>(); - List> recoveryList = new ArrayList<>(); - Map recoveryObj = new HashMap(); + public TabletServersRecovery getTserverRecovery() { + TabletServersRecovery recoveryList = new TabletServersRecovery(); MasterMonitorInfo mmi = Monitor.getMmi(); if (null == mmi) { @@ -128,19 +125,17 @@ public class TabletServerResource { for (TabletServerStatus server : mmi.tServerInfo) { if (server.logSorts != null) { for (RecoveryStatus recovery : server.logSorts) { - recoveryObj.put("server", AddressUtil.parseAddress(server.name, false).getHostText()); - recoveryObj.put("log", recovery.name); - recoveryObj.put("time", Long.toString(recovery.runtime)); - recoveryObj.put("copySort", Double.toString(recovery.progress)); + String serv = AddressUtil.parseAddress(server.name, false).getHostText(); + String log = recovery.name; + int time = recovery.runtime; + double copySort = recovery.progress; - recoveryList.add(recoveryObj); + recoveryList.addRecovery(new TabletServerRecoveryInformation(serv, log, time, copySort)); } } } - jsonObj.put("recoveryList", recoveryList); - - return jsonObj; + return recoveryList; } /** http://git-wip-us.apache.org/repos/asf/accumulo/blob/680b3a21/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServerWithTableInformation.java ---------------------------------------------------------------------- diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServerWithTableInformation.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServerWithTableInformation.java index 001f674..88804dc 100644 --- a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServerWithTableInformation.java +++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServerWithTableInformation.java @@ -31,6 +31,8 @@ public class TabletServerWithTableInformation { public TabletServerInformation tserver; public TableInformation table; + public TabletServerWithTableInformation() {} + /** * Stores a new tserver * http://git-wip-us.apache.org/repos/asf/accumulo/blob/680b3a21/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServers.java ---------------------------------------------------------------------- diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServers.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServers.java index bb690a6..6783e29 100644 --- a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServers.java +++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServers.java @@ -31,13 +31,11 @@ import org.apache.accumulo.monitor.rest.master.MasterInformation; public class TabletServers { // Variable names become JSON keys - public List servers; - public List badServers; - public List deadServers; + public List servers = new ArrayList<>(); + public List badServers = new ArrayList<>(); + public List deadServers = new ArrayList<>(); - public TabletServers() { - servers = new ArrayList<>(); - } + public TabletServers() {} public TabletServers(int size) { servers = new ArrayList<>(size); http://git-wip-us.apache.org/repos/asf/accumulo/blob/680b3a21/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServersRecovery.java ---------------------------------------------------------------------- diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServersRecovery.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServersRecovery.java new file mode 100644 index 0000000..8ec02b6 --- /dev/null +++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServersRecovery.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.accumulo.monitor.rest.tservers; + +import java.util.ArrayList; +import java.util.List; + +/** + * + * Generates a list of tservers recoveries + * + * @since 2.0.0 + * + */ +public class TabletServersRecovery { + + // Variable names become JSON keys + public List recoveryList = new ArrayList<>(); + + /** + * Initializes tserver recovery list + */ + public TabletServersRecovery() {} + + /** + * Adds a new tserver recovery to the list + * + * @param tabletServerRecovery + * TServer recovery to add + */ + public void addRecovery(TabletServerRecoveryInformation tabletServerRecovery) { + this.recoveryList.add(tabletServerRecovery); + } + +} http://git-wip-us.apache.org/repos/asf/accumulo/blob/680b3a21/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/zk/ZKInformation.java ---------------------------------------------------------------------- diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/zk/ZKInformation.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/zk/ZKInformation.java index 9f06c59..cfaba59 100644 --- a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/zk/ZKInformation.java +++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/zk/ZKInformation.java @@ -29,14 +29,12 @@ import java.util.List; public class ZKInformation { // Variable names become JSON keys - public List zkServers; + public List zkServers = new ArrayList<>(); /** * Initializes zk servers list */ - public ZKInformation() { - zkServers = new ArrayList<>(); - } + public ZKInformation() {} /** * Adds a new zk server to the list http://git-wip-us.apache.org/repos/asf/accumulo/blob/680b3a21/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/zk/ZooKeeper.java ---------------------------------------------------------------------- diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/zk/ZooKeeper.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/zk/ZooKeeper.java index 5befcd5..c555143 100644 --- a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/zk/ZooKeeper.java +++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/zk/ZooKeeper.java @@ -26,7 +26,9 @@ package org.apache.accumulo.monitor.rest.zk; public class ZooKeeper { // Variable names become JSON keys - public String server, mode; + public String server; + public String mode; + public Integer clients; public ZooKeeper() {} http://git-wip-us.apache.org/repos/asf/accumulo/blob/680b3a21/server/monitor/src/main/java/org/apache/accumulo/monitor/view/Indexes.java ---------------------------------------------------------------------- diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/view/Indexes.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/view/Indexes.java deleted file mode 100644 index e2328a3..0000000 --- a/server/monitor/src/main/java/org/apache/accumulo/monitor/view/Indexes.java +++ /dev/null @@ -1,383 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.accumulo.monitor.view; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; - -import org.apache.accumulo.core.Constants; -import org.apache.accumulo.core.client.TableNotFoundException; -import org.apache.accumulo.core.client.impl.Tables; -import org.apache.accumulo.core.util.AddressUtil; -import org.apache.accumulo.monitor.Monitor; -import org.glassfish.jersey.server.mvc.Template; - -/** - * - * Index is responsible of specifying Monitor paths and setting the templates for the HTML code - * - * @since 2.0.0 - * - */ -@Path("/") -@Produces(MediaType.TEXT_HTML) -public class Indexes { - - private Map getModel() { - - Map model = new HashMap<>(); - model.put("version", Constants.VERSION); - model.put("instance_name", Monitor.cachedInstanceName.get()); - model.put("instance_id", Monitor.getContext().getInstance().getInstanceID()); - return model; - } - - /** - * Returns the overview template - * - * @return Overview model - */ - @GET - @Template(name = "/index.ftl") - public Map get() { - - Map model = getModel(); - model.put("title", "Accumulo Overview"); - model.put("template", "overview.ftl"); - model.put("js", "overview.js"); - - return model; - } - - /** - * Returns the master template - * - * @return Master model - */ - @GET - @Path("{parameter: master|monitor}") - @Template(name = "/index.ftl") - public Map getMaster() { - - List masters = Monitor.getContext().getInstance().getMasterLocations(); - - Map model = getModel(); - model.put("title", "Master Server" + (masters.size() == 0 ? "" : ":" + AddressUtil.parseAddress(masters.get(0), false).getHostText())); - model.put("template", "master.ftl"); - model.put("js", "master.js"); - - model.put("tablesTitle", "Table Status"); - model.put("tablesTemplate", "tables.ftl"); - model.put("tablesJs", "tables.js"); - return model; - } - - /** - * Returns the tservers templates - * - * @param server - * TServer to show details - * @return tserver model - */ - @GET - @Path("tservers") - @Template(name = "/index.ftl") - public Map getTabletServers(@QueryParam("s") String server) { - - Map model = getModel(); - model.put("title", "Tablet Server Status"); - if (server != null) { - model.put("template", "server.ftl"); - model.put("js", "server.js"); - model.put("server", server); - return model; - } - model.put("template", "tservers.ftl"); - model.put("js", "tservers.js"); - return model; - } - - /** - * Returns the scans template - * - * @return Scans model - */ - @GET - @Path("scans") - @Template(name = "/index.ftl") - public Map getScans() { - - Map model = getModel(); - model.put("title", "Scans"); - model.put("template", "scans.ftl"); - model.put("js", "scans.js"); - - return model; - } - - /** - * Returns the bulk import template - * - * @return Bulk Import model - */ - @GET - @Path("bulkImports") - @Template(name = "/index.ftl") - public Map getBulkImports() { - - Map model = getModel(); - model.put("title", "Bulk Imports"); - model.put("template", "bulkImport.ftl"); - model.put("js", "bulkImport.js"); - - return model; - } - - /** - * Returns the garbage collector template - * - * @return GC model - */ - @GET - @Path("gc") - @Template(name = "/index.ftl") - public Map getGC() { - - Map model = getModel(); - model.put("title", "Garbage Collector Status"); - model.put("template", "gc.ftl"); - model.put("js", "gc.js"); - - return model; - } - - /** - * Returns the server activity template - * - * @param shape - * Shape of visualization - * @param size - * Size of visualization - * @param motion - * Motion of visualization - * @param color - * Color of visualization - * @return Server activity model - */ - @GET - @Path("vis") - @Template(name = "/index.ftl") - public Map getServerActivity(@QueryParam("shape") @DefaultValue("circles") String shape, @QueryParam("size") @DefaultValue("40") String size, - @QueryParam("motion") @DefaultValue("") String motion, @QueryParam("color") @DefaultValue("allavg") String color) { - - Map model = getModel(); - model.put("title", "Server Activity"); - model.put("template", "vis.ftl"); - - model.put("shape", shape); - model.put("size", size); - model.put("motion", motion); - model.put("color", color); - - return model; - } - - /** - * Returns the tables template - * - * @return Tables model - */ - @GET - @Path("tables") - @Template(name = "/index.ftl") - public Map getTables() throws TableNotFoundException { - - Map model = getModel(); - model.put("title", "Table Status"); // Need this for the browser tab title - model.put("tablesTitle", "Table Status"); - model.put("template", "tables.ftl"); - model.put("js", "tables.js"); - - return model; - } - - /** - * Returns participating tservers template - * - * @param tableID - * Table ID for participating tservers - * @return Participating tservers model - */ - @GET - @Path("tables/{tableID}") - @Template(name = "/index.ftl") - public Map getTables(@PathParam("tableID") String tableID) throws TableNotFoundException { - - String table = Tables.getTableName(Monitor.getContext().getInstance(), tableID); - - Map model = getModel(); - model.put("title", "Table Status"); - - model.put("template", "table.ftl"); - model.put("js", "table.js"); - model.put("tableID", tableID); - model.put("table", table); - - return model; - } - - /** - * Returns trace summary template - * - * @param minutes - * Range of minutes - * @return Trace summary model - */ - @GET - @Path("trace/summary") - @Template(name = "/index.ftl") - public Map getTracesSummary(@QueryParam("minutes") @DefaultValue("10") String minutes) { - - Map model = getModel(); - model.put("title", "Traces for the last " + minutes + " minute(s)"); - - model.put("template", "summary.ftl"); - model.put("js", "summary.js"); - model.put("minutes", minutes); - - return model; - } - - /** - * Returns traces by type template - * - * @param type - * Type of trace - * @param minutes - * Range of minutes - * @return Traces by type model - */ - @GET - @Path("trace/listType") - @Template(name = "/index.ftl") - public Map getTracesForType(@QueryParam("type") String type, @QueryParam("minutes") @DefaultValue("10") String minutes) { - - Map model = getModel(); - model.put("title", "Traces for " + type + " for the last " + minutes + " minute(s)"); - - model.put("template", "listType.ftl"); - model.put("js", "listType.js"); - model.put("type", type); - model.put("minutes", minutes); - - return model; - } - - /** - * Returns traces by ID template - * - * @param id - * ID of the traces - * @return Traces by ID model - */ - @GET - @Path("trace/show") - @Template(name = "/index.ftl") - public Map getTraceShow(@QueryParam("id") String id) { - - Map model = getModel(); - model.put("title", "Trace ID " + id); - - model.put("template", "show.ftl"); - model.put("js", "show.js"); - model.put("id", id); - - return model; - } - - /** - * Returns log report template - * - * @return Log report model - */ - @GET - @Path("log") - @Template(name = "/index.ftl") - public Map getLogs() { - - Map model = getModel(); - model.put("title", "Recent Logs"); - - model.put("template", "log.ftl"); - model.put("js", "log.js"); - - return model; - } - - /** - * Returns problem report template - * - * @param table - * Table ID to display problem details - * @return Problem report model - */ - @GET - @Path("problems") - @Template(name = "/index.ftl") - public Map getProblems(@QueryParam("table") String table) { - - Map model = getModel(); - model.put("title", "Per-Table Problem Report"); - - model.put("template", "problems.ftl"); - model.put("js", "problems.js"); - - if (table != null) { - model.put("table", table); - } - - return model; - } - - /** - * Returns replication table template - * - * @return Replication model - */ - @GET - @Path("replication") - @Template(name = "/index.ftl") - public Map getReplication() { - - Map model = getModel(); - model.put("title", "Replication Overview"); - - model.put("template", "replication.ftl"); - model.put("js", "replication.js"); - - return model; - } -} http://git-wip-us.apache.org/repos/asf/accumulo/blob/680b3a21/server/monitor/src/main/java/org/apache/accumulo/monitor/view/WebViews.java ---------------------------------------------------------------------- diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/view/WebViews.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/view/WebViews.java new file mode 100644 index 0000000..ea337a3 --- /dev/null +++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/view/WebViews.java @@ -0,0 +1,383 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.accumulo.monitor.view; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.ws.rs.DefaultValue; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +import org.apache.accumulo.core.Constants; +import org.apache.accumulo.core.client.TableNotFoundException; +import org.apache.accumulo.core.client.impl.Tables; +import org.apache.accumulo.core.util.AddressUtil; +import org.apache.accumulo.monitor.Monitor; +import org.glassfish.jersey.server.mvc.Template; + +/** + * + * Index is responsible of specifying Monitor paths and setting the templates for the HTML code + * + * @since 2.0.0 + * + */ +@Path("/") +@Produces(MediaType.TEXT_HTML) +public class WebViews { + + private Map getModel() { + + Map model = new HashMap<>(); + model.put("version", Constants.VERSION); + model.put("instance_name", Monitor.cachedInstanceName.get()); + model.put("instance_id", Monitor.getContext().getInstance().getInstanceID()); + return model; + } + + /** + * Returns the overview template + * + * @return Overview model + */ + @GET + @Template(name = "/default.ftl") + public Map get() { + + Map model = getModel(); + model.put("title", "Accumulo Overview"); + model.put("template", "overview.ftl"); + model.put("js", "overview.js"); + + return model; + } + + /** + * Returns the master template + * + * @return Master model + */ + @GET + @Path("{parameter: master|monitor}") + @Template(name = "/default.ftl") + public Map getMaster() { + + List masters = Monitor.getContext().getInstance().getMasterLocations(); + + Map model = getModel(); + model.put("title", "Master Server" + (masters.size() == 0 ? "" : ":" + AddressUtil.parseAddress(masters.get(0), false).getHostText())); + model.put("template", "master.ftl"); + model.put("js", "master.js"); + + model.put("tablesTitle", "Table Status"); + model.put("tablesTemplate", "tables.ftl"); + model.put("tablesJs", "tables.js"); + return model; + } + + /** + * Returns the tservers templates + * + * @param server + * TServer to show details + * @return tserver model + */ + @GET + @Path("tservers") + @Template(name = "/default.ftl") + public Map getTabletServers(@QueryParam("s") String server) { + + Map model = getModel(); + model.put("title", "Tablet Server Status"); + if (server != null) { + model.put("template", "server.ftl"); + model.put("js", "server.js"); + model.put("server", server); + return model; + } + model.put("template", "tservers.ftl"); + model.put("js", "tservers.js"); + return model; + } + + /** + * Returns the scans template + * + * @return Scans model + */ + @GET + @Path("scans") + @Template(name = "/default.ftl") + public Map getScans() { + + Map model = getModel(); + model.put("title", "Scans"); + model.put("template", "scans.ftl"); + model.put("js", "scans.js"); + + return model; + } + + /** + * Returns the bulk import template + * + * @return Bulk Import model + */ + @GET + @Path("bulkImports") + @Template(name = "/default.ftl") + public Map getBulkImports() { + + Map model = getModel(); + model.put("title", "Bulk Imports"); + model.put("template", "bulkImport.ftl"); + model.put("js", "bulkImport.js"); + + return model; + } + + /** + * Returns the garbage collector template + * + * @return GC model + */ + @GET + @Path("gc") + @Template(name = "/default.ftl") + public Map getGC() { + + Map model = getModel(); + model.put("title", "Garbage Collector Status"); + model.put("template", "gc.ftl"); + model.put("js", "gc.js"); + + return model; + } + + /** + * Returns the server activity template + * + * @param shape + * Shape of visualization + * @param size + * Size of visualization + * @param motion + * Motion of visualization + * @param color + * Color of visualization + * @return Server activity model + */ + @GET + @Path("vis") + @Template(name = "/default.ftl") + public Map getServerActivity(@QueryParam("shape") @DefaultValue("circles") String shape, @QueryParam("size") @DefaultValue("40") String size, + @QueryParam("motion") @DefaultValue("") String motion, @QueryParam("color") @DefaultValue("allavg") String color) { + + Map model = getModel(); + model.put("title", "Server Activity"); + model.put("template", "vis.ftl"); + + model.put("shape", shape); + model.put("size", size); + model.put("motion", motion); + model.put("color", color); + + return model; + } + + /** + * Returns the tables template + * + * @return Tables model + */ + @GET + @Path("tables") + @Template(name = "/default.ftl") + public Map getTables() throws TableNotFoundException { + + Map model = getModel(); + model.put("title", "Table Status"); // Need this for the browser tab title + model.put("tablesTitle", "Table Status"); + model.put("template", "tables.ftl"); + model.put("js", "tables.js"); + + return model; + } + + /** + * Returns participating tservers template + * + * @param tableID + * Table ID for participating tservers + * @return Participating tservers model + */ + @GET + @Path("tables/{tableID}") + @Template(name = "/default.ftl") + public Map getTables(@PathParam("tableID") String tableID) throws TableNotFoundException { + + String table = Tables.getTableName(Monitor.getContext().getInstance(), tableID); + + Map model = getModel(); + model.put("title", "Table Status"); + + model.put("template", "table.ftl"); + model.put("js", "table.js"); + model.put("tableID", tableID); + model.put("table", table); + + return model; + } + + /** + * Returns trace summary template + * + * @param minutes + * Range of minutes + * @return Trace summary model + */ + @GET + @Path("trace/summary") + @Template(name = "/default.ftl") + public Map getTracesSummary(@QueryParam("minutes") @DefaultValue("10") String minutes) { + + Map model = getModel(); + model.put("title", "Traces for the last " + minutes + " minute(s)"); + + model.put("template", "summary.ftl"); + model.put("js", "summary.js"); + model.put("minutes", minutes); + + return model; + } + + /** + * Returns traces by type template + * + * @param type + * Type of trace + * @param minutes + * Range of minutes + * @return Traces by type model + */ + @GET + @Path("trace/listType") + @Template(name = "/default.ftl") + public Map getTracesForType(@QueryParam("type") String type, @QueryParam("minutes") @DefaultValue("10") String minutes) { + + Map model = getModel(); + model.put("title", "Traces for " + type + " for the last " + minutes + " minute(s)"); + + model.put("template", "listType.ftl"); + model.put("js", "listType.js"); + model.put("type", type); + model.put("minutes", minutes); + + return model; + } + + /** + * Returns traces by ID template + * + * @param id + * ID of the traces + * @return Traces by ID model + */ + @GET + @Path("trace/show") + @Template(name = "/default.ftl") + public Map getTraceShow(@QueryParam("id") String id) { + + Map model = getModel(); + model.put("title", "Trace ID " + id); + + model.put("template", "show.ftl"); + model.put("js", "show.js"); + model.put("id", id); + + return model; + } + + /** + * Returns log report template + * + * @return Log report model + */ + @GET + @Path("log") + @Template(name = "/default.ftl") + public Map getLogs() { + + Map model = getModel(); + model.put("title", "Recent Logs"); + + model.put("template", "log.ftl"); + model.put("js", "log.js"); + + return model; + } + + /** + * Returns problem report template + * + * @param table + * Table ID to display problem details + * @return Problem report model + */ + @GET + @Path("problems") + @Template(name = "/default.ftl") + public Map getProblems(@QueryParam("table") String table) { + + Map model = getModel(); + model.put("title", "Per-Table Problem Report"); + + model.put("template", "problems.ftl"); + model.put("js", "problems.js"); + + if (table != null) { + model.put("table", table); + } + + return model; + } + + /** + * Returns replication table template + * + * @return Replication model + */ + @GET + @Path("replication") + @Template(name = "/default.ftl") + public Map getReplication() { + + Map model = getModel(); + model.put("title", "Replication Overview"); + + model.put("template", "replication.ftl"); + model.put("js", "replication.js"); + + return model; + } +} http://git-wip-us.apache.org/repos/asf/accumulo/blob/680b3a21/server/monitor/src/main/resources/resources/bulkImport.js ---------------------------------------------------------------------- diff --git a/server/monitor/src/main/resources/resources/bulkImport.js b/server/monitor/src/main/resources/resources/bulkImport.js deleted file mode 100644 index 15cce25..0000000 --- a/server/monitor/src/main/resources/resources/bulkImport.js +++ /dev/null @@ -1,213 +0,0 @@ -/* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/** - * Creates bulk import initial table - */ -$(document).ready(function() { - createBulkImportHeader(); - createServerBulkHeader(); - refreshBulkImport(); -}); - -/** - * Makes the REST calls, generates the tables with the new information - */ -function refreshBulkImport() { - $.ajaxSetup({ - async: false - }); - getBulkImports(); - $.ajaxSetup({ - async: true - }); - refreshBulkImportTable(); - refreshServerBulkTable(); -} - -/** - * Used to redraw the page - */ -function refresh() { - refreshBulkImport(); -} - -/** - * Generates the master bulk import status table - */ -function refreshBulkImportTable() { - - clearTable('masterBulkImportStatus'); - - /* - * Get the bulk import value obtained earlier, if it doesn't exists, - * create an empty array - */ - var data = sessionStorage.bulkImports === undefined ? - [] : JSON.parse(sessionStorage.bulkImports); - var items = []; - - /* If the data is empty, create an empty row, otherwise, - * create the rows for the table - */ - if (data.length === 0 || data.bulkImport.length === 0) { - items.push('Empty'); - } else { - $.each(data.bulkImport, function(key, val) { - items.push('' + val.filename + ''); - - items.push('' + val.age + - ''); - - items.push('' + - val.state + ''); - }); - } - - $('', { - html: items.join('') - }).appendTo('#masterBulkImportStatus'); -} - -/** - * Generates the bulk import status table - */ -function refreshServerBulkTable() { - - clearTable('bulkImportStatus'); - - /* Get the bulk import value obtained earlier, if it doesn't exists, - * create an empty array - */ - var data = sessionStorage.bulkImports === undefined ? - [] : JSON.parse(sessionStorage.bulkImports); - var items = []; - - /* If the data is empty, create an empty row, otherwise - * create the rows for the table - */ - if (data.length === 0 || data.tabletServerBulkImport.length === 0) { - items.push('Empty'); - } else { - $.each(data.tabletServerBulkImport, function(key, val) { - items.push('' + val.server + - ''); - - items.push('' + - val.importSize + ''); - - items.push('' + - (val.oldestAge > 0 ? val.oldestAge : '—') + ''); - }); - } - - $('', { - html: items.join('') - }).appendTo('#bulkImportStatus'); -} - -/** - * Sorts the bulkImportStatus table on the selected column - * - * @param {string} table Table ID to sort - * @param {number} n Column number to sort by - */ -function sortTable(table, n) { - var tableIDs = ['bulkImportStatus', 'masterBulkImportStatus']; - - if (sessionStorage.tableColumnSort !== undefined && - sessionStorage.tableColumnSort == n && - sessionStorage.direction !== undefined) { - direction = sessionStorage.direction === 'asc' ? 'desc' : 'asc'; - } else { - direction = sessionStorage.direction === undefined ? - 'asc' : sessionStorage.direction; - } - sessionStorage.tableColumn = tableIDs[table]; - sessionStorage.tableColumnSort = n; - sortTables(tableIDs[table], direction, n); -} - -/** - * Create tooltip for table column information - */ -$(function() { - $(document).tooltip(); -}); - -/** - * Creates the bulk import header - */ -function createBulkImportHeader() { - var caption = 'Bulk Import' + - ' Status
'; - - $('', { - html: caption - }).appendTo('#masterBulkImportStatus'); - - var items = []; - - /* - * Adds the columns, add sortTable function on click, - * if the column has a description, add title taken from the global.js - */ - items.push('Directory ' + - ''); - - items.push('Age '); - - items.push('State '); - - $('', { - html: items.join('') - }).appendTo('#masterBulkImportStatus'); -} - -/** - * Creates the bulk import header - */ -function createServerBulkHeader() { - var caption = []; - - caption.push('TabletServer Bulk ' + - 'Import Status
'); - - $('', { - html: caption.join('') - }).appendTo('#bulkImportStatus'); - - var items = []; - - /* - * Adds the columns, add sortTable function on click, - * if the column has a description, add title taken from the global.js - */ - items.push('Server '); - items.push('# '); - items.push('Oldest Age '); - - $('', { - html: items.join('') - }).appendTo('#bulkImportStatus'); -} http://git-wip-us.apache.org/repos/asf/accumulo/blob/680b3a21/server/monitor/src/main/resources/resources/css/screen.css ---------------------------------------------------------------------- diff --git a/server/monitor/src/main/resources/resources/css/screen.css b/server/monitor/src/main/resources/resources/css/screen.css new file mode 100644 index 0000000..2a9d844 --- /dev/null +++ b/server/monitor/src/main/resources/resources/css/screen.css @@ -0,0 +1,468 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/* basic screen style for all pages */ +html,body { + height: 100%; + margin: 0; + padding: 0; + color: #333333; + font-size: 10pt; + font-family: verdana, arial, sans-serif; + text-align: center; +} + +#banner { + height: 1.5em; + font-size: 1.0em; +} + +#content-wrapper { + position: relative; + min-height: 95%; +} + +* #content-wrapper { + height: 95%; +} + +#content { + position: absolute; + left: 0; + right: 0; + top: 0; + bottom: 1.5em; + padding-bottom: 0; +} + +#header { + position: absolute; + padding-top: 0; + top: 0; + left: 0; + right: 0; + height: 5em; + color: #c4c4c4; + background-color: #304065; + text-align: center; +} + +#headertitle { + /*position: absolute; + top: -1.0em; + left: 0.5em; + right: 1.0em;*/ + font-size: 20pt; +} + +#sidebar { + text-align: left; +} + +#subheader { + position: absolute; + bottom: 0; + left: 0; + right: 0; + font-size: .92em; +} + +#footer { + position: absolute; + bottom: 0; + left: 0; + right: 0; + padding: 0; + /*height: 1.5em;*/ + font-size: 1.0em; +} + +#main { + position: absolute; + top: 5.0em; + /*left: 11em;*/ + left: 0; + right: 0; + bottom: 0; + padding: 0.6em; + /*overflow: scroll;*/ + margin-left: auto; + margin-right: auto; + width: 90%; +} + +#nav { + position: absolute; + top: 0.5em; + /*left: 0;*/ + right: 0; + /*bottom: 0;*/ + padding: 0.5em; + /*width: 10em;*/ + /*color: #304065;*/ + /*background-color: #c4c4c4;*/ + /*text-align: left;*/ + /*height: 3.0em;*/ +} + +#nav-title { + margin-left: auto; + margin-right: auto; + text-align: center; + font-size: 1.1em; +} + +h1 { + font-size: 2.2em; + font-variant: small-caps; + text-align: center; +} + +h2 { + width: 100%; + font-size: 1.3em; + text-align: center; +} + +h2.error { + width: 100%; + color: #ff0000; + background-color: #000000; +} + +h2.error a { + color: #ff0000; + background-color: #000000; +} + +caption { + margin-left: auto; + margin-right: auto; +} + +caption.error { + color: #ff0000; + background-color: #000000; +} + +hr { + border: 0; + height: 1px; + background-color: #304065; + color: #304065; +} + +table { + font-size: 9pt; +} + +/* +The following is to avoid a problem with the flot +javascript library. This file sets min-width to 60% +for all tables. This make the html generated by +flot.js not work. Flot creates a class called legend +used in a div that has a child table. This sets +min-width to 0 for that child table enabling it +to render correctly. +*/ +div.legend > table { + min-width: 0%; +} + +table.sortable { + border-left: 0; + border-right: 0; + border-top: 1px #333333 dotted; + border-bottom: 1px #333333 dotted; +} + +td { + border-top: 0; + border-bottom: 0; + border-left: 0; + border-right: 0; + border-spacing-top: 0; + border-spacing-bottom: 0; + padding-left: 0.5em; + padding-right: 0.5em; + padding-top: 0.15em; + padding-bottom: 0.15em; + color: #333333; +} + +th { + border-top: 0; + border-bottom: 3px #333333 solid; + border-left: 1px #333333 dotted; + border-right: 0; + border-spacing-top: 0; + border-spacing-bottom: 0; + text-align: center; + font-variant: small-caps; + padding-left: 0.5em; + padding-right: 0.5em; + padding-top: 0.2em; + padding-bottom: 0.2em; + color: #333333; + font-size: 10pt; + vertical-align: bottom; +} + +td.firstcell { + border-left: 0; +} + +th.sortable { + color: blue; +} + +a { + text-decoration: none; + color: #0000ff; + line-height: 1.5em; +} + +a:hover { + color: #004400; + text-decoration: underline; +} + +a img { + border: 0px; +} + +div.show { + display: block; +} + +div.hide { + display: none; +} + +div.progress-chart { + border: 1px solid #333333; + border-spacing: 0; + width: 150px; + float: left; +} + +div.progress-chart>div { + height: 20px; + background-color: #0000ff; +} + +pre.logevent { + margin: 0; +} + +.noborder { + border: 0; + border-spacing: 0; + border-bottom: 0; + border-right: 0; +} + +.table-caption { + font-size: 2em; + font-variant: small-caps; + text-align: center; +} + +.table-subcaption { + font-size: 0.9em; +} + +.left { + text-align: left; +} + +.right { + text-align: right; + margin-right: 0; +} + +.error, .error a { + color: #ffffff; + background-color: #d9534f; +} + +.error-inv, .error-inv a { + color: #d9534f; +} + +.warning, .warning a { + background-color: #f0ad4e; +} + +.warning-inv, .warning-inv a { + color: #f0ad4e; +} + +.normal, .normal a { + background-color: #5cb85c; +} + +.normal-inv, .normal-inv a { + color: #5cb85c; +} + +.highlight { + background-color: #cef4b5; +} + +.icon-dot { + display: inline-block; + min-width: 1em; + height: 1em; + padding: 3px 7px; + font-size: @font-size-small; + font-weight: @badge-font-weight; + color: @badge-color; + line-height: @badge-line-height; + vertical-align: middle; + white-space: nowrap; + text-align: center; + background-color: @badge-bg; + border-radius: 1em; +} + +.smalltext { + font-size: 0.8em; +} + +.center { + text-align: center; + padding: 0.5em; +} + +.plotHeading { + text-align: center; + font-size: 1.5em; +} +.nowrap { + white-space:nowrap; +} + +.viscontrol { + border: 1px solid #c4c4c4; + padding: 5px; +} + +#vishoverinfo { + visibility: hidden; + position: absolute; + border: 1px solid #c4c4c4; + background-color: #ffffff; +} + +#shell { + text-align: left; + color: #55d839; + border: 1px; + padding-left: 5px; + background-color: #000000; + height: 40em; + overflow: auto; + font-family: Monaco, monospace; + font-size: 100%; +} + +#shell span { + display: inline; +} + +#shell input { + display: inline; + border: none; + width: 60%; + color: #55d839; + background-color: #000000; + font-family: Monaco, monospace; + font-size: 100%; +} + +#shell pre { + font-family: Monaco, monospace; + font-size: 100%; +} + +#login { + text-align: left; +} + +#login table { + margin-left: 0; + min-width: 0%; +} + +#loginError { + text-align: left; + color: red; +} + +#filters, #tables { + /*overflow-y: scroll;*/ + /*height: 100%;*/ + width: 80%; + margin-left: 15%; + /*float: left;*/ +} + +.center-block { + width: 100%; +} + +.nav-pills > li > a { + color: #c4c4c4; +} + +.nav-pills > li > a:hover, .dropdown.open > a:hover, .dropdown.open > a, .dropdown.open > a:focus { + background-color: #101010; +} + +.dropdown-menu { + right: 0; + left: unset; +} + +.axis path, .axis line +{ + fill: none; + stroke: #777; + shape-rendering: crispEdges; +} + +.axis text +{ + font-family: 'Arial'; + font-size: 13px; +} +.tick +{ + stroke-dasharray: 1, 2; +} +.bar +{ + fill: FireBrick; +} + +.legend +{ + /*padding: 5px;*/ + font: 10px sans-serif; + /*background: yellow; + box-shadow: 2px 2px 1px #888;*/ +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/accumulo/blob/680b3a21/server/monitor/src/main/resources/resources/down.gif ---------------------------------------------------------------------- diff --git a/server/monitor/src/main/resources/resources/down.gif b/server/monitor/src/main/resources/resources/down.gif deleted file mode 100644 index 087da1d..0000000 Binary files a/server/monitor/src/main/resources/resources/down.gif and /dev/null differ http://git-wip-us.apache.org/repos/asf/accumulo/blob/680b3a21/server/monitor/src/main/resources/resources/favicon.png ---------------------------------------------------------------------- diff --git a/server/monitor/src/main/resources/resources/favicon.png b/server/monitor/src/main/resources/resources/favicon.png deleted file mode 100644 index a632dab..0000000 Binary files a/server/monitor/src/main/resources/resources/favicon.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/accumulo/blob/680b3a21/server/monitor/src/main/resources/resources/flot/LICENSE.txt ---------------------------------------------------------------------- diff --git a/server/monitor/src/main/resources/resources/flot/LICENSE.txt b/server/monitor/src/main/resources/resources/flot/LICENSE.txt deleted file mode 100644 index 719da06..0000000 --- a/server/monitor/src/main/resources/resources/flot/LICENSE.txt +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2007-2014 IOLA and Ole Laursen - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE.