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 */
018package org.apache.hadoop.hdfs.server.namenode;
019
020import java.util.Map;
021
022import org.apache.hadoop.classification.InterfaceAudience;
023import org.apache.hadoop.classification.InterfaceStability;
024import 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
031public 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 missing blocks on the cluster
151   */
152  public long getNumberOfMissingBlocks();
153  
154  /**
155   * Gets the total number of missing blocks on the cluster with
156   * replication factor 1
157   *
158   * @return the total number of missing blocks on the cluster with
159   * replication factor 1
160   */
161  public long getNumberOfMissingBlocksWithReplicationFactorOne();
162
163  /**
164   * Gets the number of threads.
165   * 
166   * @return the number of threads
167   */
168  public int getThreads();
169
170  /**
171   * Gets the live node information of the cluster.
172   * 
173   * @return the live node information
174   */
175  public String getLiveNodes();
176  
177  /**
178   * Gets the dead node information of the cluster.
179   * 
180   * @return the dead node information
181   */
182  public String getDeadNodes();
183  
184  /**
185   * Gets the decommissioning node information of the cluster.
186   * 
187   * @return the decommissioning node information
188   */
189  public String getDecomNodes();
190  
191  /**
192   * Gets the cluster id.
193   * 
194   * @return the cluster id
195   */
196  public String getClusterId();
197  
198  /**
199   * Gets the block pool id.
200   * 
201   * @return the block pool id
202   */
203  public String getBlockPoolId();
204
205  /**
206   * Get status information about the directories storing image and edits logs
207   * of the NN.
208   * 
209   * @return the name dir status information, as a JSON string.
210   */
211  public String getNameDirStatuses();
212
213  /**
214   * Get Max, Median, Min and Standard Deviation of DataNodes usage.
215   *
216   * @return the DataNode usage information, as a JSON string.
217   */
218  public String getNodeUsage();
219
220  /**
221   * Get status information about the journals of the NN.
222   *
223   * @return the name journal status information, as a JSON string.
224   */
225  public String getNameJournalStatus();
226  
227  /**
228   * Get information about the transaction ID, including the last applied 
229   * transaction ID and the most recent checkpoint's transaction ID
230   */
231  public String getJournalTransactionInfo();
232
233  /**
234   * Gets the NN start time
235   *
236   * @return the NN start time
237   */
238  public String getNNStarted();
239
240  /**
241   * Get the compilation information which contains date, user and branch
242   *
243   * @return the compilation information, as a JSON string.
244   */
245  public String getCompileInfo();
246
247  /**
248   * Get the list of corrupt files
249   *
250   * @return the list of corrupt files, as a JSON string.
251   */
252  public String getCorruptFiles();
253
254  /**
255   * Get the number of distinct versions of live datanodes
256   * 
257   * @return the number of distinct versions of live datanodes
258   */
259  public int getDistinctVersionCount();
260
261  /**
262   * Get the number of live datanodes for each distinct versions
263   * 
264   * @return the number of live datanodes for each distinct versions
265   */
266  public Map<String, Integer> getDistinctVersions();
267  
268}