SpringBoot配置
management:
server:
port: 10091
endpoints:
web:
exposure:
include: '*'
base-path: /management
# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Alertmanager configuration
# windows ->(cmd进入目录执行) prometheus.exe --config.file=prometheus.yml
alerting:
alertmanagers:
- static_configs:
- targets:
- alertmanager:9090
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
# - "first_rules.yml"
# - "second_rules.yml"
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: 'prometheus'
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
metrics_path: /management/prometheus
static_configs:
# 需要监控的端口
- targets: ['localhost:10091']
默认端口9090
默认端口3000
直接启动,默认账号admin/admin
配置prometheus
docker run -d \
-p 9090:9090 \
--memory 40MB\
-v /usr/local/gps/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml \
prom/prometheus
授权 chmod 777 -R /usr/local/grafana
docker run -d \
-p 3000:3000 \
--memory 40MB\
--name=grafana \
-v /usr/local/gps/grafana:/var/lib/grafana \
grafana/grafana