Skip to content
This repository has been archived by the owner on Dec 29, 2023. It is now read-only.

Commit

Permalink
Complete export support.
Browse files Browse the repository at this point in the history
  • Loading branch information
bastiao committed Jun 3, 2019
1 parent bf9871d commit cd8fc31
Show file tree
Hide file tree
Showing 14 changed files with 650 additions and 183 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar

*.csv
# End of https://www.gitignore.io/api/maven


Expand Down
71 changes: 63 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Description

Resource Monitor for Java is a tool that helps to monitor Java process resources and detect memory leaks/CPU constrains.
Resource Monitor for Java is a tool that **helps** to **monitor Java process** resources and detect memory **leaks**/CPU constrains.

## How to use?

Expand All @@ -11,11 +11,13 @@

```
rmjvm 1.0
usage: rmjvm [-c] [-e <arg>] [-ed <arg>] [-h] [-ho <arg>] [-p <arg>] [-s
<arg>]
usage: rmjvm [-c] [-cf <arg>] [-e <arg>] [-ed <arg>] [-h] [-ho <arg>] [-p
<arg>] [-s <arg>]
-c,--check check will run all the actionsand wait
until it is requested to stop. Meanwhile it
will monitoring the memory and compare
-cf,--config <arg> the configuration file (by default
conf/rmjvm.yml)
-e,--export <arg> export format (csv, output)
-ed,--exportdirectory <arg> export directory where will be stored the
files.
Expand All @@ -25,7 +27,6 @@ usage: rmjvm [-c] [-e <arg>] [-ed <arg>] [-h] [-ho <arg>] [-p <arg>] [-s
process
-p,--port <arg> set the port for JMX of java listen process
-s,--skip <arg> skip the cpu or memory (--skip=mem,cpu)
```

## Examples
Expand All @@ -37,22 +38,76 @@ Few examples of use of the application:
$ rmjvm --help
$ rmjvm --version
$ rmjvm --check
$ rmjvm --skip=mem
$ rmjvm --skip=cpu,mem
$ rmjvm --export=csv --exportdirectory=/tmp/dump-reports
$ rmjvm --skip mem
$ rmjvm --skip cpu,mem
$ rmjvm --export csv --exportdirectory /tmp/dump-reports --config conf/rmjvm-myApp.yml
```


## Configurations

```
### Please modify according your needs
application:
uri: "service:jmx:rmi:///jndi/rmi://<YOUR-JMX-HOST>:<YOUR-JMX-PORT>/jmxrmi"
directory: "<DIRECTORY WHERE IS LOCATED JAVA APPLICATION>"
# This is just few examples for monitoring
actions:
- name: monitor01
cmd: "sendFilesApp -h hostname"
timeout: 200 # ms
monitor: ['cpu', 'mem']
executions: 20
- name: monitor02
cmd: "receiveFilesApp -h hostname"
monitor: ['mem']
timeout: 100 # ms
executions: 2
# configure a tracer
# there are few examples, such zipkin
tracer:
- uri: "http://my-zipkin-deployment:9201"
```


## Configure your Java Application

You will need to configure the following properties, that will allow to JMX connection allowed by
remote applications:

```
-Dcom.sun.management.jmxremote.port=3333
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
```


## Output - export format






## Recommended tools

You should be aware at least of two tools:
You should be aware at least of the following tools, that probably could help you find your issues:

- jConsole
- Mission Control and Flight Recorder
- Oracle VisualVM
- JVM tools: https://github.com/aragozin/jvm-tools/
- Eclipse Memory Analyser: MAT

**Note**: rmjvm was mainly developed to track the memory after specific commands and to know exactly what is increasing over the
time. Other tools are allowed to do real time monitoring and explore/monitoring and trigger specific JMX Mbeans. The main
reason to build rmjvm was mainly due to some programatic triggers that was needed.

## Other resources

Expand Down
1 change: 1 addition & 0 deletions bin/rmjvm.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/usr/bin/env bash

java -jar rmjvm-jar-with-dependencies.jar "$@"
4 changes: 2 additions & 2 deletions conf/rmjvm-dicoogle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ actions:
cmd: "c:\\Users\\bastiao\\Software\\dcm4che-5.16.3-bin\\dcm4che-5.16.3\\bin\\ianscu.bat -c DICOOGLE-STORAGE@localhost:6666"
timeout: 0 # ms
monitor: ['cpu', 'mem']
executions: 20
executions: 10
- name: monitor-dicom-qr
cmd: "c:\\Users\\bastiao\\Software\\dcm4che-5.16.3-bin\\dcm4che-5.16.3\\bin\\ianscu.bat -c DICOOGLE-STORAGE@localhost:1045"
monitor: ['mem']
timeout: 0 # ms
executions: 2
executions: 100

# configure a tracer
# there are few examples, such zipkin
Expand Down
116 changes: 76 additions & 40 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,56 @@
</plugin>

<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>com.bmdsoftware.monitor.resourcemonitor.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>com.bmdsoftware.monitor.resourcemonitor.Main</mainClass>
</manifest>
</archive>
<!--
<finalName>${project.artifactId}-${project.version}-full</finalName>
-->

<finalName>rmjvm</finalName>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>

</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>copy-resources</id>
<!-- here the phase you need -->
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/</outputDirectory>
<resources>
<resource>
<directory>bin/</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>

</plugins>
Expand Down Expand Up @@ -89,32 +119,38 @@
<artifactId>commons-cli</artifactId>
<version>1.4</version>
</dependency>

<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.21</version>
</dependency>

<dependency>
<groupId>io.zipkin.brave</groupId>
<artifactId>brave</artifactId>
<version>5.6.3</version>
</dependency>


<dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-reporter</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-sender-okhttp3</artifactId>
<version>2.6.0</version>
</dependency>


<dependency>
<groupId>io.zipkin.brave</groupId>
<artifactId>brave</artifactId>
<version>5.6.3</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>1.4</version>
</dependency>


<dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-reporter</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-sender-okhttp3</artifactId>
<version>2.6.0</version>
</dependency>


<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
Expand Down
Loading

0 comments on commit cd8fc31

Please sign in to comment.