Monitor Interface - Teradata Ecosystem Manager

Teradata Ecosystem Manager API Reference

Product
Teradata Ecosystem Manager
Release Number
16.10
Published
June 2017
Language
English (United States)
Last Update
2018-03-29
dita:mapPath
crq1488477755125.ditamap
dita:ditavalPath
ft:empty
dita:id
B035-3204
lifecycle
previous
Product Category
Analytical Ecosystem

getStat

This method returns the value of a metric depending on the arguments passed from the configuration file. The arguments are the <arg> elements, defined under the <metric> element. The arguments are passed into the getStat method as an array of strings where the order is maintained from top to bottom and left to right in the configuration file. The return float value is paired with the metric elements resourceType attribute identifier for passing through any Publisher mechanisms specified.

Use care when designing and implementing a monitor from this interface. If the collective execution time of the collectStats, getStat, and all publish methods exceeds the allotted interval of the metricCollector elements, then the implementing class enters an undefined state of behavior where future scheduled executions execute as soon as the current execution finishes, causing rapid succession of object executions.

Protype:
public Double getStat(String resourceType, String[] args) throws Exception
Parameters:
String metricName: Parameter that is the resourceType String, as defined by the configuration file resourceType attribute of the metric element, and acts as the name of the metric being collected by the class that implements the Monitor.

String[] args: Array of string values that are passed by the set of arg elements specified in the configuration file under the metric element.

Returns:
A double value that represents the value of the metric resource type gathered by this monitor.
Throws:
Any exception derived from the java.lang.Exception class. The exception message is logged to the emmonitor log file under $EM_HOME/logs and a stack trace is also logged.

collectStats

This method is run once per interval and is the first method executed. It can be used for initializing objects in the class or caching of data during the execution interval. This method is called before any of the getStat or publish methods are called.

Prototype:
public void collectStats() throws Exception
Parameters:
None
Returns:
None
Throws:
Any exception derived from the java.lang.Exception class. The exception message is logged to the emmonitor log file under $EM_HOME/logs and a stack trace is also logged.

After the custom Monitor class is created, the Monitor configuration file must be modified so the Ecosystem Manager Monitor service uses the new Metric Collector. After implementing and testing a Java class that implemented the Monitor interface, the Ecosystem Manager Monitor service must have its classpath updated.

For Windows, modify the following file:

EM_HOME%\services\emmonitor\conf\wrapper.conf 

Add a new wrapper.java.class.path.* property and point to the jar file that contains the compiled version of the class that implemented the Monitor interface.

For Linux or UNIX-based operating systems, modify the following file:

$EM_HOME/conf/emmonitor

Append the jar in the CLASSPATH_SERVICE property that contains the compiled version of the class that implements the Monitor interface.

Update of the runtime environment. The configuration file that emmonitor uses at runtime must either contain a new metricCollector element appended to the other metricCollectors or replace the existing metricCollector. In either case, the class attribute must specify the fully-qualified Java package to which the implemented monitor belongs and a unique name must be given for logging and debugging purposes.