prometheus和grafana

prometheus配置信息

  • mq
  • eureka:使用注册中心对接减少了配置,不然每个模块都要配置一次,
global:
  scrape_interval: 5s

scrape_configs:
  - job_name: 'prometheus'
    static_configs:
      - targets: ['prometheus:9090']
  - job_name: 'linux-exporter'
    metrics_path: /metrics
    static_configs:
      - targets: ['192.168.1.101:9110']
  - job_name: rocketmq
    static_configs:
      - targets: ['192.168.1.101:5557']
        labels:
          instance: 192.168.1.101
  - job_name: 'eureka'
    metrics_path: '/actuator/prometheus' #springboot默认的actuator路径
    # Scrape Eureka itself to discover new services.
    eureka_sd_configs:
      - server: http://192.168.1.101:8000/eureka #这里是Eureka注册地址
        basic_auth:
          username: web
          password: 1
    relabel_configs:
      - source_labels: [__meta_eureka_app_instance_metadata_prometheus_path]
        action: replace
        target_label: __metrics_path__
        regex: (.+)
        # 增加一个自定义label sys_model 它的值从配置eureka中获取
      - source_labels: ["__meta_eureka_app_instance_metadata_sys_module"]
        action: replace
        target_label: sys_module
        regex: (.+)

访问prometheus: