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. # 监控 bladex
  43. - job_name: "bladex"
  44. metrics_path: "/actuator/prometheus"
  45. scrape_interval: 5s
  46. consul_sd_configs:
  47. #必须保证prometheus能调用否则不会显示
  48. #若是docker部署必须保证网络与各服务调通
  49. - server: '172.30.0.72:7002' #填写实现consul-api的blade-admin服务ip:端口
  50. #匹配所有service
  51. services: [ ]
  52. relabel_configs:
  53. #service 源标签
  54. - source_labels: [ __meta_consul_service ]
  55. #匹配 "blade" 开头的service
  56. regex: "blade*"
  57. #执行的动作
  58. action: drop
  59. #将service的label重写为application
  60. - source_labels: [ __meta_consul_service ]
  61. target_label: application
  62. - source_labels: [ __meta_consul_service_address ]
  63. target_label: instance
  64. - source_labels: [ __meta_consul_tags ]
  65. target_label: job