官方站点:  Prometheus Alert是开源的运维告警中心消息转发系统

手册: README - PrometheusAlert ( gitbook.io)

一、为什么要用PrometheusAlert?

基于Prometheus的全方位监控平台..告警中心消息转发系统PrometheusAlert_监控

1.1、背景

通过configmap配置文件维护告警媒介辨析度低

部分快消息告警媒介需要额外部署webhook做转发:

alertmanager web UI 较简单,不足以展示更多的数据信息;

1.2、架构原理

Exports -> Prometheus .> Prometheus Rules > Alertmanager -> webhook > PrometheusAlet > Routes > 企微/钉钉..

1.3、PrometheusAlert 优点

1、配置灵活: 通过web UI界面配置操作,相较于configmap较灵活。

2、功能强大:支持在线修改告警模版,告警路由,告警记录,测试等

2.1.针对Prometheus增加了告警级别,并且支持按照不同级别发送消息到不同目标对象。

2.2.简化Prometheus分组配置,支持按照具体消息发送到单个或多个接收方。

2.3.增加Dashboard,提供配置测试,告警消息模版自定义,告警模版测试等功能

3.自定义强度高:通过路由匹配规则触发更多的告警煤介(企微,钉钉,飞书,公有云电话/短满息接口)。

3.1增加手机号码配置项和号码自动轮询码置,可固定发送给单一个人告警信息,也可以通过自动轮询的方式发送到多个人员且支持按照不同日期发送到不同人员,

4.开源免费:PrometheusAlert 是一款完全开源的软件,可以免费使用和定制,而且有广泛的社区支持。

二、prometheusAlert配置

2.1、在kubernetes中运行

#xubernete中运行可以直接执行以下命今行 (人的模版中未就权版3现库文件 db/prometheusalertDB.b,为防上从2%去失,请自行增加性制
S kubect1 apply -n monitor -f
https://raw.githubusercontent,com/feyu563/PrometheusAlert/master/example/kubernetes/prometheusAlert-Deployment,yaml
#启动后可使用刘览器打开以下地址查看: http://[YOUR-PrometheusAlert-URL]:8080
#里认登录账号和密码在appconf中有配
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.

2.2、使用helm部警

#clone项目源代码
$ git clone https://github.com/feiyu563/PrometheusAlert.git
$ cd PrometheusATert/example/helm
#如微修改配登文件,请更新config中的app.conf
#he1m部署模版支持配置Ingress域名,可在values.yam1中进行配器
"配修改亮成后,通过以下命令启动可(注意里认的模版中未挂较模数据隆文件 db/prometheusAertoB.db,为防止模的据丢失,请自行增加挂配盟)
S helm upgrade -instal1 monitor prometheusalert -n monitor
#启动后可使用刘览器打开以下地址查看: http://[Ingress_ur1]:[Ingress_port]
#默认登录帐号和密码在app.conf中有配置
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.

2.3、使用控制器文件部署

为防止模版数据丢失,增加挂载配置
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: prome-aert-data-pvc
namespace: monitor
spec:
accessModes:
- ReadwriteMany
storageClassName:"nfs-storage'
resources:
requests:
storage: 5Gi
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
下载官方配置文件
$ wget https://raw.githubusercontent.com/feiyu563/rometheusAlert/master/example/kubernetes/rometheusAlert-Deployment.yaml
  • 1.
  • 2.

修改配置文件

基于Prometheus的全方位监控平台..告警中心消息转发系统PrometheusAlert_监控_02

2.4、配置PrometheusAlert使用mysql作为际端数据存储

PrometheusAlert默认便用sqlite3作为后端自定义模板的存储,这种方式适合于单机部署,满足绝大部分生产场景使用。

虑到部分企业对于服务的高可用要求较高,同时也为了让PrometheusAlert更易于横向扩展,用户可以更改PrometheusAlert的默认存储为mysq.

推荐使用mysl5.7及以服本

三、prometheusAlert配置管理

3.1、编辑自定义模版

基于Prometheus的全方位监控平台..告警中心消息转发系统PrometheusAlert_告警_03

3.2、新增自定义模版

基于Prometheus的全方位监控平台..告警中心消息转发系统PrometheusAlert_告警_04

3.3、告警测试

3.4、告警路由

四、配警Alertmanager接入PrometheusAlert
五、测试验证
六、总结

1、支持任意包含WebHook接口系统的消息作为满息来源,常见的如Prometheus,Zabbix,Grafana等。

2、支持多种类型的发送目标,支持钉钉,企业微信,email,飞书,公有云短信/电活等。

3、支持按照不同级别发送消息到不同目标对象。

4、简化Prometheus分组配置,支持按照具体消息发送到单个或多个接收方可按照企业中的排班制,通过自动轮询的方式发送到多个人员且支持按照不同日期发送到不同人员