Package com.amazonaws.metrics
Class MetricAdmin
- java.lang.Object
-
- com.amazonaws.metrics.MetricAdmin
-
- All Implemented Interfaces:
MetricAdminMBean
public class MetricAdmin extends Object implements MetricAdminMBean
Administration of AwsSdkMetrics as an MBean.
-
-
Constructor Summary
Constructors Constructor Description MetricAdmin()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
disableMetrics()
Disables the metric collector at the AWS SDK level.boolean
enableDefaultMetrics()
Starts the default AWS SDK metric collector, but only if no metric collector is currently in use at the AWS SDK level.String
getCredentialFile()
Returns the last set AWS credential file; or null if there is none.String
getHostMetricName()
Returns the host name for metric purposes.String
getJvmMetricName()
Returns the JVM metric name.String
getMetricNameSpace()
Returns the metric name space.Integer
getMetricQueueSize()
Returns the internal metric queue size to be used for the default AWS SDK metric collector; or null if the default is to be used.Integer
getQueuePollTimeoutMilli()
Returns the internal metric queue timeout in millisecond to be used for the default AWS SDK metric collector; or null if the default is to be used.String
getRegion()
Returns the region configured for the default AWS SDK metric collector; or null if the default is to be used.String
getRequestMetricCollector()
Returns the name of the request metric collector set at the AWS SDK level, or NONE if there is none.String
getServiceMetricCollector()
Returns the name of the service metric collector set at the AWS SDK level, or NONE if there is none.boolean
isMachineMetricsExcluded()
Returns true if machine metrics is to be excluded; false otherwise.boolean
isMetricsEnabled()
Returns true if metrics at the AWS SDK level is enabled; false if disabled.boolean
isPerHostMetricsIncluded()
Returns true if per-host metrics is to be included; false otherwise.boolean
isSingleMetricNamespace()
Returns true if single metric name space is to be used; false otherwise.void
setCredentialFile(String filepath)
Sets the AWS credential file used by the default AWS SDK metric collector for accessing CloudWatch.void
setHostMetricName(String hostMetricName)
Sets the host name to enable per-host level metrics generation.void
setJvmMetricName(String jvmMetricName)
Sets the JVM metric name to enable per-JVM level metrics generation.void
setMachineMetricsExcluded(boolean excludeJvmMetrics)
Used to set whether the JVM metrics is to be excluded.void
setMetricNameSpace(String metricNameSpace)
Sets the metric name space.void
setMetricQueueSize(Integer metricQueueSize)
Sets the metric queue size to be used for the default AWS SDK metric collector; or null if the default is to be used.void
setPerHostMetricsIncluded(boolean includePerHostMetrics)
Used to set whether the per-host metrics is to be included.void
setQueuePollTimeoutMilli(Integer timeoutMilli)
Sets the queue poll time in millisecond to be used for the default AWS SDK metric collector; or null if the default is to be used.void
setRegion(String region)
Sets the region to be used for the default AWS SDK metric collector; or null if the default is to be used.void
setSingleMetricNamespace(boolean singleMetricNamespace)
Used to set whether a single metric name space is to be used.
-
-
-
Method Detail
-
enableDefaultMetrics
public boolean enableDefaultMetrics()
Description copied from interface:MetricAdminMBean
Starts the default AWS SDK metric collector, but only if no metric collector is currently in use at the AWS SDK level.- Specified by:
enableDefaultMetrics
in interfaceMetricAdminMBean
- Returns:
- true if the default AWS SDK metric collector has been successfully started by this call; false otherwise.
-
disableMetrics
public void disableMetrics()
Description copied from interface:MetricAdminMBean
Disables the metric collector at the AWS SDK level.- Specified by:
disableMetrics
in interfaceMetricAdminMBean
-
getRequestMetricCollector
public String getRequestMetricCollector()
Description copied from interface:MetricAdminMBean
Returns the name of the request metric collector set at the AWS SDK level, or NONE if there is none.- Specified by:
getRequestMetricCollector
in interfaceMetricAdminMBean
-
getServiceMetricCollector
public String getServiceMetricCollector()
Description copied from interface:MetricAdminMBean
Returns the name of the service metric collector set at the AWS SDK level, or NONE if there is none.- Specified by:
getServiceMetricCollector
in interfaceMetricAdminMBean
-
isMetricsEnabled
public boolean isMetricsEnabled()
Description copied from interface:MetricAdminMBean
Returns true if metrics at the AWS SDK level is enabled; false if disabled.- Specified by:
isMetricsEnabled
in interfaceMetricAdminMBean
-
isMachineMetricsExcluded
public boolean isMachineMetricsExcluded()
Description copied from interface:MetricAdminMBean
Returns true if machine metrics is to be excluded; false otherwise.- Specified by:
isMachineMetricsExcluded
in interfaceMetricAdminMBean
-
setMachineMetricsExcluded
public void setMachineMetricsExcluded(boolean excludeJvmMetrics)
Description copied from interface:MetricAdminMBean
Used to set whether the JVM metrics is to be excluded.- Specified by:
setMachineMetricsExcluded
in interfaceMetricAdminMBean
- Parameters:
excludeJvmMetrics
- true if JVM metrics is to be excluded; false otherwise.
-
getRegion
public String getRegion()
Description copied from interface:MetricAdminMBean
Returns the region configured for the default AWS SDK metric collector; or null if the default is to be used.- Specified by:
getRegion
in interfaceMetricAdminMBean
-
setRegion
public void setRegion(String region)
Description copied from interface:MetricAdminMBean
Sets the region to be used for the default AWS SDK metric collector; or null if the default is to be used.- Specified by:
setRegion
in interfaceMetricAdminMBean
-
getMetricQueueSize
public Integer getMetricQueueSize()
Description copied from interface:MetricAdminMBean
Returns the internal metric queue size to be used for the default AWS SDK metric collector; or null if the default is to be used.- Specified by:
getMetricQueueSize
in interfaceMetricAdminMBean
-
setMetricQueueSize
public void setMetricQueueSize(Integer metricQueueSize)
Description copied from interface:MetricAdminMBean
Sets the metric queue size to be used for the default AWS SDK metric collector; or null if the default is to be used.- Specified by:
setMetricQueueSize
in interfaceMetricAdminMBean
-
getQueuePollTimeoutMilli
public Integer getQueuePollTimeoutMilli()
Description copied from interface:MetricAdminMBean
Returns the internal metric queue timeout in millisecond to be used for the default AWS SDK metric collector; or null if the default is to be used. Use Integer instead of Long as it seems jconsole does not handle Long properly.- Specified by:
getQueuePollTimeoutMilli
in interfaceMetricAdminMBean
-
setQueuePollTimeoutMilli
public void setQueuePollTimeoutMilli(Integer timeoutMilli)
Description copied from interface:MetricAdminMBean
Sets the queue poll time in millisecond to be used for the default AWS SDK metric collector; or null if the default is to be used. Use Integer instead of Long as it seems jconsole does not handle Long properly.- Specified by:
setQueuePollTimeoutMilli
in interfaceMetricAdminMBean
-
getMetricNameSpace
public String getMetricNameSpace()
Description copied from interface:MetricAdminMBean
Returns the metric name space.- Specified by:
getMetricNameSpace
in interfaceMetricAdminMBean
-
setMetricNameSpace
public void setMetricNameSpace(String metricNameSpace)
Description copied from interface:MetricAdminMBean
Sets the metric name space.- Specified by:
setMetricNameSpace
in interfaceMetricAdminMBean
-
isPerHostMetricsIncluded
public boolean isPerHostMetricsIncluded()
Description copied from interface:MetricAdminMBean
Returns true if per-host metrics is to be included; false otherwise.- Specified by:
isPerHostMetricsIncluded
in interfaceMetricAdminMBean
-
setPerHostMetricsIncluded
public void setPerHostMetricsIncluded(boolean includePerHostMetrics)
Description copied from interface:MetricAdminMBean
Used to set whether the per-host metrics is to be included.- Specified by:
setPerHostMetricsIncluded
in interfaceMetricAdminMBean
- Parameters:
includePerHostMetrics
- true if per-host metrics is to be included; false otherwise.
-
getJvmMetricName
public String getJvmMetricName()
Description copied from interface:MetricAdminMBean
Returns the JVM metric name. If the returned value is either null or blank, no JVM level metrics will be generated.- Specified by:
getJvmMetricName
in interfaceMetricAdminMBean
-
setJvmMetricName
public void setJvmMetricName(String jvmMetricName)
Description copied from interface:MetricAdminMBean
Sets the JVM metric name to enable per-JVM level metrics generation. If the given value is either null or blank, no JVM level metrics will be generated.- Specified by:
setJvmMetricName
in interfaceMetricAdminMBean
-
getHostMetricName
public String getHostMetricName()
Description copied from interface:MetricAdminMBean
Returns the host name for metric purposes. If the returned value is either null or blank, the host name will be automatically detected viaInetAddress
.- Specified by:
getHostMetricName
in interfaceMetricAdminMBean
-
setHostMetricName
public void setHostMetricName(String hostMetricName)
Description copied from interface:MetricAdminMBean
Sets the host name to enable per-host level metrics generation. If the given value is either null or blank but the per-host metric is enabled, the host name will be automatically detected viaInetAddress
.- Specified by:
setHostMetricName
in interfaceMetricAdminMBean
-
getCredentialFile
public String getCredentialFile()
Description copied from interface:MetricAdminMBean
Returns the last set AWS credential file; or null if there is none.- Specified by:
getCredentialFile
in interfaceMetricAdminMBean
-
setCredentialFile
public void setCredentialFile(String filepath) throws FileNotFoundException, IOException
Description copied from interface:MetricAdminMBean
Sets the AWS credential file used by the default AWS SDK metric collector for accessing CloudWatch.- Specified by:
setCredentialFile
in interfaceMetricAdminMBean
- Parameters:
filepath
- must be a valid path to an AWS credential property file.- Throws:
FileNotFoundException
IOException
-
isSingleMetricNamespace
public boolean isSingleMetricNamespace()
Description copied from interface:MetricAdminMBean
Returns true if single metric name space is to be used; false otherwise.- Specified by:
isSingleMetricNamespace
in interfaceMetricAdminMBean
-
setSingleMetricNamespace
public void setSingleMetricNamespace(boolean singleMetricNamespace)
Description copied from interface:MetricAdminMBean
Used to set whether a single metric name space is to be used.- Specified by:
setSingleMetricNamespace
in interfaceMetricAdminMBean
-
-