## org.apache.hadoop.contrib.failmon
Class NICParser

    java.lang.Object
      org.apache.hadoop.contrib.failmon.ShellParser
          org.apache.hadoop.contrib.failmon.NICParser

All Implemented Interfaces:
  Monitored

    public class NICParser

extends ShellParser

Objects of this class parse the output of ifconfig to gather information about present Network Interface Cards in the system. The list of NICs to poll is specified in the configuration file.

Constructor Summary
`NICParser()` Constructs a NICParser and reads the list of NICs 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 NICs specified in the configuration.
`EventRecord` `query(String device)` Reads and parses the output of ifconfig for a specified NIC 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

### NICParser

    public NICParser()

  Constructs a NICParser and reads the list of NICs to query

Method Detail

### query

    public EventRecord query(String device)
                      throws UnknownHostException

  Reads and parses the output of ifconfig for a specified NIC and creates an appropriate EventRecord that holds the desirable information for it.

  Specified by:
    `query` in class `ShellParser`
  Parameters:
    `device` - the NIC device name to query
  Returns:
    the EventRecord created
  Throws:
    `UnknownHostException`

### monitor

    public EventRecord[] monitor()

  Invokes query() to do the parsing and handles parsing errors for each one of the NICs 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 network interfaces.

### getInfo

    public String getInfo()

  Return a String with information about this class

  Returns:
    A String describing this class

Copyright © 2009 The Apache Software Foundation