Skip to content

Commit 8c23c6c

Browse files
authored
Update customtpl.md
1 parent a6ef6b8 commit 8c23c6c

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

doc/readme/customtpl.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212

1313
#### 模版数据等信息均存储在程序目录的下的`db/PrometheusAlertDB.db`中。
1414

15-
## 自定义模板使用
16-
15+
----------------------------------------
16+
## 新建自定义模板
17+
----------------------------------------------------------------------
1718
### 1.下面以添加Prometheus的自定义告警消息模版为例讲解如何添加自定义模版
1819

1920
- 开始之前,请先临时更改你的Alertmanager的配置,将所有告警信息都转发到PrometheusAlert自定义接口,参考如下:
@@ -114,7 +115,9 @@ receivers:
114115
* 添加完自定义模板后,主要一定要点击保存。
115116

116117
---------------------------------------------------------------------
117-
### 2.继续对新添加的模版进行测试
118+
## 测试自定义模板
119+
----------------------------------------------------------------------
120+
### 1.对新添加的模版进行测试
118121

119122
- 打开PrometheusAlert Dashboard的模版管理页面`AlertTemplate`
120123

@@ -127,7 +130,10 @@ receivers:
127130
- 继续点击模版测试按钮即可对新添加的模版进行测试,如模版没有错误,将会收到对应的钉钉消息,如无法收到钉钉消息,请检查模版是否有什么地方配置错误
128131

129132
----------------------------------------------------------------------
130-
### 3.自定义告警消息模版接口使用非常简单
133+
## 使用自定义模板
134+
----------------------------------------------------------------------
135+
136+
### 1.自定义告警消息模版接口使用非常简单
131137

132138
- 打开PrometheusAlert Dashboard的模版管理页面`AlertTemplate`
133139

@@ -144,9 +150,10 @@ receivers:
144150
![dashboard-tpl-list](https://gitee.com/feiyu563/PrometheusAlert/raw/master/doc/dashboard-tpl-list.png)
145151

146152
----------------------------------------------------------------------
147-
## 4.关于自定义模版函数
153+
## 自定义模版函数和使用
154+
----------------------------------------------------------------------
148155

149-
### 4.1 `GetCSTtime` 函数仅支持在PrometheusAlert的自定义模版中使用,该函数主要用于强制将时间字段时区从UTC转换到CST
156+
### 1 `GetCSTtime` 函数仅支持在PrometheusAlert的自定义模版中使用,该函数主要用于强制将时间字段时区从UTC转换到CST
150157

151158
目前支持两种使用方式:
152159

@@ -202,7 +209,7 @@ receivers:
202209
{{ end }}
203210
```
204211

205-
### 4.2 `TimeFormat` 函数仅支持在PrometheusAlert的自定义模版中使用,该函数主要用于格式化时间显示
212+
### 2 `TimeFormat` 函数仅支持在PrometheusAlert的自定义模版中使用,该函数主要用于格式化时间显示
206213

207214
如下示例将prmetheus的告警时间格式改为:2006-01-02T15:04:05
208215

@@ -230,7 +237,7 @@ receivers:
230237
{{ end }}
231238
```
232239

233-
### 4.3 `GetTime` 函数仅支持在PrometheusAlert的自定义模版中使用,该函数主要用于将`毫秒或秒`级时间戳转换为时间字符
240+
### 3 `GetTime` 函数仅支持在PrometheusAlert的自定义模版中使用,该函数主要用于将`毫秒或秒`级时间戳转换为时间字符
234241

235242
目前支持两种使用方式:
236243

0 commit comments

Comments
 (0)