fs增加输出间隔配置

This commit is contained in:
崔一鸣
2019-11-05 14:50:53 +08:00
parent a2f03e8631
commit 0ef167555a
3 changed files with 8 additions and 2 deletions

View File

@@ -99,3 +99,4 @@ remote_switch = 1
remote_ip = 192.168.10.152
remote_port = 8125
local_path = ./fs2_kni.status
stat_cycle = 2

View File

@@ -1906,7 +1906,7 @@ static struct kni_field_stat_handle * fs_init(const char *profile){
struct kni_field_stat_handle *fs_handle = NULL;
screen_stat_handle_t handle = NULL;
const char *app_name = "fs2_kni";
int value = 0, ret;
int value = 0, ret, stat_cycle;
int remote_switch = 0;
char remote_ip[INET_ADDRSTRLEN];
int remote_port;
@@ -1935,6 +1935,7 @@ static struct kni_field_stat_handle * fs_init(const char *profile){
value=FS_OUTPUT_STATSD;
FS_set_para(handle, STATS_FORMAT, &value, sizeof(value));
}
MESA_load_profile_int_def(profile, section, "stat_cycle", &stat_cycle, 5);
fs_handle = ALLOC(struct kni_field_stat_handle, 1);
fs_handle->handle = handle;
FS_set_para(handle, APP_NAME, app_name, strlen(app_name) + 1);
@@ -1945,7 +1946,7 @@ static struct kni_field_stat_handle * fs_init(const char *profile){
FS_set_para(handle, PRINT_MODE, &value, sizeof(value));
value = 1;
FS_set_para(handle, CREATE_THREAD, &value, sizeof(value));
value = 5;
value = stat_cycle;
FS_set_para(handle, STAT_CYCLE, &value, sizeof(value));
value = 4096;
FS_set_para(handle, MAX_STAT_FIELD_NUM, &value, sizeof(value));

View File

@@ -317,11 +317,14 @@ enum kni_action intercept_policy_scan(struct kni_maat_handle* handle, struct ipa
char* source_subscribe_id = NULL, *dest_subscribe_id = NULL;
source_subscribe_id = (char*)Maat_plugin_get_EX_data(handle->dynamic_maat, handle->subscriber_id_tableid, sip);
dest_subscribe_id = (char*)Maat_plugin_get_EX_data(handle->dynamic_maat, handle->subscriber_id_tableid, dip);
KNI_LOG_DEBUG(handle->logger, "sip = %s, source_subscribe_id = %s", sip, source_subscribe_id == NULL ? "null" : source_subscribe_id);
KNI_LOG_DEBUG(handle->logger, "dip = %s, dest_subscribe_id = %s", dip, dest_subscribe_id == NULL ? "null" : dest_subscribe_id);
if(source_subscribe_id != NULL){
scan_ret = Maat_full_scan_string(handle->static_maat, handle->scan_tableid[TSG_OBJ_SUBSCRIBER_ID],
CHARSET_UTF8, source_subscribe_id, strlen(source_subscribe_id),
result+hit_policy_cnt, NULL, KNI_MAAT_RULE_NUM_MAX-hit_policy_cnt,
&scan_mid, thread_seq);
KNI_LOG_DEBUG(handle->logger, "source_subscribe_id = %s, scan_ret = %d", source_subscribe_id, scan_ret);
if(scan_ret > 0){
hit_policy_cnt += scan_ret;
}
@@ -332,6 +335,7 @@ enum kni_action intercept_policy_scan(struct kni_maat_handle* handle, struct ipa
CHARSET_UTF8, dest_subscribe_id, strlen(dest_subscribe_id),
result+hit_policy_cnt, NULL, KNI_MAAT_RULE_NUM_MAX-hit_policy_cnt,
&scan_mid, thread_seq);
KNI_LOG_DEBUG(handle->logger, "dest_subscribe_id = %s, scan_ret = %d", dest_subscribe_id, scan_ret);
if(scan_ret > 0){
hit_policy_cnt += scan_ret;
}