anomaly_detection 概述
⚫ anomaly_detection是openGauss集成的、可以用于数据库指标采集、预测以及异常监控与诊断的 AI工具,是dbmind套间中的一个组件。支持采集的信息包括IO_Read、IO_Write、CPU_Usage、 Memory_Usage以及数据库所占磁盘空间等。anomaly_detection可以同时监控多个指标,并预 测每个指标未来的变化趋势,当发现某个指标在未来某段时间或者某个时刻会超出人工设置的阈 值,该工具会通过日志进行报警。
⚫ anomaly_detection由agent和detector两部分组成。
agent和openGauss数据库环境部署在同一个服务器上。
detector模块基于http或https和agent模块通信,因此它可以部署到任何可以与agent端进行通信的服务
器上。
anomaly_detection 结构图

anomaly_detection 的运行和安装方法
⚫ 切 换 到 anomaly_detection 目录下 。 对 于 openGauss 社 区 代 码 来 说 , 该 路 径 在 openGauss-server/src/gausskernel/dbmind/tools/anomaly_detection,对于已经安装 的数据库系统,则该源代码路径为 $GAUSSHOME/bin/dbmind/anomaly_detection。
⚫ 在 当 前 目 录 下 可 以 看 到 requirements.txt 等文件 , 通 过 pip 包 管 理 工 具 根 据 该 requirements.txt 文件安装依赖:
pip install -r requirements.txt
⚫ 安装成功后可执行main.py. 以获取帮助信息为例,则可以执行:
cd anomaly_detection # 切换到 main.py 入口文件所在的目录
python main.py --help # 可以直接通过该命令执行获取帮助的动作,其他功能使用方法类似




