63 lines
1.7 KiB
C
63 lines
1.7 KiB
C
|
|
#pragma once
|
|||
|
|
/**
|
|||
|
|
* @file roller.h
|
|||
|
|
* @brief 负载平衡,离群检测
|
|||
|
|
* @author your name (you@domain.com)
|
|||
|
|
* @version 0.1
|
|||
|
|
* @date 2023-12-08
|
|||
|
|
*
|
|||
|
|
* Copyright: Baosight Co. Ltd.
|
|||
|
|
* DO NOT COPY/USE WITHOUT PERMISSION
|
|||
|
|
*
|
|||
|
|
*/
|
|||
|
|
#include <eqpalg/alg_base.h>
|
|||
|
|
#include <eqpalg/define/public.h>
|
|||
|
|
#include <array>
|
|||
|
|
#include <map>
|
|||
|
|
|
|||
|
|
using std::string;
|
|||
|
|
class Roller :public AlgBase {
|
|||
|
|
public:
|
|||
|
|
Roller(const string name, const mix_cc::json& rule_json, const string ruleId);
|
|||
|
|
|
|||
|
|
virtual ~Roller();
|
|||
|
|
|
|||
|
|
public:
|
|||
|
|
int init() override;
|
|||
|
|
AlarmInfo exec_mon() override;
|
|||
|
|
std::vector<AlarmInfo> exec_task(mix_cc::time_range_t time_range) override;
|
|||
|
|
const array<string, 2> BIG_SMALL = {"过大", "过小"}; ///<检测异常的结果集
|
|||
|
|
|
|||
|
|
private:
|
|||
|
|
TimeDur interval_time_; ///<查ihd均值的时间长短,默认3分钟
|
|||
|
|
std::string error_content_; ///<报警内容
|
|||
|
|
double error_diff_; ///<报警阈值,百分比
|
|||
|
|
std::string error_name_; ///<报警原因
|
|||
|
|
std::map<int, double> mmean_tags_; ///<查询的结果
|
|||
|
|
std::vector<int> comparison_tags_; ///<需要查找是否异常的tag
|
|||
|
|
std::map<int, int> tags_errors_; ///<异常的tags
|
|||
|
|
std::array<double, 3> min_max_sum_; ///最小值 最大值 和
|
|||
|
|
int n_tags_; ///< tag的个数
|
|||
|
|
private:
|
|||
|
|
/**
|
|||
|
|
* @brief 查询mmean_tags_ 调用ihd均值查询API
|
|||
|
|
* @return int
|
|||
|
|
*/
|
|||
|
|
int refresh_mmean_tags_ihd();
|
|||
|
|
/**
|
|||
|
|
* @brief 打印载入信息
|
|||
|
|
*/
|
|||
|
|
void print_load_content();
|
|||
|
|
/**
|
|||
|
|
* @brief
|
|||
|
|
* @return int 0:本次查找-没有异常 -1:本次查找-查找完成
|
|||
|
|
*/
|
|||
|
|
int exec_mon_base();
|
|||
|
|
/**
|
|||
|
|
* @brief 从vector中获取min max sum,存入
|
|||
|
|
* @param comparison_tags My Param doc
|
|||
|
|
* @return int
|
|||
|
|
*/
|
|||
|
|
int minmaxsum_get(std::vector<int> comparison_tags);
|
|||
|
|
};
|