Monitor APIs
A data view object is the holding place for the actual data polled from the managed entity. A data view relies on the associated monitor to:
- collect data for the data view
- determine which NetProbe instances to report the data view
- format collected data for each NetProbe
- send data view content to selected NetProbes
Solace Geneos Agent provides a list of default data views, and each data view is associated with one monitor.
All monitors extend from the abstract BaseMonitor
class, which allows them to interact with the agent framework. BaseMonitor
class provides a default implementation.
The agent framework or JMX calls the following methods defined in BaseMonitor
(they cannot be overwritten):
initialize()
—initialize all the properties of the monitorstart()
—start the monitorstop()
—stop the monitor
The following data structures in BaseMonitor
that are used by subclasses for collection and reporting data; they are initialized when the initialize()
method is called:
collectingContext
—a thread context where data collection tasks are executed. By default, it references theDefaultCollectingContext
provided by Solace Geneos Agent. It is a single thread doing all the collection tasks in a serial manner.reportingContext
—a thread context where data reporting tasks are executed. By default, it references theDefaultReportingContext
provided by the Solace Geneos Agent. It is a single thread doing all the reporting tasks in a serial manner.propertyMap
—a map that stores all the monitor properties understood by the Solace Geneos Agent; these are read from global and monitor-specific property files. To retrieve these monitor properties, callgetProperty(propertyName)
, or call specific getter methods provided by theBaseMonitor
, such asgetSamplingRate()
,getManagedEntities()
.viewMap<viewAlias, View>
—a map to store data views. All the data views specified in monitor specific properties are initialized and cached in this map by the agent framework. TheView
object contains properties such as alias name, view content, view propertyMap.propertyMap
—a map which stores all the view properties read from global and monitor specific property files and are understood by the agent. To retrieve view properties, callgetProperty(propertyName)
or call specific getter methods provided by the View, such asgetViewName()
,getManagedEntities()
.
logger
class for logging—subclass can obtain the logger class by callinggetLogger()
.
The agent framework calls the following methods defined in BaseMonitor
(they can be overwritten):
onPreInitialize()
—this is a subclass extension point for monitor initialization; it is called byinitialize()
method. Within this method, subclasses can:- add new properties to the
propertyMap
by callingaddProperty(Property)
. - override the default collecting or reporting context by calling
setCollectingContext(ExecutionContext)
orsetReportingContext(ExecutionContext)
.
- add new properties to the
onPostInitialize()
—this is a subclass extension point after a monitor is initialized but before the monitor is started. Within this method, subclasses can:- retrieve properties from the
propertyMap
by callinggetProperty(propertyName)
or specific property getter methods. - initialize any instance variable or any object used by the monitor implementation. In the
UsersMonitor
bundled sample, the http client is created in this method.
- retrieve properties from the
onCollect()
—this method is invoked when it is time to collect data. The subclass must override this method to:- poll data using the event broker service and SEMP
- convert collected data into NetProbe acceptable format and store them into the view map
- return the monitor’s next state
State.REPORTING_QUEUE
.
onReport()
—invoked when it is time to report. TheBaseMonitor
class provides default implementation to iterate through the data views from the monitor’s view map and callreportView(View, Netprobe, managedEntity)
method to send data to the selected NetProbes. When reporting is done, the method returns the monitor’s next stateState.WAITING
.reportView(View, Netprobe, managedEntity)
—invoked byonReport()
method. TheBaseMonitor
class provides a default implementation to send the already formatted view content to a NetProbe using ITRS XML-RPC APIs.