prometheus.yml 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. # my global config
  2. global:
  3. scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  4. evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  5. # scrape_timeout is set to the global default (10s).
  6. # Alertmanager configuration
  7. alerting:
  8. alertmanagers:
  9. - static_configs:
  10. - targets: ['172.30.0.99:9093']
  11. # Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
  12. rule_files:
  13. - "rules/alert_rules.yml"
  14. # A scrape configuration containing exactly one endpoint to scrape:
  15. # Here it's Prometheus itself.
  16. scrape_configs:
  17. # 监控 prometheus
  18. - job_name: 'prometheus'
  19. static_configs:
  20. - targets: ['172.30.0.90:9090'] #填写prometheus服务ip:端口
  21. # 监控 linux
  22. - job_name: linux
  23. static_configs:
  24. - targets: ['172.30.0.93:9100'] #填写node-exporter的docker服务ip:端口或者宿主机ip:映射的端口
  25. labels:
  26. instance: localhost:linux #实例名称或ip
  27. # 监控 mysql
  28. - job_name: 'mysql'
  29. static_configs:
  30. - targets: ['172.30.0.94:9104'] #填写mysqld-exporter的docker服务ip:端口或者宿主机ip:映射的端口
  31. labels:
  32. instance: localhost:mysql #实例名称或ip
  33. # 监控 cadvisor
  34. - job_name: "docker"
  35. static_configs:
  36. - targets: ['172.30.0.180:8080'] #填写cadvisor服务ip:端口
  37. # 监控 nacos
  38. - job_name: "nacos"
  39. metrics_path: '/nacos/actuator/prometheus'
  40. static_configs:
  41. - targets: ['172.30.0.48:8848'] #填写nacos服务ip:端口
  42. - job_name: "kdx"
  43. metrics_path: "/actuator/prometheus"
  44. scrape_interval: 5s
  45. consul_sd_configs:
  46. #必须保证prometheus能调用否则不会显示
  47. #若是docker部署必须保证网络与各服务调通
  48. - server: '172.30.0.72:7002' #填写实现consul-api的kd-admin服务ip:端口
  49. #匹配所有service
  50. services: []
  51. relabel_configs:
  52. #service 源标签
  53. - source_labels: [__meta_consul_service]
  54. #匹配 "kd" 开头的service
  55. regex: "kd*"
  56. #执行的动作
  57. action: drop
  58. #将service的label重写为application
  59. - source_labels: [__meta_consul_service]
  60. target_label: application
  61. - source_labels: [__meta_consul_service_address]
  62. target_label: instance
  63. - source_labels: [__meta_consul_tags]
  64. target_label: job