org.apache.hadoop.fs
Class DF

java.lang.Object
  extended by org.apache.hadoop.util.Shell
      extended by org.apache.hadoop.fs.DF

public class DF
extends Shell

Filesystem disk space usage statistics. Uses the unix 'df' program to get mount points, and java.io.File for space utilization. Tested on Linux, FreeBSD, Cygwin.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.hadoop.util.Shell
Shell.ExitCodeException, Shell.ShellCommandExecutor
 
Field Summary
static long DF_INTERVAL_DEFAULT
          Default DF refresh interval.
 
Fields inherited from class org.apache.hadoop.util.Shell
LOG, SET_GROUP_COMMAND, SET_OWNER_COMMAND, SET_PERMISSION_COMMAND, timeOutInterval, ULIMIT_COMMAND, USER_NAME_COMMAND, WINDOWS
 
Constructor Summary
DF(File path, Configuration conf)
           
DF(File path, long dfInterval)
           
 
Method Summary
 long getAvailable()
           
 long getCapacity()
           
 String getDirPath()
           
protected  String[] getExecString()
          return an array containing the command name & its parameters
 String getFilesystem()
           
 String getMount()
           
 int getPercentUsed()
           
 long getUsed()
           
static void main(String[] args)
           
protected  void parseExecResult(BufferedReader lines)
          Parse the execution result
 String toString()
           
 
Methods inherited from class org.apache.hadoop.util.Shell
execCommand, execCommand, execCommand, getExitCode, getGET_PERMISSION_COMMAND, getGroupsCommand, getGroupsForUserCommand, getProcess, getUlimitMemoryCommand, getUlimitMemoryCommand, getUsersForNetgroupCommand, isTimedOut, run, setEnvironment, setWorkingDirectory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DF_INTERVAL_DEFAULT

public static final long DF_INTERVAL_DEFAULT
Default DF refresh interval.

See Also:
Constant Field Values
Constructor Detail

DF

public DF(File path,
          Configuration conf)
   throws IOException
Throws:
IOException

DF

public DF(File path,
          long dfInterval)
   throws IOException
Throws:
IOException
Method Detail

getDirPath

public String getDirPath()
Returns:
the canonical path to the volume we're checking.

getFilesystem

public String getFilesystem()
                     throws IOException
Returns:
a string indicating which filesystem volume we're checking.
Throws:
IOException

getCapacity

public long getCapacity()
Returns:
the capacity of the measured filesystem in bytes.

getUsed

public long getUsed()
Returns:
the total used space on the filesystem in bytes.

getAvailable

public long getAvailable()
Returns:
the usable space remaining on the filesystem in bytes.

getPercentUsed

public int getPercentUsed()
Returns:
the amount of the volume full, as a percent.

getMount

public String getMount()
                throws IOException
Returns:
the filesystem mount point for the indicated volume
Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object

getExecString

protected String[] getExecString()
Description copied from class: Shell
return an array containing the command name & its parameters

Specified by:
getExecString in class Shell

parseExecResult

protected void parseExecResult(BufferedReader lines)
                        throws IOException
Description copied from class: Shell
Parse the execution result

Specified by:
parseExecResult in class Shell
Throws:
IOException

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception


Copyright © 2009 The Apache Software Foundation