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 monitor
  • start()—start the monitor
  • stop()—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 the DefaultCollectingContext 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 the DefaultReportingContext 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, call getProperty(propertyName), or call specific getter methods provided by the BaseMonitor, such as getSamplingRate(), 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. The View 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, call getProperty(propertyName) or call specific getter methods provided by the View, such as getViewName(), getManagedEntities().
  • logger class for logging—subclass can obtain the logger class by calling getLogger().

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 by initialize() method. Within this method, subclasses can:
    • add new properties to the propertyMap by calling addProperty(Property).
    • override the default collecting or reporting context by calling setCollectingContext(ExecutionContext) or setReportingContext(ExecutionContext).
  • 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 calling getProperty(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.
  • 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. The BaseMonitor class provides default implementation to iterate through the data views from the monitor’s view map and call reportView(View, Netprobe, managedEntity) method to send data to the selected NetProbes. When reporting is done, the method returns the monitor’s next state State.WAITING.
  • reportView(View, Netprobe, managedEntity)—invoked by onReport() method. The BaseMonitor class provides a default implementation to send the already formatted view content to a NetProbe using ITRS XML-RPC APIs.