001package org.apache.hadoop.hdfs.server.namenode; 002 003import javax.servlet.*; 004import javax.servlet.http.*; 005import javax.servlet.jsp.*; 006import org.apache.hadoop.util.ServletUtil; 007import org.apache.hadoop.ha.HAServiceProtocol.HAServiceState; 008 009public final class dfshealth_jsp extends org.apache.jasper.runtime.HttpJspBase 010 implements org.apache.jasper.runtime.JspSourceDependent { 011 012 013 //for java.io.Serializable 014 private static final long serialVersionUID = 1L; 015 016 private static java.util.List _jspx_dependants; 017 018 public Object getDependants() { 019 return _jspx_dependants; 020 } 021 022 public void _jspService(HttpServletRequest request, HttpServletResponse response) 023 throws java.io.IOException, ServletException { 024 025 JspFactory _jspxFactory = null; 026 PageContext pageContext = null; 027 HttpSession session = null; 028 ServletContext application = null; 029 ServletConfig config = null; 030 JspWriter out = null; 031 Object page = this; 032 JspWriter _jspx_out = null; 033 PageContext _jspx_page_context = null; 034 035 036 try { 037 _jspxFactory = JspFactory.getDefaultFactory(); 038 response.setContentType("text/html; charset=UTF-8"); 039 pageContext = _jspxFactory.getPageContext(this, request, response, 040 null, true, 8192, true); 041 _jspx_page_context = pageContext; 042 application = pageContext.getServletContext(); 043 config = pageContext.getServletConfig(); 044 session = pageContext.getSession(); 045 out = pageContext.getOut(); 046 _jspx_out = out; 047 048 049/* 050 * Licensed to the Apache Software Foundation (ASF) under one 051 * or more contributor license agreements. See the NOTICE file 052 * distributed with this work for additional information 053 * regarding copyright ownership. The ASF licenses this file 054 * to you under the Apache License, Version 2.0 (the 055 * "License"); you may not use this file except in compliance 056 * with the License. You may obtain a copy of the License at 057 * 058 * http://www.apache.org/licenses/LICENSE-2.0 059 * 060 * Unless required by applicable law or agreed to in writing, software 061 * distributed under the License is distributed on an "AS IS" BASIS, 062 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 063 * See the License for the specific language governing permissions and 064 * limitations under the License. 065 */ 066 067 068 final NamenodeJspHelper.HealthJsp healthjsp = new NamenodeJspHelper.HealthJsp(); 069 NameNode nn = NameNodeHttpServer.getNameNodeFromContext(application); 070 FSNamesystem fsn = nn.getNamesystem(); 071 HAServiceState nnHAState = nn.getServiceState(); 072 boolean isActive = (nnHAState == HAServiceState.ACTIVE); 073 String namenodeRole = nn.getRole().toString(); 074 String namenodeState = nnHAState.toString(); 075 String namenodeLabel = NamenodeJspHelper.getNameNodeLabel(nn); 076 077 out.write("<!DOCTYPE html>\n<html>\n<head>\n<link rel=\"stylesheet\" type=\"text/css\" href=\"/static/hadoop.css\">\n<title>Hadoop "); 078 out.print(namenodeRole); 079 out.write(" "); 080 out.print(namenodeLabel); 081 out.write("</title>\n</head> \n<body>\n<h1>"); 082 out.print(namenodeRole); 083 out.write(' '); 084 out.write('\''); 085 out.print(namenodeLabel); 086 out.write('\''); 087 out.write(' '); 088 out.write('('); 089 out.print(namenodeState); 090 out.write(")</h1>\n"); 091 out.print( NamenodeJspHelper.getVersionTable(fsn) ); 092 out.write("<br />\n"); 093 if (isActive && fsn != null) { 094 out.write("<b><a href=\"/nn_browsedfscontent.jsp\">Browse the filesystem</a></b><br>\n"); 095 } 096 out.write("<b><a href=\"/logs/\">"); 097 out.print(namenodeRole); 098 out.write(" Logs</a></b>\n\n<hr>\n<h3>Cluster Summary</h3>\n<b> "); 099 out.print( NamenodeJspHelper.getSecurityModeText()); 100 out.write("</b>\n<b> "); 101 out.print( NamenodeJspHelper.getSafeModeText(fsn)); 102 out.write("</b>\n<b> "); 103 out.print( NamenodeJspHelper.getRollingUpgradeText(fsn)); 104 out.write("</b>\n<b> "); 105 out.print( NamenodeJspHelper.getInodeLimitText(fsn)); 106 out.write("</b>\n"); 107 out.print( NamenodeJspHelper.getCorruptFilesWarning(fsn)); 108 healthjsp.generateHealthReport(out, nn, request); 109 healthjsp.generateJournalReport(out, nn, request); 110 out.write("<hr/>\n"); 111 healthjsp.generateConfReport(out, nn, request); 112 out.write("<hr/>\n<h3>Snapshot Summary</h3>\n"); 113 NamenodeJspHelper.generateSnapshotReport(out, fsn); 114 out.write("<hr/>\n<h3>Startup Progress</h3>\n"); 115 healthjsp.generateStartupProgress(out, nn.getStartupProgress()); 116 out.write("<hr/><p><a href=\"http://hadoop.apache.org/core\">Hadoop</a>, 2013. <a href=\"dfshealth.html\">New UI</a></p>\n</body>\n</html>\n"); 117 } catch (Throwable t) { 118 if (!(t instanceof SkipPageException)){ 119 out = _jspx_out; 120 if (out != null && out.getBufferSize() != 0) 121 out.clearBuffer(); 122 if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); 123 } 124 } finally { 125 if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context); 126 } 127 } 128}