Grafana 中Nacos指标未显示
在搭建 Shoulder-Platform 时,根据 Nacos 官方教程对 Nacos 监控时,未正确显示数据,仪表盘为空。
检查后发现是以下两个原因导致的:
数据源不正确
- [nacos 官方给的监控模板](https://github.com/nacos-group/nacos-template)中的数据源名称为 `prometheus` ,而 `Grafana` 默认的 Prometheus 数据源名称为 `Prometheus`(P大写),由于不匹配,导致不会显示任何数据。
标签未正确匹配
我的 prometheus.yml
中对 nacos 的配置如下(与官方不同)
- job_name: 'nacos'
scrape_interval: 20s
metrics_path: /nacos/actuator/prometheus
static_configs:
- targets: ['192.168.10.1:8848']
labels:
instance: nacos
与官方给的相比,我主动配置了标签,则需要在配置中修改为自己配置的,见下图
配置完毕后,就可以看到 CPU、内存等实例指标啦~