Skip to content

Commit

Permalink
fix: fix error. (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
mo3et authored Aug 23, 2024
1 parent 5e2d860 commit a3fae84
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 39 deletions.
41 changes: 40 additions & 1 deletion docs/guides/gettingStarted/admin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,45 @@ docker compose 部署时,会自动部署如下组件,如使用源码部署
send_resolved: true # 告警解决时是否发送通知
```

5. 邮件模版文件 email.tmpl 说明:此文件是 html 格式,告警管理模块会填充里面的变量信息,然后渲染成 html 格式文件,进行邮件的发送,可根据需求自行改写:

```tmpl
{{ define "email.to.html" }}
{{ if eq .Status "firing" }}
{{ range .Alerts }}
<!-- Begin of OpenIM Alert -->
<div style="border:1px solid #ccc; padding:10px; margin-bottom:10px;">
<h3>OpenIM Alert</h3>
<p><strong>Alert Status:</strong> firing</p>
<p><strong>Alert Program:</strong> Prometheus Alert</p>
<p><strong>Severity Level:</strong> {{ .Labels.severity }}</p>
<p><strong>Alert Type:</strong> {{ .Labels.alertname }}</p>
<p><strong>Affected Host:</strong> {{ .Labels.instance }}</p>
<p><strong>Affected Service:</strong> {{ .Labels.job }}</p>
<p><strong>Alert Subject:</strong> {{ .Annotations.summary }}</p>
<p><strong>Trigger Time:</strong> {{ .StartsAt.Format "2006-01-02 15:04:05" }}</p>
</div>
{{ end }}
{{ else if eq .Status "resolved" }}
{{ range .Alerts }}
<!-- Begin of OpenIM Alert -->
<div style="border:1px solid #ccc; padding:10px; margin-bottom:10px;">
<h3>OpenIM Alert</h3>
<p><strong>Alert Status:</strong> resolved</p>
<p><strong>Alert Program:</strong> Prometheus Alert</p>
<p><strong>Severity Level:</strong> {{ .Labels.severity }}</p>
<p><strong>Alert Type:</strong> {{ .Labels.alertname }}</p>
<p><strong>Affected Host:</strong> {{ .Labels.instance }}</p>
<p><strong>Affected Service:</strong> {{ .Labels.job }}</p>
<p><strong>Alert Subject:</strong> {{ .Annotations.summary }}</p>
<p><strong>Trigger Time:</strong> {{ .StartsAt.Format "2006-01-02 15:04:05" }}</p>
</div>
{{ end }}
<!-- End of OpenIM Alert -->
{{ end }}
{{ end }}
```

## 登录管理后台

在浏览器中输入 `http://ip:11002` 来访问管理后台。此 IP 为服务端 OPENIM_IP,确保您的浏览器能访问。默认账号和密码均为 chatAdmin
Expand Down Expand Up @@ -223,4 +262,4 @@ rpc_count
prometheus 容器没启动成功一般是两个原因:

1. 没有在`prometheus.yml`中配置内网 ip。
2. 第一次启动`prometheus`容器时可能会遇到权限问题,在`open-im-server`项目下运行`chmod -R 777 components`后重新启动容器即可。
2. 第一次启动`prometheus`容器时可能会遇到权限问题,在`open-im-server`项目下运行`chmod -R 777 components`后重新启动容器即可。
Original file line number Diff line number Diff line change
Expand Up @@ -101,44 +101,6 @@ When deploying with Docker Compose, the following components will be automatical
send_resolved: true # Whether to send a notification when the alert is resolved
```

5. **email.tmpl Template File Description**: This file is in HTML format. The alert management module will fill in the variable information and render it into an HTML file to send the email. You can modify it according to your needs:

```tmpl
{{ define "email.to.html" }}
{{ if eq .Status "firing" }}
{{ range .Alerts }}
<!-- Begin of OpenIM Alert -->
<div style="border:1px solid #ccc; padding:10px; margin-bottom:10px;">
<h3>OpenIM Alert</h3>
<p><strong>Alert Status:</strong> firing</p>
<p><strong>Alert Program:</strong> Prometheus Alert</p>
<p><strong>Severity Level:</strong> {{ .Labels.severity }}</p>
<p><strong>Alert Type:</strong> {{ .Labels.alertname }}</p>
<p><strong>Affected Host:</strong> {{ .Labels.instance }}</p>
<p><strong>Affected Service:</strong> {{ .Labels.job }}</p>
<p><strong>Alert Subject:</strong> {{ .Annotations.summary }}</p>
<p><strong>Trigger Time:</strong> {{ .StartsAt.Format "2006-01-02 15:04:05" }}</p>
</div>
{{ end }}
{{ else if eq .Status "resolved" }}
{{ range .Alerts }}
<!-- Begin of OpenIM Alert -->
<div style="border:1px solid #ccc; padding:10px; margin-bottom:10px;">
<h3>OpenIM Alert</h3>
<p><strong>Alert Status:</strong> resolved</p>
<p><strong>Alert Program:</strong> Prometheus Alert</p>
<p><strong>Severity Level:</strong> {{ .Labels.severity }}</p>
<p><strong>Alert Type:</strong> {{ .Labels.alertname }}</p>
<p><strong>Affected Host:</strong> {{ .Labels.instance }}</p>
<p><strong>Affected Service:</strong> {{ .Labels.job }}</p>
<p><strong>Alert Subject:</strong> {{ .Annotations.summary }}</p>
<p><strong>Trigger Time:</strong> {{ .StartsAt.Format "2006-01-02 15:04:05" }}</p>
</div>
{{ end }}
<!-- End of OpenIM Alert -->
{{ end }}
{{ end }}
```

## Accessing the Admin Panel

Expand Down

0 comments on commit a3fae84

Please sign in to comment.