prometheus.yml 配置
- job_name: 'node_exporter'
consul_sd_configs: - server: 'consul_ip:8500' services: ['node_exporter']
# 匹配service关键字 - job_name: 'service' consul_sd_configs: - server: 'consul_ip:8500' services: [] relabel_configs: - source_labels: [__meta_consul_tags] regex: .*service.* action: keep
注册服务
curl -X PUT -d '{"id": "test1","name": "test1","address": "10.80.229.55","port": 9100,"tags": ["service"],"checks": [{"http": "http:// 10.80.229.55:9100/","interval": "5s"}]}' http://consul_ip:8500/v1/agent/service/register
查询指定节点以及指定的服务信息
curl http://consul_ip:8500/v1/catalog/service/mysql
删除服务
curl --request PUT http://consul_ip:8500/v1/agent/service/deregister/mysql
列出数据中心
curl http://consul_ip:8500/v1/catalog/datacenters
列出节点
curl http://consul_ip:8500/v1/catalog/nodes
列出服务
curl http://consul_ip:8500/v1/catalog/services
列出服务节点
curl http://consul_ip:8500/v1/catalog/service/my-service
上篇:
Prometheus+Grafana+Alertmanager
下篇:
Prometheus+Consul服务自动发现监控
1 WhatsApp外贸营销软件怎么选?从询盘到返单,五个阶段五个难处 2 开源版"AI制片厂"来了:12条流水线、一个人也能做专业视频... 3 OpenMontage:全世界第一个开源智能视频制作系统 4 Electron、React Native 都不用了?Rust 全栈框架 Dio... 5 智能目标检测:用 Rust + dora-rs + yolo 构建“机器之眼” 6 网络故障秒排指南:10 个实战命令从入门到精通 7 Echo:还在用“旁路由”?All in One主机才是未来:PVE+OpenW... 8 男人若想发大财,就莫要去打工,我推荐做这二十件事。 9 使用MCP+Neo4j零代码构建自己的知识图谱 10 运维必备:掌握这3个存储技术 11 2025年性价比最高的AI服务器拆解:768GB显存暴打训练慢的痛点 12 2025 年最适合小白的 Python 入门学习路线全解析