This method is the output mechanism for data collected during an interval by a metricCollector. Any number of output mechanisms can be used including the formatted file output or communication with web services.
The only constraint on this implementation is the length of execution time in conjunction with the stat collection routines of the attached monitor. If the collective execution time of the collectStats, getStat, and all publish methods exceeds the allotted interval of the metricCollector elements, the implementing class enters an undefined state of behavior where future scheduled executions execute as soon as the current execution finishes. This causes rapid succession of object executions or missed data collection opportunities. It is highly recommended that this state be avoided.
public void publish(String collectorName, List<String> resourceType, List<Float> value)
|String collectorName: Parameter that is the metric collector name as defined by the name attribute of the metricCollector element.
List<String> resourceType: List of string values that correspond to the resourceType names of each metric processed during the prior monitor collection phase. These strings are in a one-to-one parallel, in-order relationship with the float list value parameter.
List<Float> value: List of float values that correspond to the returned values of the getStat method calls. The float objects are in a one-to-one parallel, in-order relationship with the string list in the resourceType parameter.
All exceptions can be handled seamlessly in this method. Exceptions that are not handled are caught and logged by the EMMonitor process and subsequent Publishers are iterated.
After the custom Publisher class is created, monitor the Monitor configuration file so the emmonitor service uses the new Publisher. After implementing and testing a Java class that implemented the Publisher interface, update the classpath of the TMSM Monitor service.
For Windows, modify the following file:
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 Publisher interface.
For Linux or UNIX-based operating systems, modify the following file:
Append the jar of the CLASSPATH_SERVICE property that contains the compiled version of the class that implements the Publisher interface.
In addition to updating the runtime environment, the configuration file that emmonitor uses at runtime must add the new Publisher as an additional Publisher element below the TMSMPublisher in any new or existing metricCollector elements. The class attribute must specify the fully-qualified Java package to which the implemented Publisher belongs.