good metrics page working, condenced gui down to single webapp
Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/ed754628 Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/ed754628 Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/ed754628 Branch: refs/heads/master Commit: ed754628d3bdebeb5e134340e9da7408b151fc2a Parents: ab40a9a Author: gbarton <[email protected]> Authored: Fri Aug 17 00:17:48 2012 -0400 Committer: gbarton <[email protected]> Committed: Fri Aug 17 00:17:48 2012 -0400 ---------------------------------------------------------------------- .../blur/thrift/ThriftBlurControllerServer.java | 6 +- .../blur/thrift/ThriftBlurShardServer.java | 6 +- .../com/nearinfinity/blur/gui/HttpJettyServer.java | 4 +- .../src/main/webapps/controller/controller.jsp | 117 -------------- .../src/main/webapps/controller/footer.jsp | 2 + src/blur-gui/src/main/webapps/controller/home.jsp | 119 +++++++++++++++ .../src/main/webapps/controller/index.html | 4 +- .../src/main/webapps/controller/metrics.jsp | 65 ++++++++ .../src/main/webapps/controller/shardList.jsp | 9 +- src/blur-gui/src/main/webapps/controller/table.jsp | 2 +- src/blur-gui/src/main/webapps/controller/test.html | 32 ++++ .../src/main/webapps/shard/WEB-INF/web.xml | 10 -- src/blur-gui/src/main/webapps/shard/functions.jsp | 25 --- src/blur-gui/src/main/webapps/shard/index.html | 13 -- src/blur-gui/src/main/webapps/shard/shard.jsp | 117 -------------- src/blur-gui/src/main/webapps/shard/style.css | 53 ------- 16 files changed, 235 insertions(+), 349 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ed754628/src/blur-core/src/main/java/com/nearinfinity/blur/thrift/ThriftBlurControllerServer.java ---------------------------------------------------------------------- diff --git a/src/blur-core/src/main/java/com/nearinfinity/blur/thrift/ThriftBlurControllerServer.java b/src/blur-core/src/main/java/com/nearinfinity/blur/thrift/ThriftBlurControllerServer.java index 4009c43..618d8dc 100644 --- a/src/blur-core/src/main/java/com/nearinfinity/blur/thrift/ThriftBlurControllerServer.java +++ b/src/blur-core/src/main/java/com/nearinfinity/blur/thrift/ThriftBlurControllerServer.java @@ -133,11 +133,13 @@ public class ThriftBlurControllerServer extends ThriftServer { int webServerPort = Integer.parseInt(configuration.get(BLUR_GUI_CONTROLLER_PORT)) + serverIndex; + //TODO: this got ugly, there has to be a better way to handle all these params + //without reversing the mvn dependancy and making blur-gui on top. final HttpJettyServer httpServer = new HttpJettyServer(bindPort, webServerPort, configuration.getInt(BLUR_CONTROLLER_BIND_PORT, -1), configuration.getInt(BLUR_SHARD_BIND_PORT, -1), - Integer.parseInt(configuration.get(BLUR_GUI_CONTROLLER_PORT)), - Integer.parseInt(configuration.get(BLUR_GUI_SHARD_PORT)), + configuration.getInt(BLUR_GUI_CONTROLLER_PORT,-1), + configuration.getInt(BLUR_GUI_SHARD_PORT,-1), "controller", blurMetrics); // This will shutdown the server when the correct path is set in zk http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ed754628/src/blur-core/src/main/java/com/nearinfinity/blur/thrift/ThriftBlurShardServer.java ---------------------------------------------------------------------- diff --git a/src/blur-core/src/main/java/com/nearinfinity/blur/thrift/ThriftBlurShardServer.java b/src/blur-core/src/main/java/com/nearinfinity/blur/thrift/ThriftBlurShardServer.java index 08b542f..79b8dd5 100644 --- a/src/blur-core/src/main/java/com/nearinfinity/blur/thrift/ThriftBlurShardServer.java +++ b/src/blur-core/src/main/java/com/nearinfinity/blur/thrift/ThriftBlurShardServer.java @@ -199,11 +199,13 @@ public class ThriftBlurShardServer extends ThriftServer { int webServerPort = Integer.parseInt(configuration.get(BLUR_GUI_SHARD_PORT)) + serverIndex; + //TODO: this got ugly, there has to be a better way to handle all these params + //without reversing the mvn dependancy and making blur-gui on top. final HttpJettyServer httpServer = new HttpJettyServer(bindPort, webServerPort, - Integer.parseInt(configuration.get(BLUR_GUI_CONTROLLER_PORT)), - Integer.parseInt(configuration.get(BLUR_GUI_SHARD_PORT)), configuration.getInt(BLUR_CONTROLLER_BIND_PORT, -1), configuration.getInt(BLUR_SHARD_BIND_PORT, -1), + configuration.getInt(BLUR_GUI_CONTROLLER_PORT,-1), + configuration.getInt(BLUR_GUI_SHARD_PORT,-1), "shard", blurMetrics); // This will shutdown the server when the correct path is set in zk http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ed754628/src/blur-gui/src/main/java/com/nearinfinity/blur/gui/HttpJettyServer.java ---------------------------------------------------------------------- diff --git a/src/blur-gui/src/main/java/com/nearinfinity/blur/gui/HttpJettyServer.java b/src/blur-gui/src/main/java/com/nearinfinity/blur/gui/HttpJettyServer.java index f2fd971..74c57b2 100644 --- a/src/blur-gui/src/main/java/com/nearinfinity/blur/gui/HttpJettyServer.java +++ b/src/blur-gui/src/main/java/com/nearinfinity/blur/gui/HttpJettyServer.java @@ -7,7 +7,6 @@ import org.mortbay.jetty.Server; import org.mortbay.jetty.servlet.ServletHolder; import org.mortbay.jetty.webapp.WebAppContext; -import com.nearinfinity.blur.BlurConfiguration; import com.nearinfinity.blur.log.Log; import com.nearinfinity.blur.log.LogFactory; import com.nearinfinity.blur.metrics.BlurMetrics; @@ -46,10 +45,11 @@ public class HttpJettyServer { System.setProperty("blur.base.controller.port",baseControllerPort+""); System.setProperty("baseGuiShardPort",baseGuiShardPort+""); System.setProperty("baseGuiControllerPort",baseGuiControllerPort+""); + System.setProperty("blur.gui.mode", base); LOG.info("System props:" + System.getProperties().toString()); WebAppContext context = new WebAppContext(); - context.setWar(getJarFolder() + "../src/blur-gui/src/main/webapps/" + base); + context.setWar(getJarFolder() + "../src/blur-gui/src/main/webapps/controller");// + base); context.setContextPath("/"); context.setParentLoaderPriority(true); //servlets http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ed754628/src/blur-gui/src/main/webapps/controller/controller.jsp ---------------------------------------------------------------------- diff --git a/src/blur-gui/src/main/webapps/controller/controller.jsp b/src/blur-gui/src/main/webapps/controller/controller.jsp deleted file mode 100644 index 3800429..0000000 --- a/src/blur-gui/src/main/webapps/controller/controller.jsp +++ /dev/null @@ -1,117 +0,0 @@ -<%@ page contentType="text/html; charset=UTF-8" isThreadSafe="false" - import="javax.servlet.*" import="javax.servlet.http.*" - import="java.io.*" import="java.util.*" import="java.text.DateFormat" - import="java.lang.Math" import="java.net.URLEncoder" - import="com.nearinfinity.blur.thrift.*" - import="com.nearinfinity.blur.thrift.generated.*" - import="com.nearinfinity.blur.thrift.generated.Blur.*"%> -<%@ include file="functions.jsp" %> -<%! - - public String tableLink(String tableName, String clusterName) { - return "<a href='table.jsp?tableName="+tableName+"&clusterName="+clusterName+"' title='view details for " + tableName + "'>" + tableName + "</a>"; - } - - public String getTables(Iface client) throws Exception { - String ret = ""; - List<String> clusters = client.shardClusterList(); - for (String cluster : clusters) { - //tables: _ tableName : enabled - List<String> tables = client.tableListByCluster(cluster); - for (String table : tables) { - try { - ret += row(cluster, tableLink(table,cluster), client.describe(table).isEnabled?"yes":"no"); - } catch (BlurException e) { - ret += row(3, "<font color=FF0000>Error describing table: " - + table + "</font>"); - } - } - } - return ret; - } - - public String getClusters(Iface client) throws Exception { - String ret = ""; - List<String> clusters = client.shardClusterList(); - for (String cluster : clusters) { - ret += row(cluster, shardListLink(cluster,client.shardServerList(cluster).size()+""), getClusterEnabled(client, cluster)); - } - return ret; - } - - - public String getConf(Iface client) throws Exception { - return row(2,"disabled as its broken"); -/* try { - Map<String, String> config = client.configuration(); - String ret = ""; - for (String key : config.keySet()) { - ret += row(key, config.get(key)); - } - return ret; - } catch (Exception e) { - return row(2, "Cannot retrieve anything from client.configuration."); - }*/ - } - - public String getClusterEnabled(Iface client, String cluster) - throws Exception { - return client.isInSafeMode(cluster) ? "Safe Mode On" - : "Yes"; - } - - public String getControllers(Iface client) throws Exception { - String ret = ""; - List<String> con = client.controllerServerList(); - - for (String c : con) { - ret += row(c, "Yes"); - } - - return ret; - }%> -<% - //TODO: prop file the port - String hostName = request.getServerName() + ":" + System.getProperty("blur.gui.servicing.port"); - - Iface client = BlurClient.getClient(hostName); -%> - - -<html> -<head> -<title>Blur Controller '<%=hostName%>' -</title> -<link href="style.css" rel="stylesheet" type="text/css" /> -</head> -<body> - <h1> - Blur Controller '<%=hostName%>' - </h1> - <br /> - <h2>Controllers</h2> - <%=table(getControllers(client),"Name","Online") %> - <hr /> - <br /> - <h2>Clusters</h2> - <%=table(getClusters(client),"Cluster Name","Shard Servers","Enabled") %> - <hr /> - <br /> - <h2>Tables</h2> - <%=table(getTables(client),"Cluster Name","Table Name","Enabled")%> - <hr /> - <br /> - <h2>Configs</h2> - <table class="statTable" class="statTableTitle"> - <tr> - <td class="statTableTitle">Param</td> - <td class="statTableTitle">Value</td> - </tr> - <%=getConf(client)%> - </table> - <hr /> - <br /> - <a href="logs">logs</a> -</body> - -</html> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ed754628/src/blur-gui/src/main/webapps/controller/footer.jsp ---------------------------------------------------------------------- diff --git a/src/blur-gui/src/main/webapps/controller/footer.jsp b/src/blur-gui/src/main/webapps/controller/footer.jsp new file mode 100644 index 0000000..b4c3f8a --- /dev/null +++ b/src/blur-gui/src/main/webapps/controller/footer.jsp @@ -0,0 +1,2 @@ + <br/> + <a href="index.html">home</a> | <a href="logs">logs</a> | <a href="metrics.jsp">metrics</a> <a href="metrics" title="Great with plugins like jsonView">(raw)</a> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ed754628/src/blur-gui/src/main/webapps/controller/home.jsp ---------------------------------------------------------------------- diff --git a/src/blur-gui/src/main/webapps/controller/home.jsp b/src/blur-gui/src/main/webapps/controller/home.jsp new file mode 100644 index 0000000..e9b5583 --- /dev/null +++ b/src/blur-gui/src/main/webapps/controller/home.jsp @@ -0,0 +1,119 @@ +<%@ page contentType="text/html; charset=UTF-8" isThreadSafe="false" + import="javax.servlet.*" import="javax.servlet.http.*" + import="java.io.*" import="java.util.*" import="java.text.DateFormat" + import="java.lang.Math" import="java.net.URLEncoder" + import="com.nearinfinity.blur.thrift.*" + import="com.nearinfinity.blur.thrift.generated.*" + import="com.nearinfinity.blur.thrift.generated.Blur.*"%> +<%@ include file="functions.jsp" %> +<%! + + public String tableLink(String tableName, String clusterName) { + return "<a href='table.jsp?tableName="+tableName+"&clusterName="+clusterName+"' title='view details for " + tableName + "'>" + tableName + "</a>"; + } + + public String getTables(Iface client) throws Exception { + String ret = ""; + List<String> clusters = client.shardClusterList(); + for (String cluster : clusters) { + //tables: _ tableName : enabled + List<String> tables = client.tableListByCluster(cluster); + for (String table : tables) { + try { + ret += row(cluster, tableLink(table,cluster), client.describe(table).isEnabled?"yes":"no"); + } catch (BlurException e) { + ret += row(3, "<font color=FF0000>Error describing table: " + + table + "</font>"); + } + } + } + return ret; + } + + public String getClusters(Iface client) throws Exception { + String ret = ""; + List<String> clusters = client.shardClusterList(); + for (String cluster : clusters) { + ret += row(cluster, shardListLink(cluster,client.shardServerList(cluster).size()+""), getClusterEnabled(client, cluster)); + } + return ret; + } + + + public String getConf(Iface client) throws Exception { + return row(2,"disabled as its broken"); +/* try { + Map<String, String> config = client.configuration(); + String ret = ""; + for (String key : config.keySet()) { + ret += row(key, config.get(key)); + } + return ret; + } catch (Exception e) { + return row(2, "Cannot retrieve anything from client.configuration."); + }*/ + } + + public String getClusterEnabled(Iface client, String cluster) + throws Exception { + return client.isInSafeMode(cluster) ? "Safe Mode On" + : "Yes"; + } + + public String getControllers(Iface client) throws Exception { + String ret = ""; + List<String> con = client.controllerServerList(); + + for (String c : con) { + String[] split = c.split(":"); + int base = Integer.parseInt(System.getProperty("blur.base.controller.port")); + int offset = Integer.parseInt(split[1])-base; + int baseShardPort = Integer.parseInt(System.getProperty("baseGuiControllerPort")); + ret += row("<a href='http://" + split[0] + ":" + (baseShardPort + offset) + "'>" + c + "</a>","Yes"); + } + + return ret; + }%> +<% + String hostName = request.getServerName() + ":" + System.getProperty("blur.gui.servicing.port"); + + Iface client = BlurClient.getClient(hostName); +%> + + +<html> +<head> +<title>Blur <%=System.getProperty("blur.gui.mode") %> '<%=hostName%>' +</title> +<link href="style.css" rel="stylesheet" type="text/css" /> +</head> +<body> + <h1> + Blur <%=System.getProperty("blur.gui.mode") %> '<%=hostName%>' + </h1> + <br /> + <h2>Controllers</h2> + <%=table(getControllers(client),"Name","Online") %> + <hr /> + <br /> + <h2>Clusters</h2> + <%=table(getClusters(client),"Cluster Name","Shard Servers","Enabled") %> + <hr /> + <br /> + <h2>Tables</h2> + <%=table(getTables(client),"Cluster Name","Table Name","Enabled")%> + <hr /> + <br /> + <h2>Configs</h2> + <table class="statTable" class="statTableTitle"> + <tr> + <td class="statTableTitle">Param</td> + <td class="statTableTitle">Value</td> + </tr> + <%=getConf(client)%> + </table> + <hr /> +<%@ include file="footer.jsp" %> +</body> + +</html> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ed754628/src/blur-gui/src/main/webapps/controller/index.html ---------------------------------------------------------------------- diff --git a/src/blur-gui/src/main/webapps/controller/index.html b/src/blur-gui/src/main/webapps/controller/index.html index b661c3b..3a08bc6 100644 --- a/src/blur-gui/src/main/webapps/controller/index.html +++ b/src/blur-gui/src/main/webapps/controller/index.html @@ -1,4 +1,4 @@ -<meta HTTP-EQUIV="REFRESH" content="0;url=controller.jsp"/> +<meta HTTP-EQUIV="REFRESH" content="0;url=home.jsp"/> <html> <head> <title>Blur</title> @@ -7,7 +7,7 @@ <h1>Blur</h1> <ul> -<li><a href="controller.jsp">Blur Controller Health/Status</a></li> +<li><a href="home.jsp">Blur Health/Status</a></li> </ul> </body> </html> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ed754628/src/blur-gui/src/main/webapps/controller/metrics.jsp ---------------------------------------------------------------------- diff --git a/src/blur-gui/src/main/webapps/controller/metrics.jsp b/src/blur-gui/src/main/webapps/controller/metrics.jsp new file mode 100644 index 0000000..4bd6da8 --- /dev/null +++ b/src/blur-gui/src/main/webapps/controller/metrics.jsp @@ -0,0 +1,65 @@ +<%@page import="java.text.DecimalFormat"%> +<%@page import="java.text.NumberFormat"%> +<%@ page contentType="text/html; charset=UTF-8" isThreadSafe="false" + import="javax.servlet.*" import="javax.servlet.http.*" + import="java.io.*" import="java.util.*" import="java.text.DateFormat" + import="java.lang.Math" import="java.net.URLEncoder" + import="com.nearinfinity.blur.thrift.*" + import="com.nearinfinity.blur.thrift.generated.*" + import="com.nearinfinity.blur.thrift.generated.Blur.*"%> +<%@ include file="functions.jsp"%> +<% + String hostName = request.getServerName() + ":" + System.getProperty("blur.gui.servicing.port"); +%> +<html> +<head> +<title>Metrics +</title> + +<link href="style.css" rel="stylesheet" type="text/css" /> + +</head> + +<script src="d3.v2.js"></script> +<body> + <script> + //decimal formatter + var df = d3.format("4d"); + + //basic printout + d3.json("metrics", function(json) { + //alert(json); + arr = []; + arr[0] = json; + //select obj and bind data + d3.select("div").selectAll("ul") + .data(arr) + .enter().append("ul") + .text("Metrics") + .selectAll("li") + .data(function(d) { + var map = []; + var i = 0; + for(var x in d) { + var obj = {}; + obj.name = x; + obj.value = d[x]; + map[i++] = obj; + } + return map}) + .enter() + .append("li") + .text(function(d) { return d.name + " " + d.value }) + .style("background-color", function(d,i) { return i % 2 ? "#eee" : "#ddd"; }); + }); + </script> + <h1> + Blur <%=System.getProperty("blur.gui.mode") %> '<%=hostName%>' + </h1> + <br /> +<div> +</div> +<%@ include file="footer.jsp" %> +</body> +</html> + http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ed754628/src/blur-gui/src/main/webapps/controller/shardList.jsp ---------------------------------------------------------------------- diff --git a/src/blur-gui/src/main/webapps/controller/shardList.jsp b/src/blur-gui/src/main/webapps/controller/shardList.jsp index a746e78..5bab8ce 100644 --- a/src/blur-gui/src/main/webapps/controller/shardList.jsp +++ b/src/blur-gui/src/main/webapps/controller/shardList.jsp @@ -7,9 +7,9 @@ import="com.nearinfinity.blur.thrift.generated.Blur.*"%> <%@ include file="functions.jsp"%> <%! - public String shards(Iface client) throws Exception { + public String shards(Iface client, String clusterName) throws Exception { String ret = ""; - List<String> servers = client.shardServerList("default"); + List<String> servers = client.shardServerList(clusterName); for(String s : servers) { String[] split = s.split(":"); @@ -50,12 +50,11 @@ Blur Shard List for Cluster '<%=clusterName%>' </h1> <br /> - <%=table(shards(client),"Shard") %> + <%=table(shards(client, clusterName),"Shard") %> <% } %> - <br/> - <a href="index.html">home</a> | <a href="logs">logs</a> +<%@ include file="footer.jsp" %> </body> </html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ed754628/src/blur-gui/src/main/webapps/controller/table.jsp ---------------------------------------------------------------------- diff --git a/src/blur-gui/src/main/webapps/controller/table.jsp b/src/blur-gui/src/main/webapps/controller/table.jsp index ae662f0..498ad20 100644 --- a/src/blur-gui/src/main/webapps/controller/table.jsp +++ b/src/blur-gui/src/main/webapps/controller/table.jsp @@ -141,7 +141,7 @@ } } %> - +<%@ include file="footer.jsp" %> </body> </html> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ed754628/src/blur-gui/src/main/webapps/controller/test.html ---------------------------------------------------------------------- diff --git a/src/blur-gui/src/main/webapps/controller/test.html b/src/blur-gui/src/main/webapps/controller/test.html index c73c263..034ba04 100644 --- a/src/blur-gui/src/main/webapps/controller/test.html +++ b/src/blur-gui/src/main/webapps/controller/test.html @@ -32,6 +32,38 @@ div { <script> //decimal formatter var df = d3.format("4d"); + + //basic printout + d3.json("metrics", function(json) { + //alert(json); + arr = []; + arr[0] = json; + //select obj and bind data + d3.select("body").selectAll("ul") + .data(arr) + .enter().append("ul") + .text("Metrics") + .selectAll("li") + .data(function(d) { + var map = []; + var i = 0; + for(var x in d) { + var obj = {}; + obj.name = x; + obj.value = d[x]; + map[i++] = obj; + } + return map}) + .enter() + .append("li") + .text(function(d) { return d.name + " " + d.value }) + .style("background-color", function(d,i) { return i % 2 ? "#eee" : "#ddd"; }); + }); + + + + //realtime update stuffs + //data holder var dummy = []; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ed754628/src/blur-gui/src/main/webapps/shard/WEB-INF/web.xml ---------------------------------------------------------------------- diff --git a/src/blur-gui/src/main/webapps/shard/WEB-INF/web.xml b/src/blur-gui/src/main/webapps/shard/WEB-INF/web.xml deleted file mode 100644 index 311e084..0000000 --- a/src/blur-gui/src/main/webapps/shard/WEB-INF/web.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<web-app xmlns="http://java.sun.com/xml/ns/javaee" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" - version="2.5"> - - <display-name>Blur GUI</display-name> - -</web-app> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ed754628/src/blur-gui/src/main/webapps/shard/functions.jsp ---------------------------------------------------------------------- diff --git a/src/blur-gui/src/main/webapps/shard/functions.jsp b/src/blur-gui/src/main/webapps/shard/functions.jsp deleted file mode 100644 index 9e5d82b..0000000 --- a/src/blur-gui/src/main/webapps/shard/functions.jsp +++ /dev/null @@ -1,25 +0,0 @@ - -<%!public String row(String... col) { - String ret = "<tr>"; - for (String c : col) - ret += "<td>" + c + "</td>"; - return ret + "</tr>\n"; - } - - public String row(int colspan, String col) { - return "<tr><td colspan=" + colspan + ">" + col + "</td></tr>"; - } - - public String shardListLink(String cluster, String display) { - return "<a href='shardList.jsp?clusterName=" + cluster - + "' title='view shard servers'>" + display + "</a>"; - } - - public String table(String content, String... headers) { - String ret = "<table class='statTable'><tr>\n"; - for(String h : headers) - ret += "<td class='statTableTitle'>" + h + "</td>\n"; - return ret + "</tr>" + content + "</table>\n"; - } - -%> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ed754628/src/blur-gui/src/main/webapps/shard/index.html ---------------------------------------------------------------------- diff --git a/src/blur-gui/src/main/webapps/shard/index.html b/src/blur-gui/src/main/webapps/shard/index.html deleted file mode 100644 index 1a67009..0000000 --- a/src/blur-gui/src/main/webapps/shard/index.html +++ /dev/null @@ -1,13 +0,0 @@ -<meta HTTP-EQUIV="REFRESH" content="0;url=shard.jsp"/> -<html> -<head> -<title>Blur</title> -</head> -<body> -<h1>Blur</h1> - -<ul> -<li><a href="shard.jsp">Blur Shard Health/Status</a></li> -</ul> -</body> -</html> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ed754628/src/blur-gui/src/main/webapps/shard/shard.jsp ---------------------------------------------------------------------- diff --git a/src/blur-gui/src/main/webapps/shard/shard.jsp b/src/blur-gui/src/main/webapps/shard/shard.jsp deleted file mode 100644 index e28f370..0000000 --- a/src/blur-gui/src/main/webapps/shard/shard.jsp +++ /dev/null @@ -1,117 +0,0 @@ -<%@ page contentType="text/html; charset=UTF-8" isThreadSafe="false" - import="javax.servlet.*" import="javax.servlet.http.*" - import="java.io.*" import="java.util.*" import="java.text.DateFormat" - import="java.lang.Math" import="java.net.URLEncoder" - import="com.nearinfinity.blur.thrift.*" - import="com.nearinfinity.blur.thrift.generated.*" - import="com.nearinfinity.blur.thrift.generated.Blur.*"%> -<%@ include file="functions.jsp" %> -<%! - - public String tableLink(String tableName, String clusterName) { - return "<a href='table.jsp?tableName="+tableName+"&clusterName="+clusterName+"' title='view details for " + tableName + "'>" + tableName + "</a>"; - } - - public String getTables(Iface client) throws Exception { - String ret = ""; - List<String> clusters = client.shardClusterList(); - for (String cluster : clusters) { - //tables: _ tableName : enabled - List<String> tables = client.tableListByCluster(cluster); - for (String table : tables) { - try { - ret += row(cluster, tableLink(table,cluster), client.describe(table).isEnabled?"yes":"no"); - } catch (BlurException e) { - ret += row(3, "<font color=FF0000>Error describing table: " - + table + "</font>"); - } - } - } - return ret; - } - - public String getClusters(Iface client) throws Exception { - String ret = ""; - List<String> clusters = client.shardClusterList(); - for (String cluster : clusters) { - ret += row(cluster, shardListLink(cluster,client.shardServerList(cluster).size()+""), getClusterEnabled(client, cluster)); - } - return ret; - } - - - public String getConf(Iface client) throws Exception { - return row(2,"disabled as its broken"); -/* try { - Map<String, String> config = client.configuration(); - String ret = ""; - for (String key : config.keySet()) { - ret += row(key, config.get(key)); - } - return ret; - } catch (Exception e) { - return row(2, "Cannot retrieve anything from client.configuration."); - }*/ - } - - public String getClusterEnabled(Iface client, String cluster) - throws Exception { - return client.isInSafeMode(cluster) ? "Safe Mode On" - : "Yes"; - } - - public String getControllers(Iface client) throws Exception { - String ret = ""; - List<String> con = client.controllerServerList(); - - for (String c : con) { - ret += row(c, "Yes"); - } - - return ret; - }%> -<% - //TODO: prop file the port - String hostName = request.getServerName() + ":" + System.getProperty("blur.gui.servicing.port"); - - Iface client = BlurClient.getClient(hostName); -%> - - -<html> -<head> -<title>Blur Shard '<%=hostName%>' -</title> -<link href="style.css" rel="stylesheet" type="text/css" /> -</head> -<body> - <h1> - Blur Shard '<%=hostName%>' - </h1> - <br /> - <h2>Controllers</h2> - <%=table(getControllers(client),"Name","Online") %> - <hr /> - <br /> - <h2>Clusters</h2> - <%=table(getClusters(client),"Cluster Name","Shard Servers","Enabled") %> - <hr /> - <br /> - <h2>Tables</h2> - <%=table(getTables(client),"Cluster Name","Table Name","Enabled")%> - <hr /> - <br /> - <h2>Configs</h2> - <table class="statTable" class="statTableTitle"> - <tr> - <td class="statTableTitle">Param</td> - <td class="statTableTitle">Value</td> - </tr> - <%=getConf(client)%> - </table> - <hr /> - <br /> - <a href="logs">logs</a> -</body> - -</html> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ed754628/src/blur-gui/src/main/webapps/shard/style.css ---------------------------------------------------------------------- diff --git a/src/blur-gui/src/main/webapps/shard/style.css b/src/blur-gui/src/main/webapps/shard/style.css deleted file mode 100644 index cda4fb7..0000000 --- a/src/blur-gui/src/main/webapps/shard/style.css +++ /dev/null @@ -1,53 +0,0 @@ -body { - font-family: sans-serif; - font-size: 11px; - line-height: 17px; -} - -a { - color: #0044FF !important; - text-decoration: none !important; -} - -h2 { - margin: 5px 5px 0px 0px; -} - -hr { - -moz-border-bottom-colors: none; - -moz-border-image: none; - -moz-border-left-colors: none; - -moz-border-right-colors: none; - -moz-border-top-colors: none; - border-color: -moz-use-text-color #DDDDDD #DDDDDD; - border-right: 1px solid #DDDDDD; - border-style: none solid solid; - border-width: 0 1px 1px; -} - -table { - font-size: 12px; - -} - -td { - align: left; - font-size: 12px; - padding-left: 10px; - padding-right: 10px; - font-family: Verdana; -} - -.statTable { - width: 500px; -} - -.statTableTitle { - color: 55555; - align: left; - font-weight: bold; - font-size:14pt; - padding: 10px 5px 0px 5px; - font-family: Helvetica; - background-color: #DDDDDD; -} \ No newline at end of file
