Configuration features


Configuration relies on file which should be found in the commons-monitoring-core classloader.

Note: you can change the file name using org.apache.commons.monitoring.configuration system property.


org.apache.commons.monitoring.configuration.Configuration has several utility methods to get int, boolean… from the properties file. You can reuse it in your monitoring extensions if you want.

Another interesting usage of Configuration class is to be a basic lifecycle handling of your objects. Using org.apache.commons.monitoring.configuration.Configuration.newInstance method you can decorate your class methods with org.apache.commons.monitoring.configuration.Configuration.Created and org.apache.commons.monitoring.configuration.Configuration.Destroying to get lifecycle hooks.

Destroying is called when the monitoring is stopped. Generally since commons-monitoring-core is deployed in the container or JVM classloader it is with the JVM but sometimes you can deploy it in your application. In this case you’ll need to either configure the javax.servlet.ServletContextListener org.apache.commons.monitoring.web.lifecycle.CommonsMonitoringLifecycle from reporting module or to call manually Configuration.shutdown() method.

Main configuration keys

  • org.apache.commons.monitoring.shutdown.hook: boolean, true by default. Should be set to false when deploying commons-monitoring-core in an application (see Utilities part).
  • [plugin name].activated: boolean, true by default. Should the plugin referenced by [] be used.
  • org.apache.commons.monitoring.jmx.method.allowed: boolean, true by default. Are JMX method invocation allowed.
  • org.apache.commons.monitoring.gauge.max-size: int, 100 by default. Number of gauge measures to keep in memory when not persistent.
  • org.apache.commons.monitoring.gauge.memory.period: int, 4000 (ms) by default. Period for memory gauge.
  • org.apache.commons.monitoring.gauge.cpu.period: int, 4000 (ms) by default. Period for CPU gauge.
  • org.apache.commons.monitoring.gauge.csv.separator: char, ‘;’ by default. CSV separator for CSV report.
  • org.apache.commons.proxy.ProxyFactory: qualified class name. ProxyFactory to use for client aop.
  • qualified class name, default DataStore to use.
  • org.apache.commons.monitoring.repositories.Repository: qualified class name, default org.apache.commons.monitoring.repositories.DefaultRepository. Repository to use.