2. file_sd_configs: 基于文件的自动发现,prometheus会定期读取文件中的配置并重新加载,文件可以是yml、yaml和json格式。 每个target在执行过程中都有一个源标签__meta_filepath为文件的路径 # 文件自动发现 file_sd_configs: -files: -foo/*.slow.json -foo/*.slow.yml -single/file.yml # ...
- job_name: "node" file_sd_configs: - files: - targets/nodes/*.json refresh_interval: 5m 说明:我们使用file_sd_configs模块代替static_configs模块,并指定files路径,并指定每5分钟prometheus重新加载该配置文件 2) 创建主机清单的JSON文件 代码解读 mkdir -p /usr/local/prometheus/targets/nodes/ cat >/...
file_sd_configs : 文件发现 #因为部署在k8s中 需要配置 这里对应有点奇怪 sd_my_server.json文件没有对应到file_sd文件中 只在/prometheus这一层vim case3-1-prometheus-cfg.yaml - job_name:'file_sd_config_CAserver'file_sd_configs: - files: - /prometheus/sd_my_server.json refresh_interval: 10s...
自动化监控file_sd_configs + consul_sd_configs - 基于文件的服务发现 新增prometheus配置项 - job_name:'file_sd'file_sd_configs: - files: ['/opt/monitor/prometheus/sd_config/*.yml'] [root@slave-2 prometheus]# kill -HUP 52720[root@slave-2 sd_config]# vi node_exporter.yml- targets: ['...
- file_sd_configs: - files: - 'configs/nginx.yml' job_name: Nginx Server metrics_path: /metrics relabel_configs: - source_labels: [__address__] regex: (.*) target_label: instance replacement: $1 - source_labels: [__address__] ...
prometheus02-file_sd_configs 1.配置文件(自动发现) [root@zabbix-proxy prometheus]# cat prometheus.yml# my global configglobal: 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 ...
scrape_configs: - job_name: apt-dpkg file_sd_configs: - files: - /etc/promtail/dpkg-apt.yaml refresh_interval: 5m ``` The targets to be scraped by Promtail are defined in `/etc/promtail/dpkg-apt.yaml`. In fact, Promtail read the target to scrape in the list of file provided...
file_sd_configs: - files: ['/usr/local/prometheus/sd_config/*.yml'] refresh_interval: 5s [root@zabbix-proxy prometheus]# 2. prometheus 软加载配置文件 kill -hup pid 3.prometheus 校验配置文件 [root@zabbix-proxy prometheus]# /usr/local/prometheus/promtool check config /usr/local/prometheus/pr...
我们用file_sd_configs块替换prometheus.yml文件中的static_configs块。在这些块中,已经指定了文件列表,并包含在files列表中。我们在父目录targets下为每个作业指定了对应的文件,并为每个作业创建了一个子目录。你可以创建适合你的任何文件结构。然后使用*.json的glob样式来指定文件。每当这些文件发生更改时,系统都将从此...
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token kubernetes_sd_configs: - role: node relabel_configs: - action: labelmap regex: __meta_kubernetes_node_label_(.+) ...