环境
pro-server-182 pro-liangbang-183 pro-liangbang-184
k8s 192.168.192.241-243
1.联邦节点配置
root@pro-liangbang-183:/apps/prometheus# cat prometheus.yml global: scrape_interval: 5s # Set the scrape interval to every 15 seconds. Default is every 1 minute. evaluation_interval: 5s # Evaluate rules every 15 seconds. The default is every 1 minute. scrape_configs:- job_name: "node_exporter-241" static_configs: - targets: ["192.168.192.241:39100"]
root@pro-liangbang-184:/apps/prometheus# cat prometheus.yml global: scrape_interval: 5s # Set the scrape interval to every 15 seconds. Default is every 1 minute. evaluation_interval: 5s # Evaluate rules every 15 seconds. The default is every 1 minute. scrape_configs:- job_name: "node_exporter-242-243" static_configs: - targets: ["192.168.192.242:39100"]
2,Prometheus节点配置
root@pro-server-182:/apps/prometheus# cat prometheus.yml global: scrape_interval: 5s # Set the scrape interval to every 15 seconds. Default is every 1 minute. evaluation_interval: 5s # Evaluate rules every 15 seconds. The default is every 1 minute. alerting: alertmanagers: - static_configs: - targets: - 192.168.192.189:9093 rule_files: - "/apps/prometheus/*.yaml" scrape_configs: # - job_name: "prometheus-cadvisor" # static_configs: # - targets: ["192.168.192.243:8080","192.168.192.242:8080","192.168.192.241:8080"] # - job_name: "node_exporter" # static_configs: # - targets: ["192.168.192.241:39100","192.168.192.242:39100","192.168.192.243:39100"] - job_name: 'prometheus-federate-192.183' scrape_interval: 10s honor_labels: true metrics_path: '/federate' params: 'match[]': - '{job="prometheus"}' - '{__name__=~"job:.*"}' - '{__name__=~"node.*"}' static_configs: - targets: - '192.168.192.183:9090' - job_name: 'prometheus-federate-192.184' scrape_interval: 10s honor_labels: true metrics_path: '/federate' params: 'match[]': - '{job="prometheus"}' - '{__name__=~"job:.*"}' - '{__name__=~"node.*"}' static_configs: - targets: - '192.168.192.184:9090'
root@pro-server-182:/apps/prometheus# rm -rf data/ #重启服务
验证指标数据
3, grafana 查看
导入模板 8919