org.apache.hadoop.contrib.failmon
Class EventRecord

java.lang.Object
  extended by org.apache.hadoop.contrib.failmon.EventRecord

public class EventRecord
extends Object

Objects of this class represent metrics collected for a specific hardware source. Each EventRecord contains a HashMap of (key, value) pairs, each of which represents a property of the metered value. For instance, when parsing a log file, an EventRecord is created for each log entry, which contains the hostname and the ip addresses of the node, timestamp of the log entry, the actual message etc. Each and every EventRecord contains the hostname of the machine on which it was collected, its IP address and the time of collection. The main purpose of this class is to provide a uniform format for records collected from various system compontents (logs, ifconfig, smartmontools, lm-sensors etc). All metric values are converted into this format after they are collected by a Monitored object.


Constructor Summary
EventRecord()
          Create the EventRecord with no fields other than "invalid" as the hostname.
EventRecord(String _hostname, Object[] _ips, Calendar _timestamp, String _type, String _logLevel, String _source, String _message)
          Create the EventRecord given the most common properties among different metric types.
 
Method Summary
 Object get(String fieldName)
          Get the value of a property of the EventRecord.
 HashMap<String,Object> getMap()
          Return the HashMap of properties of the EventRecord.
 boolean isValid()
          Check if the EventRecord is a valid one, i.e., whether it represents meaningful metric values.
 void set(String fieldName, Object fieldValue)
          Set the value of a property of the EventRecord.
 String toString()
          Creates and returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EventRecord

public EventRecord(String _hostname,
                   Object[] _ips,
                   Calendar _timestamp,
                   String _type,
                   String _logLevel,
                   String _source,
                   String _message)
Create the EventRecord given the most common properties among different metric types.


EventRecord

public EventRecord()
Create the EventRecord with no fields other than "invalid" as the hostname. This is only used as a dummy.

Method Detail

getMap

public final HashMap<String,Object> getMap()
Return the HashMap of properties of the EventRecord.

Returns:
a HashMap that contains all properties of the record.

set

public void set(String fieldName,
                Object fieldValue)
Set the value of a property of the EventRecord.

Parameters:
fieldName - the name of the property to set
fieldValue - the value of the property to set

get

public Object get(String fieldName)
Get the value of a property of the EventRecord. If the property with the specific key is not found, null is returned.

Parameters:
fieldName - the name of the property to get.

isValid

public boolean isValid()
Check if the EventRecord is a valid one, i.e., whether it represents meaningful metric values.

Returns:
true if the EventRecord is a valid one, false otherwise.

toString

public String toString()
Creates and returns a string representation of the object.

Overrides:
toString in class Object
Returns:
a String representation of the object


Copyright © 2009 The Apache Software Foundation