Cadvisor+prometheus+grafana

发布时间:2022-07-01 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了Cadvisor+prometheus+grafana脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

部署CADvisor

[root@localhost ~]# docker run -d 
--volume=/:/rootfs:ro 
--volume=/VAR/run:/var/run:ro 
--volume=/Sys:/sys:ro 
--volume=/var/lib/docker/:/var/lib/docker:ro 
--volume=/dev/disk/:/dev/disk:ro 
--publish=8080:8080 
--detach=true 
--name=cadvisor 
GOOGLE/cadvisor:latest
[root@localhost ~]# docker ps -a
CONTaiNER ID   IMAGE                    COMMAND                  CREATED          statUS         PORTS                                       names
13420a47d9bf   google/cadvisor:latest   "/usr/bin/cadvisor -…"   10 seconds ago   Up 9 seconds   0.0.0.0:8080->8080/tcp, :::8080->8080/tcp   cadvisor

Cadvisor+prometheus+grafana

prometheus

特点:

  • 有多维度的数据模型
  • 有自己的查询语言:PRomQL
  • 不依赖分布式存储
  • 支持通过中间网关推送时间序列数据
  • 通过服务发现或静态配置,来发现目标服务对象
  • 支持图标和界面展示

部署Prometheus

[root@localhost ~]# docker pull prom/Prometheus   //下载普罗米修斯
[root@localhost ~]# vim /tmp/prometheus.yML      //创建静态普罗米修斯yml文件
#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.                  
   # scrap_timeout is set to the global default (10s).

# Alertmanager configuration
Alerting:
  alertmanagers:
  - static_configs:
    - targets:
      # - alertmanager:9093

#Load rules once andpreiodically 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 scrapedFrom this config.
  - job_name: 'prometheus'

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.
 
    static_configs:
    - targets: ['localhost:9090']
  - job_name: 'docker'      ##定义一个叫docker的组
    static_configs:
- targets: ['192.168.200.14:8080']

[root@localhost ~]# docker run -d --name=prometheus -p 9090:9090 -v /tmp/prometheus.yml:/etc/prometheus/prometheus.yml -v /etc/localtime:/etc/localtime prom/prometheus

页面访问端口9090

Cadvisor+prometheus+grafana

部署Granafa

[root@localhost ~]# docker run -d --name=granafa -p 3000:3000 grafana/grafana
65f2b78f0d30a27d38e12d728db66a60d9f44fc2ad2ab3ac3fd58c4cb7afd4f6
[root@localhost ~]# docker ps -a
CONTAINER ID   IMAGE                    COMMAND                  CREATED          STATUS          PORTS                                       NAMES
65f2b78f0d30   grafana/grafana          "/run.sh"                9 seconds ago    Up 8 seconds    0.0.0.0:3000->3000/tcp, :::3000->3000/tcp   granafa
dd61dd779dae   prom/prometheus          "/bin/prometheus --c…"   8 minutes ago    Up 4 minutes    0.0.0.0:9090->9090/tcp, :::9090->9090/tcp   prometheus
13420a47d9bf   google/cadvisor:latest   "/usr/bin/cadvisor -…"   46 minutes ago   Up 46 minutes   0.0.0.0:8080->8080/tcp, :::8080->8080/tcp   cadvisor

Cadvisor+prometheus+grafana

Cadvisor+prometheus+grafana

Cadvisor+prometheus+grafana

Cadvisor+prometheus+grafana

脚本宝典总结

以上是脚本宝典为你收集整理的Cadvisor+prometheus+grafana全部内容,希望文章能够帮你解决Cadvisor+prometheus+grafana所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。