001// Autogenerated Jamon implementation 002// /Users/peter.somogyi/Cloudera/repos/hbase-upstream/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon 003 004package org.apache.hadoop.hbase.tmpl.master; 005 006// 32, 1 007import java.util.*; 008// 33, 1 009import java.io.IOException; 010// 34, 1 011import org.apache.hadoop.hbase.client.RegionInfo; 012// 35, 1 013import org.apache.hadoop.hbase.client.TableDescriptor; 014// 36, 1 015import org.apache.hadoop.hbase.HBaseConfiguration; 016// 37, 1 017import org.apache.hadoop.hbase.HConstants; 018// 38, 1 019import org.apache.hadoop.hbase.HTableDescriptor; 020// 39, 1 021import org.apache.hadoop.hbase.NamespaceDescriptor; 022// 40, 1 023import org.apache.hadoop.hbase.ServerName; 024// 41, 1 025import org.apache.hadoop.hbase.TableName; 026// 42, 1 027import org.apache.hadoop.hbase.client.Admin; 028// 43, 1 029import org.apache.hadoop.hbase.client.MasterSwitchType; 030// 44, 1 031import org.apache.hadoop.hbase.master.assignment.AssignmentManager; 032// 45, 1 033import org.apache.hadoop.hbase.master.DeadServer; 034// 46, 1 035import org.apache.hadoop.hbase.master.HMaster; 036// 47, 1 037import org.apache.hadoop.hbase.master.RegionState; 038// 48, 1 039import org.apache.hadoop.hbase.master.ServerManager; 040// 49, 1 041import org.apache.hadoop.hbase.protobuf.ProtobufUtil; 042// 50, 1 043import org.apache.hadoop.hbase.quotas.QuotaUtil; 044// 51, 1 045import org.apache.hadoop.hbase.security.access.AccessControlLists; 046// 52, 1 047import org.apache.hadoop.hbase.security.visibility.VisibilityConstants; 048// 53, 1 049import org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription; 050// 54, 1 051import org.apache.hadoop.hbase.tool.Canary; 052// 55, 1 053import org.apache.hadoop.hbase.util.Bytes; 054// 56, 1 055import org.apache.hadoop.hbase.util.FSUtils; 056// 57, 1 057import org.apache.hadoop.hbase.util.JvmVersion; 058// 58, 1 059import org.apache.hadoop.util.StringUtils; 060 061public class MasterStatusTmplImpl 062 extends org.jamon.AbstractTemplateImpl 063 implements org.apache.hadoop.hbase.tmpl.master.MasterStatusTmpl.Intf 064 065{ 066 private final HMaster master; 067 private final AssignmentManager assignmentManager; 068 private final boolean catalogJanitorEnabled; 069 private final Set<ServerName> deadServers; 070 private final String filter; 071 private final String format; 072 private final Map<String,Integer> frags; 073 private final ServerName metaLocation; 074 private final ServerManager serverManager; 075 private final List<ServerName> servers; 076 // 70, 1 077 078 public String formatZKString() { 079 StringBuilder quorums = new StringBuilder(); 080 String zkQuorum = master.getZooKeeper().getQuorum(); 081 082 if (null == zkQuorum) { 083 return quorums.toString(); 084 } 085 086 String[] zks = zkQuorum.split(","); 087 088 if (zks.length == 0) { 089 return quorums.toString(); 090 } 091 092 for(int i = 0; i < zks.length; ++i) { 093 quorums.append(zks[i].trim()); 094 095 if (i != (zks.length - 1)) { 096 quorums.append("<br/>"); 097 } 098 } 099 100 return quorums.toString(); 101 } 102 103 // 97, 1 104 105 public static String getUserTables(HMaster master, List<TableDescriptor> tables){ 106 if (master.isInitialized()){ 107 try { 108 Map<String, TableDescriptor> descriptorMap = master.getTableDescriptors().getAll(); 109 if (descriptorMap != null) { 110 for (TableDescriptor desc : descriptorMap.values()) { 111 if (!desc.getTableName().isSystemTable()) { 112 tables.add(desc); 113 } 114 } 115 } 116 } catch (IOException e) { 117 return "Got user tables error, " + e.getMessage(); 118 } 119 } 120 return null; 121 } 122 123 protected static org.apache.hadoop.hbase.tmpl.master.MasterStatusTmpl.ImplData __jamon_setOptionalArguments(org.apache.hadoop.hbase.tmpl.master.MasterStatusTmpl.ImplData p_implData) 124 { 125 if(! p_implData.getAssignmentManager__IsNotDefault()) 126 { 127 p_implData.setAssignmentManager(null); 128 } 129 if(! p_implData.getCatalogJanitorEnabled__IsNotDefault()) 130 { 131 p_implData.setCatalogJanitorEnabled(true); 132 } 133 if(! p_implData.getDeadServers__IsNotDefault()) 134 { 135 p_implData.setDeadServers(null); 136 } 137 if(! p_implData.getFilter__IsNotDefault()) 138 { 139 p_implData.setFilter("general"); 140 } 141 if(! p_implData.getFormat__IsNotDefault()) 142 { 143 p_implData.setFormat("html"); 144 } 145 if(! p_implData.getFrags__IsNotDefault()) 146 { 147 p_implData.setFrags(null); 148 } 149 if(! p_implData.getMetaLocation__IsNotDefault()) 150 { 151 p_implData.setMetaLocation(null); 152 } 153 if(! p_implData.getServerManager__IsNotDefault()) 154 { 155 p_implData.setServerManager(null); 156 } 157 if(! p_implData.getServers__IsNotDefault()) 158 { 159 p_implData.setServers(null); 160 } 161 return p_implData; 162 } 163 public MasterStatusTmplImpl(org.jamon.TemplateManager p_templateManager, org.apache.hadoop.hbase.tmpl.master.MasterStatusTmpl.ImplData p_implData) 164 { 165 super(p_templateManager, __jamon_setOptionalArguments(p_implData)); 166 master = p_implData.getMaster(); 167 assignmentManager = p_implData.getAssignmentManager(); 168 catalogJanitorEnabled = p_implData.getCatalogJanitorEnabled(); 169 deadServers = p_implData.getDeadServers(); 170 filter = p_implData.getFilter(); 171 format = p_implData.getFormat(); 172 frags = p_implData.getFrags(); 173 metaLocation = p_implData.getMetaLocation(); 174 serverManager = p_implData.getServerManager(); 175 servers = p_implData.getServers(); 176 } 177 178 @Override public void renderNoFlush(final java.io.Writer jamonWriter) 179 throws java.io.IOException 180 { 181 // 61, 1 182 if (format.equals("json") ) 183 { 184 // 61, 30 185 jamonWriter.write("\n "); 186 // 62, 3 187 { 188 org.apache.hadoop.hbase.tmpl.common.TaskMonitorTmpl __jamon__var_0 = new org.apache.hadoop.hbase.tmpl.common.TaskMonitorTmpl(this.getTemplateManager()); 189 __jamon__var_0.setFilter(filter); 190 __jamon__var_0.setFormat("json" ); 191 __jamon__var_0.renderNoFlush(jamonWriter); 192 } 193 // 62, 68 194 jamonWriter.write("\n "); 195 // 63, 3 196 return; 197 } 198 // 64, 7 199 jamonWriter.write("\n"); 200 // 65, 1 201 202ServerManager serverManager = master.getServerManager(); 203AssignmentManager assignmentManager = master.getAssignmentManager(); 204 205 // 117, 1 206 jamonWriter.write("<!DOCTYPE html>\n<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\">\n <title>"); 207 // 122, 12 208 if (master.isActiveMaster() ) 209 { 210 // 122, 43 211 jamonWriter.write("Master: "); 212 } 213 // 122, 51 214 else 215 { 216 // 122, 58 217 jamonWriter.write("Backup Master: "); 218 } 219 // 122, 79 220 jamonWriter.write("\n "); 221 // 123, 5 222 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(master.getServerName().getHostname()), jamonWriter); 223 // 123, 47 224 jamonWriter.write("</title>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <meta name=\"description\" content=\"\">\n <link href=\"/static/css/bootstrap.min.css\" rel=\"stylesheet\">\n <link href=\"/static/css/bootstrap-theme.min.css\" rel=\"stylesheet\">\n <link href=\"/static/css/hbase.css\" rel=\"stylesheet\">\n </head>\n\n <body>\n\n <div class=\"navbar navbar-fixed-top navbar-default\">\n <div class=\"container-fluid\">\n <div class=\"navbar-header\">\n <button type=\"button\" class=\"navbar-toggle\" data-toggle=\"collapse\" data-target=\".navbar-collapse\">\n <span class=\"icon-bar\"></span>\n <span class=\"icon-bar\"></span>\n <span class=\"icon-bar\"></span>\n </button>\n <a class=\"navbar-brand\" href=\"/master-status\"><img src=\"/static/hbase_logo_small.png\" alt=\"HBase Logo\"/></a>\n </div>\n <div class=\"collapse navbar-collapse\">\n <ul class=\"nav navbar-nav\">\n <li class=\"active\"><a href=\"/\">Home</a></li>\n <li><a href=\"/tablesDetailed.jsp\">Table Details</a></li>\n "); 225 // 147, 17 226 if (master.isActiveMaster() ) 227 { 228 // 147, 48 229 jamonWriter.write("\n <li><a href=\"/procedures.jsp\">Procedures & Locks</a></li>\n <li><a href=\"/hbck.jsp\">HBCK Report</a></li>\n "); 230 } 231 // 150, 23 232 jamonWriter.write("\n <li><a href=\"/processMaster.jsp\">Process Metrics</a></li>\n <li><a href=\"/logs/\">Local Logs</a></li>\n <li><a href=\"/logLevel\">Log Level</a></li>\n <li><a href=\"/dump\">Debug Dump</a></li>\n <li><a href=\"/jmx\">Metrics Dump</a></li>\n "); 233 // 156, 17 234 if (HBaseConfiguration.isShowConfInServlet()) 235 { 236 // 156, 64 237 jamonWriter.write("\n <li><a href=\"/conf\">HBase Configuration</a></li>\n "); 238 } 239 // 158, 23 240 jamonWriter.write("\n </ul>\n </div><!--/.nav-collapse -->\n </div>\n </div>\n\n <div class=\"container-fluid content\">\n\t"); 241 // 165, 2 242 if (master.isActiveMaster() ) 243 { 244 // 165, 33 245 jamonWriter.write("\n <div class=\"row inner_header\">\n <div class=\"page-header\">\n <h1>Master <small>"); 246 // 168, 35 247 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(master.getServerName().getHostname()), jamonWriter); 248 // 168, 77 249 jamonWriter.write("</small></h1>\n </div>\n </div>\n\n <div class=\"row\">\n <!-- Various warnings that cluster admins should be aware of -->\n "); 250 // 174, 9 251 if (JvmVersion.isBadJvmVersion() ) 252 { 253 // 174, 45 254 jamonWriter.write("\n <div class=\"alert alert-error\">\n Your current JVM version "); 255 // 176, 36 256 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(System.getProperty("java.version")), jamonWriter); 257 // 176, 76 258 jamonWriter.write(" is known to be\n unstable with HBase. Please see the\n <a href=\"http://hbase.apache.org/book.html#trouble.log.gc\">HBase Reference Guide</a>\n for details.\n </div>\n "); 259 } 260 // 181, 15 261 jamonWriter.write("\n "); 262 // 182, 9 263 if (master.isInitialized() && !catalogJanitorEnabled ) 264 { 265 // 182, 65 266 jamonWriter.write("\n <div class=\"alert alert-error\">\n Please note that your cluster is running with the CatalogJanitor disabled. It can be\n re-enabled from the hbase shell by running the command 'catalogjanitor_switch true'\n </div>\n "); 267 } 268 // 187, 15 269 jamonWriter.write("\n "); 270 // 188, 9 271 if (master.isInMaintenanceMode() ) 272 { 273 // 188, 45 274 jamonWriter.write("\n <div class=\"alert alert-warning\">\n Your Master is in maintenance mode. This may be because of HBCK aborting while\n running in repair mode. Please re-run HBCK in repair mode.\n </div>\n "); 275 } 276 // 193, 15 277 jamonWriter.write("\n "); 278 // 194, 9 279 if (!master.isBalancerOn() ) 280 { 281 // 194, 39 282 jamonWriter.write("\n <div class=\"alert alert-warning\">\n The Load Balancer is not enabled which will eventually cause performance degradation\n in HBase as Regions will not be distributed across all RegionServers. The balancer\n is only expected to be disabled during rolling upgrade scenarios.\n </div>\n "); 283 } 284 // 200, 15 285 jamonWriter.write("\n "); 286 // 201, 9 287 if (!master.isSplitOrMergeEnabled(MasterSwitchType.SPLIT) ) 288 { 289 // 201, 70 290 jamonWriter.write("\n <div class=\"alert alert-warning\">\n Region splits are disabled. This may be the result of HBCK aborting while\n running in repair mode. Manually enable splits from the HBase shell,\n or re-run HBCK in repair mode.\n </div>\n "); 291 } 292 // 207, 15 293 jamonWriter.write("\n "); 294 // 208, 9 295 if (!master.isSplitOrMergeEnabled(MasterSwitchType.MERGE) ) 296 { 297 // 208, 70 298 jamonWriter.write("\n <div class=\"alert alert-warning\">\n Region merges are disabled. This may be the result of HBCK aborting while\n running in repair mode. Manually enable merges from the HBase shell,\n or re-run HBCK in repair mode.\n </div>\n "); 299 } 300 // 214, 15 301 jamonWriter.write("\n "); 302 // 215, 9 303 if (master.getMasterCoprocessorHost().findCoprocessor("RSGroupAdminEndpoint") != null ) 304 { 305 // 215, 98 306 jamonWriter.write("\n <section>\n <h2>RSGroup</h2>\n "); 307 // 218, 13 308 { 309 org.apache.hadoop.hbase.tmpl.master.RSGroupListTmpl __jamon__var_1 = new org.apache.hadoop.hbase.tmpl.master.RSGroupListTmpl(this.getTemplateManager()); 310 __jamon__var_1.renderNoFlush(jamonWriter, master, serverManager); 311 } 312 // 218, 79 313 jamonWriter.write("\n </section>\n "); 314 } 315 // 220, 15 316 jamonWriter.write("\n <section>\n <h2>Region Servers</h2>\n "); 317 // 223, 13 318 { 319 org.apache.hadoop.hbase.tmpl.master.RegionServerListTmpl __jamon__var_2 = new org.apache.hadoop.hbase.tmpl.master.RegionServerListTmpl(this.getTemplateManager()); 320 __jamon__var_2.setServers(servers ); 321 __jamon__var_2.renderNoFlush(jamonWriter, master); 322 } 323 // 223, 74 324 jamonWriter.write("\n\n "); 325 // 225, 13 326 if ((deadServers != null) ) 327 { 328 // 225, 42 329 jamonWriter.write("\n "); 330 // 226, 17 331 { 332 // 226, 17 333 __jamon_innerUnit__deadRegionServers(jamonWriter); 334 } 335 // 226, 40 336 jamonWriter.write("\n "); 337 } 338 // 227, 19 339 jamonWriter.write("\n </section>\n <section>\n "); 340 // 230, 13 341 { 342 org.apache.hadoop.hbase.tmpl.master.BackupMasterStatusTmpl __jamon__var_3 = new org.apache.hadoop.hbase.tmpl.master.BackupMasterStatusTmpl(this.getTemplateManager()); 343 __jamon__var_3.renderNoFlush(jamonWriter, master ); 344 } 345 // 230, 58 346 jamonWriter.write("\n </section>\n <section>\n <h2>Tables</h2>\n <div class=\"tabbable\">\n <ul class=\"nav nav-pills\">\n <li class=\"active\">\n <a href=\"#tab_userTables\" data-toggle=\"tab\">User Tables</a>\n </li>\n <li class=\"\">\n <a href=\"#tab_catalogTables\" data-toggle=\"tab\">System Tables</a>\n </li>\n <li class=\"\">\n <a href=\"#tab_userSnapshots\" data-toggle=\"tab\">Snapshots</a>\n </li>\n </ul>\n <div class=\"tab-content\" style=\"padding-bottom: 9px; border-bottom: 1px solid #ddd;\">\n <div class=\"tab-pane active\" id=\"tab_userTables\">\n "); 347 // 248, 25 348 if ((metaLocation != null) ) 349 { 350 // 248, 55 351 jamonWriter.write("\n "); 352 // 249, 29 353 { 354 // 249, 29 355 __jamon_innerUnit__userTables(jamonWriter); 356 } 357 // 249, 45 358 jamonWriter.write("\n "); 359 } 360 // 250, 31 361 jamonWriter.write("\n </div>\n <div class=\"tab-pane\" id=\"tab_catalogTables\">\n "); 362 // 253, 25 363 if ((metaLocation != null) ) 364 { 365 // 253, 55 366 jamonWriter.write("\n "); 367 // 254, 29 368 { 369 // 254, 29 370 __jamon_innerUnit__catalogTables(jamonWriter); 371 } 372 // 254, 48 373 jamonWriter.write("\n "); 374 } 375 // 255, 31 376 jamonWriter.write("\n </div>\n <div class=\"tab-pane\" id=\"tab_userSnapshots\">\n "); 377 // 258, 25 378 { 379 // 258, 25 380 __jamon_innerUnit__userSnapshots(jamonWriter); 381 } 382 // 258, 44 383 jamonWriter.write("\n </div>\n </div>\n </div>\n </section>\n "); 384 // 263, 9 385 if (master.getAssignmentManager() != null ) 386 { 387 // 263, 54 388 jamonWriter.write("\n "); 389 // 264, 9 390 { 391 org.apache.hadoop.hbase.tmpl.master.AssignmentManagerStatusTmpl __jamon__var_4 = new org.apache.hadoop.hbase.tmpl.master.AssignmentManagerStatusTmpl(this.getTemplateManager()); 392 __jamon__var_4.renderNoFlush(jamonWriter, master.getAssignmentManager()); 393 } 394 // 264, 90 395 jamonWriter.write("\n "); 396 } 397 // 265, 15 398 jamonWriter.write("\n\t"); 399 } 400 // 266, 2 401 else 402 { 403 // 266, 9 404 jamonWriter.write("\n <section>\n "); 405 // 268, 13 406 { 407 org.apache.hadoop.hbase.tmpl.master.BackupMasterStatusTmpl __jamon__var_5 = new org.apache.hadoop.hbase.tmpl.master.BackupMasterStatusTmpl(this.getTemplateManager()); 408 __jamon__var_5.renderNoFlush(jamonWriter, master ); 409 } 410 // 268, 58 411 jamonWriter.write("\n </section>\n\t"); 412 } 413 // 270, 8 414 jamonWriter.write("\n\n\n <section>\n "); 415 // 274, 13 416 { 417 org.apache.hadoop.hbase.tmpl.common.TaskMonitorTmpl __jamon__var_6 = new org.apache.hadoop.hbase.tmpl.common.TaskMonitorTmpl(this.getTemplateManager()); 418 __jamon__var_6.setFilter(filter ); 419 __jamon__var_6.renderNoFlush(jamonWriter); 420 } 421 // 274, 61 422 jamonWriter.write("\n </section>\n\n <section>\n <h2>Software Attributes</h2>\n <table id=\"attributes_table\" class=\"table table-striped\">\n <tr>\n <th>Attribute Name</th>\n <th>Value</th>\n <th>Description</th>\n </tr>\n <tr>\n <td>HBase Version</td>\n <td>"); 423 // 287, 25 424 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.hbase.util.VersionInfo.getVersion()), jamonWriter); 425 // 287, 84 426 jamonWriter.write(", revision="); 427 // 287, 95 428 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.hbase.util.VersionInfo.getRevision()), jamonWriter); 429 // 287, 155 430 jamonWriter.write("</td><td>HBase version and revision</td>\n </tr>\n <tr>\n <td>HBase Compiled</td>\n <td>"); 431 // 291, 25 432 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.hbase.util.VersionInfo.getDate()), jamonWriter); 433 // 291, 81 434 jamonWriter.write(", "); 435 // 291, 83 436 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.hbase.util.VersionInfo.getUser()), jamonWriter); 437 // 291, 139 438 jamonWriter.write("</td>\n <td>When HBase version was compiled and by whom</td>\n </tr>\n <tr>\n <td>HBase Source Checksum</td>\n <td>"); 439 // 296, 25 440 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.hbase.util.VersionInfo.getSrcChecksum()), jamonWriter); 441 // 296, 88 442 jamonWriter.write("</td>\n <td>HBase source MD5 checksum</td>\n </tr>\n <tr>\n <td>Hadoop Version</td>\n <td>"); 443 // 301, 25 444 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.util.VersionInfo.getVersion()), jamonWriter); 445 // 301, 78 446 jamonWriter.write(", revision="); 447 // 301, 89 448 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.util.VersionInfo.getRevision()), jamonWriter); 449 // 301, 143 450 jamonWriter.write("</td>\n <td>Hadoop version and revision</td>\n </tr>\n <tr>\n <td>Hadoop Compiled</td>\n <td>"); 451 // 306, 25 452 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.util.VersionInfo.getDate()), jamonWriter); 453 // 306, 75 454 jamonWriter.write(", "); 455 // 306, 77 456 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.util.VersionInfo.getUser()), jamonWriter); 457 // 306, 127 458 jamonWriter.write("</td>\n <td>When Hadoop version was compiled and by whom</td>\n </tr>\n <tr>\n <td>Hadoop Source Checksum</td>\n <td>"); 459 // 311, 25 460 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.util.VersionInfo.getSrcChecksum()), jamonWriter); 461 // 311, 82 462 jamonWriter.write("</td>\n <td>Hadoop source MD5 checksum</td>\n </tr>\n <tr>\n <td>ZooKeeper Client Version</td>\n <td>"); 463 // 316, 25 464 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.zookeeper.Version.getVersion()), jamonWriter); 465 // 316, 72 466 jamonWriter.write(", revision="); 467 // 316, 83 468 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.zookeeper.Version.getRevision()), jamonWriter); 469 // 316, 131 470 jamonWriter.write("</td>\n <td>ZooKeeper client version and revision</td>\n </tr>\n <tr>\n <td>ZooKeeper Client Compiled</td>\n <td>"); 471 // 321, 25 472 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.zookeeper.Version.getBuildDate()), jamonWriter); 473 // 321, 74 474 jamonWriter.write("</td>\n <td>When ZooKeeper client version was compiled</td>\n </tr>\n <tr>\n <td>ZooKeeper Quorum</td>\n <td> "); 475 // 327, 26 476 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(formatZKString()), jamonWriter); 477 // 327, 48 478 jamonWriter.write(" </td>\n <td>Addresses of all registered ZK servers. For more, see <a href=\"/zk.jsp\">zk dump</a>.</td>\n </tr>\n <tr>\n <td>ZooKeeper Base Path</td>\n <td> "); 479 // 332, 26 480 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(master.getZooKeeper().getZNodePaths().baseZNode), jamonWriter); 481 // 332, 79 482 jamonWriter.write("</td>\n <td>Root node of this cluster in ZK.</td>\n </tr>\n <tr>\n <td>HBase Root Directory</td>\n <td>"); 483 // 337, 25 484 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(FSUtils.getRootDir(master.getConfiguration()).toString()), jamonWriter); 485 // 337, 87 486 jamonWriter.write("</td>\n <td>Location of HBase home directory</td>\n </tr>\n <tr>\n <td>HMaster Start Time</td>\n <td>"); 487 // 342, 25 488 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(new Date(master.getMasterStartTime())), jamonWriter); 489 // 342, 68 490 jamonWriter.write("</td>\n <td>Date stamp of when this HMaster was started</td>\n </tr>\n "); 491 // 345, 17 492 if (master.isActiveMaster() ) 493 { 494 // 345, 48 495 jamonWriter.write("\n\t <tr>\n\t <td>HMaster Active Time</td>\n\t <td>"); 496 // 348, 26 497 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(new Date(master.getMasterActiveTime())), jamonWriter); 498 // 348, 70 499 jamonWriter.write("</td>\n\t <td>Date stamp of when this HMaster became active</td>\n\t </tr>\n\t <tr>\n\t <td>HBase Cluster ID</td>\n\t <td>"); 500 // 353, 26 501 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(master.getClusterId() != null ? master.getClusterId() : "Not set"), jamonWriter); 502 // 353, 97 503 jamonWriter.write("</td>\n\t <td>Unique identifier generated for each HBase cluster</td>\n\t </tr>\n\t <tr>\n\t <td>Load average</td>\n\t <td>"); 504 // 358, 26 505 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(master.getServerManager() == null ? "0.00" : 506 StringUtils.limitDecimalTo2(master.getServerManager().getAverageLoad())), jamonWriter); 507 // 359, 98 508 jamonWriter.write("</td>\n\t <td>Average number of regions per regionserver. Naive computation.</td>\n\t </tr>\n\t "); 509 // 362, 18 510 if (frags != null ) 511 { 512 // 362, 39 513 jamonWriter.write("\n\t <tr>\n\t <td>Fragmentation</td>\n\t <td>"); 514 // 365, 26 515 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(frags.get("-TOTAL-") != null ? frags.get("-TOTAL-").intValue() + "%" : "n/a"), jamonWriter); 516 // 365, 108 517 jamonWriter.write("</td>\n\t <td>Overall fragmentation of all tables, including hbase:meta</td>\n\t </tr>\n\t "); 518 } 519 // 368, 24 520 jamonWriter.write("\n\t <tr>\n\t <td>Coprocessors</td>\n\t <td>"); 521 // 371, 26 522 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(master.getMasterCoprocessorHost() == null ? "[]" : 523 java.util.Arrays.toString(master.getMasterCoprocessors())), jamonWriter); 524 // 372, 84 525 jamonWriter.write("</td>\n\t <td>Coprocessors currently loaded by the master</td>\n\t </tr>\n\t <tr>\n\t <td>LoadBalancer</td>\n\t <td>"); 526 // 377, 26 527 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(master.getLoadBalancerClassName()), jamonWriter); 528 // 377, 65 529 jamonWriter.write("</td>\n\t <td>LoadBalancer to be used in the Master</td>\n\t </tr>\n "); 530 } 531 // 380, 23 532 jamonWriter.write("\n </table>\n </section>\n </div>\n </div> <!-- /container -->\n\n <script src=\"/static/js/jquery.min.js\" type=\"text/javascript\"></script>\n <script src=\"/static/js/bootstrap.min.js\" type=\"text/javascript\"></script>\n <script src=\"/static/js/tab.js\" type=\"text/javascript\"></script>\n </body>\n</html>\n\n"); 533 } 534 535 536 // 392, 1 537 private void __jamon_innerUnit__catalogTables(final java.io.Writer jamonWriter) 538 throws java.io.IOException 539 { 540 // 393, 1 541 542 List<TableDescriptor> sysTables = master.isInitialized() ? 543 master.listTableDescriptorsByNamespace(NamespaceDescriptor.SYSTEM_NAMESPACE_NAME_STR) : null; 544 545 // 397, 1 546 if ((sysTables != null && sysTables.size() > 0)) 547 { 548 // 397, 51 549 jamonWriter.write("\n<table class=\"table table-striped\">\n<tr>\n <th>Table Name</th>\n "); 550 // 401, 5 551 if ((frags != null) ) 552 { 553 // 401, 28 554 jamonWriter.write("\n <th title=\"Fragmentation - Will be 0% after a major compaction and fluctuate during normal usage.\">Frag.</th>\n "); 555 } 556 // 403, 11 557 jamonWriter.write("\n <th>Description</th>\n</tr>\n"); 558 // 406, 1 559 for (TableDescriptor systemTable : sysTables) 560 { 561 // 406, 48 562 jamonWriter.write("\n<tr>\n"); 563 // 408, 1 564 TableName tableName = systemTable.getTableName(); 565 // 409, 5 566 jamonWriter.write("<td><a href=\"table.jsp?name="); 567 // 409, 33 568 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(tableName), jamonWriter); 569 // 409, 48 570 jamonWriter.write("\">"); 571 // 409, 50 572 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(tableName), jamonWriter); 573 // 409, 65 574 jamonWriter.write("</a></td>\n "); 575 // 410, 5 576 if ((frags != null)) 577 { 578 // 410, 27 579 jamonWriter.write("\n <td align=\"center\">"); 580 // 411, 28 581 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(frags.get(tableName.getNameAsString()) != null ? frags.get(tableName.getNameAsString()) 582 .intValue() + "%" : "n/a"), jamonWriter); 583 // 412, 37 584 jamonWriter.write("</td>\n "); 585 } 586 // 413, 11 587 jamonWriter.write("\n "); 588 // 414, 5 589 String description = null; 590 if (tableName.equals(TableName.META_TABLE_NAME)){ 591 description = "The hbase:meta table holds references to all User Table regions."; 592 } else if (tableName.equals(Canary.DEFAULT_WRITE_TABLE_NAME)){ 593 description = "The hbase:canary table is used to sniff the write availbility of" 594 + " each regionserver."; 595 } else if (tableName.equals(AccessControlLists.ACL_TABLE_NAME)){ 596 description = "The hbase:acl table holds information about acl."; 597 } else if (tableName.equals(VisibilityConstants.LABELS_TABLE_NAME)){ 598 description = "The hbase:labels table holds information about visibility labels."; 599 } else if (tableName.equals(TableName.NAMESPACE_TABLE_NAME)){ 600 description = "The hbase:namespace table holds information about namespaces."; 601 } else if (tableName.equals(QuotaUtil.QUOTA_TABLE_NAME)){ 602 description = "The hbase:quota table holds quota information about number" + 603 " or size of requests in a given time frame."; 604 } else if (tableName.equals(TableName.valueOf("hbase:rsgroup"))){ 605 description = "The hbase:rsgroup table holds information about regionserver groups."; 606 } else if (tableName.equals(TableName.valueOf("hbase:replication"))) { 607 description = "The hbase:replication table tracks cross cluster replication through " + 608 "WAL file offsets."; 609 } 610 611 // 436, 5 612 jamonWriter.write("<td>"); 613 // 436, 9 614 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(description), jamonWriter); 615 // 436, 26 616 jamonWriter.write("</td>\n</tr>\n"); 617 } 618 // 438, 8 619 jamonWriter.write("\n</table>\n"); 620 } 621 // 440, 7 622 jamonWriter.write("\n"); 623 } 624 625 626 // 536, 1 627 private void __jamon_innerUnit__deadRegionServers(final java.io.Writer jamonWriter) 628 throws java.io.IOException 629 { 630 // 538, 1 631 if ((deadServers != null && deadServers.size() > 0)) 632 { 633 // 538, 55 634 jamonWriter.write("\n<h2>Dead Region Servers</h2>\n<table class=\"table table-striped\">\n <tr>\n <th></th>\n <th>ServerName</th>\n <th>Stop time</th>\n </tr>\n "); 635 // 546, 5 636 637 DeadServer deadServerUtil = master.getServerManager().getDeadServers(); 638 ServerName [] deadServerNames = deadServers.toArray(new ServerName[deadServers.size()]); 639 Arrays.sort(deadServerNames); 640 for (ServerName deadServerName: deadServerNames) { 641 642 // 552, 5 643 jamonWriter.write("<tr>\n \t<th></th>\n <td>"); 644 // 554, 13 645 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(deadServerName), jamonWriter); 646 // 554, 33 647 jamonWriter.write("</td>\n <td>"); 648 // 555, 13 649 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(deadServerUtil.getTimeOfDeath(deadServerName)), jamonWriter); 650 // 555, 64 651 jamonWriter.write("</td>\n </tr>\n "); 652 // 557, 5 653 654 } 655 656 // 560, 5 657 jamonWriter.write("<tr>\n <th>Total: </th>\n <td>servers: "); 658 // 562, 22 659 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(deadServers.size()), jamonWriter); 660 // 562, 46 661 jamonWriter.write("</td>\n <th></th>\n </tr>\n</table>\n"); 662 } 663 // 566, 7 664 jamonWriter.write("\n"); 665 } 666 667 668 // 507, 1 669 private void __jamon_innerUnit__userSnapshots(final java.io.Writer jamonWriter) 670 throws java.io.IOException 671 { 672 // 508, 1 673 674 List<SnapshotDescription> snapshots = master.isInitialized() ? 675 master.getSnapshotManager().getCompletedSnapshots() : null; 676 677 // 512, 1 678 if ((snapshots != null && snapshots.size() > 0)) 679 { 680 // 512, 51 681 jamonWriter.write("\n<table class=\"table table-striped\">\n <tr>\n <th>Snapshot Name</th>\n <th>Table</th>\n <th>Creation Time</th>\n </tr>\n "); 682 // 519, 5 683 for (SnapshotDescription snapshotDesc : snapshots) 684 { 685 // 519, 57 686 jamonWriter.write("\n "); 687 // 520, 5 688 689 TableName snapshotTable = TableName.valueOf(snapshotDesc.getTable()); 690 691 // 523, 5 692 jamonWriter.write("<tr>\n <td><a href=\"snapshot.jsp?name="); 693 // 524, 40 694 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(snapshotDesc.getName()), jamonWriter); 695 // 524, 68 696 jamonWriter.write("\">"); 697 // 524, 70 698 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(snapshotDesc.getName()), jamonWriter); 699 // 524, 98 700 jamonWriter.write("</a> </td>\n <td><a href=\"table.jsp?name="); 701 // 525, 37 702 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(snapshotTable.getNameAsString()), jamonWriter); 703 // 525, 74 704 jamonWriter.write("\">"); 705 // 525, 76 706 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(snapshotTable.getNameAsString()), jamonWriter); 707 // 525, 113 708 jamonWriter.write("</a>\n </td>\n <td>"); 709 // 527, 13 710 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(new Date(snapshotDesc.getCreationTime())), jamonWriter); 711 // 527, 59 712 jamonWriter.write("</td>\n </tr>\n "); 713 } 714 // 529, 12 715 jamonWriter.write("\n <p>"); 716 // 530, 8 717 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(snapshots.size()), jamonWriter); 718 // 530, 30 719 jamonWriter.write(" snapshot(s) in set. [<a href=\"/snapshotsStats.jsp\">Snapshot Storefile stats</a>]</p>\n</table>\n"); 720 } 721 // 532, 7 722 jamonWriter.write("\n"); 723 } 724 725 726 // 443, 1 727 private void __jamon_innerUnit__userTables(final java.io.Writer jamonWriter) 728 throws java.io.IOException 729 { 730 // 444, 1 731 732 List<TableDescriptor> tables = new ArrayList<TableDescriptor>(); 733 String errorMessage = getUserTables(master, tables); 734 735 // 448, 1 736 if ((tables.size() == 0 && errorMessage != null)) 737 { 738 // 448, 52 739 jamonWriter.write("\n<p> "); 740 // 449, 5 741 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(errorMessage), jamonWriter); 742 // 449, 23 743 jamonWriter.write(" </p>\n"); 744 } 745 // 450, 7 746 jamonWriter.write("\n\n"); 747 // 452, 1 748 if ((tables != null && tables.size() > 0)) 749 { 750 // 452, 45 751 jamonWriter.write("\n<table class=\"table table-striped\">\n <tr>\n <th>Namespace</th>\n <th>Table Name</th>\n "); 752 // 457, 9 753 if ((frags != null) ) 754 { 755 // 457, 32 756 jamonWriter.write("\n <th title=\"Fragmentation - Will be 0% after a major compaction and fluctuate during normal usage.\">Frag.</th>\n "); 757 } 758 // 459, 15 759 jamonWriter.write("\n <th>Online Regions</th>\n <th>Offline Regions</th>\n <th>Failed Regions</th>\n <th>Split Regions</th>\n <th>Other Regions</th>\n <th>Description</th>\n </tr>\n "); 760 // 467, 5 761 for (TableDescriptor desc : tables) 762 { 763 // 467, 42 764 jamonWriter.write("\n "); 765 // 468, 5 766 767 HTableDescriptor htDesc = new HTableDescriptor(desc); 768 TableName tableName = htDesc.getTableName(); 769 Map<RegionState.State, List<RegionInfo>> tableRegions = 770 master.getAssignmentManager().getRegionStates() 771 .getRegionByStateOfTable(tableName); 772 int openRegionsCount = tableRegions.get(RegionState.State.OPEN).size(); 773 int offlineRegionsCount = tableRegions.get(RegionState.State.OFFLINE).size(); 774 int splitRegionsCount = tableRegions.get(RegionState.State.SPLIT).size(); 775 int failedRegionsCount = tableRegions.get(RegionState.State.FAILED_OPEN).size() 776 + tableRegions.get(RegionState.State.FAILED_CLOSE).size(); 777 int otherRegionsCount = 0; 778 for (List<RegionInfo> list: tableRegions.values()) { 779 otherRegionsCount += list.size(); 780 } 781 // now subtract known states 782 otherRegionsCount = otherRegionsCount - openRegionsCount 783 - failedRegionsCount - offlineRegionsCount 784 - splitRegionsCount; 785 786 // 488, 5 787 jamonWriter.write("<tr>\n <td>"); 788 // 489, 13 789 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(tableName.getNamespaceAsString()), jamonWriter); 790 // 489, 51 791 jamonWriter.write("</td>\n <td><a href=table.jsp?name="); 792 // 490, 36 793 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(tableName.getNameAsString()), jamonWriter); 794 // 490, 69 795 jamonWriter.write(">"); 796 // 490, 70 797 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(tableName.getQualifierAsString()), jamonWriter); 798 // 490, 108 799 jamonWriter.write("</a> </td>\n "); 800 // 491, 9 801 if ((frags != null) ) 802 { 803 // 491, 32 804 jamonWriter.write("\n <td align=\"center\">"); 805 // 492, 32 806 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(frags.get(tableName.getNameAsString()) != null ? frags.get(tableName.getNameAsString()).intValue() + "%" : "n/a"), jamonWriter); 807 // 492, 150 808 jamonWriter.write("</td>\n "); 809 } 810 // 493, 15 811 jamonWriter.write("\n <td>"); 812 // 494, 13 813 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(openRegionsCount), jamonWriter); 814 // 494, 35 815 jamonWriter.write("</td>\n <td>"); 816 // 495, 13 817 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(offlineRegionsCount), jamonWriter); 818 // 495, 38 819 jamonWriter.write("</td>\n <td>"); 820 // 496, 13 821 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(failedRegionsCount), jamonWriter); 822 // 496, 37 823 jamonWriter.write("</td>\n <td>"); 824 // 497, 13 825 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(splitRegionsCount), jamonWriter); 826 // 497, 36 827 jamonWriter.write("</td>\n <td>"); 828 // 498, 13 829 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(otherRegionsCount), jamonWriter); 830 // 498, 36 831 jamonWriter.write("</td>\n <td>"); 832 // 499, 13 833 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(htDesc.toStringCustomizedValues()), jamonWriter); 834 // 499, 52 835 jamonWriter.write("</td>\n </tr>\n "); 836 } 837 // 501, 12 838 jamonWriter.write("\n <p>"); 839 // 502, 8 840 org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(tables.size()), jamonWriter); 841 // 502, 27 842 jamonWriter.write(" table(s) in set. [<a href=tablesDetailed.jsp>Details</a>]</p>\n</table>\n"); 843 } 844 // 504, 7 845 jamonWriter.write("\n"); 846 } 847 848 849}