diff --git a/CHANGELOG.md b/CHANGELOG.md index bdc270b7..bc2288b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Set debug log entry on nice log lvl to be shown only for verbose mode - Clean up cmd execution log entries - Increase test timeout to build on slow boxes +- Support custom connectors ## 1.4.1 (2019-10-01) - Fixed issue when parsing float NaN values. diff --git a/README.md b/README.md index c2a82b13..52370890 100644 --- a/README.md +++ b/README.md @@ -83,12 +83,21 @@ $ echo "org.apache.cassandra.metrics:type=Table,keyspace=*,scope=*,name=ReadLatency" | java -jar target/nrjmx-0.0.1-SNAPSHOT-jar-with-dependencies.jar -hostname 127.0.0.1 -port 7199 -username user -password pwd ``` +## Custom protocols + +JMX allows use of custom protocols to communicate with the application. In order to use a custom protocol you have to include the custom connectors in the nrjmx classpath. +By default nrjmx will include the sub-folder connectors in it's class path. If this folder does not exist create it under the fodler where you have nrjmx installed. + +For example, to add support for JBoss, create a folder `connectors` under the default (Linux) library path `/usr/lib/nrjmx/` (`/usr/lib/nrjmx/connectors`) and copy the custom connector `jar` into the folder (`$JBOSS_HOME/bin/client/jboss-cli-client.jar`). You can now execute JMX queries against JBoss. + ### Remote URL connection If you want to use a remoting-jmx URL you can use the flag `-remote`. In this case it will use the remoting connection URL: `service:jmx:remote://host:port` instead of `service:jmx:rmi:///jndi/rmi://host:port/jmxrmi` This sets URI ready for JBoss Domain mode. +Note: you will need to add support for the custom JBoss protocol. See the previous section `Custom protocols`. + #### JBoss Standalone mode This is supported via `-remoteJBossStandalone` and will set connection URL to `service:jmx:remote+http://host:port`. @@ -97,6 +106,7 @@ Example of usage with remoting: ```bash $ ./bin/nrjmx -hostname 127.0.0.1 -port 7199 -username user -password pwd -remote ``` +Note: you will need to add support for the custom JBoss protocol. See the previous section `Custom protocols`. ### Non-Standard JMX Service URI diff --git a/bin/nrjmx b/bin/nrjmx index 8b8e73a2..b9f44ced 100755 --- a/bin/nrjmx +++ b/bin/nrjmx @@ -9,7 +9,9 @@ elif [ ! -z "${JAVA_HOME}" ]; then fi if [ -f /usr/lib/nrjmx/nrjmx.jar ]; then - ${java_tool} -jar /usr/lib/nrjmx/nrjmx.jar $@ + CLASSPATH=/usr/lib/nrjmx/*:/usr/lib/nrjmx/connectors/* else - ${java_tool} -jar `dirname $0`/nrjmx.jar $@ + CLASSPATH=./*:./connectors/* fi + +${java_tool} -cp ${CLASSPATH} org.newrelic.nrjmx.Application $@ \ No newline at end of file diff --git a/pom.xml b/pom.xml index e3f93e15..71443f18 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 nrjmx nrjmx - 1.3.1 + 1.5.1 nrjmx The New Relic JMX tool provides a command line tool to connect to a JMX server and retrieve the MBeans it exposes. @@ -14,16 +14,6 @@ https://newrelic.com/infrastructure/ - - org.jboss.remotingjmx - remoting-jmx - 3.0.3.Final - - - org.jboss.remoting - jboss-remoting - 5.0.12.Final - org.yaml snakeyaml diff --git a/src/main/java/org/newrelic/nrjmx/Application.java b/src/main/java/org/newrelic/nrjmx/Application.java index 52f6d18c..b62d369c 100644 --- a/src/main/java/org/newrelic/nrjmx/Application.java +++ b/src/main/java/org/newrelic/nrjmx/Application.java @@ -2,7 +2,6 @@ import org.apache.commons.cli.HelpFormatter; -import java.util.logging.Level; import java.util.logging.Logger; public class Application {