Sample code
To demonstrate the enhanced monitoring capabilities of the system, a sample implementation is provided to integrate the system with Graphite.
PLTStatisticsConsumer and IStatisticObject interfaces
that are provided with the system.The sample code is available in the following location: <INSTALL_DIR>/xapidocs/code_examples/graphite.
You can tweak the code to suit your setup. The properties file referred
in the code is available as graphite-exporter.properties.sample in
the graphite folder.
Using the sample code
- Set the value of
yfs.plt.statistics.consumer.classnameproperty tocom.ibm.sterling.sample.graphite.StatisticalDataExporterForGraphitein thecustomer_overrides.propertiesfile. - Make a copy of the
graphite-exporter.properties.samplefile and rename the copy tographite-exporter.properties. - Set appropriate values in the
graphite-exporter.propertiesfile.Note: You can find comprehensive documentation for each property in the sample property file. - Compile the java files provided in the sample code.
- Create a JAR file for the compiled files. Tip: Ensure that the
graphite-exporter.propertiesfile is present in the root folder of the JAR so that the file need not be included separately in the CLASSPATH. - After creating the JAR file, include the new JAR file in the CLASSPATH environment variable by
running the
install3rdPartyutility appropriately:install3rdParty.shon Unix or Linuxinstall3rdParty.cmdon Windows
For more information, see Building other extensions.
- Build and deploy the EAR.
graphite-exporter.properties file.timerscountersjvmstat
This classification is done to provide a predictable naming
convention to the Graphite administrator. Graphite rules around storage
and aggregation are set by matching regular expression patterns. The
category prefix (controlled through graphite-exporter.properties)
and the digest labels (controlled through sample code) give the Graphite
administrator a predictable regular expression to manage such configuration.
Most
of the metrics that you would like to monitor are already classified
under a category. For example, the number of order lines shipped are
classified under the counters category. Similarly,
the response time of APIs are classified under the timers category.
However, certain metric names may not be included in any of these
categories. In such scenarios, the sample code automatically classifies
them under the default category.
The statistics.category.default.prefix property
determines the prefix for metrics published in the default category.
We recommend that you monitor metrics published in the default category
and include them under the appropriate category by modifying the graphite-exporter.properties appropriately.