Skip to content

Commit

Permalink
add external connector support
Browse files Browse the repository at this point in the history
  • Loading branch information
arvdias committed Nov 6, 2019
1 parent 6e933d2 commit 7574e19
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand All @@ -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

Expand Down
6 changes: 4 additions & 2 deletions bin/nrjmx
Original file line number Diff line number Diff line change
Expand Up @@ -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 $@
12 changes: 1 addition & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>nrjmx</groupId>
<artifactId>nrjmx</artifactId>
<version>1.3.1</version>
<version>1.5.1</version>
<name>nrjmx</name>
<description>The New Relic JMX tool provides a command line tool to connect to a JMX server and retrieve the MBeans
it exposes.
Expand All @@ -14,16 +14,6 @@
<url>https://newrelic.com/infrastructure/</url>
</organization>
<dependencies>
<dependency>
<groupId>org.jboss.remotingjmx</groupId>
<artifactId>remoting-jmx</artifactId>
<version>3.0.3.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.remoting</groupId>
<artifactId>jboss-remoting</artifactId>
<version>5.0.12.Final</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/newrelic/nrjmx/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import org.apache.commons.cli.HelpFormatter;

import java.util.logging.Level;
import java.util.logging.Logger;

public class Application {
Expand Down

0 comments on commit 7574e19

Please sign in to comment.