org.apache.hadoop.contrib.failmon
Class SMARTParser

java.lang.Object
  extended by org.apache.hadoop.contrib.failmon.ShellParser
      extended by org.apache.hadoop.contrib.failmon.SMARTParser
All Implemented Interfaces:
Monitored

public class SMARTParser
extends ShellParser

Objects of this class parse the output of smartmontools to gather information about the state of disks in the system. The smartmontools utility reads the S.M.A.R.T. attributes from the disk devices and reports them to the user. Note that since running smartctl requires superuser provileges, one should grand sudo privileges to the running user for the command smartctl (without a password). Alternatively, one can set up a cron job that periodically dumps the output of smartctl into a user-readable file. See the configuration file for details.


Constructor Summary
SMARTParser()
          Constructs a SMARTParser and reads the list of disk devices to query
 
Method Summary
 String getInfo()
          Return a String with information about this class
 EventRecord[] monitor()
          Invokes query() to do the parsing and handles parsing errors for each one of the disks specified in the configuration.
 EventRecord query(String device)
          Reads and parses the output of smartctl for a specified disk and creates an appropriate EventRecord that holds the desirable information for it.
 
Methods inherited from class org.apache.hadoop.contrib.failmon.ShellParser
findAll, findPattern, monitor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SMARTParser

public SMARTParser()
Constructs a SMARTParser and reads the list of disk devices to query

Method Detail

query

public EventRecord query(String device)
                  throws Exception
Reads and parses the output of smartctl for a specified disk and creates an appropriate EventRecord that holds the desirable information for it. Since the output of smartctl is different for different kinds of disks, we try to identify as many attributes as posssible for all known output formats.

Specified by:
query in class ShellParser
Parameters:
device - the disk device name to query
Returns:
the EventRecord created
Throws:
Exception

monitor

public EventRecord[] monitor()
Invokes query() to do the parsing and handles parsing errors for each one of the disks specified in the configuration.

Specified by:
monitor in interface Monitored
Specified by:
monitor in class ShellParser
Returns:
an array of EventRecords that holds one element that represents the current state of the disk devices.

getInfo

public String getInfo()
Return a String with information about this class

Returns:
A String describing this class


Copyright © 2009 The Apache Software Foundation