diff options
| author | liuxueli <[email protected]> | 2020-10-16 18:08:41 +0800 |
|---|---|---|
| committer | liuxueli <[email protected]> | 2020-10-16 18:08:41 +0800 |
| commit | 46322d01502e4ff20a0fe34f2ae153fe9f193cc9 (patch) | |
| tree | 25a007587f1098b83e11771b6298b29e3479946a /src/tsg_rule.cpp | |
| parent | 899ae69a4b3a33e4e295b28966ea7e570d087cf2 (diff) | |
修正生效范围tag的名称,支持配置文件修改,由device_id改为data_centerv3.3.3
Diffstat (limited to 'src/tsg_rule.cpp')
| -rw-r--r-- | src/tsg_rule.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/tsg_rule.cpp b/src/tsg_rule.cpp index 5362761..4b64b6b 100644 --- a/src/tsg_rule.cpp +++ b/src/tsg_rule.cpp @@ -124,7 +124,7 @@ static int proto_str2id(tsg_protocol_t proto) return 0; } -static int get_data_center(char *accept_tag, char *data_center, int data_center_len) +static int get_data_center(char *accept_tag, char *effective_tag_key, char *data_center, int data_center_len) { int i=0,len; cJSON *object=cJSON_Parse(accept_tag); @@ -139,7 +139,7 @@ static int get_data_center(char *accept_tag, char *data_center, int data_center_ if(item!=NULL) { cJSON *tag_item=cJSON_GetObjectItem(item, "tag"); - if(tag_item!=NULL && tag_item->valuestring!=NULL && (memcmp("device_id", tag_item->valuestring, strlen("device_id")))==0) + if(tag_item!=NULL && tag_item->valuestring!=NULL && (memcmp(effective_tag_key, tag_item->valuestring, strlen(effective_tag_key)))==0) { cJSON *v_item=cJSON_GetObjectItem(item, "value"); if(v_item!=NULL && v_item->valuestring!=NULL) @@ -462,6 +462,7 @@ static Maat_feather_t init_maat_feather(const char* conffile, char* instance_nam int ret=0,scan_detail=0,effect_interval=60; Maat_feather_t _maat_feather=NULL; int factor=0, redis_port_num=0,redis_index=0; + char effective_tag_key[128]={0}; char effective_range_filename[1024]={0}; char redis_ip[16]={0}, effective_flag[1024]={0}; int maat_mode=0,maat_stat_on=0,maat_perf_on=0,thread_max=0; @@ -483,7 +484,8 @@ static Maat_feather_t init_maat_feather(const char* conffile, char* instance_nam if(strlen(g_tsg_para.data_center)==0 && strlen(effective_flag)>0) { - get_data_center(effective_flag, g_tsg_para.data_center, sizeof(g_tsg_para.data_center)); + MESA_load_profile_string_def(conffile, module, "EFFECTIVE_TAG_KEY", effective_tag_key, sizeof(effective_tag_key),"data_center"); + get_data_center(effective_flag, effective_tag_key, g_tsg_para.data_center, sizeof(g_tsg_para.data_center)); } MESA_load_profile_int_def(conffile, module,"MAAT_MODE", &(maat_mode),0); |
