mirror of https://gitee.com/stylefeng/roses
修改prometheus监控bug
parent
4e5c634e08
commit
437256afe2
|
@ -20,7 +20,7 @@
|
||||||
<!--监控的自动配置-->
|
<!--监控的自动配置-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.stylefeng.roses</groupId>
|
<groupId>cn.stylefeng.roses</groupId>
|
||||||
<artifactId>monitor-spring-boot-starter</artifactId>
|
<artifactId>monitor-sdk-prometheus</artifactId>
|
||||||
<version>7.0.1</version>
|
<version>7.0.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
|
@ -4,14 +4,12 @@ import cn.hutool.core.util.StrUtil;
|
||||||
import cn.stylefeng.roses.kernel.monitor.api.PrometheusApi;
|
import cn.stylefeng.roses.kernel.monitor.api.PrometheusApi;
|
||||||
import cn.stylefeng.roses.kernel.monitor.api.constants.MonitorConstants;
|
import cn.stylefeng.roses.kernel.monitor.api.constants.MonitorConstants;
|
||||||
import cn.stylefeng.roses.kernel.monitor.api.pojo.prometheus.PromResultInfo;
|
import cn.stylefeng.roses.kernel.monitor.api.pojo.prometheus.PromResultInfo;
|
||||||
import cn.stylefeng.roses.kernel.monitor.system.holder.SystemHardwareInfoHolder;
|
|
||||||
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
|
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
|
||||||
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
|
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
@ -86,7 +84,7 @@ public class PrometheusMonitorController {
|
||||||
*/
|
*/
|
||||||
@GetResource(name = "jvm监控数据", path = "/view/monitor/getJvmInfo")
|
@GetResource(name = "jvm监控数据", path = "/view/monitor/getJvmInfo")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String jvmInfo(@RequestParam("id") String id, @RequestParam("area") String area) {
|
public String jvmInfo(@RequestParam(value = "id",required = false) String id, @RequestParam(value = "area",required = false) String area) {
|
||||||
Map<String, Object> metricMap = getMetricInfos(getPromQl(id, area), "jvm_", "", "");
|
Map<String, Object> metricMap = getMetricInfos(getPromQl(id, area), "jvm_", "", "");
|
||||||
return JSON.toJSONString(metricMap);
|
return JSON.toJSONString(metricMap);
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,8 @@
|
||||||
request.dataObject = {
|
request.dataObject = {
|
||||||
level: level,
|
level: level,
|
||||||
isRate: 'irate',
|
isRate: 'irate',
|
||||||
rateMetric: 'logback_events_total'
|
rateMetric: 'logback_events_total',
|
||||||
|
timeInterval: '[5m]'
|
||||||
};
|
};
|
||||||
request.setAsync(true);
|
request.setAsync(true);
|
||||||
request.start();
|
request.start();
|
||||||
|
|
|
@ -31,6 +31,13 @@
|
||||||
<version>7.0.1</version>
|
<version>7.0.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!--prometheus融合模块-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.stylefeng.roses</groupId>
|
||||||
|
<artifactId>monitor-integration-beetl</artifactId>
|
||||||
|
<version>7.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
Loading…
Reference in New Issue