当前位置:网站首页>Prometheus监控容器、pod、邮件告警
Prometheus监控容器、pod、邮件告警
2022-08-03 05:26:00 【养了一只皮卡丘】
Cadvisor 进行收集,通过 Prometheus 作为数据源,利用 Grafana 进行展示。
环境说明:
已做工作可以参考上一篇文章Prometheus、Grafan基于docker部署
| 主机名 | IP | 部署功能 |
|---|---|---|
| master | 192.168.143.140 | Grafan 容器 Prometheus 容器 node_exporter |
| node1 | 192.168.143.141 | cadvisor容器 node_exporter |
node1主机上 用此命令运行容器google/cadvisor官方镜像
docker run \
--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 \
--privileged \
--device=/dev/kmsg \
google/cadvisor
[[email protected] ~]# docker run \
> --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 \
> --privileged \
> --device=/dev/kmsg \
> google/cadvisor





在 master 主机上配置prometheus.yml文件
使prometheus能够接受到node1采集的信息
[[email protected] ~]# vim /opt/prometheus.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.
# scrape_timeout is set to the global default (10s).
# Alertmanager configuration
alerting:
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 it's Prometheus itself.
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: "prometheus"
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ["192.168.143.140:9100"]
- job_name: "Linux Server"
static_configs:
- targets:
- 192.168.143.141:9100
- 192.168.143.142:9100
//新增配置
- job_name: "cadvisor Service "
static_configs:
- targets: ["192.168.143.141:8080"]
//重启docker,也可以docekr restart prometheus
[[email protected] ~]# systemctl restart docker
//master上面查看,监控状态发现有新的节点

//发现原来的模板监控不了,此时添加新的模板
添加新的模板



边栏推荐
猜你喜欢
随机推荐
2. What is the difference between Exception and Error?
appium(3)webview测试
MySql【后面附有练习题】
ZBrush+Substance Designer2021制作高品质3D角色模型全流程!
6. What is the difference between Vector, ArrayList and LinkedList?(design, performance, safety)
用DirectX12绘制一个几何体的程序详述
Difference between @JsonProperty and JSONField?
数组与字符串8-最长回文子串
POE交换机全方位解读(中)
使用Blender和ZBrush制作武器模型
ARP协议及简单路由器原理(1)
域名注册流程:如何选择购买合适的域名?
window下VS2022封装静态库以及调用静态库
3. What is the difference between final, finally, and finalize?
借助ginput函数在figure窗口实时读取、展示多条曲线的坐标值
常见的电子元器件分类介绍-唯样商城
域名怎么管理,域名管理注意事项有哪些?
数组与字符串14-使用双指针移除元素
采用Trench肖特基二极管,实现功率密度的显著提升
二分查找1-实现一个二分查找









