Skip to content

Commit

Permalink
Merge pull request #1 from MinXie1209/dev-jdk1.8
Browse files Browse the repository at this point in the history
style( jdk1.8兼容):
  • Loading branch information
MinXie1209 authored Apr 3, 2023
2 parents b06a95d + e0f8734 commit 4331f71
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
.idea/
target/
*.iml
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
# jmx_minxie
A simple JMX agent for monitoring Java applications.

e.g. for monitoring the number of threads in a Java application.
## 怎么使用?
jmx_agent 提供了assembly打包插件,可通过assembly:assembly 打出一个带依赖的包
jmx_agent-1.0-SNAPSHOT-jar-with-dependencies.jar

这个包是一个agent的包,可以通过-javaagent启动
例如
> java -jar -javaagent:jmx_agent-1.0-SNAPSHOT-jar-with-dependencies.jar=12345 demo.jar

## 示例图
![dashboard](./docs/dashboard01.jpg)
![dashboard](./docs/dashboard02.jpg)
![dashboard](./docs/dashboard03.jpg)
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ class MemoryMetricVo {
}
}
ManagementFactory.getPlatformMXBean(OperatingSystemMXBean::class.java).let {
this.totalPhysicalMemorySize = it.totalMemorySize.toFloat()
this.totalPhysicalMemorySize = it.totalPhysicalMemorySize.toFloat()
this.committedVirtualMemorySize = it.committedVirtualMemorySize.toFloat()
this.freePhysicalMemorySize = it.freeMemorySize.toFloat()
this.freePhysicalMemorySize = it.freePhysicalMemorySize.toFloat()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ProcessMetricVo public constructor() {
this.availableProcessors = it.availableProcessors.toFloat()
this.systemLoadAverage = it.systemLoadAverage.toFloat()
this.processCpuLoad = it.processCpuLoad.toFloat()
this.cpuLoad = it.cpuLoad.toFloat()
this.cpuLoad = it.systemCpuLoad.toFloat()
}
ManagementFactory.getPlatformMXBean(UnixOperatingSystemMXBean::class.java).let {
this.openFds = it.openFileDescriptorCount.toFloat()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ package minxie.space.jmx

import org.junit.jupiter.api.Test

import org.junit.jupiter.api.Assertions.*

class MetricHttpServerTest {
open class MetricHttpServerTest {

@Test
fun start() {
Expand Down
8 changes: 1 addition & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<kotlin.compiler.jvmTarget>17</kotlin.compiler.jvmTarget>
<kotlin.compiler.jvmTarget>1.8</kotlin.compiler.jvmTarget>
</properties>

<repositories>
Expand All @@ -36,12 +36,6 @@
<version>1.8.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
Expand Down

0 comments on commit 4331f71

Please sign in to comment.