安装 prometheus
docker run \
--name=prometheus \
--volume=/data/app/prometheus/config/:/etc/prometheus/ \
--volume=/etc/localtime:/etc/localtime \
--volume=/data/app/prometheus/data:/prometheus \
--network=host \
--expose=9090/tcp \
--restart=always \
prom/prometheus \
--config.file=/etc/prometheus/prometheus.yml --web.enable-lifecycle
配置文件(prometheus)
#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
alerting:
alertmanagers:
- static_configs:
- targets:
- XXX:9093
rule_files:
- /etc/prometheus/rules.yml
scrape_configs:
- job_name: 'XXX'
scrape_interval: 10s
file_sd_configs:
- refresh_interval: 1m
files: ["/etc/prometheus/json/*.json"]