fieldstat3的metrc支持输出vsysid

This commit is contained in:
fengweihao
2023-04-26 16:12:29 +08:00
parent b9a8a45540
commit 3523e8a951
4 changed files with 5 additions and 2 deletions

View File

@@ -21,7 +21,8 @@ enum metric_columns_index
enum metric_tags_index
{
TAG_RULE_ID = 0,
TAG_VSYS_ID = 0,
TAG_RULE_ID,
TAG_PINNING_STATUS,
TAG_ACTION,
TAG_SUB_ACTION,

View File

@@ -10,7 +10,7 @@ struct tfe_fieldstat_metric_t *tfe_fieldstat_metric_create(char *telegraf_ip, in
{
int i=0;
struct fieldstat_tag metric_tags[TAG_MAX] = {{"rule_id", 0, -1}, {"pinning_status", 0, -1 }, {"action", 0, -1}, {"sub_action", 2, -1} };
struct fieldstat_tag metric_tags[TAG_MAX] = {{"vsys_id", 0, -1}, {"rule_id", 0, -1}, {"pinning_status", 0, -1 }, {"action", 0, -1}, {"sub_action", 2, -1} };
const char *column_field[COLUMN_MAX] = {"hit_count", "in_bytes", "out_bytes", "in_pkts", "out_pkts"};
enum field_type column_type[COLUMN_MAX] = {FIELD_TYPE_COUNTER, FIELD_TYPE_COUNTER, FIELD_TYPE_COUNTER, FIELD_TYPE_COUNTER, FIELD_TYPE_COUNTER};

View File

@@ -862,6 +862,7 @@ void doh_send_metric_log(const struct tfe_stream * stream, struct doh_ctx *ctx,
size_t c2s_byte_num = 0, s2c_byte_num =0;
struct tfe_fieldstat_metric_t *fieldstat = (struct tfe_fieldstat_metric_t *)tfe_bussiness_resouce_get(DYNAMIC_FIELDSTAT);
fieldstat->tags[thread_id][TAG_VSYS_ID].value_int = ctx->result->vsys_id;
fieldstat->tags[thread_id][TAG_RULE_ID].value_int = ctx->result->config_id;
fieldstat->tags[thread_id][TAG_ACTION].value_int = 48;
fieldstat->tags[thread_id][TAG_SUB_ACTION].value_str = "redirect";

View File

@@ -3270,6 +3270,7 @@ void proxy_send_metric_log(const struct tfe_stream * stream, struct proxy_http_c
for(i=0; i< ctx->n_enforce; i++)
{
fieldstat->tags[thread_id][TAG_VSYS_ID].value_int = ctx->enforce_rules[i].vsys_id;
fieldstat->tags[thread_id][TAG_RULE_ID].value_int = ctx->enforce_rules[i].config_id;
fieldstat->tags[thread_id][TAG_ACTION].value_int = ctx->enforce_rules[i].action;
if(ctx->enforce_rules[i].action == PX_ACTION_MANIPULATE)