prometheus安装(docker)
参考:https://github.com/songjiayang/prometheus_practice
https://github.com/kjanshair/docker-prometheus
https://github.com/vegasbrianc/prometheus
alertmanager
mkdir /opt/alertmanager -p
vim /opt/alertmanager/Dockerfile
FROM prom/alertmanager:v0.19.0
EXPOSE 9093
vim /opt/alertmanager/docker-compose.yml
version: "3.7"
services:
alertmanager:
image: v-alertmanager
container_name: alertmanager
build:
context: .
dockerfile: Dockerfile
restart: always
ports:
- 9093:9093
volumes:
- /opt/alertmanager/etc/alertmanager/alertmanager.yml:/etc/alertmanager/alertmanager.yml
- /var/lib/alertmanager:/alertmanager
command:
- '--config.file=/etc/alertmanager/alertmanager.yml'
- '--storage.path=/alertmanager'
mkdir -p /var/lib/alertmanager;chmod -R 777 /var/lib/alertmanager
vim /opt/alertmanager/etc/alertmanager/alertmanager.yml
global:
resolve_timeout: 5m route:
group_by: ['alertname']
group_wait: 10s
group_interval: 10s
repeat_interval: 1h
receiver: 'web.hook'
receivers:
- name: 'web.hook'
webhook_configs:
- url: 'http://127.0.0.1:5001/'
inhibit_rules:
- source_match:
severity: 'critical'
target_match:
severity: 'warning'
equal: ['alertname', 'dev', 'instance']
global:
resolve_timeout: 5m
route:
repeat_interval: 2h
receiver: email-1
routes:
- match:
alertname: httpd_down
receiver: email-1 - match:
alertname: nginx_down
receiver: email-2 receivers:
- name: email-1
email_configs:
- to: <to-email>
from: <from-email>
smarthost: <smtp:port>
auth_username: "<user-name>"
auth_identity: "<user-name>"
auth_password: "<user-app-specific-password>" - name: email-2
email_configs:
- to: <to-email>
from: <from-email>
smarthost: <smtp:port>
auth_username: "<user-name>"
auth_identity: "<user-name>"
auth_password: "<user-app-specific-password>"
生成启动
cd /opt/alertmanager
docker-compose build --no-cache
docker-compose up -d --force-recreate
docker-compose down
docker-compose restart
查看进程
netstat -anltp|grep 9093
查看日志
docker logs --tail="500" alertmanager
docker logs -f alertmanager
进入容器
docker exec -it alertmanager /bin/sh
docker cp alertmanager:/etc/alertmanager/alertmanager.yml /opt/alertmanager/alertmanager_bak.yml
node_exporter
数据采集,不向中央服务器发送,而是等待抓取。默认暴露地址http://CURRENT_IP:9100/metrics
mkdir /opt/node-exporter -p
vim /opt/node-exporter/Dockerfile
FROM prom/node-exporter:v0.18.1
EXPOSE 9100
vim /opt/node-exporter/docker-compose.yml
version: '3.7'
services:
node-exporter:
image: v-node-exporter
container_name: node-exporter
build:
context: .
dockerfile: Dockerfile
restart: unless-stopped
ports:
- 9100:9100
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
command:
- '--path.procfs=/host/proc'
- '--path.sysfs=/host/sys'
- '--collector.filesystem.ignored-mount-points="^/(sys|proc|dev|host|etc)($$|/)"'
注意别与elasticsearch-head的9100端口重叠
生成启动
cd /opt/node-exporter/
docker-compose build
docker-compose up -d --force-recreate
docker-compose down
docker-compose restart
查看进程
netstat -anltp|grep 9100
查看日志
docker logs --tail="500" node-exporter
docker logs -f node-exporter
进入容器
docker exec -it node-exporter /bin/sh
查看帮助
./node_exporter -h
prometheus
mkdir /opt/prometheus -p
vim /opt/prometheus/Dockerfile
FROM prom/prometheus:v2.14.0
EXPOSE 9090
vim /opt/prometheus/docker-compose.yml
version: "3.7"
services:
prometheus:
image: v-prometheus
container_name: prometheus
build:
context: .
dockerfile: Dockerfile
restart: always
ports:
- 9090:9090
volumes:
- ./etc/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
- /var/lib/prometheus:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
- '--web.console.templates=/usr/share/prometheus/consoles'
mkdir -p /var/lib/prometheus;chmod -R 777 /var/lib/prometheus
chown -R 1000:1000 /opt/prometheus/etc/prometheus
vim /opt/prometheus/etc/prometheus/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
altering:
alertmanagers:
- static_configs:
- targets:
- alertmanagerserver1:9093 # Load rules once and periodically evaluate them according to the global 'evaluation_interval'. rule_files:
# - "1_rules.yml"
# - "2_rules.yml" # A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['prometheusserver1:9090']
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
vim vim /opt/prometheus/etc/prometheus/1_rules.yml
groups: - name: httpd
rules:
- alert: httpd_down
expr: probe_success{instance="http://httpd:80",job="httpd"} == 0
for: 1s
labels:
severity: critical
annotations:
summary: "httpd is down" - name: nginx
rules:
- alert: nginx_down
expr: probe_success{instance="http://nginx:80",job="nginx"} == 0
for: 1s
labels:
severity: warning
annotations:
summary: "nginx is down"
生成启动
cd /opt/prometheus/
docker-compose build
docker-compose up -d --force-recreate
docker-compose down
docker-compose restart
查看进程
netstat -anltp|grep 9090
查看日志
docker logs --tail="500" prometheus
docker logs -f prometheus
进入容器
docker exec -it prometheus /bin/sh
docker cp prometheus:/etc/prometheus/prometheus.yml /opt/prometheus/prometheus_bak.yml
PushGateway
mkdir /opt/pushgateway -p
vim /opt/pushgateway/Dockerfile
FROM prom/pushgateway:v1.0.0
EXPOSE 9091
blackbox-exporter
mkdir /opt/blackbox-exporter -p
vim /opt/blackbox-exporter/Dockerfile
FROM prom/blackbox-exporter:v0.16.0
EXPOSE
vim /opt/blackbox-exporter/docker-compose.yml
version: "3.7"
services:
blackbox-exporter:
image: v-blackbox-exporter
container_name: blackbox
build:
context: .
dockerfile: Dockerfile
restart: unless-stopped
ports:
- "9115:9115"
Grafana
构建Dockerfile
mkdir /opt/grafana
vim /opt/grafana/Dockerfile
FROM grafana/grafana:6.5.1
EXPOSE 3000
vim /opt/grafana/docker-compose.yml
version: '3.7'
services:
grafana:
image: v-grafana
container_name: grafana
build:
context: .
dockerfile: Dockerfile
ports:
- 3000:3000
environment:
- GF_SECURITY_ADMIN_USER=${ADMIN_USER:-admin}
- GF_SECURITY_ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin}
- GF_USERS_ALLOW_SIGN_UP=true
volumes:
- /var/lib/grafana:/var/lib/grafana
- /var/log/grafana:/var/log/grafana
- ./etc/grafana/provisioning:/etc/grafana/provisioning
- /etc/localtime:/etc/localtime:ro
restart: unless-stopped
mkdir -p /var/lib/grafana;chmod -R 777 /var/lib/grafana
mkdir -p /var/log/grafana;chmod -R 777 /var/log/grafana
mkdir -p /opt/grafana/etc/grafana/provisioning/datasources;
mkdir -p /opt/grafana/etc/grafana/provisioning/notifiers;
mkdir -p /opt/grafana/etc/grafana/provisioning/dashboards;
chmod -R 777 /opt/grafana/etc/grafana/provisioning
/var/lib/grafana 为数据库所在目录
生成启动
cd /opt/grafana/
docker-compose build
docker-compose up -d --force-recreate
docker-compose down
docker-compose restart
查看进程
netstat -anltp|grep 3000
查看日志
docker logs --tail="500" grafana
docker logs -f grafana
进入容器
docker exec -it grafana /bin/bash
进入网站 用户名密码都是admin
prometheus集群 Thanos(略)
prometheus安装(docker)的更多相关文章
- centos7下安装docker(17.4docker监控----prometheus)
Prometheus是一个非常优秀的监控工具.准确的说,应该是监控方案.Prometheus提供了监控数据搜集,存储,处理,可视化和告警一套完整的解决方案 Prometheus架构如盗图: 官网上的原 ...
- Grafana连接Prometheus监控Docker平台
Grafana是一款开源的分析平台. Grafana allows you to query, visualize, alert on and understand your metrics no m ...
- Prometheus安装
Prometheus安装 下载地址: https://prometheus.io/download/ 现在时间是: 2019.09.07 安装环境: Linux centos7 minimal 虚拟机 ...
- Prometheus 监控Docker服务器及Granfanna可视化
Prometheus 监控Docker服务器及Granfanna可视化 cAdvisor(Container Advisor)用于收集正在运行的容器资源使用和性能信息. 使用Prometheus监控c ...
- Prometheus 安装部署
Prometheus 安装部署 安装版本:prometheus-2.6.1 百度云下载:https://pan.baidu.com/s/1w16lQZKw8PCHqlRuSK2i7A 提取码:lw1q ...
- centos 7 安装 Docker Engine-CentOS 社区版
获取Docker Engine-CentOS社区: https://docs.docker.com/install/linux/docker-ce/centos/ 1.操作系统要求 1.1 要安装 D ...
- Prometheus监控Docker Swarm集群(一)
Prometheus监控Docker Swarm集群(一) cAdvisor简介 为了解决容器的监控问题,Google开发了一款容器监控工具cAdvisor(Container Advisor),它为 ...
- Prometheus安装教程
Prometheus安装教程 欢迎关注H寻梦人公众号 参考目录 docker安装Prometheus 基于docker 搭建Prometheus+Grafana prometheus官方文档 dock ...
- CentOS7安装docker
1. 查看系统版本 $ cat /etc/redhat-release 2. 安装docker $ yum install docker 3.检查安装是否成功$ docker version 若 ...
随机推荐
- PIE SDK矢量栅格化算法
1.算法功能简介 矢量栅格化,由矢量数据向栅格数据的转换一般比较方便.对于点.线目标,由其所在的栅格行.列数表示,对于面状目标,则需判定落人该面积内的像元.通常栅格(像元)尺寸均大于原来坐标表示的分辨 ...
- 英语chrysopal金绿宝石chrysopal单词
chrysopal金绿宝石,也称金绿玉.化学成分为BeAl2O4.晶体属正交(斜方)晶系的氧化物矿物.它位列名贵宝石,具有四个变种:猫眼,变石,变石猫眼和金绿宝石晶体. 金绿宝石本身就是较稀少的矿物, ...
- vue多个路由使用同一个页面,通过name判断参数,渲染页面数据
项目中,发现有多个页面的数据内容相同,只是请求数据的参数不同,就可以使用同一个组件来渲染 这里的客户列表 / 我负责的 / 我参与的 都使用同一个组件,不同点在请求数据的参数 可以看到,通过钩子函数, ...
- QTableWidget右键菜单
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> namespace Ui { class MainWind ...
- linux安装包制作
1. 常见安装包 打包或压缩文件tar,zip,gz等,一般解压后即可 管理工具的deb,rpm等.这类安装文件可以通过第三方的命令安装 (apt和yum) .bin类,其实就是把sh和zip打包为b ...
- Asp.Net SignalR 使用记录 技术回炉重造-总纲 动态类型dynamic转换为特定类型T的方案 通过对象方法获取委托_C#反射获取委托_ .net core入门-跨域访问配置
Asp.Net SignalR 使用记录 工作上遇到一个推送消息的功能的实现.本着面向百度编程的思想.网上百度了一大堆.主要的实现方式是原生的WebSocket,和SignalR,再次写一个关于A ...
- mysql 多条数据中,分组获取值最大的数据记录
摘要: 多条纪录中,几个字段相同,但是其中一个或者多个字段不同,则去该字段最大(这里只有一个不同) 源数据: 目的是移除:在同一天中只能存在一天数据,则取审核日期最大,数据库脚本如下: SELECT ...
- 使用springboot集成腾讯云短信服务,解决配置文件读取乱码问题
springboot集成腾讯云短信服务: (1)导入依赖 <dependency> <groupId>org.springframework.boot</groupId& ...
- eclipse设置序列化忽略生成serialVersionUID警告
java中的类想要序列化必须实现java.io.Serializable接口,一般实现接口都会用警告信息,提示生成serialVersionUID,虽然我觉得这个应该生成才合理.这里还是记录一下取消生 ...
- 网络编程socket理论一
网络通信理论 首先说下网络之间的通信流程看图 Socket 层是位于运输层和应用层之间的,封装好的,方便使用 Socket 是什么和工作流程 Socket是应用层与TCP/IP协议族通信的中间软件抽象 ...