snmpmonitor
Class Check

java.lang.Object
  |
  +--snmpmonitor.Check

public class Check
extends java.lang.Object


Constructor Summary
Check(int interval)
          Create a check that does not depend on an SNMP peer.
Check(Peer peer, int interval)
          Create a check for a given SNMP peer agent and with a given interval.
Check(java.lang.String name, int interval)
          Create a check with a given name that does not depend on an SNMP peer.
Check(java.lang.String name, Peer peer, int interval)
          Create a check of a given name for a given SNMP peer agent and with a given interval.
 
Method Summary
 void check()
          Run the actual check.
 int getInterval()
          Return the interval used for this check.
 java.lang.String getName()
          Return the name of this check.
 java.util.Date getNextDate()
          Get the date when this check has to be run the next time, based on the time when this check was called last time and the interval.
 Peer getPeer()
          Return the SNMP peer of this check.
 void init()
          Initialize this check.
 void setName(java.lang.String name)
          Set the name of this check.
 void update()
          Update the time of the last check run.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Check

public Check(java.lang.String name,
             int interval)
Create a check with a given name that does not depend on an SNMP peer.
Parameters:
name - The name of this check.
interval - The interval in seconds to be used for this check.

Check

public Check(int interval)
Create a check that does not depend on an SNMP peer.
Parameters:
interval - The interval in seconds to be used for this check.

Check

public Check(java.lang.String name,
             Peer peer,
             int interval)
Create a check of a given name for a given SNMP peer agent and with a given interval.
Parameters:
peer - The SNMP peer to be checked.
interval - The interval in seconds to be used for this check.

Check

public Check(Peer peer,
             int interval)
Create a check for a given SNMP peer agent and with a given interval.
Parameters:
peer - The SNMP peer to be checked.
interval - The interval in seconds to be used for this check.
Method Detail

init

public void init()
Initialize this check. This method is implicitly called by the constructor. It can be useful for intializing values read from counter objects or other situations where only deltas/changes are relevant.

check

public void check()
Run the actual check. This method has to implement all steps of the actual check for the agent host given by the private variable connection.

update

public void update()
Update the time of the last check run. This method should be called at the end of check().

getInterval

public int getInterval()
Return the interval used for this check.
Returns:
The interval in seconds.

getPeer

public Peer getPeer()
Return the SNMP peer of this check.

getName

public java.lang.String getName()
Return the name of this check.

setName

public void setName(java.lang.String name)
Set the name of this check.
Parameters:
The - new name.

getNextDate

public java.util.Date getNextDate()
Get the date when this check has to be run the next time, based on the time when this check was called last time and the interval.
Returns:
A Date object that represents the time when this check has to be fired the next time.