Implementing user-defined categories in Collection Services
The user-defined categories function in Collection Services enables applications to integrate performance data collection into Collection Services.
About this task
This allows you to gather data from an application by writing a data collection program, registering it, and integrating it with Collection Services. Collection Services will then call the data collection program at every collection interval, and will store the data in the collection object. You should use the Collection Object APIs listed below to access the data stored in the collection object. You may access the data in real-time, as it is being collected, or for as long as the collection object is retained.
To implement this function, you need to:
- Develop a program to collect performance data for a new category in Collection Services.
- Create a job description for your collection program. The job description QPMUSRCAT in QGPL provides an example, but does not represent default values or recommendations.
- Register the new category and specify the data collection
- Register: QypsRegCollectorDataCategory
- De-register: QypsDeregCollectorDataCategory
After you register the category, Collection Services includes it in the list of available collection categories.
- Add the category to your Collection Services profile, and then cycle Collection Services
- Develop a program to query the collection object.
- Retrieve active management collection object name: QpmRtvActiveMgtcolName (Used only for querying the collection object in real-time)
- Retrieve management collection object attributes: QpmRtvMgtcolAttrs
- Open management collection object: QpmOpenMgtcol
- Close management collection object: QpmCloseMgtcol
- Open management collection object repository: QpmOpenMgtcolRepo
- Close management collection object repository: QpmCloseMgtcolRepo
- Read management collection object data: QpmReadMgtcolData
Your customized collection program now runs at each collection interval, and the collected data is archived in the collection objects.
You can also implement the Java™ versions of these APIs. The required Java classes are included in ColSrv.jar, in the integrated file system (IFS) directory QIBM/ProdData/OS400/CollectionServices/lib. Java applications should include this file in their classpath. For more information about the Java implementation, download the javadocs in a .zip file.
Query the collection object in real-time
If your application needs to query the collection object in real-time, it will need to synchronize the queries with Collection Services. To do this, the application should create a data queue and register it with Collection Services. Once registered, the collector sends a notification for each collection interval and for the end of the collection cycle. The application should maintain the data queue, including removing the data queue when finished, and handling abnormal termination. To register and deregister the data queue, refer to the following APIs:
- Add collector notification: QypsAddCollectorNotification
- Remove collector notification: QypsRmvCollectorNotification