mirror of
https://github.com/Tencent/Metis.git
synced 2025-12-25 19:52:49 +00:00
feat(docs): update docs
This commit is contained in:
parent
ee5235c6fe
commit
37192ff798
58
README.en.md
58
README.en.md
|
|
@ -1 +1,57 @@
|
|||
[Click me switch to Chinese version](README.md)
|
||||
[Click me switch to Chinese version](README.md)
|
||||
|
||||

|
||||
|
||||
[](https://github.com/tencent/Metis/master/LICENSE.TXT)
|
||||
[](https://github.com/tencent/Metis/releases)
|
||||
[](https://github.com/tencent/Metis/pulls)
|
||||
|
||||
The name **Metis** is taken from the Greek goddess of wisdom, Metis, which is a collection of application practices in the AIOps field. It mainly solves the problem of intelligent operation and maintenance in terms of quality, efficiency and cost. The current version of the open source time series anomaly detection learnware is to solve the anomaly detection problem of time series data from the perspective of machine learning.
|
||||
|
||||
The realization of the time series anomaly detection learnware is based on statistical judgment, unsupervised and supervised learning to jointly detect time series data. The first-level decision is made by statistical judgment and unsupervised algorithm, and the suspected abnormality is output. Secondly, the supervised model is judged, and the final test result is obtained. The detection model is generated through a large number of sample training and can be continuously updated according to the sample.
|
||||
|
||||
The time series anomaly detection learnware has been covered in **20w+** Zhiyun server, which carries the abnormality detection of **240w+** service indicators. After extensive monitoring and data polishing, the learnware has a wide range of applications in the field of anomaly detection and operation and maintenance monitoring.
|
||||
|
||||
## Support Platform
|
||||
|
||||
The operating system platform currently running is as follows:
|
||||
|
||||
- OS: Linux
|
||||
|
||||
## Support Language
|
||||
|
||||
The development languages supported by the front and back ends are as follows:
|
||||
|
||||
- Front-end: JavaScript, TypeScript
|
||||
- Back-end: Python 2.7
|
||||
|
||||
## Overview
|
||||
|
||||
* [Use scenario](docs/usecase.md)
|
||||
* [Code directory](docs/code_framework.md)
|
||||
* [Code architecture](docs/architecture.md)
|
||||
|
||||
## Installation Guide
|
||||
|
||||
* When installing for the first time, please refer to the installation documentation: [install.md](docs/install.md)
|
||||
|
||||
## Instructions
|
||||
|
||||
* [WEB instructions](docs/web_userguide.md)
|
||||
* [API instructions](docs/api_userguide.md)
|
||||
|
||||
## License
|
||||
|
||||
Metis is based on the BSD 3-Clause License, see for details: [LICENSE.TXT](LICENSE.TXT).
|
||||
|
||||
## Contributing
|
||||
|
||||
If you find a problem during use, please submit and describe via [https://github.com/Tencent/Metis/issues](issues) , you can also view other issues here and contribute code by resolving these issues.
|
||||
|
||||
If you are contributing your code for the first time, please read [CONTRIBUTING](CONTRIBUTING.md) to learn about our contribution process.
|
||||
|
||||
## Contact Information
|
||||
|
||||
QQ technology exchange group: 288723616.
|
||||
|
||||

|
||||
|
|
@ -1,127 +1,128 @@
|
|||
## API接口文档
|
||||
|
||||
用户可使用API接口对时间序列进行异常检测,检测后的结果通过WEB管理端查看和管理。 服务端提供两个异常检测的API接口供不同场景调用:
|
||||
|
||||
1、量值检测:适用于大多数类型数据的检测,使用无监督和有监督联合检测,会加载检测模型
|
||||
|
||||
2、率值检测:适用于严格正态分布类型数据的检测,使用无监督算法进行检测,如成功率等生死指标数据的检测
|
||||
|
||||
- API请求调用请使用搭建的后端服务地址
|
||||
- 当前检测时间窗口选取为3小时,每分钟1个数据点,即窗口值为180
|
||||
- 同比数据日期和时间段的选择可根据实际情况调整,文档中两个同比数据分别去昨日和一周前的同比
|
||||
|
||||
针对当前一个值的检测,需要依赖过去三段数据,数据选取规则参考示例图:
|
||||

|
||||
|
||||
### 量值检测
|
||||
|
||||
* API: POST /{ip}:{port}/PredictValue
|
||||
* 功能说明:根据参考数据检测最近一个数据点是否异常
|
||||
* 请求参数request:
|
||||
|
||||
```
|
||||
{
|
||||
"viewId":"2012",
|
||||
"viewName":"登陆功能",
|
||||
"attrId":"19201",
|
||||
"attrName":"ptlogin登陆请求总量",
|
||||
"taskId":"1530608070706",
|
||||
"window":180,
|
||||
"dataC":"9,10,152,...,255,...,16",
|
||||
"dataB":"9,10,152,...,255,...,18",
|
||||
"dataA":"9,10,152,...,458"
|
||||
}
|
||||
```
|
||||
|
||||
* request字段说明:
|
||||
|
||||
| 名称 | 类型 |必填| 默认值 | 说明 |
|
||||
| --- | --- | --- |--- | --- | ---|
|
||||
| viewId| string| 是|无|指标集ID |
|
||||
| viewName| string| 是| 无|指标集名称|
|
||||
| attrId| string| 是| 无|指标ID|
|
||||
| attrName| string| 是| 无|指标名称|
|
||||
| taskId| string| 否| 无|使用的检测模型,如不传,则采用系统默认模型|
|
||||
| window| int| 是| 无|窗口值,目前支持180|
|
||||
| dataC| string| 是| 无|待检测的1个点对应一周前同时刻的点 + 前后小时的数据,361个数据点按时间顺序拼接,英文逗号分隔|
|
||||
| dataB| string| 是| 无|待检测的1个点对应昨日同时刻的点 + 前后三小时的数据,361个数据点按时间顺序拼接,英文逗号分隔|
|
||||
| dataA| string| 是| 无|待检测的1个点+前三小时的数据,共181个数据点,181个数据点按时间顺序拼接,英文逗号分隔|
|
||||
|
||||
|
||||
* 详情参数response:
|
||||
```
|
||||
{
|
||||
"code":0,
|
||||
"msg":"操作成功",
|
||||
"data":
|
||||
{
|
||||
"ret":0,
|
||||
"p":"0.05",
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
* response 字段说明:
|
||||
|
||||
| 名称 | 类型 | 说明 |
|
||||
|---|---|---|---|
|
||||
| code | int | 返回码。0:成功;非0:失败 |
|
||||
| msg | string | 返回消息 |
|
||||
| ret | int | 检测结果是否异常。0:异常;1:正常 |
|
||||
| p | string | 概率值,值越小,置信度越高,目前p<0.15,判决为异常 |
|
||||
|
||||
### 率值检测
|
||||
|
||||
* API: POST /{ip}:{port}/PredictRate
|
||||
* 功能说明:根据参考数据检测最近一个数据点是否异常
|
||||
* 请求参数request:
|
||||
|
||||
```
|
||||
{
|
||||
"viewId":"2012",
|
||||
"viewName":"登陆功能",
|
||||
"attrId":"19201",
|
||||
"attrName":"ptlogin登陆成功率",
|
||||
"window":180,
|
||||
"dataC":"100,99.8,100,...,100,...,100",
|
||||
"dataB":"99.5,100,100,...,99.6,...,100",
|
||||
"dataA":"100,98.5,100,...,85.9"
|
||||
}
|
||||
```
|
||||
|
||||
* request字段说明:
|
||||
|
||||
| 名称 | 类型 |必填| 默认值 | 说明 |
|
||||
| --- | --- | --- |--- | --- | ---|
|
||||
| viewId| string| 是|无|指标集ID |
|
||||
| viewName| string| 是| 无|指标集名称|
|
||||
| attrId| string| 是| 无|指标ID|
|
||||
| attrName| string| 是| 无|指标名称|
|
||||
| window| int| 是| 无|窗口值,目前支持180|
|
||||
| dataC| string| 是| 无|待检测的1个点对应一周前同时刻的点 + 前后小时的数据,361个数据点按时间顺序拼接,英文逗号分隔|
|
||||
| dataB| string| 是| 无|待检测的1个点对应昨日同时刻的点 + 前后三小时的数据,361个数据点按时间顺序拼接,英文逗号分隔|
|
||||
| dataA| string| 是| 无|待检测的1个点+前三小时的数据,共181个数据点,181个数据点按时间顺序拼接,英文逗号分隔|
|
||||
|
||||
|
||||
* 详情参数response:
|
||||
|
||||
```
|
||||
{
|
||||
"code":0,
|
||||
"msg":"操作成功",
|
||||
"data":
|
||||
{
|
||||
"ret":0,
|
||||
"p":"0",
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
* response 字段说明:
|
||||
|
||||
| 名称 | 类型 | 说明 |
|
||||
|---|---|---|---|
|
||||
| code | int | 返回码。0:成功;非0:失败 |
|
||||
| msg | string | 返回消息 |
|
||||
| ret | int | 检测结果是否异常。0:异常;1:正常 |
|
||||
# API接口文档
|
||||
## 时间序列异常检测学件接口
|
||||
|
||||
用户可使用API接口对时间序列进行异常检测,检测后的结果通过WEB管理端查看和管理。 服务端提供两个异常检测的API接口供不同场景调用:
|
||||
|
||||
1、量值检测:适用于大多数类型数据的检测,使用无监督和有监督联合检测,会加载检测模型
|
||||
|
||||
2、率值检测:适用于严格正态分布类型数据的检测,使用无监督算法进行检测,如成功率等生死指标数据的检测
|
||||
|
||||
- API请求调用请使用搭建的后端服务地址
|
||||
- 当前检测时间窗口选取为3小时,每分钟1个数据点,即窗口值为180
|
||||
- 同比数据日期和时间段的选择可根据实际情况调整,文档中两个同比数据分别去昨日和一周前的同比
|
||||
|
||||
针对当前一个值的检测,需要依赖过去三段数据,数据选取规则参考示例图:
|
||||

|
||||
|
||||
### 1、量值检测
|
||||
|
||||
* API: POST /{ip}:{port}/PredictValue
|
||||
* 功能说明:根据参考数据检测最近一个数据点是否异常
|
||||
* 请求参数request:
|
||||
|
||||
```
|
||||
{
|
||||
"viewId":"2012",
|
||||
"viewName":"登陆功能",
|
||||
"attrId":"19201",
|
||||
"attrName":"ptlogin登陆请求总量",
|
||||
"taskId":"1530608070706",
|
||||
"window":180,
|
||||
"dataC":"9,10,152,...,255,...,16",
|
||||
"dataB":"9,10,152,...,255,...,18",
|
||||
"dataA":"9,10,152,...,458"
|
||||
}
|
||||
```
|
||||
|
||||
* request字段说明:
|
||||
|
||||
| 名称 | 类型 |必填| 默认值 | 说明 |
|
||||
| --- | --- | --- |--- | --- | ---|
|
||||
| viewId| string| 是|无|指标集ID |
|
||||
| viewName| string| 是| 无|指标集名称|
|
||||
| attrId| string| 是| 无|指标ID|
|
||||
| attrName| string| 是| 无|指标名称|
|
||||
| taskId| string| 否| 无|使用的检测模型,如不传,则采用系统默认模型|
|
||||
| window| int| 是| 无|窗口值,目前支持180|
|
||||
| dataC| string| 是| 无|待检测的1个点对应一周前同时刻的点 + 前后小时的数据,361个数据点按时间顺序拼接,英文逗号分隔|
|
||||
| dataB| string| 是| 无|待检测的1个点对应昨日同时刻的点 + 前后三小时的数据,361个数据点按时间顺序拼接,英文逗号分隔|
|
||||
| dataA| string| 是| 无|待检测的1个点+前三小时的数据,共181个数据点,181个数据点按时间顺序拼接,英文逗号分隔|
|
||||
|
||||
|
||||
* 详情参数response:
|
||||
```
|
||||
{
|
||||
"code":0,
|
||||
"msg":"操作成功",
|
||||
"data":
|
||||
{
|
||||
"ret":0,
|
||||
"p":"0.05",
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
* response 字段说明:
|
||||
|
||||
| 名称 | 类型 | 说明 |
|
||||
|---|---|---|---|
|
||||
| code | int | 返回码。0:成功;非0:失败 |
|
||||
| msg | string | 返回消息 |
|
||||
| ret | int | 检测结果是否异常。0:异常;1:正常 |
|
||||
| p | string | 概率值,值越小,置信度越高,目前p<0.15,判决为异常 |
|
||||
|
||||
### 2、率值检测
|
||||
|
||||
* API: POST /{ip}:{port}/PredictRate
|
||||
* 功能说明:根据参考数据检测最近一个数据点是否异常
|
||||
* 请求参数request:
|
||||
|
||||
```
|
||||
{
|
||||
"viewId":"2012",
|
||||
"viewName":"登陆功能",
|
||||
"attrId":"19201",
|
||||
"attrName":"ptlogin登陆成功率",
|
||||
"window":180,
|
||||
"dataC":"100,99.8,100,...,100,...,100",
|
||||
"dataB":"99.5,100,100,...,99.6,...,100",
|
||||
"dataA":"100,98.5,100,...,85.9"
|
||||
}
|
||||
```
|
||||
|
||||
* request字段说明:
|
||||
|
||||
| 名称 | 类型 |必填| 默认值 | 说明 |
|
||||
| --- | --- | --- |--- | --- | ---|
|
||||
| viewId| string| 是|无|指标集ID |
|
||||
| viewName| string| 是| 无|指标集名称|
|
||||
| attrId| string| 是| 无|指标ID|
|
||||
| attrName| string| 是| 无|指标名称|
|
||||
| window| int| 是| 无|窗口值,目前支持180|
|
||||
| dataC| string| 是| 无|待检测的1个点对应一周前同时刻的点 + 前后小时的数据,361个数据点按时间顺序拼接,英文逗号分隔|
|
||||
| dataB| string| 是| 无|待检测的1个点对应昨日同时刻的点 + 前后三小时的数据,361个数据点按时间顺序拼接,英文逗号分隔|
|
||||
| dataA| string| 是| 无|待检测的1个点+前三小时的数据,共181个数据点,181个数据点按时间顺序拼接,英文逗号分隔|
|
||||
|
||||
|
||||
* 详情参数response:
|
||||
|
||||
```
|
||||
{
|
||||
"code":0,
|
||||
"msg":"操作成功",
|
||||
"data":
|
||||
{
|
||||
"ret":0,
|
||||
"p":"0",
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
* response 字段说明:
|
||||
|
||||
| 名称 | 类型 | 说明 |
|
||||
|---|---|---|---|
|
||||
| code | int | 返回码。0:成功;非0:失败 |
|
||||
| msg | string | 返回消息 |
|
||||
| ret | int | 检测结果是否异常。0:异常;1:正常 |
|
||||
| p | string | 概率值,值越小,置信度越高 |
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
>> * [服务端环境安装](#chapter-1-3)
|
||||
>> * [WEB管理端环境安装](#chapter-1-4)
|
||||
>
|
||||
> * [docker方式部署](#chapter-2)
|
||||
> * [docker方式部署](#chapter-2)
|
||||
>
|
||||
本安装文档仅描述了在一台服务器上安装搭建整个Metis的过程,目的是为了让用户对Metis的部署搭建、运行等整体认识。
|
||||
|
||||
|
|
@ -20,19 +20,19 @@
|
|||
| --- | --- |
|
||||
| linux内核版本:| CentOS 7.4 |
|
||||
| python版本:| 2.7版本|
|
||||
| mysql版本:| 5.6.26及以上版本|
|
||||
| MySQL版本:| 5.6.26及以上版本|
|
||||
| Node.js版本:| 8.11.1及以上版本|s
|
||||
| Django版本:| 1.11.13及以上版本|
|
||||
|
||||
运行服务器要求:1台普通安装linux系统的机器即可(推荐CentOS系统)。2.服务器需要开放80和8080端口
|
||||
运行服务器要求:1台普通安装linux系统的机器即可(推荐CentOS系统),服务器需要开放80和8080端口
|
||||
|
||||
以下步骤假定安装机器的代码目录是 `/data/Metis/`,可根据实际情况更改。
|
||||
|
||||
## 1.2. <a id="chapter-1-2"></a>数据库环境安装
|
||||
|
||||
### 1.2.1. mysql 安装介绍
|
||||
### 1.2.1. MySQL 安装介绍
|
||||
|
||||
采用yum源安装或者在mysql官网下载源码安装,安装好后检测mysql服务是否正常工作。
|
||||
采用yum源安装或者在MySQL官网下载源码安装,安装好后检测MySQL服务是否正常工作。
|
||||
|
||||
```
|
||||
yum install mariadb-server
|
||||
|
|
@ -41,9 +41,9 @@ systemctl start mariadb
|
|||
|
||||
### 1.2.2. 初始化数据库
|
||||
|
||||
为了方便用户快速使用,提供了50+异常检测结果数据和300+样本数据供大家使用。
|
||||
为了方便快速体验,提供了10+异常检测结果数据和300+样本数据供大家使用。
|
||||
|
||||
1、创建需要的数据库用户名并授权,连接mysql客户端并执行
|
||||
1、创建需要的数据库用户名并授权,连接MySQL客户端并执行
|
||||
|
||||
```
|
||||
grant all privileges on *.* to metis@127.0.0.1 identified by 'metis@123';
|
||||
|
|
@ -56,7 +56,7 @@ systemctl start mariadb
|
|||
mysqladmin -umetis -pmetis@123 -h127.0.0.1 create metis
|
||||
```
|
||||
|
||||
3、将`/Metis/app/sql/`目录下的sql初始化文件,导入数据`metis`数据库
|
||||
3、将`/Metis/app/sql/time_series_detector/`目录下的sql初始化文件,导入数据`metis`数据库
|
||||
|
||||
```
|
||||
mysql -umetis -pmetis@123 -h127.0.0.1 metis < /data/Metis/app/sql/time_series_detector/anomaly.sql
|
||||
|
|
@ -92,7 +92,7 @@ yum install mysql-devel
|
|||
|
||||
### 1.3.2. pip 安装python依赖包
|
||||
|
||||
通过工程目录下docs/requirements.txt安装
|
||||
通过工程目录下`/Metis/docs/requirements.txt`安装
|
||||
|
||||
```
|
||||
pip install -I -r requirements.txt
|
||||
|
|
@ -104,7 +104,7 @@ pip install -I -r requirements.txt
|
|||
export PYTHONPATH=/data/Metis:$PYTHONPATH
|
||||
```
|
||||
|
||||
为了保证下次登陆可以导入环境变量,请将环境变量配置写入/etc/profile文件
|
||||
为了保证下次登陆可以导入环境变量,请将环境变量配置写入服务器的`/etc/profile`文件中
|
||||
|
||||
### 1.3.4. 部署Django服务端
|
||||
|
||||
|
|
@ -126,13 +126,13 @@ python /data/Metis/app/controller/manage.py runserver {ip}:{port}
|
|||
|
||||
### 1.4.2. npm install安装前端依赖
|
||||
|
||||
安装 uweb/pacakge.json 配置文件中依赖的第三方安装包
|
||||
安装`/Metis/uweb/pacakge.json`配置文件中依赖的第三方安装包
|
||||
|
||||
进入要uweb目录,执行npm install
|
||||
进入到uweb目录,执行npm install
|
||||
|
||||
### 1.4.3. 编译代码
|
||||
|
||||
修改uweb/src/app.json 文件的后端地址配置: "origin": "http://${ip}:${port}" , ip和port对应服务端地址
|
||||
修改`/Metis/uweb/src/app.json`文件的后端地址配置: "origin": "http://${ip}:${port}" , ip和port对应服务端地址
|
||||
|
||||
运行npm run build
|
||||
|
||||
|
|
@ -166,7 +166,7 @@ server {
|
|||
|
||||
### 1.4.4. 启动WEB服务
|
||||
|
||||
nginx正常启动后,打开浏览器并访问 http://${ip}:80/
|
||||
nginx正常启动后,打开浏览器并访问 `http://${ip}:80/`
|
||||
|
||||
### 1.4.5. 本地修改调试
|
||||
|
||||
|
|
@ -184,9 +184,8 @@ service docker start
|
|||
```
|
||||
|
||||
## 2.2. <a id="chapter-2"></a> 部署docker环境
|
||||
执行Meits/docker/start.sh ${本机ip},等待部署完成
|
||||
|
||||
部署完成后,可以通过浏览器直接访问:http://${IP}
|
||||
|
||||
|
||||
|
||||
执行部署文件
|
||||
```
|
||||
Meits/docker/start.sh ${IP}
|
||||
```
|
||||
等待部署完成后,可以通过浏览器直接访问: `http://${IP}`
|
||||
|
|
|
|||
Loading…
Reference in New Issue