discuz 企业网站,快速创建一个网页,如何获取网站的seo,原创WordPress自媒体Cadvisor产品简介
Cadvisor是Google开源的一款用于展示和分析容器运行状态的可视化工具。通过在主机上运行Cadvisor用户可以轻松的获取到当前主机上容器的运行统计信息#xff0c;并以图表的形式向用户展示。
接着上一篇来继续
部署Cadvisor
被监控主机上部署Cadvisor容器…Cadvisor产品简介
Cadvisor是Google开源的一款用于展示和分析容器运行状态的可视化工具。通过在主机上运行Cadvisor用户可以轻松的获取到当前主机上容器的运行统计信息并以图表的形式向用户展示。
接着上一篇来继续
部署Cadvisor
被监控主机上部署Cadvisor容器 清空原来的 [rootagent ~]# docker rm -f $(docker ps -aq) c78b7f80fd41 a76c56a3155b 14c0398f35a2 a0010d5c535f [rootagent ~]# 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 \ --publish8080:8080 \ --detachtrue \ --namecadvisor \ google/cadvisor:latest fbd537636358169b4bcbce652b94211b06c4c7aee41362ceeb456004510b7e82 访问cAdvisor页面
访问http://192.168.50.50:8080 cAdvisor页面可以看到收集到的数据 Prometheus产品简介
Prometheus是一个最初在SoundCloud上构建的开源系统监视和警报工具包。自2012年成立以来很多公司和组织都采用了Prometheus该项目拥有非常活跃的开发者和用户社区。 它现在是一个独立的开源项目可以独立于任何公司进行维护。 为了强调这一点并阐明项目的治理结构Prometheus于2016年加入Cloud Native Computing Foundation云原生基金会作为继Kubernetes之后的第二个托管项目。 Prometheus的主要特征有
多维度数据模型-由指标键值对标识的时间序列数据组成PromQL一种灵活的查询语言不依赖分布式存储; 单个服务器节点是自治的以HTTP方式通过pull模型拉取时间序列数据支持通过中间网关推送时间序列数据通过服务发现或者静态配置来发现目标服务对象支持多种多样的图表和界面展示
部署Prometheus [rootagent ~]# docker pull prom/prometheus Using default tag: latest *latest: Pulling from prom/prometheus 3cb635b06aa2: Pull complete 34f699df6fe0: Pull complete 33d6c9635e0f: Pull complete f2af7323bed8: Pull complete c16675a6a294: Pull complete 827843f6afe6: Pull complete 3d272942eeaf: Pull complete 7e785cfa34da: Pull complete 05e324559e3b: Pull complete 170620261a59: Pull complete ec35f5996032: Pull complete 5509173eb708: Pull complete Digest: sha256:cb9817249c346d6cfadebe383ed3b3cd4c540f623db40c4ca00da2ada45259bb Status: Downloaded newer image for prom/prometheus:latest docker.io/prom/prometheus:latest 配置prometheus.yml
一定注意格式很容易出错
[rootagent ~]# vim /tmp/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 is every 1 minute.# # scrape_timeout is set to the global default (10s).# Alertmanager configurationalerting:alertmanagers:- static_configs:- targets:# - alertmanager:9093# Load rules once and periodically 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 its Prometheus itself.scrape_configs:# The job name is added as a label jobjob_name to any timeseries scraped from 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.50.50:8080] ##填写一个或多个cadvisor的主机地址用逗号隔开
运行容器 [rootagent ~]# docker run -d \ --nameprometheus -p 9090:9090 \ -v /tmp/prometheus.yml:/etc/prometheus/prometheus.yml \ -v /etc/localtime:/etc/localtime \ prom/prometheus a8d8416ff184232a062a71fa4ee458c904b74f6f7b86313539708fe435bd4dd1 查看有没有启动 [rootagent ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES a8d8416ff184 prom/prometheus /bin/prometheus --c… 2 minutes ago Up 2 seconds 0.0.0.0:9090-9090/tcp, :::9090-9090/tcp prometheus 7c5c6cae02da google/cadvisor:latest /usr/bin/cadvisor -… 3 minutes ago Up 3 minutes 0.0.0.0:8080-8080/tcp, :::8080-8080/tcp cadvisor 访问prometheus页面
http://192.168.50.50:9090 看到docker组状态up为正常 查询都可以查 部署Granfana [rootagent ~]# docker run -d \ --namegrafana \ -p 3000:3000 \ grafana/grafana 91f8dea9a3970f374e521eeb9203fab24e9ef766b8f95bb0672ea1706daa2e7d [rootagent ~]# docker run --namenginx -d -p 80:80 nginx accb1ec5c8c9f711ba8d023474746beb32c041929b934029d41248c7c81c64d8 访问http://192.168.50.50:3000默认账户admin 密码 admin首次登陆需要修改密码 配置数据源 导入模板 选择对应的数据源点击导入就可以看到被监控主机的数据 准备测试容器
[rootagent ~]# docker run --namenginx -d -p 80:80 nginx accb1ec5c8c9f711ba8d023474746beb32c041929b934029d41248c7c81c64d8
可以看到成功了
右上角保存 到此Cadvisor PrometheusGrafana基本架构部署完毕