JolokiaBeanMonitor
The JolokiaBeanMonitor is a JMX monitor specialized for the use with the Jolokia framework. Use the JolokiaBeanMonitor when you need to run a method via JMX or poll an attribute via JMX. This monitor requires a fully installed and configured Jolokia agent 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.
Configuration and use
Parameter | Description | Default value |
---|---|---|
Required |
||
beanname |
The bean name to query against. |
n/a |
Optional |
||
attrname |
The name of the JMX attribute to scrape. |
n/a |
attrpath |
The attribute path. |
n/a |
auth-username {} |
The username to use for HTTP BASIC auth. |
n/a |
auth-password {} |
The password to use for HTTP BASIC auth. |
n/a |
banner {} |
A string that is matched against the output of the system-call. If the output contains the banner, the service is determined as up. Start with |
n/a |
input1 {} |
Method input |
n/a |
input2 {} |
Method input |
n/a |
methodname {} |
The name of the bean method to execute. Output will be compared to banner. |
n/a |
port |
The port of the Jolokia agent. |
8080 |
url {} |
The Jolokia agent URL. |
{} indicates the parameter supports placeholder substitution.
The attrname and methodname parameters are optional but one of them must be set. |
This monitor implements the Common Configuration Parameters.
Variable | Description |
---|---|
${ipaddr} |
IP-address of the interface the service is bound to. |
${port} |
Port the service it bound to. |
Examples
Some example configuration on how to configure the monitor in poller-configuration.xml
.
<parameter key="url" value="http://$\{ipaddr}:$\{port}/jolokia"/>
<parameter key="url" value="https://$\{ipaddr}:$\{port}/jolokia"/>
AttrName versus MethodName
The JolokiaBeanMonitor has two modes of operation. It can either scrape an attribute from a bean or run a method and compare output to a banner. The method run is useful when your application has its own test methods that you would like to trigger via Horizon.
Arguments to run a test method called "superTest" that take in a string as input:
<parameter key="beanname" value="MyBean" />
<parameter key="methodname" value="superTest" />
<parameter key="input1" value="someString"/>
Arguments to scrape an attribute from the same bean:
<parameter key="beanname" value="MyBean" />
<parameter key="attrname" value="upTime" />