当前位置:网站首页>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上面查看,监控状态发现有新的节点
//发现原来的模板监控不了,此时添加新的模板
添加新的模板
边栏推荐
- classpath: comparison with classpath*
- window下VS2022封装静态库以及调用静态库
- 9. Please introduce the class loading process, what is the parent delegation model?
- 【测试基础】bug分级、测试流程、ISO9126质量模型
- 二层交换机,三层交换机,路由器内容总结记录
- 【3D建模制作技巧分享】ZBrush快捷键如何设置
- 稳压二极管的工作原理及稳压二极管使用电路图
- Automatic ticket issuance based on direct reduction of China Southern Airlines app
- 最优化方法概述
- MATLAB给多组条形图添加误差棒
猜你喜欢
随机推荐
ZEMAX | 如何倾斜和偏心序列光学元件
ZEMAX | 如何使用渐晕系数
内网渗透之PPT票据传递攻击(Pass the Ticket)
详解SSL证书的分类以及如何选择合适的证书?
appium(3)webview测试
数组与字符串14-使用双指针移除元素
二层交换机,三层交换机,路由器内容总结记录
VI和VIM编辑指令
数组与字符串8-最长回文子串
ZBrush+Substance Designer2021制作高品质3D角色模型全流程!
ZEMAX | 探索 OpticStudio中的序列模式
Typora
C语言中打印字符数组出现乱码的问题(烫烫烫)
二分查找2 - x的平方根
小程序动态加载分包文件及根路径处理
电子元器件之电子变压器可分为哪几类?
JS--正则表达式
ZEMAX | 如何创建简单的非序列系统
./autogen.sh: 4: ./autogen.sh: autoreconf: not found
cobalt strike 的基础使用