Modifying Custom Monitors Created Before Version 6.1
The 6.1 version of the Solace Geneos Agent used an updated HTTP Client library from Apache. As a result, any custom monitors that were created using earlier versions of the Solace-provided UsersMonitor.java example before Version 6.0 require code changes to work properly with the new library used in Version 6.1.
The required code changes are generic to all monitors based on the UsersMonitor.java example.
Steps to Modify Custom Monitors
- Unpack the
sol-geneossamplefile and copy all custom monitor java files into the appropriate places in thesrc/com/…directory structure. This ensures that the final product picks up the new libraries. - Modify the sections and methods, as described in Sections and Methods Requiring Modification.
SEMP parsing and data management code can remain unchanged.
- After the indicated sections and methods are modified, you must recompile, redeploy, and restart the Solace Geneos Agent. Refer to Adding New Monitors.
Sections and Methods Requiring Modification
The following sections and methods of pre-version 6.1 monitors must be modified:
If the custom monitors are based on the UsersMonitor.java sample, the best way to update the code is to open the custom monitor beside UsersMonitor.java in a diff tool, such as WinMerge. Then copy individual pieces of the updated code from the 6.1 version of UsersMonitor.java into the custom monitor.
Import section
- Replace
org.apache.http.*section - Add:
import com.solacesystems.solgeneos.sample.util.SampleHttpSEMPResponse;import com.solacesystems.solgeneos.sample.util.SampleResponseHandler;
- Leave unchanged:
- the import of your
SEMPParserclass
- the import of your
Private variable section
- Change
httpClienttoDefaultHttpClient - Add:
private ResponseHandler<SampleHttpSEMPResponse> m_responseHandler;
- Leave unchanged:
- your SEMP request string
- your parser variable, ‘
m_parser’ should still refer to the appropriateSEMPParserclass
onPostInitialize() method
- Modify parameter management
- Modify credential management
- Leave unchanged:
- your parser variable,
'm_parser'should still refer to the appropriateSEMPParserclass
- your parser variable,
onCollect() method
- Update
httpPostdeclaration and handling - Leave unchanged:
- the
post.setEntitycall should still refer to the request string constant set in the private variable declaration 'post.setEntity(new ByteArrayEntity(SHOW_CUSTOM_REQUEST.getBytes("UTF-8")));'
- the