Skip to content

Commit

Permalink
Merge main into sweep/github-actions-run
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] authored Dec 28, 2023
2 parents 414564f + f34f48b commit 85cfadc
Show file tree
Hide file tree
Showing 24 changed files with 255 additions and 15 deletions.
96 changes: 82 additions & 14 deletions docs/guides/gettingStarted/admin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,67 @@ import Image3 from './assets/admin.jpg';
# 监控系统
本文档介绍二进制&docker-compose方式部署openim的Prometheus监控和告警功能的部署和使用,
本文档介绍二进制&docker方式部署openim的Prometheus监控和告警功能的部署和使用,
k8s方式部署openim的监控和告警使用请查阅链接文档:https://github.com/openimsdk/helm-charts/blob/main/docs/user-guide-zh.md
## 部署
通过open-im-server服务提供的docker-compose.yml部署监控告警需要的组件:prometheus,grafana,alertmanager,node-exporter(可选);
把默认注释的四个组件变成可用,安装成功后,即可通过管理后台进入grafana页面查看监控信息。
## 二进制部署openim-server方式的监控部署
如下是二进制方式部署openim-server的步骤流程:
步骤1:Clone the repository and switch to the release branch
git clone https://github.com/openimsdk/open-im-server && cd open-im-server
步骤2:Set common environment variables.
步骤3:Deploy components.
make init && docker compose up -d.
我们要开启监控功能,需要在将步骤3分解三个小步:3.1,3.2,3.3
步骤3.1:执行make init命令,将生成出的config/config.yaml文件打开,修改如下prometheus.enable: true
:::tip
如需配置告警功能,请在此步骤改写alertmanager.yml,email.tmpl,instance-down-rules.yml请查阅 告警系统>告警配置文件说明.为体验的方便,可先不改写三配置文件。
:::
import Image40 from './assets/config1.png';
<img src={Image40} width="700" alt="PC Web Interface" />
```
步骤3.2:修改docker-compose.yml文件,把openim-admin管理后台模块和监控告警需要的组件:prometheus,grafana,alertmanager,node-exporter(可选)变成可用,
把对应模块的注释去掉,如图
import Image4 from './assets/docker-compose1.png';
<img src={Image4} width="700" alt="PC Web Interface" />
```
import Image5 from './assets/docker-compose2.png';
<img src={Image5} width="700" alt="PC Web Interface" />
```
步骤3.3:执行docker compose up -d安装所有监控组件和管理后台模块
:::tip
因openim-admin管理后台模块使用到了chat服务模块,所以你还需要安装我们额外的chat模块,
安装chat模块的文档请查阅Quick Start>Source Code Deployment>AppServer(chat)
:::
## docker部署openim-server方式的监控部署
如下是docker部署openim-server的步骤流程:
步骤1:Set Common Environment Variables
步骤2:Pull and Launch Image
git clone https://github.com/openim-sigs/openim-docker openim/openim-docker && export openim=$(pwd)/openim && cd $openim/openim-docker && make init && docker compose up -d

我们要开启监控功能,需要将步骤2分解三个小步:2.1,2.2,2.3
步骤2.1:执行如下命令
git clone https://github.com/openim-sigs/openim-docker openim/openim-docker && export openim=$(pwd)/openim && cd $openim/openim-docker && make init
将生成出的config/config.yaml文件打开,修改如下prometheus.enable: true。
:::tip
如需配置告警功能,请在此步骤改写alertmanager.yml,email.tmpl,instance-down-rules.yml请查阅 告警系统>告警配置文件说明.为体验的方便,可先不改写三配置文件。
:::
import Image40 from './assets/config1.png';
<img src={Image40} width="700" alt="PC Web Interface" />
```
步骤2.2:修改docker-compose.yml文件,把监控需要的组件:prometheus,grafana,alertmanager,node-exporter(可选)变成可用,
把对应模块的注释去掉,如图
import Image4 from './assets/docker-compose1.png';
<img src={Image4} width="700" alt="PC Web Interface" />
```
import Image5 from './assets/docker-compose2.png';
<img src={Image5} width="700" alt="PC Web Interface" />
```
步骤2.3:执行docker compose up -d安装所有监控组件。
## k8s方式部署openim-server
k8s部署openim-server和开启监控功能请查阅文档:https://github.com/openimsdk/helm-charts/blob/main/README-zh_CN.md
## 体验
1. 通过openim管理后台网页的链接入口访问,管理后台网页地址:https://ip/openim-admin-front/
1. 通过openim管理后台网页的链接入口访问,管理后台网页地址:https://ip:11002/
2. 管理后台默认用户名和密码 (admin1:admin1),点击下图链接,将打开grafana网页.
import Image6 from './assets/admin1.png';
<img src={Image6} width="700" alt="PC Web Interface" />
Expand Down Expand Up @@ -73,7 +119,8 @@ import Image11 from './assets/dashboard2.png';
import Image12 from './assets/dashboard3.png';
<img src={Image12} width="700" alt="PC Web Interface" />
```
6.导入node-export的官网dashboard,直接官网寻找你满意的node-exporter dashboard试图,然后导入,比如 1860(Node Exporter Full)
6.导入node-export的官网dashboard,直接官网(https://grafana.com/grafana/dashboards/)寻找你满意的node-exporter dashboard试图,
然后导入,比如 1860(Node Exporter Full)
import Image13 from './assets/dashboard4.png';
<img src={Image13} width="700" alt="PC Web Interface" />
```
Expand All @@ -82,26 +129,47 @@ import Image13 from './assets/dashboard4.png';
import Image14 from './assets/dashboard5.png';
<img src={Image14} width="700" alt="PC Web Interface" />
```

7.配置告警,系统实现了两条默认告警规则(instance_down,database_insert_failure_alerts)邮件告警,
只需要修改alertmanager.yml(或者在make init命令前修改alertmanager.yml.template)里面的发送邮箱和接收邮箱的配置信息,即可接收系统告警邮件。
告警配置文件说明:
# 告警系统
系统实现了两条默认告警规则(instance_down,database_insert_failure_alerts)邮件告警,
只需要修改config文件夹下的alertmanager.yml文件里面的发送邮箱和接收邮箱的配置信息,即可接收默认规则的系统告警邮件。
:::tip
如果想实现钉钉,企业微信等方式的告警通知,需要自行改写alertmanager.yml,
可以参阅告警管理模块官方文档:https://prometheus.io/docs/alerting/latest/alertmanager/
:::
## 告警配置文件说明
1,告警三配置文件说明,整个告警有三个配置文件,分别是alertmanager.yml,email.tmpl,instance-down-rules.yml,如下图:
import Image15 from './assets/alert1.png';
<img src={Image15} width="700" alt="PC Web Interface" />
```
邮件告警架构说明图,Prometheus组件加载告警规则instance-down-rules.yml文件,将符合条件的告警信息发送到alertmanager组件,
2,邮件告警架构说明图,Prometheus组件加载告警规则instance-down-rules.yml文件,将符合条件的告警信息发送到alertmanager组件,
alertmanager组件加载alertmanager.yml和email.tmpl文件,通过配置的告警邮箱信息和邮件模版发送邮件
import Image16 from './assets/alert2.png';
<img src={Image16} width="700" alt="PC Web Interface" />
```
告警规则instance-down-rules.yaml文件说明,如果增加告警规则可以在instance-down-rules.yml文件中添加规则:
3,告警规则instance-down-rules.yaml文件说明,如果增加告警规则可以在instance-down-rules.yml文件中添加规则:
import Image17 from './assets/alert3.png';
<img src={Image17} width="700" alt="PC Web Interface" />
```
告警管理alertmanager.yml文件说明,请修改成你真实的发送邮箱和接收邮箱配置信息,即可接收告警信息:
4,告警管理alertmanager.yml文件说明,请修改成你真实的发送邮箱和接收邮箱配置信息,即可接收告警信息:
import Image18 from './assets/alert4.png';
<img src={Image18} width="700" alt="PC Web Interface" />
```
8.如果是在k8s环境通过helm chart方式部署的openim服务,可以通过grafana查看loki日志,即通过grafana查看openim所有服务的日志信息。
5,邮件模版文件email.tmpl说明,此文件是html格式,告警管理模块会填充里面的变量信息,然后渲染成html格式文件,进行邮件的发送,
你可以跟着自己的需要进行模版文件的改写:
import Image19 from './assets/alert5.png';
<img src={Image19} width="700" alt="PC Web Interface" />
```
## 告警部署
告警模块是和监控模块一起部署的,不存在单独部署告警模块。
请在部署监控步骤(监控系统>二进制部署openim-server方式的监控部署>步骤3.1;监控系统>docker部署openim-server方式的监控部署>步骤2.1)中根据需要
改写alertmanager.yml,email.tmpl,instance-down-rules.yml文件成你需求即可,
体验阶段只需要修改alertmanager.yml文件里面的发送邮箱和接收邮箱的配置信息,即可接收默认规则的系统告警邮件,快速体验.
## 告警体验
可手动触发instancedown告警规则,执行make stop命令停止openim-server服务,等待5m分钟以上,即可收到告警邮件,内容如下:
import Image20 from './assets/alert6.png';
<img src={Image20} width="700" alt="PC Web Interface" />
```
# 日志系统
如果是在k8s环境通过helm chart方式部署的openim服务,可以通过grafana查看loki日志,即通过grafana查看openim所有服务的日志信息。
目前二进制和docker部署没有集成loki日志收集组件,想体验loki日志收集功能,请采用helm chart部署,
详情请查阅链接https://github.com/openimsdk/helm-charts/blob/main/docs/user-guide-zh.md
Binary file modified docs/guides/gettingStarted/assets/alert1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/guides/gettingStarted/assets/alert5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/guides/gettingStarted/assets/alert6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/guides/gettingStarted/assets/config1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,180 @@ import Image3 from './assets/admin.jpg';

<img src={Image3} width="700" alt="PC Web Interface" />


# Monitoring System
This document introduces the deployment and use of Prometheus monitoring and alarm functions in Openim using binary and Docker methods,
Please refer to the link document for the monitoring and alarm usage of Openim deployed in k8s mode: https://github.com/openimsdk/helm-charts/blob/main/docs/user-guide-zh.md

## openim-server source code deployment method
The following is the steps of deploying Openim server in source code mode:
step1:Clone the repository and switch to the release branch
git clone https://github.com/openimsdk/open-im-server && cd open-im-server
step2:Set common environment variables.
step3:Deploy components.
make init && docker compose up -d.

To enable the monitoring function, we need to break down step 3 into three small steps: 3.1, 3.2, 3.3
Step 3.1: Execute the "make init" command, open the generated config/config.yaml file, and modify it as follows: Prometheus. enable: true
:::tip
If you need to configure the alarm function, please rewrite alertmanager. yml, email. tmml, and instance down rules. yml in this step.
Please refer to the (Alarm System>Alarm Configuration File Description).
For the convenience of the experience, you may not rewrite the three configuration files for now.
:::
import Image40 from './assets/config1.png';
<img src={Image40} width="700" alt="PC Web Interface" />
```
Step 3.2: Modify the docker-compose.yml file to make the openim-admin management backend module and
the components required for monitoring alarms, such as Prometheus, Grafana, Alertmanager, and Node Exporter (optional) available
Step 3.3: Execute "docker-compose up-d" to install all monitoring components and management backend modules
:::tip
Since the openim admin management backend module uses the chat service module, you will need to install our additional chat module,
Please refer to:Quick Start>Source Code Deployment>AppServer(chat)
:::
import Image4 from './assets/docker-compose1.png';
<img src={Image4} width="700" alt="PC Web Interface" />
```
import Image5 from './assets/docker-compose2.png';
<img src={Image5} width="700" alt="PC Web Interface" />
```
## openim-server docker deployment method
The following is the step-by-step process for Docker to deploy Openim Server:
step1:Set Common Environment Variables
step2:Pull and Launch Image
git clone https://github.com/openim-sigs/openim-docker openim/openim-docker && export openim=$(pwd)/openim && cd $openim/openim-docker && make init && docker compose up -d
To enable the monitoring function, we need to break down step 2 into three small steps: 2.1, 2.2, 2.3
Step 2.1: Execute the following command:
git clone https://github.com/openim-sigs/openim-docker openim/openim-docker && export openim=$(pwd)/openim && cd $openim/openim-docker && make init
open the generated config/config.yaml file, and modify it as follows: Prometheus. enable: true
:::tip
If you need to configure the alarm function, please rewrite alertmanager. yml, email. tmml, and instance down rules. yml in this step.
Please refer to the (Alarm System>Alarm Configuration File Description).
For the convenience of the experience, you may not rewrite the three configuration files for now.
:::
import Image40 from './assets/config1.png';
<img src={Image40} width="700" alt="PC Web Interface" />
```
Step 2.2: Modify the docker-compose.yml file to make the components required for monitoring alarms, such as Prometheus, Grafana, Alertmanager, and Node Exporter (optional) available
import Image4 from './assets/docker-compose1.png';
<img src={Image4} width="700" alt="PC Web Interface" />
```
import Image5 from './assets/docker-compose2.png';
<img src={Image5} width="700" alt="PC Web Interface" />
```
Step 2.3: Execute "docker compose up -d" to install all monitoring components.


## openim-server helm chart deployment method
Please refer to the documentation for deploying openim server and enabling monitoring functions in k8s: https://github.com/openimsdk/helm-charts/blob/main/README-zh_CN.md

## Deployment

## Experience

1. visit admin backend web pages through the link addresses: https://ip:11002/

2. he default username and password for the management backend (admin1: admin1), click on the link below to open the Grafana webpage.
import Image6 from './assets/admin1.png';
<img src={Image6} width="700" alt="PC Web Interface" />
```
3. Login to Grafana using default username and password (admin: admin).
import Image7 from './assets/login.png';
<img src={Image7} width="700" alt="PC Web Interface" />
```

4. Add a Prometheus data source, as shown in the following figure.
Enter the URL of the Prometheus data source: http://172.28.0.1:19090 Click "Save and Test" to save the data source.
import Image8 from './assets/database.png';
<img src={Image8} width="700" alt="PC Web Interface" />
```
import Image9 from './assets/database2.png';
<img src={Image9} width="700" alt="PC Web Interface" />
```

5. Import Docker version Openim to customize dashboard dashboard.
Click on the import button in the following image
import Image10 from './assets/dashboard.png';
<img src={Image10} width="700" alt="PC Web Interface" />
```
Copy the content of config/template/prometheus dashboard.yaml to the area shown below, then click the load button:
import Image11 from './assets/dashboard2.png';
<img src={Image11} width="700" alt="PC Web Interface" />
```
Select your Data Source and job, and you will be able to view custom indicator information, as shown in the following figure
import Image12 from './assets/dashboard3.png';
<img src={Image12} width="700" alt="PC Web Interface" />
```
6.import node-exporter dashboard, such as 1860 (Node Exporter Full).you can find dashboard from website(https://grafana.com/grafana/dashboards/)
import Image13 from './assets/dashboard4.png';
<img src={Image13} width="700" alt="PC Web Interface" />
```
You are about to view the node exporter indicator information, as shown in the following figure
import Image14 from './assets/dashboard5.png';
<img src={Image14} width="700" alt="PC Web Interface" />
```
# Alarm system
The system has implemented two default alarm rules (instance_down, database_insert_failure-alerts) for email alarms,
You only need to modify the configuration information of the sending and receiving email addresses in the alertmanager.yml file under the config folder
to receive system alarm emails based on default rules
:::tip
If you want to implement alarm notifications through DingTalk, Enterprise WeChat, and other methods, you need to rewrite alertmanager. yml yourself,
refer to website:https://prometheus.io/docs/alerting/latest/alertmanager/
:::
## Alarm Configuration File Description
1,The entire alarm has three configuration files, namely alertmanager.yml, email.tmpl, and instance-down-rules.yml, as shown in the following figure:
import Image15 from './assets/alert1.png';
<img src={Image15} width="700" alt="PC Web Interface" />
```
2,Email Alert Architecture Description.
The Prometheus component loads the alarm rule instance-down-rules.yml file and sends the alarm information to the alertmanager component,
The alertmanager component loads alertmanager.yml and email.tmpl files, and sends emails through the configured alert email information and email template
import Image16 from './assets/alert2.png';
<img src={Image16} width="700" alt="PC Web Interface" />
```
3,instance-down-rules.yml file description.
You can add your personal rules in instance-down-rules.yml file in bellow:
import Image17 from './assets/alert3.png';
<img src={Image17} width="700" alt="PC Web Interface" />
```
4,alertmanager.yml file description.
Please modify to your actual sending and receiving email configuration information to receive alarm messages:
import Image18 from './assets/alert4.png';
<img src={Image18} width="700" alt="PC Web Interface" />
```
5,email.tmplfile description.
This file is in HTML format, and the alarm management module will fill in the variable information inside, then render it into an HTML format file for email sending.
You can rewrite the template file according to your own needs:
import Image19 from './assets/alert5.png';
<img src={Image19} width="700" alt="PC Web Interface" />
```


## Alarm deployment
The alarm module is deployed together with the monitoring module, and there is no separate deployment of alarm modules.
Please deploy monitoring steps (Monitoring System>Binary Deployment Openim Server Monitoring Deployment>Step 3.1; Monitoring System>Docker Deployment Openim Server Monitoring Deployment>Step 2.1) as needed
Rewrite the alertmanager. yml, email.tmpl, and instance down rules.yml files to meet your requirements,
During the experience phase, you only need to modify the configuration information of the sending and receiving email addresses in the alertmanager.yml
file to receive default system alarm emails, providing a quick experience


## Alarm experience
You can manually trigger the instancedown alarm rule, execute the "make stop" command to stop the openim server service,
wait for more than 5 minutes, and then receive the alarm email. The content is as follows:
import Image20 from './assets/alert6.png';
<img src={Image20} width="700" alt="PC Web Interface" />
```
# Logging system
If the Openim service is deployed through the help chart method in a k8s environment, the Loki logs can be viewed through Grafana, that is, the log information of all Openim services can be viewed through Grafana.
At present, there is no integrated Loki log collection component for source and Docker deployments. If you want to experience the Loki log collection function, please use the helm chart deployment in k8s system,
For details, please refer to the link https://github.com/openimsdk/helm-charts/blob/main/docs/user-guide-zh.md
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 85cfadc

Please sign in to comment.