无监控不运维——Prometheus 快速入门

Linux安全运维 (4.8万) 2019-09-18 20:50:47

Prometheus 是由 SoundCloud 开发的开源监控报警系统和时序列数据库(TSDB),自 2012 年起,许多公司及组织已经采用 Prometheus,并且该项目有着非常活跃的开发者和用户社区,现在已经成为一个独立的开源项目,并且保持独立于任何公司,Prometheus 在 2016 加入 CNCF ( Cloud Native Computing Foundation ), 作为在 kubernetes 之后的第二个由基金会主持的项目。github 地址(https://github.com/prometheus)

无监控不运维——Prometheus 快速入门_https://www.tiejiang.org_Linux安全运维_第1张

本周四 51reboot 就将为大家带来 Prometheus 分享 手把手教大家快速搭建一套告警系统。

分享内容如下:

项目演示

知识介绍

Prometheus 基础

是什么

架构设计

为什么选择 Promethues

Prometheus 组件概览和实战

Server

NodeExporter

Pushgateway

Alertmanager

Grafana 集成

答疑问题讨论

分享嘉宾:禾木老师

1、Ruby on Rails 爱好者

2、多年 Golang 研发经验3、

3、年 Promethus 二次开发及使用经验及社区代码贡献者

4、《Prometheus: Up & Running: Infrastructure and Application Performance Monitoring》  中文翻译作者(校验完毕待发版)

项目演示效果图

无监控不运维——Prometheus 快速入门_https://www.tiejiang.org_Linux安全运维_第2张

Prometheus 架构

无监控不运维——Prometheus 快速入门_https://www.tiejiang.org_Linux安全运维_第3张

为什么选择 Prometheus ?

who not?

现代(用 Go 编写)

无依赖,安装方便,上手容易

很多插件或者 exporter

Grafana 默认支持

K8s 默认支持,非常适合容器和微服务

社区活跃,它不仅仅是个工具而是生态

Prometheus 组件概览和实战

Prometheus Server

安装

Prometheus  Server 的安装比较灵活,可以使用二进制安装包或者 Docker 安装, 下面以二进制的方式为例:无监控不运维——Prometheus 快速入门_https://www.tiejiang.org_Linux安全运维_第4张

解压缩包并运行  `./prometheus  `无监控不运维——Prometheus 快速入门_https://www.tiejiang.org_Linux安全运维_第5张

访问 http://IP:9090 查看 Prometheus console无监控不运维——Prometheus 快速入门_https://www.tiejiang.org_Linux安全运维_第6张

Prometheus Node Exporter

安装,运行

Prometheus  Node Exporter  主要用于物理主机的采样,它同样可以使用二进制安装包和 Docker 的安装, 下面以二进制的方式为例:无监控不运维——Prometheus 快速入门_https://www.tiejiang.org_Linux安全运维_第7张

Prometheus 添加 Node Job

修改 prometheus.yml无监控不运维——Prometheus 快速入门_https://www.tiejiang.org_Linux安全运维_第8张

使用 ./promtool check config 进行配置文件检测

使用 kill –HUP PID 进行重启

Prometheus Pushgateway 

安装,运行

Prometheus  Pushgateway 主要用于无法单独提供 Exporter 的数据的收集,它同样可以使用二进制安装包和 Docker 的安装, 下面以二进制的方式为例:无监控不运维——Prometheus 快速入门_https://www.tiejiang.org_Linux安全运维_第9张

Pushgateway 添加数据

使用 HTTP 请求添加数据无监控不运维——Prometheus 快速入门_https://www.tiejiang.org_Linux安全运维_第10张

Prometheus 添加 Pushgateway

修改 prometheus.yml无监控不运维——Prometheus 快速入门_https://www.tiejiang.org_Linux安全运维_第11张

使用同样的方法,重启 Prometheus。无监控不运维——Prometheus 快速入门_https://www.tiejiang.org_Linux安全运维_第12张

Alertmanager

安装,运行

Prometheus  Alertmanager 主要用于告警信息的管理,使用它可以很方便的对Prometheus 触发的告警进行分组,降噪,设置不同告警渠道。它同样可以使用二进制安装包和 Docker 的安装, 下面以二进制的方式为例:无监控不运维——Prometheus 快速入门_https://www.tiejiang.org_Linux安全运维_第13张

与 Prometheus 集成

修改 prometheus.yml无监控不运维——Prometheus 快速入门_https://www.tiejiang.org_Linux安全运维_第14张

添加 node_rules.yml 文件无监控不运维——Prometheus 快速入门_https://www.tiejiang.org_Linux安全运维_第15张

使用 ./promtool 检查配置文件

重启 Prometheus

Rules Console无监控不运维——Prometheus 快速入门_https://www.tiejiang.org_Linux安全运维_第16张

触发告警无监控不运维——Prometheus 快速入门_https://www.tiejiang.org_Linux安全运维_第17张无监控不运维——Prometheus 快速入门_https://www.tiejiang.org_Linux安全运维_第18张

Grafana 集成 

安装,运行

Grafana 是一款非常流行的开源的功能强大的指标展示工具,它和 Prometheus 能够做到无缝对接,它同样可以使用二进制安装包和 Docker 的安装, 下面以二进制的方式为例:无监控不运维——Prometheus 快速入门_https://www.tiejiang.org_Linux安全运维_第19张

1、访问页面 http://IP:3000 ,并登录

2、默认账号密码(admin/admin),首次登录后提示修改密码

3、配置数据源,并选择 Prometheus无监控不运维——Prometheus 快速入门_https://www.tiejiang.org_Linux安全运维_第20张无监控不运维——Prometheus 快速入门_https://www.tiejiang.org_Linux安全运维_第21张

4、创建 dashboard ,添加面板, 并保存无监控不运维——Prometheus 快速入门_https://www.tiejiang.org_Linux安全运维_第22张

参与方式

本次分享时间:2019-9-19 晚 21:00 直播

参与方式:

扫码添加小助手的微信,备注【Prometheus】,

即可获取直播链接,也可进入直播群与老师互动

无监控不运维——Prometheus 快速入门_https://www.tiejiang.org_Linux安全运维_第23张

THE END

Leave a Reply