Monitor API sample overview

The Resource Monitor API sample demonstrates how to use the Resource Monitor Server Java API to interact with the Resource Monitor Server.

The Resource Monitor API can be used to:

There are also public utility functions on the API to get a list of the object identifiers for all Director Native agents and to allow the user to check whether the Monitor Server is ready to be connected to by the API.

Detail of the Resource Monitor API sample

The Resoure Monitor API sample demonstrates using the programming interface to:

Running the sample

The sample code must first be compiled in order to run. To compile the sample code, change the current directory to:

[drive]:\Program Files\IBM\Director SDK\samples\javasrc\com\BobCo\monitors

In this directory you will find the Java source files and a makefile. Run the makefile to compile the source files. The class files created by the makefile will now be found in:

[drive]:\Program Files\IBM\Director SDK\samples\classes\com\BobCo\monitors

After compiling the code, copy the class files to:

[drive]:\Program Files\IBM\Director\classes\com\BobCo\monitors

Change the current directory to:

[drive]:\Program Files\IBM\Director\classes

To run a sample, enter one of the following commands:

twgjava com.BobCo.monitors.MonAPISample1
twgjava com.BobCo.monitors.MonAPISample2 moid

where moid is the numeric id for an existing managed object
twgjava com.BobCo.monitors.MonAPISample3

twgjava com.BobCo.monitors.MonAPISample4a

twgjava com.BobCo.monitors.MonAPISample4b

Examples:

twgjava com.BobCo.monitors.MonAPISample1 
twgjava com.BobCo.monitors.MonAPISample2 324

where 324 is the id of an existing managed object

JAVADOC for the Resource Monitor Server API classes

com.tivoli.twg.monitor.api.TWGMonAPI
This is the primary object that must be created to be able to communicate with the monitor server.
com.tivoli.twg.monitor.api.TWGMonAttribute
One of these objects will be returned for each attribute that is being actively monitored on a system
com.tivoli.twg.monitor.api.TWGMonAttributeUpdateListener
listener interface that might be used to have an attribute notify the listener when its state has changed
com.tivoli.twg.monitor.api.TWGMonDoubleThresholdData
used to set thresholds against the numeric attributes
com.tivoli.twg.monitor.api.TWGMonException
exception class used to notify the caller of an error handling a request.
com.tivoli.twg.monitor.api.TWGMonNode
represents one attribute or one level of the path to an attribute when navigating the tree of attributes
com.tivoli.twg.monitor.api.TWGMonNodeList
contains a list of nodes that are returned when navigating to the children of a path node when navigating the tree of attributes
com.tivoli.twg.monitor.api.TWGMonNodeListener
listener interface that might be used to get asynchronous notification of the completion of a request to traverse that attribute tree to retrieve a list of attribute nodes
com.tivoli.twg.monitor.api.TWGMonPath
used to represent a the path to an attribute in the attribute tree
com.tivoli.twg.monitor.api.TWGMonStringThresholdData
used to set thresholds against the string attributes
com.tivoli.twg.monitor.api.TWGMonThreshold
used to contain the base set of information used to set thresholds against attributes

Source files of the sample

samples\javasrc\com\BobCo\monitors\makefile
file used to build the same files into executable class files
samples\javasrc\com\BobCo\monitors\MonAPISample1.java
this sample demonstrates a utility function that gets a list of all managed object ID's
samples\javasrc\com\BobCo\monitors\MonAPISample2.java
this sample demonstrates a monitoring a single attribute for a short period of time
samples\javasrc\com\BobCo\monitors\MonAPISample3.java
this sample demonstrates a recursive descent of the attribute tree on a system or set of systems
samples\javasrc\com\BobCo\monitors\MonAPISample4a.java
this sample demonstrates setting up an attribute alias against the set of all managed objects
samples\javasrc\com\BobCo\monitors\MonAPISample4b.java
this sample demonstrates removing the attribute alias that was set up in the MonAPISample4a example