You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-commits@hadoop.apache.org by ar...@apache.org on 2013/08/20 19:18:54 UTC
svn commit: r1515890 - in
/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main:
java/org/apache/hadoop/hdfs/server/datanode/DatanodeJspHelper.java
webapps/datanode/dataNodeHome.jsp webapps/datanode/index.html
webapps/hdfs/index.html
Author: arp
Date: Tue Aug 20 17:18:53 2013
New Revision: 1515890
URL: http://svn.apache.org/r1515890
Log:
HDFS-2933. Improve DataNode Web UI Index Page. (Vivek Ganesan via Arpit Agarwal)
Added:
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/datanode/dataNodeHome.jsp
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/datanode/index.html
Modified:
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DatanodeJspHelper.java
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/index.html
Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DatanodeJspHelper.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DatanodeJspHelper.java?rev=1515890&r1=1515889&r2=1515890&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DatanodeJspHelper.java (original)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DatanodeJspHelper.java Tue Aug 20 17:18:53 2013
@@ -19,7 +19,9 @@ package org.apache.hadoop.hdfs.server.da
import java.io.File;
import java.io.IOException;
+import java.net.InetAddress;
import java.net.InetSocketAddress;
+import java.net.URI;
import java.net.URL;
import java.net.URLEncoder;
import java.security.PrivilegedExceptionAction;
@@ -27,6 +29,7 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
+import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.JspWriter;
@@ -36,6 +39,7 @@ import org.apache.hadoop.classification.
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hdfs.DFSClient;
import org.apache.hadoop.hdfs.DFSConfigKeys;
+import org.apache.hadoop.hdfs.protocol.DatanodeID;
import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
import org.apache.hadoop.hdfs.protocol.DirectoryListing;
import org.apache.hadoop.hdfs.protocol.HdfsFileStatus;
@@ -43,6 +47,9 @@ import org.apache.hadoop.hdfs.protocol.L
import org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier;
import org.apache.hadoop.hdfs.security.token.block.BlockTokenSecretManager;
import org.apache.hadoop.hdfs.server.common.JspHelper;
+import org.apache.hadoop.hdfs.server.namenode.FSNamesystem;
+import org.apache.hadoop.hdfs.server.namenode.NameNode;
+import org.apache.hadoop.hdfs.server.namenode.NameNodeHttpServer;
import org.apache.hadoop.http.HtmlQuoting;
import org.apache.hadoop.http.HttpConfig;
import org.apache.hadoop.net.NetUtils;
@@ -50,6 +57,7 @@ import org.apache.hadoop.security.UserGr
import org.apache.hadoop.security.token.Token;
import org.apache.hadoop.util.ServletUtil;
import org.apache.hadoop.util.StringUtils;
+import org.apache.hadoop.util.VersionInfo;
@InterfaceAudience.Private
public class DatanodeJspHelper {
@@ -712,4 +720,24 @@ public class DatanodeJspHelper {
final String nnAddr = request.getParameter(JspHelper.NAMENODE_ADDRESS);
return getDFSClient(ugi, nnAddr, conf);
}
+
+ /** Return a table containing version information. */
+ public static String getVersionTable(ServletContext context) {
+ StringBuilder sb = new StringBuilder();
+ final DataNode dataNode = (DataNode) context.getAttribute("datanode");
+ sb.append("<div class='dfstable'><table>");
+ sb.append("<tr><td class='col1'>Version:</td><td>");
+ sb.append(VersionInfo.getVersion() + ", " + VersionInfo.getRevision());
+ sb.append("</td></tr>\n" + "\n <tr><td class='col1'>Compiled:</td><td>"
+ + VersionInfo.getDate());
+ sb.append(" by " + VersionInfo.getUser() + " from "
+ + VersionInfo.getBranch());
+ if (dataNode != null) {
+ sb.append("</td></tr>\n <tr><td class='col1'>Cluster ID:</td><td>"
+ + dataNode.getClusterId());
+ }
+ sb.append("</td></tr>\n</table></div>");
+ return sb.toString();
+ }
+
}
Added: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/datanode/dataNodeHome.jsp
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/datanode/dataNodeHome.jsp?rev=1515890&view=auto
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/datanode/dataNodeHome.jsp (added)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/datanode/dataNodeHome.jsp Tue Aug 20 17:18:53 2013
@@ -0,0 +1,58 @@
+<%
+/*
+ * 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.
+ */
+%>
+<%@page import="org.apache.hadoop.hdfs.tools.GetConf"%>
+<%@page import="org.apache.hadoop.hdfs.server.datanode.DatanodeJspHelper"%>
+<%@page import="org.apache.hadoop.hdfs.server.datanode.DataNode"%>
+<%@ page
+ contentType="text/html; charset=UTF-8"
+ import="org.apache.hadoop.util.ServletUtil"
+%>
+<%!
+ //for java.io.Serializable
+ private static final long serialVersionUID = 1L;
+%>
+<%
+ DataNode dataNode = (DataNode)getServletContext().getAttribute("datanode");
+ String state = dataNode.isDatanodeUp()?"active":"inactive";
+ String dataNodeLabel = dataNode.getDisplayName();
+%>
+
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="stylesheet" type="text/css" href="/static/hadoop.css">
+<title>Hadoop DataNode <%=dataNodeLabel%></title>
+</head>
+<body>
+<h1>DataNode '<%=dataNodeLabel%>' (<%=state%>)</h1>
+<%= DatanodeJspHelper.getVersionTable(getServletContext()) %>
+<br />
+<b><a href="/logs/">DataNode Logs</a></b>
+<br />
+<b><a href="/logLevel">View/Set Log Level</a></b>
+<br />
+<b><a href="/metrics">Metrics</a></b>
+<br />
+<b><a href="/conf">Configuration</a></b>
+<br />
+<b><a href="/blockScannerReport">Block Scanner Report</a></b>
+<%
+out.println(ServletUtil.htmlFooter());
+%>
Added: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/datanode/index.html
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/datanode/index.html?rev=1515890&view=auto
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/datanode/index.html (added)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/datanode/index.html Tue Aug 20 17:18:53 2013
@@ -0,0 +1,35 @@
+<!--
+ 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.
+-->
+<meta HTTP-EQUIV="REFRESH" content="0;url=dataNodeHome.jsp"/>
+<html>
+<head>
+<title>Hadoop Administration</title>
+</head>
+
+<body>
+
+<h1>Hadoop Administration</h1>
+
+<ul>
+
+<li><a href="dataNodeHome.jsp">DataNode Home</a></li>
+
+</ul>
+
+</body>
+
+</html>
Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/index.html
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/index.html?rev=1515890&r1=1515889&r2=1515890&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/index.html (original)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/index.html Tue Aug 20 17:18:53 2013
@@ -1,5 +1,3 @@
-<meta HTTP-EQUIV="REFRESH" content="0;url=dfshealth.jsp"/>
-<html>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -16,6 +14,8 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
+<meta HTTP-EQUIV="REFRESH" content="0;url=dfshealth.jsp"/>
+<html>
<head>
<title>Hadoop Administration</title>
</head>