uk.org.iscream.cms.server.client.monitors
Class CPU__Monitor

java.lang.Object
  extended by java.lang.Thread
      extended by uk.org.iscream.cms.server.client.MonitorSkeleton
          extended by uk.org.iscream.cms.server.client.monitors.CPU__Monitor
All Implemented Interfaces:
Runnable, PluginMonitor

public class CPU__Monitor
extends MonitorSkeleton

This Monitor watches the CPU load for all machines

Version:
$Id: CPU__Monitor.java,v 1.30 2004/08/01 10:40:45 tdb Exp $
Author:
$Author: tdb $

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
private  String[] _attributeNames
          An array of "nice names" for the attributes in _attributes.
private  String[] _attributes
          An array of attributes which we will be checking.
private  HashMap _hosts
          A HashMap of Registers (or groups of Registers), one for each host we're monitoring.
private  String _name
          This is the friendly identifier of the component this class is running in.
 String DESC
          A description of this monitor
 String REVISION
          The current CVS revision of this class
 
Fields inherited from class uk.org.iscream.cms.server.client.MonitorSkeleton
_alerterQueue, _logger, _qID, _running
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
CPU__Monitor()
           
 
Method Summary
 void analysePacket(XMLPacket packet)
          Analyse a packet of data, and generate an alert if necessary.
private  int checkAttributeThreshold(String attributeString, Register reg)
          Checks a piece of current data, and returns the threshold it breaches, if any.
 String getDescription()
          return the String representation of what the monitor does
protected  Queue getQueue()
          Returns a reference to a specific Queue for this monitor.
private  void initAttributeRegsiters(String source, HashMap attributeRegisters)
          Initialises a HashMap of Registers with the current list of attributes.
 String toString()
          Overrides the Object.toString() method to provide clean logging (every class should have this).
 
Methods inherited from class uk.org.iscream.cms.server.client.MonitorSkeleton
checkBooleanConfig, getQueueId, processAlert, run
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REVISION

public final String REVISION
The current CVS revision of this class

See Also:
Constant Field Values

DESC

public final String DESC
A description of this monitor

See Also:
Constant Field Values

_name

private String _name
This is the friendly identifier of the component this class is running in. eg, a Filter may be called "filter1", If this class does not have an owning component, a name from the configuration can be placed here. This name could also be changed to null for utility classes.


_hosts

private HashMap _hosts
A HashMap of Registers (or groups of Registers), one for each host we're monitoring.


_attributes

private String[] _attributes
An array of attributes which we will be checking.


_attributeNames

private String[] _attributeNames
An array of "nice names" for the attributes in _attributes.

Constructor Detail

CPU__Monitor

public CPU__Monitor()
Method Detail

analysePacket

public void analysePacket(XMLPacket packet)
Analyse a packet of data, and generate an alert if necessary.

Specified by:
analysePacket in class MonitorSkeleton
Parameters:
packet - the XMLPacket to analyse

toString

public String toString()
Overrides the Object.toString() method to provide clean logging (every class should have this). This uses the uk.org.iscream.cms.util.NameFormat class to format the toString()

Overrides:
toString in class Thread
Returns:
the name of this class and its CVS revision

getDescription

public String getDescription()
return the String representation of what the monitor does

Specified by:
getDescription in interface PluginMonitor
Specified by:
getDescription in class MonitorSkeleton
Returns:
the description

checkAttributeThreshold

private int checkAttributeThreshold(String attributeString,
                                    Register reg)
Checks a piece of current data, and returns the threshold it breaches, if any.

Parameters:
attributeString - a String representing the current data value
reg - the Register for the host
Returns:
the threshold level breached, if any

initAttributeRegsiters

private void initAttributeRegsiters(String source,
                                    HashMap attributeRegisters)
Initialises a HashMap of Registers with the current list of attributes. This is only used if we are looking at more than one distinct attribute.

Parameters:
source - the host we are looking at
attributeRegisters - a HashMap to put the new Registers in

getQueue

protected Queue getQueue()
Returns a reference to a specific Queue for this monitor. This Queue returns only the data packets (based on type) that we want too look at.

Specified by:
getQueue in class MonitorSkeleton
Returns:
a reference to a Queue


Copyright © 2000-2003 i-scream. All Rights Reserved.