Skip to content

Commit

Permalink
📝 init repo
Browse files Browse the repository at this point in the history
  • Loading branch information
tycoding committed May 11, 2019
0 parents commit fe08e52
Show file tree
Hide file tree
Showing 915 changed files with 181,849 additions and 0 deletions.
Empty file added README.md
Empty file.
58 changes: 58 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>cn.tycoding</groupId>
<artifactId>monitor</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>monitor</name>
<description>JVM-Monitor</description>

<properties>
<java.version>1.8</java.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
13 changes: 13 additions & 0 deletions src/main/java/cn/tycoding/MonitorApplication.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package cn.tycoding;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class MonitorApplication {

public static void main(String[] args) {
SpringApplication.run(MonitorApplication.class, args);
}

}
116 changes: 116 additions & 0 deletions src/main/java/cn/tycoding/controller/BaseDataController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
package cn.tycoding.controller;

import cn.tycoding.service.*;
import cn.tycoding.utils.ResultCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* @author tycoding
* @date 2019-05-10
*/
@RestController
public class BaseDataController {

@Autowired
private ClassLoaderService classLoaderService;

@GetMapping("/class/get")
public ResultCode getClassLoader() {
try {
return new ResultCode(200, classLoaderService.get());
} catch (Exception e) {
e.printStackTrace();
return new ResultCode(500, e.getMessage());
}
}

@Autowired
private CompilationService compilationService;

@GetMapping("/compilation/get")
public ResultCode getCompilation() {
try {
return new ResultCode(200, compilationService.get());
} catch (Exception e) {
e.printStackTrace();
return new ResultCode(500, e.getMessage());
}
}

@Autowired
private MemoryService memoryService;

@GetMapping("/memory/get")
public ResultCode getMemory() {
try {
return new ResultCode(200, memoryService.get());
} catch (Exception e) {
e.printStackTrace();
return new ResultCode(500, e.getMessage());
}
}

@Autowired
private RuntimeInfoService runtimeInfoService;

@GetMapping("/runtime/get")
public ResultCode getRuntimeInfo() {
try {
return new ResultCode(200, runtimeInfoService.get());
} catch (Exception e) {
e.printStackTrace();
return new ResultCode(500, e.getMessage());
}
}

@Autowired
private SystemInfoService systemInfoService;

@GetMapping("/system/get")
public ResultCode getSystemInfo() {
try {
return new ResultCode(200, systemInfoService.get());
} catch (Exception e) {
e.printStackTrace();
return new ResultCode(500, e.getMessage());
}
}

@Autowired
private ThreadInfoService threadInfoService;

@GetMapping("/thread/get")
public ResultCode getThreadInfo() {
try {
return new ResultCode(200, threadInfoService.get());
} catch (Exception e) {
e.printStackTrace();
return new ResultCode(500, e.getMessage());
}
}

@Autowired
private GarbageCollectorService garbageCollectorService;

@GetMapping("/gc/get")
public ResultCode getGC() {
try {
return new ResultCode(200, garbageCollectorService.get());
} catch (Exception e) {
e.printStackTrace();
return new ResultCode(500, e.getMessage());
}
}

@GetMapping("/gc/getPools")
public ResultCode getGCPools() {
try {
return new ResultCode(200, garbageCollectorService.getPools());
} catch (Exception e) {
e.printStackTrace();
return new ResultCode(500, e.getMessage());
}
}
}
62 changes: 62 additions & 0 deletions src/main/java/cn/tycoding/controller/RouterController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package cn.tycoding.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

/**
* @author tycoding
* @date 2019-05-10
*/
@Controller
public class RouterController {

/**
* 首页
*
* @return
*/
@GetMapping({"/", "/index"})
public String index() {
return "index";
}

/**
* 概述页
*
* @return
*/
@GetMapping("/overview")
public String overview() {
return "/jvm/overview";
}

/**
* 类加载监控页
*
* @return
*/
@GetMapping("/class")
public String monitor() {
return "/jvm/class";
}

/**
* 内存监控页
*
* @return
*/
@GetMapping("/memory")
public String gc() {
return "/jvm/memory";
}

/**
* 线程监控页
*
* @return
*/
@GetMapping("/thread")
public String thread() {
return "/jvm/thread";
}
}
40 changes: 40 additions & 0 deletions src/main/java/cn/tycoding/entity/ClassLoaderBean.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package cn.tycoding.entity;

import lombok.Data;

import java.io.Serializable;

/**
* 类加载数据
*
* @author tycoding
* @date 2019-05-10
*/
@Data
public class ClassLoaderBean implements Serializable {

/**
* 主键
*/
private Long id;

/**
* JVM加载类的数量
*/
private Integer count;

/**
* JVM已加载类数量
*/
private Long loaded;

/**
* JVM未加载类数量
*/
private Long unLoaded;

/**
* 是否启用类加载详细信息的输出
*/
private Boolean isVerbose;
}
35 changes: 35 additions & 0 deletions src/main/java/cn/tycoding/entity/CompilationBean.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package cn.tycoding.entity;

import lombok.Data;

import java.io.Serializable;

/**
* 编译信息
*
* @author tycoding
* @date 2019-05-10
*/
@Data
public class CompilationBean implements Serializable {

/**
* 主键
*/
private Long id;

/**
* 即时(JIT)编译器名称
*/
private String name;

/**
* 总编译时间(毫秒)
*/
private Long totalTime;

/**
* JVM是否支持对编译时间的监视
*/
private Boolean isSupport;
}
16 changes: 16 additions & 0 deletions src/main/java/cn/tycoding/entity/GarbageCollectorBean.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package cn.tycoding.entity;

import lombok.Data;

import java.io.Serializable;

/**
* JVM垃圾回收信息
*
* @author tycoding
* @date 2019-05-10
*/
@Data
public class GarbageCollectorBean implements Serializable {

}
Loading

0 comments on commit fe08e52

Please sign in to comment.