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'.
static_configs:
- targets: ["localhost:9090"]
labels:
instance: '实例1'
- targets: ["localhost:9100"]
labels:
instance: '实例2'
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:
# - alertmanager:9093
# 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'.
static_configs:
- targets: ["localhost:9090"]
- job_name: "node_exporter"
scrape_interval: 10s
static_configs:
- targets: ["localhost:9100"]
labels:
instance: '本机'
- targets: ["1.2.3.4(其他机器的IP):9100"]
labels:
instance: '其他机器'
# 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:
# - alertmanager:9093
# 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'.
static_configs:
- targets: ["localhost:9090"]
labels:
instance: '实例1'
- job_name: "node_exporter"
scrape_interval: 10s
static_configs:
- targets: ["localhost:9100"]
labels:
instance: '本机'
@Bene #86
现在我的 /etc/prometheus/prometheus.yml 内容是这样的,应该如何改呢?
@fscarmen #91
@JohnsonRan #90
这个命令是让 nodeExporter 只读取 br-lan 的数据了,而且我面板的网速部分基本限定了 eth.* / ens.* 之类的网卡,不会接触 br-lan 的数据
需要重新编辑,加上 br-lan
感觉有点吃内存
@adouta #94
测试加了20个探针,服务端大概增加了350MB内存,供参考
@Bene 再次感谢楼主!
哪位大能录个搭建视频,上传油管,绝逼有播放
@Bene #92 我已经按你的配置文件改了,并重启了 prometheus,仍然未行,请大佬看看哪里漏了?
@fscarmen #97
试试删掉 9090 的 label,这里都不需要 label 的
我现在是两台机器,但只显示1台的呢?使用哪里有问题?在服务端是能获取客户端的数据
@fscarmen #73 这个主要是看你的数据源来自哪里,如果你都是用Prometheus采集的,那么在grafana上会自动跟新在Prometheus上采集到的数据,通过instance实例变量去切换当前展示的数据的实例对象。