各节点主机部署容器监控组件cadvisor-exporter,我这边Docker网络使用的macvlan方式,所以直接给容器分配了IP地址。 # docker run -d -h cadvisor139-216 --name=cadvisor139-216 --net=none -m 8g --cpus=4 --ip=10.1.139.216 --volume=/:/rootfs:ro --volume=/var/run:/var/run:rw --volume=/sys:/sys...
-v /opt/prometheus/server/rules.yml:/etc/prometheus/rules.yml \ docker.io/prom/prometheus:v2.20.1 # 其它参数(非必选) --config.file=/etc/prometheus/prometheus.yml \ --web.enable-lifecycle #===# # docker部署 docker run -d \ --name=prometheus \ -p 9090:9090 \ -v /opt/prometheus/p...
第一段代码是放在prometheus.yml的scrape_config内,第二段代码是保存在/opt/prometheus/monitor_config/目录下,名称可以写被监控的机器ip文件为yml文件,如10.172.12.12.yml - job_name: 'zx_host' file_sd_configs: - files: ['/opt/prometheus/monitor_config/*.yml'] refresh_interval: 5s - targets: [ ...
tls_config: 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_(.+) - source_labels: [__meta_kub...
kubernetes_sd_configs: - role: node scheme: https tls_config: ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token relabel_configs: - action: labelmap regex: __meta_kubernetes_node_label_(.+) ...
$docker run --name prometheus -d -p9090:9090\ -v /home/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml \## 挂载 prometheus.yml 静态配置文件-v /home/prometheus/groups/:/usr/local/prometheus/groups/\## 挂载动态配置文件-v /home/prometheus/rules/:/usr/local/prometheus/rules/\## 挂载...
cat /opt/prometheus/sd_config/docker-hosts.yml - targets: - 172.22.3.149:9080 重启prometheus # systemctl restart prometheus 浏览器地址栏输入http://172.22.xx.xx:9090/targets 可以看到targets已经增加了对服务docker-hosts的监控 在grafana中配置面板显示对主机docker-hosts监控内容 ...
新增/opt/prometheus/sd_config/docker-hosts.yml文件,内容如下 cat /opt/prometheus/sd_config/docker-hosts.yml - targets: - 172.22.3.149:9080 1. 2. 3. 重启prometheus # systemctl restart prometheus 1. 浏览器地址栏输入http://172.22.3.148:9090/targets ...
docker: 需要开启 experimental 实验特性,配置 metrics-addr,如容器创建耗时等指标。 kube-proxy: 默认 127 暴露,10249端口。外部采集时可以修改为 0.0.0.0 监听,会暴露:写入 iptables 规则的耗时等指标。 kube-state-metrics: K8S 官方项目,采集pod、deployment等资源的元信息。
- files: ['/usr/local/prometheus/sd_config/docker-node.yml'] refresh_interval: 3s vim /usr/local/prometheus/sd_config/docker-node.yml - targets: - 192.168.1.155:8080 - 192.168.1.156:8080 labels: type: docker /usr/local/prometheus/promtool check config /usr/local/prometheus/prometheus.yml ...