|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.rhq.enterprise.agent.AgentManagement
public class AgentManagement
This is the management layer for the agent. This is the MBean that is used to manage the agent itself. It emits the agent's metric data.
| Field Summary | |
|---|---|
static ObjectName |
singletonObjectName
|
| Fields inherited from interface org.rhq.enterprise.agent.AgentManagementMBean |
|---|
BASE_OBJECT_NAME, JMX_DOMAIN, KEY_NAME, PLUGIN_INFO_MD5, PLUGIN_INFO_NAME, PLUGIN_INFO_PATH, PLUGIN_INFO_SIZE, PLUGIN_INFO_TIMESTAMP |
| Constructor Summary | |
|---|---|
AgentManagement(AgentMain agent)
Constructor for AgentManagement. |
|
| Method Summary | |
|---|---|
void |
downloadLatestFailoverList()
Tells the agent to download an updated server failover list. |
OperationResult |
executeAvailabilityScan(Boolean changesOnly)
Asks the agent's plugin container to execute an availability scan and returns the results. |
String |
executePromptCommand(String command)
Executes an agent prompt command. |
Properties |
getAgentConfiguration()
Returns the entire set of agent configuration preferences. |
String |
getAgentHomeDirectory()
Returns the directory that is considered the "agent home" (i.e. |
long |
getAgentServerClockDifference()
Returns the number of milliseconds this agent thinks its clock is ahead or behind from its server's clock. |
long |
getAverageExecutionTimeReceived()
|
long |
getAverageExecutionTimeSent()
|
long |
getCurrentTime()
Returns the current time, as it is known to the agent. |
int |
getJVMActiveThreads()
Returns the number of currently active threads in the agent's JVM. |
long |
getJVMFreeMemory()
Returns the agent JVM's free memory as reported by Runtime.getRuntime().freeMemory(). |
long |
getJVMTotalMemory()
Returns the agent JVM's total memory as reported by Runtime.getRuntime().totalMemory(). |
MBeanServer |
getMBeanServer()
Returns the MBeanServer where this MBean is registered; null if this MBean is not registered. |
int |
getNumberAgentRestarts()
Returns the number of times the agent has been restarted for the entire lifetime of the agent's JVM. |
long |
getNumberCommandsActiveSent()
|
long |
getNumberCommandsInQueue()
|
long |
getNumberCommandsSpooled()
|
long |
getNumberFailedCommandsReceived()
|
long |
getNumberFailedCommandsSent()
|
long |
getNumberSuccessfulCommandsReceived()
|
long |
getNumberSuccessfulCommandsSent()
|
long |
getNumberTotalCommandsReceived()
|
long |
getNumberTotalCommandsSent()
Combines the number of successful and failed commands sent. |
ObjectName |
getObjectName()
This is the name that the MBean is registered under. |
String |
getReasonForLastRestart()
Returns the code that indicates why the agent was last restarted. |
long |
getUptime()
Returns the number of seconds the agent has been started - this resets everytime the agent is shutdown. |
String |
getVersion()
Returns the agent's version string. |
boolean |
isSending()
|
void |
mergeIntoAgentConfiguration(Properties config)
The given set of agent configuration preferences (in the form of name/value pairs in a Properties object) is added to the current set of agent configuration preferences. |
void |
postDeregister()
|
void |
postRegister(Boolean registrationDone)
|
void |
preDeregister()
|
ObjectName |
preRegister(MBeanServer server,
ObjectName name)
|
void |
removeFromAgentConfiguration(List<String> preferenceNames)
Given the names of preferences, this will remove those preference settings from the agent configuration. |
void |
restart()
This will perform an agent hot-restart. |
void |
restartPluginContainer()
This will shutdown then immediately restart the agent's internal plugin container. |
OperationResult |
retrieveAllPluginInfo()
Returns information on all currently deployed plugins. |
String |
retrieveCurrentDateTime(String timeZone)
Returns a string of the agent's current date/time, formatted with the given time zone. |
OperationResult |
retrievePluginInfo(String pluginName)
Returns information on the given plugin. |
void |
setDebugMode(Boolean enabled,
Boolean traceMessaging)
Turns on or off debug mode, which makes the agent log more verbose with debug messages. |
void |
shutdown()
This will shutdown the agent's communications layer and the plugin container. |
void |
switchToServer(String server)
|
void |
updatePlugins()
This will tell the agent to update its plugins. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static ObjectName singletonObjectName
| Constructor Detail |
|---|
public AgentManagement(AgentMain agent)
AgentManagement.
agent - the agent to be monitored| Method Detail |
|---|
public void switchToServer(String server)
switchToServer in interface AgentManagementMBeanpublic void restart()
AgentManagementMBeanAgentManagementMBean.shutdown() and then immediately started
again. This is usually called after a client has
changed some configuration settings.
The actual restart is performed asynchronously. The caller has just a few seconds after this method returns before it takes effect.
restart in interface AgentManagementMBeanpublic void shutdown()
AgentManagementMBeanThe actual shutdown is performed asynchronously. The caller has just a few seconds after this method returns before it takes effect.
shutdown in interface AgentManagementMBeanpublic void downloadLatestFailoverList()
AgentManagementMBean
downloadLatestFailoverList in interface AgentManagementMBeanpublic void updatePlugins()
AgentManagementMBeanAfter the plugins are updated, the plugin container will immediately be
restarted.
The actual PC restart is performed asynchronously. The caller has just a few seconds after this method returns before it takes effect.
updatePlugins in interface AgentManagementMBeanpublic OperationResult retrieveAllPluginInfo()
AgentManagementMBeanPropertyMap for
each plugin. The name of the map will be the plugin name. Each map will have the key/value pairs where the keys
are PLUGIN_INFO_xxx.
retrieveAllPluginInfo in interface AgentManagementMBeanpublic OperationResult retrievePluginInfo(String pluginName)
AgentManagementMBeansimple properties
where the names are defined by PLUGIN_INFO_xxx.
retrievePluginInfo in interface AgentManagementMBeanpluginName - the plugin whose information is to be returned
public void restartPluginContainer()
AgentManagementMBeanupdated the plugins. Restarting the plugin container forces it to load in newly updated
plugins.
The actual restart is performed asynchronously. The caller has just a few seconds after this method returns before it takes effect.
restartPluginContainer in interface AgentManagementMBeanAgentManagementMBean.updatePlugins()public OperationResult executeAvailabilityScan(Boolean changesOnly)
AgentManagementMBeanDiscoveryAgentService.executeAvailabilityScanImmediately(boolean) for the semantics of this call.
executeAvailabilityScan in interface AgentManagementMBeanchangesOnly - if true, only report those availabilities that have changed
OperationResult objectpublic String getVersion()
AgentManagementMBean
getVersion in interface AgentManagementMBeanpublic long getCurrentTime()
AgentManagementMBeanSystem.currentTimeMillis.
getCurrentTime in interface AgentManagementMBeanpublic String retrieveCurrentDateTime(String timeZone)
AgentManagementMBeantimeZonecan be either an abbreviation such as "PST", a full name such as
"America/Los_Angeles", or a custom ID such as "GMT-8:00". Note that the support of abbreviations is
for JDK 1.1.x compatibility only and full names should be used.
retrieveCurrentDateTime in interface AgentManagementMBeantimeZone - the time zone to display the date/time in
TimeZone.getTimeZone(String)
public void setDebugMode(Boolean enabled,
Boolean traceMessaging)
throws ExecutionException
AgentManagementMBeanenabled flag is false, traceMessaging is ignored (i.e. all debug
will be disabled, including message tracing).
setDebugMode in interface AgentManagementMBeanenabled - enable debug modetraceMessaging - if true, message tracing will be enabled unless enabled is false
ExecutionException - if failed to change the debug mode
public String executePromptCommand(String command)
throws ExecutionException
AgentManagementMBeancommand is the prompt command
plus any additional command arguments, separated by spaces (just as if you typed the command
in the console window). The results will be a string that contains the text that you would
have seen in the console output had the prompt command been executed from the console.
executePromptCommand in interface AgentManagementMBeancommand - the command to execute along with any command line arguments.
ExecutionException - if the prompt command threw an exception, this method will throw an exception
whose message is the output text that was written by the prompt command up until the error
occurred. The cause of the thrown exception will be the actual exception thrown by
the prompt command. This way you can see what the prompt command output was as well as
the exception that occurred.public String getAgentHomeDirectory()
AgentManagementMBean
getAgentHomeDirectory in interface AgentManagementMBeanpublic int getNumberAgentRestarts()
AgentManagementMBeanAgentManagementMBean.getReasonForLastRestart().
getNumberAgentRestarts in interface AgentManagementMBeanpublic String getReasonForLastRestart()
AgentManagementMBean
getReasonForLastRestart in interface AgentManagementMBeanpublic long getAgentServerClockDifference()
AgentManagementMBean
getAgentServerClockDifference in interface AgentManagementMBeanpublic long getUptime()
AgentManagementMBean
getUptime in interface AgentManagementMBeanpublic long getNumberSuccessfulCommandsReceived()
getNumberSuccessfulCommandsReceived in interface AgentManagementMBeanServiceContainerMetricsMBean.getNumberSuccessfulCommandsReceived()public long getNumberFailedCommandsReceived()
getNumberFailedCommandsReceived in interface AgentManagementMBeanServiceContainerMetricsMBean.getNumberFailedCommandsReceived()public long getNumberTotalCommandsReceived()
getNumberTotalCommandsReceived in interface AgentManagementMBeanServiceContainerMetricsMBean.getNumberTotalCommandsReceived()public long getAverageExecutionTimeReceived()
getAverageExecutionTimeReceived in interface AgentManagementMBeanServiceContainerMetricsMBean#getAverageExecutionTime()public long getAverageExecutionTimeSent()
getAverageExecutionTimeSent in interface AgentManagementMBeanClientCommandSenderMetrics.getAverageExecutionTimeSent()public long getNumberSuccessfulCommandsSent()
getNumberSuccessfulCommandsSent in interface AgentManagementMBeanClientCommandSenderMetrics.getNumberSuccessfulCommandsSent()public long getNumberFailedCommandsSent()
getNumberFailedCommandsSent in interface AgentManagementMBeanClientCommandSenderMetrics.getNumberFailedCommandsSent()public long getNumberTotalCommandsSent()
AgentManagementMBean
getNumberTotalCommandsSent in interface AgentManagementMBeanClientCommandSenderMetrics.getNumberSuccessfulCommandsSent(),
ClientCommandSenderMetrics.getNumberFailedCommandsSent()public long getNumberCommandsActiveSent()
getNumberCommandsActiveSent in interface AgentManagementMBeanClientCommandSenderMetrics.getNumberCommandsActive()public long getNumberCommandsInQueue()
getNumberCommandsInQueue in interface AgentManagementMBeanClientCommandSenderMetrics.getNumberCommandsInQueue()public long getNumberCommandsSpooled()
getNumberCommandsSpooled in interface AgentManagementMBeanClientCommandSenderMetrics.getNumberCommandsSpooled()public boolean isSending()
isSending in interface AgentManagementMBeanClientCommandSenderMetrics.isSending()public long getJVMFreeMemory()
AgentManagementMBeanRuntime.getRuntime().freeMemory().
getJVMFreeMemory in interface AgentManagementMBeanpublic long getJVMTotalMemory()
AgentManagementMBeanRuntime.getRuntime().totalMemory().
getJVMTotalMemory in interface AgentManagementMBeanpublic int getJVMActiveThreads()
AgentManagementMBean
getJVMActiveThreads in interface AgentManagementMBeanpublic Properties getAgentConfiguration()
AgentManagementMBean
getAgentConfiguration in interface AgentManagementMBeanpublic void mergeIntoAgentConfiguration(Properties config)
AgentManagementMBeanconfig that
already exist in the current agent configuration will override the old values in the current agent configuration.
Those preferences found in config but do not exist yet in the current agent configuration are
added to the agent configuration. If a preference exists in the current configuration but is not found in
config, then that preference is left as-is.
Changing the agent configuration usually requires the agent to be restarted in order for the new settings to be picked up.
mergeIntoAgentConfiguration in interface AgentManagementMBeanconfig - new agent configuration preferencespublic void removeFromAgentConfiguration(List<String> preferenceNames)
AgentManagementMBean
removeFromAgentConfiguration in interface AgentManagementMBeanpreferenceNames - the preferences to remove from the agent configurationpublic MBeanServer getMBeanServer()
null if this MBean is not registered.
public ObjectName getObjectName()
public ObjectName preRegister(MBeanServer server,
ObjectName name)
throws Exception
preRegister in interface MBeanRegistrationExceptionMBeanRegistration.preRegister(MBeanServer, ObjectName)public void postRegister(Boolean registrationDone)
postRegister in interface MBeanRegistrationMBeanRegistration.postRegister(Boolean)public void postDeregister()
postDeregister in interface MBeanRegistrationMBeanRegistration.postDeregister()
public void preDeregister()
throws Exception
preDeregister in interface MBeanRegistrationExceptionMBeanRegistration.preDeregister()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||