summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author童宗振 <[email protected]>2024-04-23 11:03:42 +0000
committer童宗振 <[email protected]>2024-04-23 11:03:42 +0000
commitbe47e141bfd2536cd674ae2666ea5ac95f7945b3 (patch)
tree55a09c8687bc7300e32fda5083511681f66fb998
parent01a46530179313f515c3735cdcca889e3e359dc9 (diff)
parent299b8b631d314757e3886028deabe0aebfc14672 (diff)
Merge branch 'fix-error' into 'master'
fix error: Variable error; See merge request tsg/dp_telemetry_app!21
-rw-r--r--etc/dp_telemetry_rules.json2
-rw-r--r--etc/dp_trace.conf12
-rw-r--r--etc/table_schema.json2
-rw-r--r--src/maat.c4
-rw-r--r--src/main.c1
-rw-r--r--src/trace_output.c7
6 files changed, 14 insertions, 14 deletions
diff --git a/etc/dp_telemetry_rules.json b/etc/dp_telemetry_rules.json
index b7e6bd0..9830e08 100644
--- a/etc/dp_telemetry_rules.json
+++ b/etc/dp_telemetry_rules.json
@@ -1,7 +1,7 @@
{
"plugin_table": [
{
- "table_name": "DP_TRACE_TELEMETRY_TABLE",
+ "table_name": "DATAPATH_TELEMETRY_JOB",
"table_content": [
"72694b1c-6833-4c46-acde-52e2d6409314\t100\tether host 00:15:5d:b8:10:a6\t60\t2\t200\t0\t{}\t1"
]
diff --git a/etc/dp_trace.conf b/etc/dp_trace.conf
index 588643e..ecd4273 100644
--- a/etc/dp_trace.conf
+++ b/etc/dp_trace.conf
@@ -11,10 +11,10 @@ listen_port=10000
keep_alive_path=/probe
[kafka]
-borker_list="192.168.44.12"
+borker_list="192.168.44.12:9094"
topic_name="DATAPATH-TELEMETRY-RECORD"
-sasl_username=
-sasl_password=
+sasl_username=admin
+sasl_password=galaxy2019
[maat]
# 0:json 1:redis
@@ -22,6 +22,6 @@ maat_log_level=0
maat_input_mode=0
table_schema=../etc/table_schema.json
json_cfg_file=../etc/dp_telemetry_rules.json
-maat_redis_server=
-maat_redis_port_range=
-maat_redis_db_index= \ No newline at end of file
+maat_redis_server=192.168.44.3
+maat_redis_port_range=7002
+maat_redis_db_index=0 \ No newline at end of file
diff --git a/etc/table_schema.json b/etc/table_schema.json
index 422dabd..30bae66 100644
--- a/etc/table_schema.json
+++ b/etc/table_schema.json
@@ -1,7 +1,7 @@
[
{
"table_id": 1,
- "table_name": "DP_TRACE_TELEMETRY_TABLE",
+ "table_name": "DATAPATH_TELEMETRY_JOB",
"table_type": "plugin",
"valid_column": 9,
"custom": {
diff --git a/src/maat.c b/src/maat.c
index 611908e..bff849e 100644
--- a/src/maat.c
+++ b/src/maat.c
@@ -73,8 +73,8 @@ void dp_trace_maat_init()
struct maat * target = dp_trace_maat_instance_create();
DP_TRACE_VERIFY(target, "create maat instance failed.");
- int ret = maat_plugin_table_ex_schema_register(target, "DP_TRACE_TELEMETRY_TABLE", telemetry_job_add_cb,
+ int ret = maat_plugin_table_ex_schema_register(target, "DATAPATH_TELEMETRY_JOB", telemetry_job_add_cb,
telemetry_job_del_cb, NULL, 0, NULL);
- DP_TRACE_VERIFY(ret == 0, "failed at register callback of DP_TRACE_TELEMETRY_TABLE.");
+ DP_TRACE_VERIFY(ret == 0, "failed at register callback of DATAPATH_TELEMETRY_JOB.");
dzlog_info("data path trace maat init end");
} \ No newline at end of file
diff --git a/src/main.c b/src/main.c
index cc9ec3b..328994a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -24,6 +24,7 @@ static void signal_handler(evutil_socket_t fd, short what, void * arg)
{
case SIGHUP:
dynamic_config_load_and_apply();
+ break;
default:
dzlog_warn("Received unexpected signal: %d", fd);
}
diff --git a/src/trace_output.c b/src/trace_output.c
index aff6faa..c5a2e5b 100644
--- a/src/trace_output.c
+++ b/src/trace_output.c
@@ -9,6 +9,7 @@
#include <mpack.h>
+#include <arpa/inet.h>
#include <errno.h>
#include <fcntl.h>
#include <netinet/ip.h>
@@ -18,8 +19,6 @@
#include <pthread.h>
#include <stdlib.h>
#include <unistd.h>
-#include <arpa/inet.h>
-
struct pkt_inner_ip_port
{
@@ -84,7 +83,7 @@ void dp_trace_output_init()
DP_TRACE_VERIFY(ret == 0, "pthread_mutex_init failed(ret = % d)", ret);
}
- kafka_handle = kafka_handle_create(conf->broker_list, conf->sasl_password, conf->sasl_username);
+ kafka_handle = kafka_handle_create(conf->broker_list, conf->sasl_username, conf->sasl_password);
kafka_topic = kafka_topic_new(kafka_handle, conf->topic_name, NULL);
for (unsigned int i = 0; i < TELEMETRY_DIM(dp_trace_output); i++)
@@ -675,7 +674,7 @@ int marsio_pkt_inner_ip_port_get(const marsio_buff_t * mbuf, struct pkt_inner_ip
}
else if (l4_layer_type_id == LAYER_TYPE_ID_UDP)
{
- struct udphdr * udp_hdr = (struct udphdr *)tcp_ptr;
+ struct udphdr * udp_hdr = (struct udphdr *)udp_ptr;
info->src_port = udp_hdr->uh_sport;
info->dst_port = udp_hdr->uh_dport;
}