Hyperic HQ Plugin API v. 4.4.0.2

org.hyperic.hq.agent.server
Class AgentDaemon

java.lang.Object
  extended by org.hyperic.hq.agent.server.monitor.AgentMonitorSimple
      extended by org.hyperic.hq.agent.server.AgentDaemon
All Implemented Interfaces:
AgentMonitorInterface

public class AgentDaemon
extends AgentMonitorSimple

The main daemon which processes requests from clients. The Agent has the responsibility of being the 'live' entity on remote machines. Bootstrap configuration is done entirely within this class.


Nested Class Summary
static class AgentDaemon.RunnableAgent
           
 
Field Summary
static java.lang.String NOTIFY_AGENT_DOWN
           
static java.lang.String NOTIFY_AGENT_FAILED_START
           
static java.lang.String NOTIFY_AGENT_UP
           
static java.lang.String PROP_CERTDN
           
static java.lang.String PROP_HOSTNAME
           
 
Fields inherited from interface org.hyperic.hq.agent.server.monitor.AgentMonitorInterface
KEY_KEYS, KEY_TYPES
 
Method Summary
 void configure(AgentConfig cfg)
          Configure the agent to run with new parameters.
static AgentStorageProvider createStorageProvider(AgentConfig cfg)
           
 void die()
          Tell the Agent to close all connections, and die.
 AgentTransportLifecycle getAgentTransportLifecycle()
          Retrieve the agent transport lifecycle.
 AgentConfig getBootConfig()
          Get the bootstrap configuration that the Agent was initialized with.
 java.lang.String getCurrentAgentBundle()
           
 double getJVMFreeMemory()
          MONITOR METHOD: Get the JVMs free memory
 double getJVMTotalMemory()
          MONITOR METHOD: Get the JVMs total memory
static AgentDaemon getMainInstance()
           
 java.lang.String[] getMonitors()
          MONITOR METHOD: Get the monitors which are registered with the agent
 AgentMonitorValue[] getMonitorValues(java.lang.String monitorName, java.lang.String[] monitorKeys)
           
 double getNumActiveThreads()
          MONITOR METHOD: Get the # of active threads
 PluginManager getPluginManager(java.lang.String type)
          Retreive a plugin manager.
 double getStartTime()
          MONITOR METHOD: Get the time the agent started
 AgentStorageProvider getStorageProvider()
          Retreive the storage object in use by the Agent.
 double getUpTime()
          MONITOR METHOD: Get the time the agent has been running
 boolean isRunning()
          Determine if the Agent is currently running.
static AgentDaemon newInstance(AgentConfig cfg)
          Create a new AgentDaemon object based on a passed configuration.
 void registerMonitor(java.lang.String monitorName, AgentMonitorInterface monitor)
           
 void registerNotifyHandler(AgentNotificationHandler handler, java.lang.String msgClass)
          Register an object to be called when a notifiation of the specified message class occurs;
 void sendNotification(java.lang.String msgClass, java.lang.String message)
          Send a notification event to all notification handlers which have registered with the specified message class.
 void setConnectionListener(AgentConnectionListener newListener)
          A stub API which allows handlers to set the connection listener that the agent uses.
 void start()
          Start the Agent's listening process.
 
Methods inherited from class org.hyperic.hq.agent.server.monitor.AgentMonitorSimple
getMonitorKeys, getMonitorTypes, getMonitorValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOTIFY_AGENT_UP

public static final java.lang.String NOTIFY_AGENT_UP

NOTIFY_AGENT_DOWN

public static final java.lang.String NOTIFY_AGENT_DOWN

NOTIFY_AGENT_FAILED_START

public static final java.lang.String NOTIFY_AGENT_FAILED_START

PROP_CERTDN

public static final java.lang.String PROP_CERTDN
See Also:
Constant Field Values

PROP_HOSTNAME

public static final java.lang.String PROP_HOSTNAME
See Also:
Constant Field Values
Method Detail

getMainInstance

public static AgentDaemon getMainInstance()

newInstance

public static AgentDaemon newInstance(AgentConfig cfg)
                               throws AgentConfigException
Create a new AgentDaemon object based on a passed configuration.

Parameters:
cfg - Configuration the new Agent should use.
Throws:
AgentConfigException - indicating the passed configuration is invalid.

getPluginManager

public PluginManager getPluginManager(java.lang.String type)
                               throws AgentRunningException,
                                      PluginException
Retreive a plugin manager.

Parameters:
type - The type of plugin manager that is wanted
Returns:
The plugin manager for the type given
Throws:
AgentRunningException - Indicating the agent was not running when the request was made.
PluginException - If the requested manager was not found.

getStorageProvider

public AgentStorageProvider getStorageProvider()
                                        throws AgentRunningException
Retreive the storage object in use by the Agent. This routine should be used primarily by server handlers wishing to do any kind of storage.

Returns:
The storage provider object used by the Agent
Throws:
AgentRunningException - indicating the Agent was not running when the request was made.

getBootConfig

public AgentConfig getBootConfig()
Get the bootstrap configuration that the Agent was initialized with.

Returns:
The configuration object used to initialize the Agent.

getCurrentAgentBundle

public java.lang.String getCurrentAgentBundle()
Returns:
The current agent bundle name.

getAgentTransportLifecycle

public AgentTransportLifecycle getAgentTransportLifecycle()
                                                   throws AgentRunningException
Retrieve the agent transport lifecycle.

Throws:
AgentRunningException - indicating the Agent was not running when the request was made.

registerNotifyHandler

public void registerNotifyHandler(AgentNotificationHandler handler,
                                  java.lang.String msgClass)
Register an object to be called when a notifiation of the specified message class occurs;

Parameters:
handler - Handler to call to process the notification message
msgClass - Message class to register with

sendNotification

public void sendNotification(java.lang.String msgClass,
                             java.lang.String message)
Send a notification event to all notification handlers which have registered with the specified message class.

Parameters:
msgClass - Message class that the message belongs to
message - Message to send

createStorageProvider

public static AgentStorageProvider createStorageProvider(AgentConfig cfg)
                                                  throws AgentConfigException
Throws:
AgentConfigException

configure

public void configure(AgentConfig cfg)
               throws AgentRunningException,
                      AgentConfigException
Configure the agent to run with new parameters. This routine will load jars, open sockets, and other resources in preparation for running.

Parameters:
cfg - Configuration to use to configure the Agent
Throws:
AgentRunningException - indicating the Agent was running when a reconfiguration was attempted.
AgentConfigException - indicating the configuration was invalid.

getMonitors

public java.lang.String[] getMonitors()
                               throws AgentMonitorException
MONITOR METHOD: Get the monitors which are registered with the agent

Throws:
AgentMonitorException

getStartTime

public double getStartTime()
                    throws AgentMonitorException
MONITOR METHOD: Get the time the agent started

Throws:
AgentMonitorException

getUpTime

public double getUpTime()
                 throws AgentMonitorException
MONITOR METHOD: Get the time the agent has been running

Throws:
AgentMonitorException

getJVMTotalMemory

public double getJVMTotalMemory()
                         throws AgentMonitorException
MONITOR METHOD: Get the JVMs total memory

Throws:
AgentMonitorException

getJVMFreeMemory

public double getJVMFreeMemory()
                        throws AgentMonitorException
MONITOR METHOD: Get the JVMs free memory

Throws:
AgentMonitorException

getNumActiveThreads

public double getNumActiveThreads()
                           throws AgentMonitorException
MONITOR METHOD: Get the # of active threads

Throws:
AgentMonitorException

registerMonitor

public void registerMonitor(java.lang.String monitorName,
                            AgentMonitorInterface monitor)

getMonitorValues

public AgentMonitorValue[] getMonitorValues(java.lang.String monitorName,
                                            java.lang.String[] monitorKeys)

isRunning

public boolean isRunning()
Determine if the Agent is currently running.

Returns:
true if the Agent is running (listening on its port)

die

public void die()
         throws AgentRunningException
Tell the Agent to close all connections, and die.

Throws:
AgentRunningException - indicating the Agent was not running when die() was called.

setConnectionListener

public void setConnectionListener(AgentConnectionListener newListener)
                           throws AgentRunningException
A stub API which allows handlers to set the connection listener that the agent uses.

Throws:
AgentRunningException

start

public void start()
           throws AgentStartException
Start the Agent's listening process. This routine blocks for the entire execution of the Agent.

Throws:
AgentStartException - indicating the Agent was unable to start, or one of the plugins failed to start.

Hyperic HQ Plugin API v. 4.4.0.2

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.