当前位置:   article > 正文

docker部署prometheus监控k8s、容器_docker run -d -p 9090:9090 -v /prometheus/promethe

docker run -d -p 9090:9090 -v /prometheus/prometheus.yml

1、部署prometheus、grafana

监控主机上部署prometheus、grafana

启动prometheus:

docker run -d  -p 9090:9090 -v /data/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml  prom/prometheus

cat  /data/prometheus/prometheus.yml
global:
  scrape_interval:     15s 
  evaluation_interval: 15s 

alerting:
  alertmanagers:
  - static_configs:
    - targets:

scrape_configs:

  - job_name: 'prometheus'
    static_configs:
    - targets: ['192.168.4.148:9090']

  - job_name: 'linux'
    static_configs:
    - targets: ['192.168.4.134:9100','192.168.4.135:9100','192.168.4.136:9100']
  - job_name: 'docker'
    static_configs:
    - targets: ['192.168.4.134:9994','192.168.4.135:9994','192.168.4.136:9994']

启动grafana :

docker run -d -p 3000:3000 --name=grafana grafana/grafana 

访问http://192.168.4.148:9090

访问http://192.168.4.148:3000

2、k8s node节点、docker主机:部署node-exporter、cadvisor

启动node-exporter:

docker run -d -p 9100:9100 --net='host'  prom/node-exporter

启动cadvisor:

docker run --volume=/:/rootfs:ro --volume=/var/run:/var/run:rw \ 
--volume=/sys:/sys:ro --volume=/var/lib/docker/:/var/lib/docker:ro \ 
--publish=9994:8080 --detach=true --name=cadvisor --restart=always google/cadvisor

3、加入模板即可

dashboards模版id
7362 mysql
10467 监控物理机/虚拟机(windows)
8919 监控物理机/虚拟机(linux)
9614 nginx

监控容器

8321
3146
8685
10000
8588
315

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/羊村懒王/article/detail/338781
推荐阅读
相关标签
  

闽ICP备14008679号