1. docker run -d --name prometheus --restart=always -p 9090:9090 -v /root/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus
    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:
    11. # - alertmanager:9093
    12. # Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
    13. rule_files:
    14. # - "first_rules.yml"
    15. # - "second_rules.yml"
    16. # A scrape configuration containing exactly one endpoint to scrape:
    17. # Here it's Prometheus itself.
    18. scrape_configs:
    19. # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
    20. - job_name: 'prometheus'
    21. # metrics_path defaults to '/metrics'
    22. # scheme defaults to 'http'.
    23. static_configs:
    24. - targets: ['192.168.0.157:9090','192.168.0.8:9090','192.168.0.57:9090','192.168.0.196:9090','192.168.0.58:9090','192.168.0.167:9090','192.168.0.220:9090','192.168.0.54:9090','192.168.0.227:9090','192.168.0.26:9090','192.168.0.31:9090','192.168.0.168:9090']
    25. #node_export
    26. - job_name: 'cadvisor'
    27. static_configs:
    28. - targets: ['192.168.0.157:38080']
    29. - job_name: 'microService'
    30. # 多久采集一次数据
    31. scrape_interval: 10s
    32. # 采集时的超时时间
    33. scrape_timeout: 10s
    34. # 采集的路径
    35. metrics_path: '/actuator/prometheus'
    36. # 采集服务的地址,设置成Springboot应用所在服务器的具体地址
    37. static_configs:
    38. - targets: ['192.168.0.58:8011']
    39. #node_export
    40. - job_name: 'HW'
    41. static_configs:
    42. - targets: ['192.168.0.157:9100','192.168.0.8:9100','192.168.0.57:9100','192.168.0.196:9100','192.168.0.58:9100','192.168.0.167:9100','192.168.0.220:9100','192.168.0.54:9100','192.168.0.227:9100','192.168.0.26:9100','192.168.0.31:9100','192.168.0.168:9100']
    43. #mysql_export
    44. - job_name: 'Mysql'
    45. static_configs:
    46. - targets: ['192.168.0.220:9104']
    47. #redis_export
    48. - job_name: "redis"
    49. static_configs:
    50. - targets: ['192.168.0.157:9121']