You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ec...@apache.org on 2011/11/29 19:35:07 UTC

svn commit: r1208013 - in /incubator/accumulo/branches/1.4: conf/monitor_logger.xml src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/DefaultServlet.java

Author: ecn
Date: Tue Nov 29 18:35:06 2011
New Revision: 1208013

URL: http://svn.apache.org/viewvc?rev=1208013&view=rev
Log:
ACCUMULO-192: display "Permission Denied" if we get errors trying to use superuser priveliged calls to the NameNode

Modified:
    incubator/accumulo/branches/1.4/conf/monitor_logger.xml
    incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/DefaultServlet.java

Modified: incubator/accumulo/branches/1.4/conf/monitor_logger.xml
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/conf/monitor_logger.xml?rev=1208013&r1=1208012&r2=1208013&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/conf/monitor_logger.xml (original)
+++ incubator/accumulo/branches/1.4/conf/monitor_logger.xml Tue Nov 29 18:35:06 2011
@@ -54,9 +54,9 @@
      <appender-ref ref="GUI" />
   </logger>
 
-  <!-- Log non-accumulo messages to debug, noraml logs. -->
+  <!-- Log non-accumulo messages to debug, normal logs. -->
   <root>
-     <level value="DEBUG"/>
+     <level value="INFO"/>
      <appender-ref ref="A2" />
      <appender-ref ref="A3" />
   </root>

Modified: incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/DefaultServlet.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/DefaultServlet.java?rev=1208013&r1=1208012&r2=1208013&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/DefaultServlet.java (original)
+++ incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/DefaultServlet.java Tue Nov 29 18:35:06 2011
@@ -54,6 +54,7 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hdfs.DistributedFileSystem;
 import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
 import org.apache.hadoop.hdfs.protocol.FSConstants.DatanodeReportType;
+import org.apache.hadoop.ipc.RemoteException;
 import org.apache.hadoop.mapred.ClusterStatus;
 import org.apache.hadoop.mapred.JobClient;
 import org.apache.hadoop.mapred.JobTracker;
@@ -265,24 +266,25 @@ public class DefaultServlet extends Basi
       String consumed = "Unknown";
       String diskUsed = "Unknown";
       try {
-        ContentSummary all = fs.getContentSummary(new Path("/"));
-        ContentSummary acu = fs.getContentSummary(new Path(ServerConfiguration.getSystemConfiguration().get(Property.INSTANCE_DFS_DIR)));
-        consumed = String.format("%.2f%%", acu.getSpaceConsumed() * 100. / all.getSpaceConsumed());
+        Path path = new Path(ServerConfiguration.getSystemConfiguration().get(Property.INSTANCE_DFS_DIR));
+        log.debug("Reading the content summary for " + path);
+        ContentSummary acu = fs.getContentSummary(path);
+        consumed = String.format("%.2f%%", acu.getSpaceConsumed() * 100. / fs.getUsed());
         diskUsed = bytes(acu.getSpaceConsumed());
+        
+        boolean highlight = false;
+        tableRow(sb, (highlight = !highlight), "Disk&nbsp;Used", diskUsed);
+        tableRow(sb, (highlight = !highlight), "%&nbsp;of&nbsp;Used&nbsp;DFS", consumed);
+        tableRow(sb, (highlight = !highlight), "<a href='/tables'>Tables</a>", NumberType.commas(Monitor.getTotalTables()));
+        tableRow(sb, (highlight = !highlight), "<a href='/tservers'>Tablet&nbsp;Servers</a>", NumberType.commas(info.tServerInfo.size()));
+        tableRow(sb, (highlight = !highlight), "<a href='/tservers'>Dead&nbsp;Tablet&nbsp;Servers</a>", NumberType.commas(info.deadTabletServers.size()));
+        tableRow(sb, (highlight = !highlight), "Tablets", NumberType.commas(Monitor.getTotalTabletCount()));
+        tableRow(sb, (highlight = !highlight), "Entries", NumberType.commas(Monitor.getTotalEntries()));
+        tableRow(sb, (highlight = !highlight), "Lookups", NumberType.commas(Monitor.getTotalLookups()));
+        tableRow(sb, (highlight = !highlight), "Uptime", Duration.format(System.currentTimeMillis() - Monitor.getStartTime()));
       } catch (Exception e) {
         log.debug(e, e);
       }
-      
-      boolean highlight = false;
-      tableRow(sb, (highlight = !highlight), "Disk&nbsp;Used", diskUsed);
-      tableRow(sb, (highlight = !highlight), "%&nbsp;of&nbsp;Used&nbsp;DFS", consumed);
-      tableRow(sb, (highlight = !highlight), "<a href='/tables'>Tables</a>", NumberType.commas(Monitor.getTotalTables()));
-      tableRow(sb, (highlight = !highlight), "<a href='/tservers'>Tablet&nbsp;Servers</a>", NumberType.commas(info.tServerInfo.size()));
-      tableRow(sb, (highlight = !highlight), "<a href='/tservers'>Dead&nbsp;Tablet&nbsp;Servers</a>", NumberType.commas(info.deadTabletServers.size()));
-      tableRow(sb, (highlight = !highlight), "Tablets", NumberType.commas(Monitor.getTotalTabletCount()));
-      tableRow(sb, (highlight = !highlight), "Entries", NumberType.commas(Monitor.getTotalEntries()));
-      tableRow(sb, (highlight = !highlight), "Lookups", NumberType.commas(Monitor.getTotalLookups()));
-      tableRow(sb, (highlight = !highlight), "Uptime", Duration.format(System.currentTimeMillis() - Monitor.getStartTime()));
     }
     sb.append("</table>\n");
   }
@@ -311,8 +313,10 @@ public class DefaultServlet extends Basi
       for (DatanodeInfo stat : liveNodes)
         count += stat.getXceiverCount();
       tableRow(sb, (highlight = !highlight), "Xceivers", NumberType.commas(count));
+    } catch (RemoteException ex) {
+      sb.append("<tr><td colspan='2'>Permission&nbsp;Denied</td></tr>\n");
     } catch (Exception ex) {
-      sb.append("<tr><td colspan='2'><span class='error'>Name Node is Down</span></td></tr>\n");
+      sb.append("<tr><td colspan='2'><span class='error'>Down</span></td></tr>\n");
     }
     sb.append("</table>\n");
   }