docker私有仓库和监控及报警环境搭建
来源:互联网 发布:淘宝皇冠店铺出租 编辑:程序博客网 时间:2024/05/28 09:33
一、私有仓库搭建(registry)以172.16.113.12仓库为例
1、下载registry镜像
docker pull registry
2、运行镜像
docker run -d -p 5000:5000 -v /home/registry/:/var/lib/registry/ --name registry registry
3、push镜像
镜像的标签改成仓库地址 docker tag image 172.16.113.12:5000/image
docker push 172.16.113.12:5000/image
4、pull镜像
docker pull 172.16.113.12:5000/image
5、查看仓库镜像
172.16.113.12:5000/v2/_catalog
6、注意事项
docker必须配置--insecure-registry 172.16.113.12:5000,否则会提示连接错误
配置文件目录:/etc/systemd/system/docker.service.d/docker.conf
二、docker监控搭建(prometheus+cadvisor)以172.16.113.12为例
1、下载prometheus镜像
docker pull prom/prometheus
2、下载cadvisor镜像
docker pull google/cadvisor
3、在要监控的docker主机运行cadvisor镜像
docker run -d -v /:/rootfs:ro -v /var/run:/var/run:rw -v /sys:/sys:ro -v /home/lib/docker/:/var/lib/docker:ro -p 8080:8080 --name cadvisor google/cadvisor
4、配置prometheus.yml
global: scrape_interval: 15s external_labels: monitor: 'codelab-monitor'scrape_configs: - job_name: 'prometheus' scrape_interval: 5s static_configs: - targets: ['172.16.106.6:8080','172.16.106.7:8080','172.16.106.8:8080']
主要是targets,配置的是目标docker的cadvisor地址
5、运行镜像
docker run -d -p 9090:9090 -v /home/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml --name prometheus prom/prometheus
6、查看监控
prometheus 172.16.113.12:9090
cadvisor 172.16.106.6:8080
7、查询语法支持正则过过滤
三、监控报警
1、下载alertmanager镜像
docker pull prom/alertmanager
2、prometheus.yml文件添加报警文件
rule_files:
- "first.rules"
指定文件为first.rules
3、first.rules添加报警规则
ALERT InstanceStatus
IF up{job="docker-solr"} == 0
FOR 10s
LABELS {
instance = "",
}
ANNOTATIONS {
summary = "服务器 运行状态",
description = "服务器 已当机超过 10s"
}
当job=docker-solr的up值为0,且连续10秒,则触发报警
4、编辑alertmanager的转发配置simple.yml
global:
resolve_timeout: 1m
route:
group_by: ['InstanceStatus']
group_wait: 5s
group_interval: 10s
repeat_interval: 1h
receiver: 'team-X-pager'
receivers:
- name: 'team-X-pager'
webhook_configs:
- url: 'http://api.110monitor.com/alert/api/event/prometheus/4702344f-5a25-82b4-5d91-7e3b2e654527'
send_resolved: true
使用webhook模式,配置报警通过onealert进行转发
5、申请onealert账号,配置prometheus应用,并生成红色的应用ID
6、运行alertmanager镜像
docker run -d -p 9093:9093 -v /home/prometheus/simple.yml:/etc/alertmanager/config.yml --name alertmanager prom/alertmanager
7、重启prometheus镜像
docker restart prometheus
阅读全文
0 0
- docker私有仓库和监控及报警环境搭建
- centos7 安装docker及搭建私有仓库
- Docker搭建私有仓库
- Docker私有仓库搭建
- 搭建Docker私有仓库
- 搭建docker私有仓库
- docker 搭建私有仓库
- 搭建docker私有仓库
- Docker私有仓库搭建
- docker搭建私有仓库
- docker私有仓库搭建
- docker搭建私有仓库
- docker私有仓库搭建
- Docker私有仓库搭建
- Docker私有仓库搭建
- Docker私有仓库搭建
- Docker私有仓库搭建
- docker搭建私有仓库
- 【Scikit-Learn 中文文档】三十八:成对的矩阵, 类别和核函数
- 用vuejs写一个分页组件
- 2017.12.6
- session和cookie总结,看完以下三篇文章就可以较好的理解了
- crontab使用方法
- docker私有仓库和监控及报警环境搭建
- 二进制图像矩阵转换为向量
- mysql--用户管理
- 《Thing in Java》对final关键字的介绍之数据
- SVN E200009 which is not part of the commit; both sides of the move must be committed together
- Util化SimpleDateFormat
- 编程习惯
- lwj_C#_homework get set 属性
- 微信公众号地图导航,公众号添加地图导航