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;
024
025/**
026 * This is the JMX management interface for namenode information
027 */
028@InterfaceAudience.Public
029@InterfaceStability.Stable
030public interface NameNodeMXBean {
031
032  /**
033   * Gets the version of Hadoop.
034   * 
035   * @return the version
036   */
037  public String getVersion();
038
039  /**
040   * Get the version of software running on the Namenode
041   * @return a string representing the version
042   */
043  public String getSoftwareVersion();
044
045  /**
046   * Gets the used space by data nodes.
047   * 
048   * @return the used space by data nodes
049   */
050  public long getUsed();
051  
052  /**
053   * Gets total non-used raw bytes.
054   * 
055   * @return total non-used raw bytes
056   */
057  public long getFree();
058  
059  /**
060   * Gets total raw bytes including non-dfs used space.
061   * 
062   * @return the total raw bytes including non-dfs used space
063   */
064  public long getTotal();
065  
066  
067  /**
068   * Gets the safemode status
069   * 
070   * @return the safemode status
071   * 
072   */
073  public String getSafemode();
074  
075  /**
076   * Checks if upgrade is finalized.
077   * 
078   * @return true, if upgrade is finalized
079   */
080  public boolean isUpgradeFinalized();
081  
082  /**
083   * Gets total used space by data nodes for non DFS purposes such as storing
084   * temporary files on the local file system
085   * 
086   * @return the non dfs space of the cluster
087   */
088  public long getNonDfsUsedSpace();
089  
090  /**
091   * Gets the total used space by data nodes as percentage of total capacity
092   * 
093   * @return the percentage of used space on the cluster.
094   */
095  public float getPercentUsed();
096  
097  /**
098   * Gets the total remaining space by data nodes as percentage of total 
099   * capacity
100   * 
101   * @return the percentage of the remaining space on the cluster
102   */
103  public float getPercentRemaining();
104
105  /**
106   * Returns the amount of cache used by the datanode (in bytes).
107   */
108  public long getCacheUsed();
109
110  /**
111   * Returns the total cache capacity of the datanode (in bytes).
112   */
113  public long getCacheCapacity();
114  
115  /**
116   * Get the total space used by the block pools of this namenode
117   */
118  public long getBlockPoolUsedSpace();
119  
120  /**
121   * Get the total space used by the block pool as percentage of total capacity
122   */
123  public float getPercentBlockPoolUsed();
124    
125  /**
126   * Gets the total numbers of blocks on the cluster.
127   * 
128   * @return the total number of blocks of the cluster
129   */
130  public long getTotalBlocks();
131  
132  /**
133   * Gets the total number of files on the cluster
134   * 
135   * @return the total number of files on the cluster
136   */
137  public long getTotalFiles();
138  
139  /**
140   * Gets the total number of missing blocks on the cluster
141   * 
142   * @return the total number of files and blocks on the cluster
143   */
144  public long getNumberOfMissingBlocks();
145  
146  /**
147   * Gets the number of threads.
148   * 
149   * @return the number of threads
150   */
151  public int getThreads();
152
153  /**
154   * Gets the live node information of the cluster.
155   * 
156   * @return the live node information
157   */
158  public String getLiveNodes();
159  
160  /**
161   * Gets the dead node information of the cluster.
162   * 
163   * @return the dead node information
164   */
165  public String getDeadNodes();
166  
167  /**
168   * Gets the decommissioning node information of the cluster.
169   * 
170   * @return the decommissioning node information
171   */
172  public String getDecomNodes();
173  
174  /**
175   * Gets the cluster id.
176   * 
177   * @return the cluster id
178   */
179  public String getClusterId();
180  
181  /**
182   * Gets the block pool id.
183   * 
184   * @return the block pool id
185   */
186  public String getBlockPoolId();
187
188  /**
189   * Get status information about the directories storing image and edits logs
190   * of the NN.
191   * 
192   * @return the name dir status information, as a JSON string.
193   */
194  public String getNameDirStatuses();
195
196  /**
197   * Get Max, Median, Min and Standard Deviation of DataNodes usage.
198   *
199   * @return the DataNode usage information, as a JSON string.
200   */
201  public String getNodeUsage();
202
203  /**
204   * Get status information about the journals of the NN.
205   *
206   * @return the name journal status information, as a JSON string.
207   */
208  public String getNameJournalStatus();
209  
210  /**
211   * Get information about the transaction ID, including the last applied 
212   * transaction ID and the most recent checkpoint's transaction ID
213   */
214  public String getJournalTransactionInfo();
215
216  /**
217   * Gets the NN start time
218   *
219   * @return the NN start time
220   */
221  public String getNNStarted();
222
223  /**
224   * Get the compilation information which contains date, user and branch
225   *
226   * @return the compilation information, as a JSON string.
227   */
228  public String getCompileInfo();
229
230  /**
231   * Get the list of corrupt files
232   *
233   * @return the list of corrupt files, as a JSON string.
234   */
235  public String getCorruptFiles();
236
237  /**
238   * Get the number of distinct versions of live datanodes
239   * 
240   * @return the number of distinct versions of live datanodes
241   */
242  public int getDistinctVersionCount();
243
244  /**
245   * Get the number of live datanodes for each distinct versions
246   * 
247   * @return the number of live datanodes for each distinct versions
248   */
249  public Map<String, Integer> getDistinctVersions();
250  
251}