You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by la...@apache.org on 2013/06/24 22:33:40 UTC

svn commit: r1496203 - /hbase/branches/0.95/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/BackupMasterStatusTmpl.jamon

Author: larsh
Date: Mon Jun 24 20:33:39 2013
New Revision: 1496203

URL: http://svn.apache.org/r1496203
Log:
HBASE-5083 Add missing file.

Added:
    hbase/branches/0.95/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/BackupMasterStatusTmpl.jamon

Added: hbase/branches/0.95/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/BackupMasterStatusTmpl.jamon
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/BackupMasterStatusTmpl.jamon?rev=1496203&view=auto
==============================================================================
--- hbase/branches/0.95/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/BackupMasterStatusTmpl.jamon (added)
+++ hbase/branches/0.95/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/BackupMasterStatusTmpl.jamon Mon Jun 24 20:33:39 2013
@@ -0,0 +1,74 @@
+<%doc>
+
+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.
+</%doc>
+<%args>
+HMaster master;
+</%args>
+<%import>
+java.util.*;
+org.apache.hadoop.hbase.ServerName;
+org.apache.hadoop.hbase.ClusterStatus;
+org.apache.hadoop.hbase.master.HMaster;
+</%import>
+<%java>
+Collection<ServerName> masters = null;
+
+if (master.isActiveMaster()) {
+  ClusterStatus status = master.getClusterStatus();
+  masters = status.getBackupMasters();
+} else{
+  ServerName sn = master.getMasterAddressManager().getMasterAddress();
+  assert sn != null : "Failed to retreive master's ServerName!";
+  masters = Collections.singletonList(sn);
+}
+</%java>
+
+<%java>
+ServerName [] serverNames = masters.toArray(new ServerName[masters.size()]);
+</%java>
+<%if (!master.isActiveMaster()) %>
+    <%if serverNames[0] != null %>
+        <h2>Master</h2>
+        <a href="<% serverNames[0].getHostname() %>:<% master.getConfiguration().getInt("hbase.master.info.port", 60010) %>/master-status" target="_blank"><% serverNames[0].getHostname() %></a>
+    <%else>
+        Unable to parse master hostname.
+    </%if>
+<%else>
+    <h2>Backup Masters</h2>
+
+    <table class="table table-striped">
+    <tr>
+        <th>ServerName</th>
+        <th>Port</th>
+        <th>Start Time</th>
+    </tr>
+    <%java>
+    Arrays.sort(serverNames);
+    for (ServerName serverName : serverNames) {
+    </%java>
+    <tr>
+        <td><a href="<% serverName.getHostname() %>:<% master.getConfiguration().getInt("hbase.master.info.port", 60010) %>/master-status" target="_blank"><% serverName.getHostname() %></a></td>
+        <td><% serverName.getPort() %></td>
+        <td><% new Date(serverName.getStartcode()) %></td>
+    </tr>
+    <%java>
+    }
+    </%java>
+    <tr><td>Total:<% (masters != null) ? masters.size() : 0 %></td>
+    </table>
+</%if>