本文共 979 字,大约阅读时间需要 3 分钟。
prometheus 是一款第三方的监控组件,提供了更直观和方便的监控需求,原理是,定时对应用的 /actuator/metrics 发起信息采集,进行展示和分析;
首先需要引入 micrometer-registry-prometheus 的 jar 包,资源配置文件中,添加对 premetheus 的 endpoint 的 web 暴露,然后单独部署和启动 Prometheus,并配置对应用的监控任务,最后访问 prometheus 页面;
# 应用的promethenus的endpoint http://localhost:12301/actuator/prometheus # prometheus的配置文件(部分) job_name: explore-spring-boot metrics_path: '/actuator/prometheus' static_configs: - targets: ['192.168.8.129:12301'] labels: instance: explore-spring-boot # prometheus的页面访问 http://192.168.99.100:9090/targets
在 prometheus 的基础上,提供了更多的查询,监控,告警的功能,数据采集源有多渠道,如 DB,prometheus;
首先 grafana 也需要单独部署和启动,部署完成后,访问 http://192.168.99.100:3000/,然后添加数据源,URL 是prometheus 的访问 URL(http://192.168.99.100:9090),添加 dashboard,点击 graph,选择 panel,进行 edit,并选择监控的 metrics,enable query 后即可看到对 mertics 的监控;
更详细操作参考:https://editor.csdn.net/md/?articleId=103539144;
转载地址:http://psfin.baihongyu.com/