Docker运行Prometheus(普罗米修斯)
1.编辑yaml格式,进行自我监控# mkdir /etc/prometheus# cd /etc/prometheus/# vi /etc/prometheus/prometheus.ymlglobal:scrape_interval:15s # By default, scrape targets every 15 seconds.# Attach th...
·
1.编辑yaml格式,进行自我监控
# mkdir /etc/prometheus
# cd /etc/prometheus/
# vi /etc/prometheus/prometheus.yml
global:
scrape_interval: 15s # By default, scrape targets every 15 seconds.
# Attach these labels to any time series or alerts when communicating with
# external systems (federation, remote storage, Alertmanager).
external_labels:
monitor: 'codelab-monitor'
# 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'
# Override the global default and scrape targets from this job every 5 seconds.
scrape_interval: 5s
static_configs:
- targets: ['localhost:9090']
或者
global:
scrape_interval: 15s
scrape_timeout: 10s
evaluation_interval: 1m
external_labels:
monitor: codelab-monitor
scrape_configs:
- job_name: prometheus
honor_timestamps: true
scrape_interval: 5s
scrape_timeout: 5s
metrics_path: /metrics
scheme: http
static_configs:
- targets:
- localhost:9090
2.运行Docker的prometheus(普罗米修斯)容器
# docker run \
-p 9090:9090 \
-v /etc/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml \
prom/prometheus
level=info ts=2020-01-17T15:37:54.425Z caller=main.go:294 msg="no time or size retention was set so using the default time retention" duration=15d
level=info ts=2020-01-17T15:37:54.425Z caller=main.go:330 msg="Starting Prometheus" version="(version=2.15.2, branch=HEAD, revision=d9613e5c466c6e9de548c4dae1b9aabf9aaf7c57)"
level=info ts=2020-01-17T15:37:54.425Z caller=main.go:331 build_context="(go=go1.13.5, user=root@688433cf4ff7, date=20200106-14:50:51)"
level=info ts=2020-01-17T15:37:54.425Z caller=main.go:332 host_details="(Linux 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 bf94042176af (none))"
level=info ts=2020-01-17T15:37:54.425Z caller=main.go:333 fd_limits="(soft=1048576, hard=1048576)"
level=info ts=2020-01-17T15:37:54.426Z caller=main.go:334 vm_limits="(soft=unlimited, hard=unlimited)"
level=info ts=2020-01-17T15:37:54.430Z caller=main.go:648 msg="Starting TSDB ..."
level=info ts=2020-01-17T15:37:54.430Z caller=web.go:506 component=web msg="Start listening for connections" address=0.0.0.0:9090
level=info ts=2020-01-17T15:37:54.437Z caller=head.go:584 component=tsdb msg="replaying WAL, this may take awhile"
level=info ts=2020-01-17T15:37:54.440Z caller=head.go:632 component=tsdb msg="WAL segment loaded" segment=0 maxSegment=0
level=info ts=2020-01-17T15:37:54.441Z caller=main.go:663 fs_type=XFS_SUPER_MAGIC
level=info ts=2020-01-17T15:37:54.441Z caller=main.go:664 msg="TSDB started"
level=info ts=2020-01-17T15:37:54.441Z caller=main.go:734 msg="Loading configuration file" filename=/etc/prometheus/prometheus.yml
level=info ts=2020-01-17T15:37:54.442Z caller=main.go:762 msg="Completed loading of configuration file" filename=/etc/prometheus/prometheus.yml
level=info ts=2020-01-17T15:37:54.442Z caller=main.go:617 msg="Server is ready to receive web requests."
3.打开浏览器 ,输入ip:9090
更多推荐
已为社区贡献3条内容
所有评论(0)