<%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>
HRegionServer regionServer;
String filter = "general";
String format = "html";
</%args>
<%import>
java.util.*;
org.apache.hadoop.hbase.regionserver.HRegionServer;
org.apache.hadoop.hbase.HRegionInfo;
org.apache.hadoop.hbase.ServerName;
org.apache.hadoop.hbase.HBaseConfiguration;
org.apache.hadoop.hbase.protobuf.ProtobufUtil;
org.apache.hadoop.hbase.protobuf.generated.AdminProtos.ServerInfo;
org.apache.hadoop.hbase.zookeeper.MasterAddressTracker;
</%import>
<%if format.equals("json") %>
  <& ../common/TaskMonitorTmpl; filter = filter; format = "json" &>
  <%java return; %>
</%if>
<%java>
  ServerInfo serverInfo = ProtobufUtil.getServerInfo(regionServer);
  ServerName serverName = ProtobufUtil.toServerName(serverInfo.getServerName());
  List<HRegionInfo> onlineRegions = ProtobufUtil.getOnlineRegions(regionServer);
  int masterInfoPort = regionServer.getConfiguration().getInt("hbase.master.info.port", 60010);
  MasterAddressTracker masterAddressTracker = regionServer.getMasterAddressTracker();
  ServerName masterServerName = masterAddressTracker == null ? null
    : masterAddressTracker.getMasterAddress();
</%java>
<!--[if IE]>
<!DOCTYPE html>
<![endif]-->
<?xml version="1.0" encoding="UTF-8" ?>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>HBase Region Server: <% serverName.getHostname() %></title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">

    <link href="/static/css/bootstrap.min.css" rel="stylesheet">
    <link href="/static/css/bootstrap-theme.min.css" rel="stylesheet">
    <link href="/static/css/hbase.css" rel="stylesheet">
  </head>

  <body>

    <div class="navbar  navbar-fixed-top navbar-default">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="/rs-status"><img src="/static/hbase_logo_small.png" alt="HBase Logo"/></a>
            </div>
            <div class="collapse navbar-collapse">
                <ul class="nav navbar-nav">
                <li class="active"><a href="/">Home</a></li>
                <li><a href="/logs/">Local logs</a></li>
                <li><a href="/logLevel">Log Level</a></li>
                <li><a href="/dump">Debug dump</a></li>
                <li><a href="/jmx">Metrics Dump</a></li>
                <%if HBaseConfiguration.isShowConfInServlet()%>
                <li><a href="/conf">HBase Configuration</a></li>
                </%if>
            </ul>
          </div><!--/.nav-collapse -->
        </div>
      </div>
    </div>

  <div class="container">
    <div class="row inner_header">
        <div class="page-header">
            <h1>RegionServer <small><% serverName %></small></h1>
        </div>
    </div>
    <div class="row">

    <section>
    <h2>Server Metrics</h2>
    <& ServerMetricsTmpl; mWrap = regionServer.getMetrics().getRegionServerWrapper(); &>
    </section>

    <section>
    <& ../common/TaskMonitorTmpl; filter = filter &>
    </section>

    <section>
    <h2>Regions</h2>
    <& RegionListTmpl; regionServer = regionServer; onlineRegions = onlineRegions; &>
    </section>

    <section>
    <h2>Software Attributes</h2>
    <table id="attributes_table" class="table table-striped">
        <tr>
            <th>Attribute Name</th>
            <th>Value</th>
            <th>Description</th>
        </tr>
        <tr>
            <td>HBase Version</td>
            <td><% org.apache.hadoop.hbase.util.VersionInfo.getVersion() %>, r<% org.apache.hadoop.hbase.util.VersionInfo.getRevision() %></td>
            <td>HBase version and revision</td>
        </tr>
        <tr>
            <td>HBase Compiled</td>
            <td><% org.apache.hadoop.hbase.util.VersionInfo.getDate() %>, <% org.apache.hadoop.hbase.util.VersionInfo.getUser() %></td>
            <td>When HBase version was compiled and by whom</td>
        </tr>
        <tr>
            <td>Zookeeper Quorum</td>
            <td><% regionServer.getZooKeeper().getQuorum() %></td>
            <td>Addresses of all registered ZK servers</td>
        </tr>
        <tr>
            <td>Coprocessors</td>
            <td><% java.util.Arrays.toString(regionServer.getCoprocessors()) %></td>
            <td>Coprocessors currently loaded by this regionserver</td>
        </tr>
        <tr>
            <td>RS Start Time</td>
            <td><% new Date(regionServer.getStartcode()) %></td>
            <td>Date stamp of when this region server was started</td>
        </tr>
        <tr>
            <td>HBase Master</td>
            <td>
                <%if (masterInfoPort < 0) %>
                No hbase.master.info.port found
                <%elseif masterServerName == null %>
                No master found
                <%else>
                <%java>
                String host = masterServerName.getHostname() + ":" + masterInfoPort;
                String url = "//" + host + "/";
                </%java>
                <a href="<% url %>"><% host %></a>
                </%if>
            </td>
            <td>Address of HBase Master</td>
        </tr>
    </table>
    </section>
    </div>
</div>
<script src="/static/js/jquery.min.js" type="text/javascript"></script>
<script src="/static/js/bootstrap.min.js" type="text/javascript"></script>
<script src="/static/js/tab.js" type="text/javascript"></script>
</body>
</html>
