Write a custom HealthScanner view
- Last Updated: August 19, 2021
- 4 minute read
- OpenEdge
- Version 12.2
- Documentation
A pluggable interface is required for the OpenEdge HealthScanner to output data to other monitoring tools. You can write a custom HealthScanner view to output HealthScanner details in the format of your choice.
The plugin architecture in PAS for OpenEdge is based on the Java Service Provider Interface (SPI). PAS for OpenEdge requires implementing the correct interfaces for formatting the HealthScanner data and packaging the implementation in a JAR file.
http://localhost:port/health?view=detailshttp://localhost:port/health?view=summaryhttp://localhost:port/health?view=confighttp://localhost:port/health?view=dataset
This topic describes how to create additional views when a specific format
is needed for the HealthScanner data. For example, a new view called Acme might be
called using the view=acme parameter in the URL.
- Implement the
com.progress.appserv.services.health.spi.HealthViewVisitorinterface. This interface follows a hierarchical visitor pattern and is available in oecollector-version.jar:public interface HealthViewVisitor { // Called for each probe that is not a composite. void visit ( HealthProbe probe ); // Called for each composite on entering. void enter ( CompositeHealthProbe probe ); // Called for each composite on leaving. void leave ( CompositeHealthProbe probe ); // Method to get result String getDetails (); } - Implement the
com.progress.appserv.services.health.spi.HealthViewFactoryinterface. This is a factory that creates instances of the view visitor interface that you implemented in Step 1. TheHealthViewFactoryinterface is also included in oecollector-version.jar:public interface HealthViewFactory { // Provide the name of the view visitor. String getViewName (); // Get an instance of the view visitor. HealthViewVisitor getVisitor (); } - Register the service provider by creating a file named com.progress.appserv.services.health.spi.HealthViewFactory. The
content of the file is the name of your factory class.
For example, if your view factory implementation from Step 2 contains the line com.acme.AcmeViewFactory, then your factory class is
com.acme.AcmeViewFactory. - Package the service as a JAR file. Include compiled versions of
the classes that you created in Step 1 and Step 2. As well as the file you
created in Step 3.For example, if your visitor interface is
com.acme.AcmeViewVisitorand your factory iscom.acme.AcmeViewFactorythen the contents of the JAR file looks like this:META-INF/MANIFEST.MF META-INF/services/com.progress.appserv.services.health.spi.HealthViewFactory com/acme/AcmeViewFactory.class com/acme/AcmeViewVisitor.class - Copy the JAR file into $DLC/servers/pasoe/lib/ext.
- Restart the PAS for OpenEdge instance, and test the view in a
browser:
http://localhost:port/health?view=acme
Example interface implementation
The following code is an example of a HealthScanner visitor interface implementation called AcmeViewVisitor.java:
|
The following code is an example of a HealthScanner factory interface implementation called AcmeViewFactory.java:
|