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    
025    /**
026     * This is the JMX management interface for namenode information
027     */
028    @InterfaceAudience.Public
029    @InterfaceStability.Stable
030    public 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       * Get the total space used by the block pools of this namenode
107       */
108      public long getBlockPoolUsedSpace();
109      
110      /**
111       * Get the total space used by the block pool as percentage of total capacity
112       */
113      public float getPercentBlockPoolUsed();
114        
115      /**
116       * Gets the total numbers of blocks on the cluster.
117       * 
118       * @return the total number of blocks of the cluster
119       */
120      public long getTotalBlocks();
121      
122      /**
123       * Gets the total number of files on the cluster
124       * 
125       * @return the total number of files on the cluster
126       */
127      public long getTotalFiles();
128      
129      /**
130       * Gets the total number of missing blocks on the cluster
131       * 
132       * @return the total number of files and blocks on the cluster
133       */
134      public long getNumberOfMissingBlocks();
135      
136      /**
137       * Gets the number of threads.
138       * 
139       * @return the number of threads
140       */
141      public int getThreads();
142    
143      /**
144       * Gets the live node information of the cluster.
145       * 
146       * @return the live node information
147       */
148      public String getLiveNodes();
149      
150      /**
151       * Gets the dead node information of the cluster.
152       * 
153       * @return the dead node information
154       */
155      public String getDeadNodes();
156      
157      /**
158       * Gets the decommissioning node information of the cluster.
159       * 
160       * @return the decommissioning node information
161       */
162      public String getDecomNodes();
163      
164      /**
165       * Gets the cluster id.
166       * 
167       * @return the cluster id
168       */
169      public String getClusterId();
170      
171      /**
172       * Gets the block pool id.
173       * 
174       * @return the block pool id
175       */
176      public String getBlockPoolId();
177    
178      /**
179       * Get status information about the directories storing image and edits logs
180       * of the NN.
181       * 
182       * @return the name dir status information, as a JSON string.
183       */
184      public String getNameDirStatuses();
185      
186      /**
187       * Get information about the transaction ID, including the last applied 
188       * transaction ID and the most recent checkpoint's transaction ID
189       */
190      public String getJournalTransactionInfo();
191    
192      /**
193       * Get the number of distinct versions of live datanodes
194       * 
195       * @return the number of distinct versions of live datanodes
196       */
197      public int getDistinctVersionCount();
198    
199      /**
200       * Get the number of live datanodes for each distinct versions
201       * 
202       * @return the number of live datanodes for each distinct versions
203       */
204      public Map<String, Integer> getDistinctVersions();
205      
206    }