JolokiaBeanMonitor

The JolokiaBeanMonitor is a JMX monitor specialized for the use with the Jolokia framework. Use the JolokiaBeanMonitor when you need to to run a method via JMX or poll an attribute via JMX. This monitor requires a fully installed and configured Jolokia agent to be deployed in the JVM container. If required, you can provide attribute names, paths, and method parameters as additional arguments to the call.

To determine the status of the service the JolokiaBeanMonitor relies on the output to be matched against a banner. If the banner is part of the output the status is interpreted as up, otherwise it is considered down. Banner matching supports regular expression and substring match. This monitor implements placeholder substitution in parameter values.

Monitor Facts

Class Name

org.opennms.netmgt.poller.monitors.JolokiaBeanMonitor

Remote Enabled

false

Configuration and Use

Table 1. Monitor specific parameters for the JolokiaBeanMonitor
Parameter Description Required Default value Placeholder substitution

beanname

The bean name to query against.

required

-

No

attrname

The name of the JMX attribute to scrape.

optional (attrname or methodname must be set)

-

No

attrpath

The attribute path.

optional

-

No

auth-username

The username to use for HTTP BASIC auth.

optional

-

Yes

auth-password

The password to use for HTTP BASIC auth.

optional

-

Yes

banner

A string that is match against the output of the system-call. If the output contains the banner, the service is determined as up. Specify a regex by starting with ~.

optional

-

Yes

input1

Method input

optional

-

Yes

input2

Method input

optional

-

Yes

methodname

The name of the bean method to execute, output will be compared to banner.

optional (attrname or methodname must be set)

-

Yes

port

The port of the jolokia agent.

optional

8080

No

url

The jolokia agent url. Defaults to "http://<ipaddr>:<port>/jolokia"

optional

-

Yes

This monitor implements the Common Configuration Parameters.

Table 2. Variables which can be used in the configuration
Variable Description

${ipaddr}

IP-address of the interface the service is bound to.

${port}

Port the service it bound to.

Examples

Some example configuration how to configure the monitor in the poller-configuration.xml

<parameter key="url" value="http://$\{ipaddr}:$\{port}/jolokia"/>
<parameter key="url" value="https://$\{ipaddr}:$\{port}/jolokia"/>

AttrName vs. MethodName

The JolokiaBeanMonitor has two modes of operation. It can either scrape an attribute from a bean, or execute a method and compare output to a banner. The method execute is useful when your application has its own test methods that you would like to trigger via Horizon.

The args to execute a test method called "superTest" that take in a string as input would look like this:

<parameter key="beanname" value="MyBean" />
<parameter key="methodname" value="superTest" />
<parameter key="input1" value="someString"/>

The args to scrape an attribute from the same bean would look like this:

<parameter key="beanname" value="MyBean" />
<parameter key="attrname" value="upTime" />