001    /**
002     * Licensed to the Apache Software Foundation (ASF) under one
003     * or more contributor license agreements.  See the NOTICE file
004     * distributed with this work for additional information
005     * regarding copyright ownership.  The ASF licenses this file
006     * to you under the Apache License, Version 2.0 (the
007     * "License"); you may not use this file except in compliance
008     * with the License.  You may obtain a copy of the License at
009     *
010     *     http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing, software
013     * distributed under the License is distributed on an "AS IS" BASIS,
014     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015     * See the License for the specific language governing permissions and
016     * limitations under the License.
017     */
018    package org.apache.hadoop.hdfs.server.namenode;
019    
020    import java.util.Map;
021    
022    import org.apache.hadoop.classification.InterfaceAudience;
023    import org.apache.hadoop.classification.InterfaceStability;
024    import org.apache.hadoop.hdfs.protocol.RollingUpgradeInfo;
025    
026    /**
027     * This is the JMX management interface for namenode information
028     */
029    @InterfaceAudience.Public
030    @InterfaceStability.Stable
031    public interface NameNodeMXBean {
032    
033      /**
034       * Gets the version of Hadoop.
035       * 
036       * @return the version
037       */
038      public String getVersion();
039    
040      /**
041       * Get the version of software running on the Namenode
042       * @return a string representing the version
043       */
044      public String getSoftwareVersion();
045    
046      /**
047       * Gets the used space by data nodes.
048       * 
049       * @return the used space by data nodes
050       */
051      public long getUsed();
052      
053      /**
054       * Gets total non-used raw bytes.
055       * 
056       * @return total non-used raw bytes
057       */
058      public long getFree();
059      
060      /**
061       * Gets total raw bytes including non-dfs used space.
062       * 
063       * @return the total raw bytes including non-dfs used space
064       */
065      public long getTotal();
066      
067      
068      /**
069       * Gets the safemode status
070       * 
071       * @return the safemode status
072       * 
073       */
074      public String getSafemode();
075      
076      /**
077       * Checks if upgrade is finalized.
078       * 
079       * @return true, if upgrade is finalized
080       */
081      public boolean isUpgradeFinalized();
082    
083      /**
084       * Gets the RollingUpgrade information
085       *
086       * @return Rolling upgrade information
087       */
088      public RollingUpgradeInfo.Bean getRollingUpgradeStatus();
089    
090      /**
091       * Gets total used space by data nodes for non DFS purposes such as storing
092       * temporary files on the local file system
093       * 
094       * @return the non dfs space of the cluster
095       */
096      public long getNonDfsUsedSpace();
097      
098      /**
099       * Gets the total used space by data nodes as percentage of total capacity
100       * 
101       * @return the percentage of used space on the cluster.
102       */
103      public float getPercentUsed();
104      
105      /**
106       * Gets the total remaining space by data nodes as percentage of total 
107       * capacity
108       * 
109       * @return the percentage of the remaining space on the cluster
110       */
111      public float getPercentRemaining();
112    
113      /**
114       * Returns the amount of cache used by the datanode (in bytes).
115       */
116      public long getCacheUsed();
117    
118      /**
119       * Returns the total cache capacity of the datanode (in bytes).
120       */
121      public long getCacheCapacity();
122      
123      /**
124       * Get the total space used by the block pools of this namenode
125       */
126      public long getBlockPoolUsedSpace();
127      
128      /**
129       * Get the total space used by the block pool as percentage of total capacity
130       */
131      public float getPercentBlockPoolUsed();
132        
133      /**
134       * Gets the total numbers of blocks on the cluster.
135       * 
136       * @return the total number of blocks of the cluster
137       */
138      public long getTotalBlocks();
139      
140      /**
141       * Gets the total number of files on the cluster
142       * 
143       * @return the total number of files on the cluster
144       */
145      public long getTotalFiles();
146      
147      /**
148       * Gets the total number of missing blocks on the cluster
149       * 
150       * @return the total number of files and blocks on the cluster
151       */
152      public long getNumberOfMissingBlocks();
153      
154      /**
155       * Gets the number of threads.
156       * 
157       * @return the number of threads
158       */
159      public int getThreads();
160    
161      /**
162       * Gets the live node information of the cluster.
163       * 
164       * @return the live node information
165       */
166      public String getLiveNodes();
167      
168      /**
169       * Gets the dead node information of the cluster.
170       * 
171       * @return the dead node information
172       */
173      public String getDeadNodes();
174      
175      /**
176       * Gets the decommissioning node information of the cluster.
177       * 
178       * @return the decommissioning node information
179       */
180      public String getDecomNodes();
181      
182      /**
183       * Gets the cluster id.
184       * 
185       * @return the cluster id
186       */
187      public String getClusterId();
188      
189      /**
190       * Gets the block pool id.
191       * 
192       * @return the block pool id
193       */
194      public String getBlockPoolId();
195    
196      /**
197       * Get status information about the directories storing image and edits logs
198       * of the NN.
199       * 
200       * @return the name dir status information, as a JSON string.
201       */
202      public String getNameDirStatuses();
203    
204      /**
205       * Get Max, Median, Min and Standard Deviation of DataNodes usage.
206       *
207       * @return the DataNode usage information, as a JSON string.
208       */
209      public String getNodeUsage();
210    
211      /**
212       * Get status information about the journals of the NN.
213       *
214       * @return the name journal status information, as a JSON string.
215       */
216      public String getNameJournalStatus();
217      
218      /**
219       * Get information about the transaction ID, including the last applied 
220       * transaction ID and the most recent checkpoint's transaction ID
221       */
222      public String getJournalTransactionInfo();
223    
224      /**
225       * Gets the NN start time
226       *
227       * @return the NN start time
228       */
229      public String getNNStarted();
230    
231      /**
232       * Get the compilation information which contains date, user and branch
233       *
234       * @return the compilation information, as a JSON string.
235       */
236      public String getCompileInfo();
237    
238      /**
239       * Get the list of corrupt files
240       *
241       * @return the list of corrupt files, as a JSON string.
242       */
243      public String getCorruptFiles();
244    
245      /**
246       * Get the number of distinct versions of live datanodes
247       * 
248       * @return the number of distinct versions of live datanodes
249       */
250      public int getDistinctVersionCount();
251    
252      /**
253       * Get the number of live datanodes for each distinct versions
254       * 
255       * @return the number of live datanodes for each distinct versions
256       */
257      public Map<String, Integer> getDistinctVersions();
258      
259    }