Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
skiffer-git committed Jul 26, 2024
2 parents a321303 + 5c52840 commit 6929653
Show file tree
Hide file tree
Showing 192 changed files with 12,868 additions and 2,380 deletions.
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ ZOOKEEPER_IMAGE=bitnami/zookeeper:3.8
KAFKA_IMAGE=bitnami/kafka:3.5.1
MINIO_IMAGE=minio/minio:RELEASE.2024-01-11T07-46-16Z
ETCD_IMAGE=quay.io/coreos/etcd:v3.5.13
PROMETHEUS_IMAGE=prom/prometheus:v2.45.6
ALERTMANAGER_IMAGE=prom/alertmanager:v0.27.0
GRAFANA_IMAGE=grafana/grafana:11.0.1

OPENIM_WEB_FRONT_IMAGE=openim/openim-web-front:release-v3.5.1
OPENIM_ADMIN_FRONT_IMAGE=openim/openim-admin-front:release-v1.7
Expand Down
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,7 @@ deployments/charts/generated-configs/
### OpenIM Config ###
.env
config/config.yaml
config/alertmanager.yml
config/prometheus.yml
config/email.tmpl
config/notification.yaml
config/instance-down-rules.yml

### OpenIM deploy ###
deployments/openim-server/charts
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ COPY --from=builder $SERVER_DIR/start-config.yml $SERVER_DIR/
COPY --from=builder $SERVER_DIR/go.mod $SERVER_DIR/
COPY --from=builder $SERVER_DIR/go.sum $SERVER_DIR/

RUN go get github.com/openimsdk/[email protected].13
RUN go get github.com/openimsdk/[email protected].14-alpha.5

# Set the command to run when the container starts
ENTRYPOINT ["sh", "-c", "mage start && tail -f /dev/null"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<p align="center">
<a href="./README.md">Englist</a> ·
<a href="./README.md">English</a> ·
<a href="./README_zh_CN.md">中文</a> ·
<a href="./docs/readme/README_uk.md">Українська</a> ·
<a href="./docs/readme/README_cs.md">Česky</a> ·
Expand Down
2 changes: 1 addition & 1 deletion README_zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


<p align="center">
<a href="./README.md">Englist</a> ·
<a href="./README.md">English</a> ·
<a href="./README_zh_CN.md">中文</a> ·
<a href="./docs/readme/README_uk.md">Українська</a> ·
<a href="./docs/readme/README_cs.md">Česky</a> ·
Expand Down
1 change: 0 additions & 1 deletion cmd/openim-api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@ func main() {
if err := cmd.NewApiCmd().Exec(); err != nil {
program.ExitWithError(err)
}

}
34 changes: 34 additions & 0 deletions config/alertmanager.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
global:
resolve_timeout: 5m
smtp_from: [email protected]
smtp_smarthost: smtp.163.com:465
smtp_auth_username: [email protected]
smtp_auth_password: YOURAUTHPASSWORD
smtp_require_tls: false
smtp_hello: xxx

templates:
- /etc/alertmanager/email.tmpl

route:
group_by: [ 'alertname' ]
group_wait: 5s
group_interval: 5s
repeat_interval: 5m
receiver: email
routes:
- matchers:
- alertname = "XXX"
group_by: [ 'instance' ]
group_wait: 5s
group_interval: 5s
repeat_interval: 5m
receiver: email

receivers:
- name: email
email_configs:
- to: '[email protected]'
html: '{{ template "email.to.html" . }}'
headers: { Subject: "[OPENIM-SERVER]Alarm" }
send_resolved: true
36 changes: 36 additions & 0 deletions config/email.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{{ 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 }}
Loading

0 comments on commit 6929653

Please sign in to comment.