entropy.monitoring
Class ConfigurationAdapter

java.lang.Object
  extended by entropy.monitoring.ConfigurationAdapter
Direct Known Subclasses:
GangliaConfigurationAdapter

public abstract class ConfigurationAdapter
extends Object

Extract a configuration from a monitoring system.

Author:
Fabien Hermenier

Field Summary
static int DEFAULT_CPU_STEP
          Default step to round CPU capacity and consumption.
 
Constructor Summary
ConfigurationAdapter()
          Make a new Configuration adapter.
 
Method Summary
abstract  Configuration extractConfiguration()
          Get the current configuration.
static int getCPUCapacity(int mhz, int nbCPU)
          Get a CPU value using current metrics and default step.
static int getCPUConsumption(float cpuPct, Node host)
          Get the CPU consumption of a virtual machine.
 List<String> getNodesBlackList()
          Get the nodes black list.
 List<String> getNodesWhiteList()
          Get the nodes white list.
static int round(int nb, int step)
          Return the closest number, with a certain step.
 void setNodesBlackList(List<String> nodes)
          Set the nodes black list.
 void setNodesWhiteList(List<String> nodes)
          Set the nodes white list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CPU_STEP

public static final int DEFAULT_CPU_STEP
Default step to round CPU capacity and consumption.

See Also:
Constant Field Values
Constructor Detail

ConfigurationAdapter

public ConfigurationAdapter()
Make a new Configuration adapter.

Method Detail

extractConfiguration

public abstract Configuration extractConfiguration()
                                            throws MonitoringException
Get the current configuration.

Returns:
a consistent configuration
Throws:
MonitoringException - if an error occurs

round

public static int round(int nb,
                        int step)
Return the closest number, with a certain step.

Parameters:
nb - the number
step - the step
Returns:
a number

getCPUCapacity

public static int getCPUCapacity(int mhz,
                                 int nbCPU)
Get a CPU value using current metrics and default step.

Parameters:
mhz - The CPU frequency
nbCPU - the number of CPU allocated
Returns:
round(mhz * nbCPU, DEFAULT_CPU_STEP);

getCPUConsumption

public static int getCPUConsumption(float cpuPct,
                                    Node host)
Get the CPU consumption of a virtual machine. The virtual machine must have 1 virtual CPU.

Parameters:
cpuPct - the percentage of CPU consumed by the virtual machine
host - the host of the virtual machine
Returns:
the CPU consumption

setNodesBlackList

public void setNodesBlackList(List<String> nodes)
Set the nodes black list.

Parameters:
nodes - the list

getNodesBlackList

public List<String> getNodesBlackList()
Get the nodes black list.

Returns:
a list, that may be empty

setNodesWhiteList

public void setNodesWhiteList(List<String> nodes)
Set the nodes white list.

Parameters:
nodes - the list

getNodesWhiteList

public List<String> getNodesWhiteList()
Get the nodes white list.

Returns:
a list, that may be empty


Copyright © 2010. All Rights Reserved.