[monitor]服务端编译打包脚本
This commit is contained in:
@@ -1,37 +0,0 @@
|
|||||||
{
|
|
||||||
"detected": true,
|
|
||||||
"monitor": {
|
|
||||||
"app": "TanCloud",
|
|
||||||
"creator": "tom",
|
|
||||||
"description": "对SAAS网站TanCloud的可用性监控",
|
|
||||||
"gmtCreate": "2021-11-18T14:18:11.968Z",
|
|
||||||
"gmtUpdate": "2021-11-18T14:18:11.968Z",
|
|
||||||
"host": "139.198.109.64",
|
|
||||||
"id": 87584674384,
|
|
||||||
"intervals": 600,
|
|
||||||
"jobId": 43243543543,
|
|
||||||
"modifier": "tom",
|
|
||||||
"name": "Api-TanCloud.cn",
|
|
||||||
"status": 1
|
|
||||||
},
|
|
||||||
"params": [
|
|
||||||
{
|
|
||||||
"field": "port",
|
|
||||||
"gmtCreate": "2021-11-18T14:18:11.968Z",
|
|
||||||
"gmtUpdate": "2021-11-18T14:18:11.968Z",
|
|
||||||
"id": 87584674384,
|
|
||||||
"monitorId": 875846754543,
|
|
||||||
"type": 1,
|
|
||||||
"value": "8088"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"field": "host",
|
|
||||||
"gmtCreate": "2021-11-18T14:18:11.968Z",
|
|
||||||
"gmtUpdate": "2021-11-18T14:18:11.968Z",
|
|
||||||
"id": 87584674384,
|
|
||||||
"monitorId": 875846754543,
|
|
||||||
"type": 1,
|
|
||||||
"value": "139.198.109.64"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -75,8 +75,8 @@ public class CalculateAlarm {
|
|||||||
// 采集异常
|
// 采集异常
|
||||||
Alert.AlertBuilder alertBuilder = Alert.builder()
|
Alert.AlertBuilder alertBuilder = Alert.builder()
|
||||||
.monitorId(monitorId)
|
.monitorId(monitorId)
|
||||||
.priority((byte) 0)
|
.priority(CommonConstants.ALERT_PRIORITY_CODE_EMERGENCY)
|
||||||
.status((byte) 0)
|
.status(CommonConstants.ALERT_STATUS_CODE_PENDING)
|
||||||
.times(1);
|
.times(1);
|
||||||
if (metricsData.getCode() == CollectRep.Code.UN_REACHABLE) {
|
if (metricsData.getCode() == CollectRep.Code.UN_REACHABLE) {
|
||||||
// UN_REACHABLE 对端不可达(网络层icmp)
|
// UN_REACHABLE 对端不可达(网络层icmp)
|
||||||
@@ -101,7 +101,8 @@ public class CalculateAlarm {
|
|||||||
if (stateCode != null) {
|
if (stateCode != null) {
|
||||||
// 发送告警恢复
|
// 发送告警恢复
|
||||||
Alert resumeAlert = Alert.builder()
|
Alert resumeAlert = Alert.builder()
|
||||||
.monitorId(monitorId).status((byte) 2).build();
|
.monitorId(monitorId)
|
||||||
|
.status(CommonConstants.ALERT_STATUS_CODE_RESTORED).build();
|
||||||
dataQueue.addAlertData(resumeAlert);
|
dataQueue.addAlertData(resumeAlert);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -167,7 +168,7 @@ public class CalculateAlarm {
|
|||||||
.monitorId(monitorId)
|
.monitorId(monitorId)
|
||||||
.alertDefineId(define.getId())
|
.alertDefineId(define.getId())
|
||||||
.priority(define.getPriority())
|
.priority(define.getPriority())
|
||||||
.status((byte) 0)
|
.status(CommonConstants.ALERT_STATUS_CODE_PENDING)
|
||||||
.target(app + "." + metrics + "." + define.getField())
|
.target(app + "." + metrics + "." + define.getField())
|
||||||
.times(times)
|
.times(times)
|
||||||
// 模板中关键字匹配替换
|
// 模板中关键字匹配替换
|
||||||
|
|||||||
65
assembly/server/assembly.xml
Normal file
65
assembly/server/assembly.xml
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd
|
||||||
|
http://maven.apache.org/ASSEMBLY/2.0.0 ">
|
||||||
|
<!--必填,会追加到打包文件名称的末尾-->
|
||||||
|
<id>1.0</id>
|
||||||
|
<!--打包类型,可以设置多种类型,打包的时候不同的类型都会打包打出来-->
|
||||||
|
<formats>
|
||||||
|
<format>tar.gz</format>
|
||||||
|
<format>zip</format>
|
||||||
|
</formats>
|
||||||
|
<!--第三方依赖设置-->
|
||||||
|
<dependencySets>
|
||||||
|
<dependencySet>
|
||||||
|
<!--使用项目中的artifact,第三方包打包进tar.gz文件的lib目录下-->
|
||||||
|
<useProjectArtifact>true</useProjectArtifact>
|
||||||
|
<outputDirectory>lib</outputDirectory>
|
||||||
|
</dependencySet>
|
||||||
|
</dependencySets>
|
||||||
|
|
||||||
|
<!--文件相关设置-->
|
||||||
|
<fileSets>
|
||||||
|
<!--bin文件下的所有脚本文件输出到打包后的bin目录下-->
|
||||||
|
<fileSet>
|
||||||
|
<directory>../assembly/server/bin</directory>
|
||||||
|
<outputDirectory>bin</outputDirectory>
|
||||||
|
</fileSet>
|
||||||
|
|
||||||
|
<!-- src/main/resources目录下配置文件打包到config目录下 -->
|
||||||
|
<fileSet>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<includes>
|
||||||
|
<include>application.yml</include>
|
||||||
|
<include>logback-spring.xml</include>
|
||||||
|
</includes>
|
||||||
|
<filtered>true</filtered>
|
||||||
|
<outputDirectory>${file.separator}config</outputDirectory>
|
||||||
|
</fileSet>
|
||||||
|
|
||||||
|
<!-- src/main/resources/define目录下配置文件打包到define目录下 -->
|
||||||
|
<fileSet>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<includes>
|
||||||
|
<include>define/**</include>
|
||||||
|
</includes>
|
||||||
|
<filtered>true</filtered>
|
||||||
|
<outputDirectory>${file.separator}</outputDirectory>
|
||||||
|
</fileSet>
|
||||||
|
|
||||||
|
<!-- 将target目录下的启动jar打包到目录下-->
|
||||||
|
<fileSet>
|
||||||
|
<directory>target</directory>
|
||||||
|
<outputDirectory>/</outputDirectory>
|
||||||
|
<includes>
|
||||||
|
<include>*.jar</include>
|
||||||
|
</includes>
|
||||||
|
</fileSet>
|
||||||
|
|
||||||
|
<!-- 将webapp的静态资源打包到目录下-->
|
||||||
|
<fileSet>
|
||||||
|
<directory>../web-app/dist</directory>
|
||||||
|
<outputDirectory>dist</outputDirectory>
|
||||||
|
</fileSet>
|
||||||
|
</fileSets>
|
||||||
|
</assembly>
|
||||||
0
assembly/server/bin/shutdown.sh
Normal file
0
assembly/server/bin/shutdown.sh
Normal file
0
assembly/server/bin/startup.sh
Normal file
0
assembly/server/bin/startup.sh
Normal file
@@ -62,6 +62,40 @@ public interface CommonConstants {
|
|||||||
*/
|
*/
|
||||||
byte SUSPENDING_CODE = 0x04;
|
byte SUSPENDING_CODE = 0x04;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 告警状态: 0-正常告警(待处理)
|
||||||
|
*/
|
||||||
|
byte ALERT_STATUS_CODE_PENDING = 0x00;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 告警状态: 1-阈值触发但未达到告警次数
|
||||||
|
*/
|
||||||
|
byte ALERT_STATUS_CODE_NOT_REACH = 0x01;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 告警状态: 2-恢复告警
|
||||||
|
*/
|
||||||
|
byte ALERT_STATUS_CODE_RESTORED = 0x02;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 告警状态: 3-已处理
|
||||||
|
*/
|
||||||
|
byte ALERT_STATUS_CODE_SOLVED = 0x03;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 告警级别: 0:高-emergency-紧急告警-红色
|
||||||
|
*/
|
||||||
|
byte ALERT_PRIORITY_CODE_EMERGENCY = 0x00;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 告警级别: 1:中-critical-严重告警-橙色
|
||||||
|
*/
|
||||||
|
byte ALERT_PRIORITY_CODE_CRITICAL = 0x01;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 告警级别: 2:低-warning-警告告警-黄色
|
||||||
|
*/
|
||||||
|
byte ALERT_PRIORITY_CODE_WARNING = 0x02;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字段参数类型: 数字
|
* 字段参数类型: 数字
|
||||||
|
|||||||
@@ -113,16 +113,63 @@
|
|||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
<finalName>hertz-beat</finalName>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
<includes>
|
||||||
|
<include>application.yml</include>
|
||||||
|
<include>sureness.yml</include>
|
||||||
|
<include>banner.txt</include>
|
||||||
|
<include>db/**</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
<version>2.4.13</version>
|
<version>3.2.0</version>
|
||||||
|
<configuration>
|
||||||
|
<classesDirectory>target/classes/</classesDirectory>
|
||||||
|
<archive>
|
||||||
|
<!--生成的jar包不包含maven描述相关文件-->
|
||||||
|
<addMavenDescriptor>false</addMavenDescriptor>
|
||||||
|
<manifest>
|
||||||
|
<!--项目启动类-->
|
||||||
|
<mainClass>com.usthe.manager.Manager</mainClass>
|
||||||
|
<useUniqueVersions>false</useUniqueVersions>
|
||||||
|
<!--第三方JAR加入类构建的路径maven-dependency-plugin-->
|
||||||
|
<addClasspath>true</addClasspath>
|
||||||
|
<!--外部依赖jar包的位置-->
|
||||||
|
<classpathPrefix>lib/</classpathPrefix>
|
||||||
|
</manifest>
|
||||||
|
<manifestEntries>
|
||||||
|
<Class-Path>. config</Class-Path>
|
||||||
|
</manifestEntries>
|
||||||
|
</archive>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<!--关键插件,maven提供的assembly插件,需要放在最后-->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
|
<version>3.3.0</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
|
<id>make-zip</id>
|
||||||
|
<!--绑定的maven操作-->
|
||||||
|
<phase>package</phase>
|
||||||
|
<!--运行一次-->
|
||||||
<goals>
|
<goals>
|
||||||
<goal>repackage</goal>
|
<goal>single</goal>
|
||||||
</goals>
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<descriptors>
|
||||||
|
<descriptor>../assembly/server/assembly.xml</descriptor>
|
||||||
|
</descriptors>
|
||||||
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ public class DispatchAlarm {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 若是恢复告警 需对监控状态进行恢复
|
// 若是恢复告警 需对监控状态进行恢复
|
||||||
if (alert.getStatus() == 2) {
|
if (alert.getStatus() == CommonConstants.ALERT_STATUS_CODE_RESTORED) {
|
||||||
monitorService.updateMonitorStatus(alert.getMonitorId(), CommonConstants.AVAILABLE_CODE);
|
monitorService.updateMonitorStatus(alert.getMonitorId(), CommonConstants.AVAILABLE_CODE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,128 @@
|
|||||||
|
package com.usthe.manager.config;
|
||||||
|
|
||||||
|
import org.springframework.boot.autoconfigure.template.TemplateAvailabilityProvider;
|
||||||
|
import org.springframework.boot.autoconfigure.template.TemplateAvailabilityProviders;
|
||||||
|
import org.springframework.boot.autoconfigure.web.WebProperties;
|
||||||
|
import org.springframework.boot.autoconfigure.web.servlet.error.ErrorViewResolver;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.core.Ordered;
|
||||||
|
import org.springframework.core.io.Resource;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
import org.springframework.util.FileCopyUtils;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
import org.springframework.web.servlet.View;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.EnumMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同DefaultErrorViewResolver 解决angular静态网站资源前端路由问题 把404的网站请求给angular前端进行路由
|
||||||
|
* @author tom
|
||||||
|
* @date 2021/12/24 21:07
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class AngularErrorViewResolver implements ErrorViewResolver, Ordered {
|
||||||
|
|
||||||
|
private static final Map<HttpStatus.Series, String> SERIES_VIEWS;
|
||||||
|
private static final String NOT_FOUND_CODE = "404";
|
||||||
|
|
||||||
|
static {
|
||||||
|
Map<HttpStatus.Series, String> views = new EnumMap<>(HttpStatus.Series.class);
|
||||||
|
views.put(HttpStatus.Series.CLIENT_ERROR, "4xx");
|
||||||
|
views.put(HttpStatus.Series.SERVER_ERROR, "5xx");
|
||||||
|
SERIES_VIEWS = Collections.unmodifiableMap(views);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ApplicationContext applicationContext;
|
||||||
|
|
||||||
|
private final WebProperties.Resources resources;
|
||||||
|
|
||||||
|
private final TemplateAvailabilityProviders templateAvailabilityProviders;
|
||||||
|
|
||||||
|
private int order = Ordered.LOWEST_PRECEDENCE;
|
||||||
|
|
||||||
|
public AngularErrorViewResolver(ApplicationContext applicationContext, WebProperties.Resources resources) {
|
||||||
|
Assert.notNull(applicationContext, "ApplicationContext must not be null");
|
||||||
|
Assert.notNull(resources, "Resources must not be null");
|
||||||
|
this.applicationContext = applicationContext;
|
||||||
|
this.resources = resources;
|
||||||
|
this.templateAvailabilityProviders = new TemplateAvailabilityProviders(applicationContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ModelAndView resolveErrorView(HttpServletRequest request, HttpStatus status, Map<String, Object> model) {
|
||||||
|
ModelAndView modelAndView = resolve(String.valueOf(status.value()), model);
|
||||||
|
if (modelAndView == null && SERIES_VIEWS.containsKey(status.series())) {
|
||||||
|
modelAndView = resolve(SERIES_VIEWS.get(status.series()), model);
|
||||||
|
}
|
||||||
|
return modelAndView;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ModelAndView resolve(String viewName, Map<String, Object> model) {
|
||||||
|
String errorViewName = "error/" + viewName;
|
||||||
|
if (NOT_FOUND_CODE.equals(viewName)) {
|
||||||
|
errorViewName = "index";
|
||||||
|
}
|
||||||
|
TemplateAvailabilityProvider provider = this.templateAvailabilityProviders.getProvider(errorViewName,
|
||||||
|
this.applicationContext);
|
||||||
|
if (provider != null) {
|
||||||
|
return new ModelAndView(errorViewName, model);
|
||||||
|
}
|
||||||
|
return resolveResource(errorViewName, model);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ModelAndView resolveResource(String viewName, Map<String, Object> model) {
|
||||||
|
for (String location : this.resources.getStaticLocations()) {
|
||||||
|
try {
|
||||||
|
Resource resource = this.applicationContext.getResource(location);
|
||||||
|
resource = resource.createRelative(viewName + ".html");
|
||||||
|
if (resource.exists()) {
|
||||||
|
return new ModelAndView(new HtmlResourceView(resource), model);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getOrder() {
|
||||||
|
return this.order;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrder(int order) {
|
||||||
|
this.order = order;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link View} backed by an HTML resource.
|
||||||
|
*/
|
||||||
|
private static class HtmlResourceView implements View {
|
||||||
|
|
||||||
|
private Resource resource;
|
||||||
|
|
||||||
|
HtmlResourceView(Resource resource) {
|
||||||
|
this.resource = resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getContentType() {
|
||||||
|
return MediaType.TEXT_HTML_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(Map<String, ?> model, HttpServletRequest request, HttpServletResponse response)
|
||||||
|
throws Exception {
|
||||||
|
response.setContentType(getContentType());
|
||||||
|
FileCopyUtils.copy(this.resource.getInputStream(), response.getOutputStream());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,6 @@ import com.usthe.manager.pojo.dto.ParamDefineDto;
|
|||||||
import com.usthe.manager.pojo.entity.ParamDefine;
|
import com.usthe.manager.pojo.entity.ParamDefine;
|
||||||
import com.usthe.manager.service.AppService;
|
import com.usthe.manager.service.AppService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.kafka.common.protocol.types.Field;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.CommandLineRunner;
|
import org.springframework.boot.CommandLineRunner;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -18,7 +17,6 @@ import org.yaml.snakeyaml.Yaml;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
@@ -123,12 +121,11 @@ public class AppServiceImpl implements AppService, CommandLineRunner {
|
|||||||
public void run(String... args) throws Exception {
|
public void run(String... args) throws Exception {
|
||||||
// 读取app定义配置加载到内存中 define/app/*.yml
|
// 读取app定义配置加载到内存中 define/app/*.yml
|
||||||
Yaml yaml = new Yaml();
|
Yaml yaml = new Yaml();
|
||||||
String defineAppPath = "define" + File.separator + "app";
|
String classpath = this.getClass().getResource(File.separator).getPath();
|
||||||
URL url = Thread.currentThread().getContextClassLoader().getResource(defineAppPath);
|
String defineAppPath = classpath + File.separator + "define" + File.separator + "app";
|
||||||
assert url != null;
|
File directory = new File(defineAppPath);
|
||||||
File directory = new File(url.toURI());
|
|
||||||
if (!directory.exists() || directory.listFiles() == null) {
|
if (!directory.exists() || directory.listFiles() == null) {
|
||||||
throw new IllegalArgumentException("define app directory not exist");
|
throw new IllegalArgumentException("define app directory not exist: " + defineAppPath);
|
||||||
}
|
}
|
||||||
for (File appFile : Objects.requireNonNull(directory.listFiles())) {
|
for (File appFile : Objects.requireNonNull(directory.listFiles())) {
|
||||||
if (appFile.exists()) {
|
if (appFile.exists()) {
|
||||||
@@ -142,12 +139,10 @@ public class AppServiceImpl implements AppService, CommandLineRunner {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 读取监控参数定义配置加载到数据库中 define/param/*.yml
|
// 读取监控参数定义配置加载到数据库中 define/param/*.yml
|
||||||
String defineParamPath = "define" + File.separator + "param";
|
String defineParamPath = classpath + File.separator + "define" + File.separator + "param";
|
||||||
url = Thread.currentThread().getContextClassLoader().getResource(defineParamPath);
|
directory = new File(defineParamPath);
|
||||||
assert url != null;
|
|
||||||
directory = new File(url.toURI());
|
|
||||||
if (!directory.exists() || directory.listFiles() == null) {
|
if (!directory.exists() || directory.listFiles() == null) {
|
||||||
throw new IllegalArgumentException("define param directory not exist");
|
throw new IllegalArgumentException("define param directory not exist: " + defineParamPath);
|
||||||
}
|
}
|
||||||
for (File appFile : Objects.requireNonNull(directory.listFiles())) {
|
for (File appFile : Objects.requireNonNull(directory.listFiles())) {
|
||||||
if (appFile.exists()) {
|
if (appFile.exists()) {
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ resourceRole:
|
|||||||
excludedResource:
|
excludedResource:
|
||||||
- /account/auth/form===post
|
- /account/auth/form===post
|
||||||
- /i18n/**===get
|
- /i18n/**===get
|
||||||
|
# web ui 静态资源
|
||||||
|
- /console/**===get
|
||||||
- /**/*.html===get
|
- /**/*.html===get
|
||||||
- /**/*.js===get
|
- /**/*.js===get
|
||||||
- /**/*.css===get
|
- /**/*.css===get
|
||||||
@@ -19,10 +21,11 @@ excludedResource:
|
|||||||
- /**/*.ttf===get
|
- /**/*.ttf===get
|
||||||
- /**/*.png===get
|
- /**/*.png===get
|
||||||
- /**/*.gif===get
|
- /**/*.gif===get
|
||||||
|
- /**/*.png===*
|
||||||
|
# swagger ui 资源
|
||||||
- /swagger-resources/**===get
|
- /swagger-resources/**===get
|
||||||
- /v2/api-docs===get
|
- /v2/api-docs===get
|
||||||
- /v3/api-docs===get
|
- /v3/api-docs===get
|
||||||
- /**/*.png===*
|
|
||||||
|
|
||||||
# account info
|
# account info
|
||||||
# there are three account: admin, root, tom
|
# there are three account: admin, root, tom
|
||||||
|
|||||||
2
pom.xml
2
pom.xml
@@ -102,7 +102,7 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<rulesets>
|
<rulesets>
|
||||||
<ruleset>rulesets/java/ali-comment.xml</ruleset>
|
<ruleset>rulesets/java/ali-comment.xml</ruleset>
|
||||||
<ruleset>rulesets/java/ali-concurrent.xml</ruleset>
|
<!--<ruleset>rulesets/java/ali-concurrent.xml</ruleset>-->
|
||||||
<ruleset>rulesets/java/ali-constant.xml</ruleset>
|
<ruleset>rulesets/java/ali-constant.xml</ruleset>
|
||||||
<!--<ruleset>rulesets/java/ali-exception.xml</ruleset>-->
|
<!--<ruleset>rulesets/java/ali-exception.xml</ruleset>-->
|
||||||
<!--<ruleset>rulesets/java/ali-flowcontrol.xml</ruleset>-->
|
<!--<ruleset>rulesets/java/ali-flowcontrol.xml</ruleset>-->
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
|||||||
@Api(tags = "监控指标数据API")
|
@Api(tags = "监控指标数据API")
|
||||||
public class MetricsDataController {
|
public class MetricsDataController {
|
||||||
|
|
||||||
|
private static final Integer METRIC_FULL_LENGTH = 3;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisDataStorage redisDataStorage;
|
private RedisDataStorage redisDataStorage;
|
||||||
|
|
||||||
@@ -77,7 +79,7 @@ public class MetricsDataController {
|
|||||||
@RequestParam(required = false) String history
|
@RequestParam(required = false) String history
|
||||||
) {
|
) {
|
||||||
String[] names = metricFull.split(".");
|
String[] names = metricFull.split(".");
|
||||||
if (names.length != 3) {
|
if (names.length != METRIC_FULL_LENGTH) {
|
||||||
throw new IllegalArgumentException("metrics full name: " + metricFull + " is illegal.");
|
throw new IllegalArgumentException("metrics full name: " + metricFull + " is illegal.");
|
||||||
}
|
}
|
||||||
String app = names[0];
|
String app = names[0];
|
||||||
|
|||||||
@@ -3,3 +3,8 @@
|
|||||||
> 前端工程
|
> 前端工程
|
||||||
|
|
||||||
**面向开发者,易用友好的高性能监控云服务**
|
**面向开发者,易用友好的高性能监控云服务**
|
||||||
|
|
||||||
|
|
||||||
|
## 编译打包
|
||||||
|
|
||||||
|
```ng build --prod --base-href /console/```
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
"build": {
|
"build": {
|
||||||
"builder": "@angular-devkit/build-angular:browser",
|
"builder": "@angular-devkit/build-angular:browser",
|
||||||
"options": {
|
"options": {
|
||||||
"outputPath": "dist/web-app",
|
"outputPath": "dist",
|
||||||
"index": "src/index.html",
|
"index": "src/index.html",
|
||||||
"main": "src/main.ts",
|
"main": "src/main.ts",
|
||||||
"polyfills": "src/polyfills.ts",
|
"polyfills": "src/polyfills.ts",
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ import { Environment } from '@delon/theme';
|
|||||||
|
|
||||||
export const environment = {
|
export const environment = {
|
||||||
production: true,
|
production: true,
|
||||||
useHash: true,
|
useHash: false,
|
||||||
api: {
|
api: {
|
||||||
baseUrl: './',
|
baseUrl: '/',
|
||||||
refreshTokenEnabled: true
|
refreshTokenEnabled: true
|
||||||
}
|
}
|
||||||
} as Environment;
|
} as Environment;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import * as MOCK_DATA from '../../_mock';
|
|||||||
|
|
||||||
export const environment = {
|
export const environment = {
|
||||||
production: false,
|
production: false,
|
||||||
useHash: true,
|
useHash: false,
|
||||||
api: {
|
api: {
|
||||||
baseUrl: 'http://localhost:8080/',
|
baseUrl: 'http://localhost:8080/',
|
||||||
refreshTokenEnabled: true
|
refreshTokenEnabled: true
|
||||||
|
|||||||
Reference in New Issue
Block a user