!20 fix issues raised during 22.03 test
From: @wo_cow Reviewed-by: @MrRlu Signed-off-by: @MrRlu
This commit is contained in:
commit
cbb3a4a41e
87
add-documentation-related-to-docker-images.patch
Normal file
87
add-documentation-related-to-docker-images.patch
Normal file
@ -0,0 +1,87 @@
|
||||
From 4519bf3ce98b819c0cf421b902df3124bc9e4374 Mon Sep 17 00:00:00 2001
|
||||
From: wo_cow <niuqianqian@huawei.com>
|
||||
Date: Sat, 26 Nov 2022 17:05:18 +0800
|
||||
Subject: [PATCH] add documentation related to docker images. set nsprobe to
|
||||
start automatically
|
||||
|
||||
---
|
||||
README.md | 44 +++++++++++++++++++++++++++++++++++++----
|
||||
config/gala-gopher.conf | 4 +++-
|
||||
2 files changed, 43 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/README.md b/README.md
|
||||
index efcea94..002dbb6 100644
|
||||
--- a/README.md
|
||||
+++ b/README.md
|
||||
@@ -59,13 +59,49 @@ gala-gopher集成了常用的native探针以及知名中间件探针;gala-goph
|
||||
|
||||
#### 基于容器镜像安装运行
|
||||
|
||||
-- 准备工作
|
||||
|
||||
- 获取gala-gopher的rpm包,获取方式详见第一小节[基于rpm包安装运行](#基于rpm包安装运行)。
|
||||
+- 获取容器镜像
|
||||
|
||||
-- 生成容器镜像
|
||||
+ 用户可以选择直接[获取官方容器镜像](#docker1)或自行[构建容器镜像](#docker2)
|
||||
|
||||
- 用于生成容器镜像的Dockerfile文件归档在[build目录](./build),生成方法详见[如何生成gala-gopher容器镜像](doc/how_to_build_docker_image.md)。
|
||||
+ <a id="docker1"></a>
|
||||
+ - 获取官方容器镜像
|
||||
+
|
||||
+ 打开docker配置文件
|
||||
+
|
||||
+ ```shell
|
||||
+ vi /etc/docker/daemon.json
|
||||
+ ```
|
||||
+
|
||||
+ 添加hub.oepkgs.net镜像仓库
|
||||
+
|
||||
+ ```shell
|
||||
+ {
|
||||
+ "insecure-registries" : [ "hub.oepkgs.net" ]
|
||||
+ }
|
||||
+ ```
|
||||
+
|
||||
+ 重启docker服务
|
||||
+
|
||||
+ ```shell
|
||||
+ systemctl daemon-reload
|
||||
+ systemctl restart docker
|
||||
+ ```
|
||||
+
|
||||
+ 拉取指定版本的gala-gopher官方容器镜像
|
||||
+
|
||||
+ 目前支持的镜像版本tag有:euleros-v2r9,20.03-lts,20.03-lts-sp1,22.03-lts
|
||||
+
|
||||
+ ```shell
|
||||
+ docker pull hub.oepkgs.net/a-ops/gala-gopher:20.03-lts-sp1
|
||||
+ ```
|
||||
+
|
||||
+ <a id="docker2"></a>
|
||||
+ - 构建容器镜像
|
||||
+
|
||||
+ 获取gala-gopher的rpm包,获取方式详见第一小节[基于rpm包安装运行](#基于rpm包安装运行)。
|
||||
+
|
||||
+ 用于生成容器镜像的Dockerfile文件归档在[build目录](./build),生成方法详见[如何生成gala-gopher容器镜像](doc/how_to_build_docker_image.md)。
|
||||
|
||||
- 创建并运行容器
|
||||
|
||||
diff --git a/config/gala-gopher.conf b/config/gala-gopher.conf
|
||||
index cb7fec1..33d9714 100644
|
||||
--- a/config/gala-gopher.conf
|
||||
+++ b/config/gala-gopher.conf
|
||||
@@ -156,7 +156,9 @@ extend_probes =
|
||||
name = "nsprobe";
|
||||
command = "/opt/gala-gopher/extend_probes/nsprobe"
|
||||
param = "";
|
||||
- switch = "off";
|
||||
+ start_check = "echo \"isulad docker\" | xargs systemctl status | grep Active | grep running | wc -l";
|
||||
+ check_type = "count";
|
||||
+ switch = "auto";
|
||||
},
|
||||
{
|
||||
name = "ioprobe";
|
||||
--
|
||||
2.28.0.windows.1
|
||||
|
||||
349
fix-bugs-for-ksliprobe-pgsliprobe-stackprobe.patch
Normal file
349
fix-bugs-for-ksliprobe-pgsliprobe-stackprobe.patch
Normal file
@ -0,0 +1,349 @@
|
||||
From 72946403263a0ac056a65f85fd19736d200c8aa4 Mon Sep 17 00:00:00 2001
|
||||
From: wo_cow <niuqianqian@huawei.com>
|
||||
Date: Tue, 22 Nov 2022 15:40:11 +0800
|
||||
Subject: [PATCH] fix bugs for ksliprobe pgsliprobe stackprobe
|
||||
|
||||
---
|
||||
src/common/common.h | 1 +
|
||||
src/common/util.c | 19 +++++
|
||||
.../ebpf.probe/src/ksliprobe/ksliprobe.bpf.c | 4 +
|
||||
.../ebpf.probe/src/pgsliprobe/pgsliprobe.c | 74 +++++++++----------
|
||||
.../src/pgsliprobe/pgsliprobe_bpf.h | 7 +-
|
||||
.../src/stackprobe/conf/stackprobe.conf | 2 +-
|
||||
.../src/stackprobe/stack_bpf/memleak.bpf.c | 11 +--
|
||||
.../extends/ebpf.probe/src/stackprobe/svg.c | 31 +++++++-
|
||||
.../pg_stat.probe/pg_stat_probe.py | 8 +-
|
||||
src/probes/system_infos.probe/system_procs.c | 2 +-
|
||||
10 files changed, 105 insertions(+), 54 deletions(-)
|
||||
|
||||
diff --git a/src/common/common.h b/src/common/common.h
|
||||
index 4ce6a81..49496c4 100644
|
||||
--- a/src/common/common.h
|
||||
+++ b/src/common/common.h
|
||||
@@ -168,6 +168,7 @@ unsigned short ntohs(unsigned short netshort);
|
||||
/* get uprobe func offset */
|
||||
int get_func_offset(char *proc_name, char *func_name, char *bin_file_path);
|
||||
|
||||
+char *get_cur_date(void);
|
||||
char *get_cur_time(void);
|
||||
|
||||
void ip_str(unsigned int family, unsigned char *ip, unsigned char *ip_str, unsigned int ip_str_size);
|
||||
diff --git a/src/common/util.c b/src/common/util.c
|
||||
index 65e5d4d..dbe5f75 100644
|
||||
--- a/src/common/util.c
|
||||
+++ b/src/common/util.c
|
||||
@@ -21,6 +21,25 @@
|
||||
#include <stdarg.h>
|
||||
#include "common.h"
|
||||
|
||||
+char *get_cur_date(void)
|
||||
+{
|
||||
+ /* return date str, ex: 2021/5/17 */
|
||||
+ static char tm[TM_STR_LEN] = {0};
|
||||
+ struct tm *tmp_ptr = NULL;
|
||||
+ time_t t;
|
||||
+
|
||||
+ (void)time(&t);
|
||||
+
|
||||
+ tmp_ptr = localtime(&t);
|
||||
+ (void)snprintf(tm,
|
||||
+ TM_STR_LEN,
|
||||
+ "%d-%d-%d",
|
||||
+ (1900 + tmp_ptr->tm_year),
|
||||
+ (1 + tmp_ptr->tm_mon),
|
||||
+ tmp_ptr->tm_mday);
|
||||
+ return tm;
|
||||
+}
|
||||
+
|
||||
char *get_cur_time(void)
|
||||
{
|
||||
/* return time str, ex: 2021/5/17 19:56:03 */
|
||||
diff --git a/src/probes/extends/ebpf.probe/src/ksliprobe/ksliprobe.bpf.c b/src/probes/extends/ebpf.probe/src/ksliprobe/ksliprobe.bpf.c
|
||||
index bf653f0..6fa64ab 100644
|
||||
--- a/src/probes/extends/ebpf.probe/src/ksliprobe/ksliprobe.bpf.c
|
||||
+++ b/src/probes/extends/ebpf.probe/src/ksliprobe/ksliprobe.bpf.c
|
||||
@@ -374,6 +374,10 @@ static __always_inline void process_rd_msg(u32 tgid, int fd, const char *buf, co
|
||||
|
||||
#ifndef KERNEL_SUPPORT_TSTAMP
|
||||
csd->start_ts_nsec = ts_nsec;
|
||||
+#else
|
||||
+ if (csd->start_ts_nsec == 0) {
|
||||
+ csd->start_ts_nsec = ts_nsec;
|
||||
+ }
|
||||
#endif
|
||||
csd->status = SAMP_READ_READY;
|
||||
|
||||
diff --git a/src/probes/extends/ebpf.probe/src/pgsliprobe/pgsliprobe.c b/src/probes/extends/ebpf.probe/src/pgsliprobe/pgsliprobe.c
|
||||
index 9171985..6b75f06 100644
|
||||
--- a/src/probes/extends/ebpf.probe/src/pgsliprobe/pgsliprobe.c
|
||||
+++ b/src/probes/extends/ebpf.probe/src/pgsliprobe/pgsliprobe.c
|
||||
@@ -180,7 +180,6 @@ static void *msg_event_receiver(void *arg)
|
||||
}
|
||||
|
||||
poll_pb(pb, params.period * 1000);
|
||||
-
|
||||
stop = 1;
|
||||
return NULL;
|
||||
}
|
||||
@@ -380,6 +379,7 @@ int main(int argc, char **argv)
|
||||
{
|
||||
int err, ret;
|
||||
FILE *fp = NULL;
|
||||
+ int init = 0;
|
||||
struct bpf_link_hash_t *item, *tmp;
|
||||
|
||||
err = args_parse(argc, argv, ¶ms);
|
||||
@@ -409,15 +409,6 @@ int main(int argc, char **argv)
|
||||
goto init_err;
|
||||
}
|
||||
|
||||
- load_args(GET_MAP_FD(pgsli_kprobe, args_map), ¶ms);
|
||||
- err = init_conn_mgt_process(GET_MAP_FD(pgsli_kprobe, output));
|
||||
- if (err != 0) {
|
||||
- fprintf(stderr, "Init connection management process failed.\n");
|
||||
- goto init_err;
|
||||
- }
|
||||
-
|
||||
- printf("pgsliprobe probe successfully started!\n");
|
||||
-
|
||||
while (!stop) {
|
||||
sleep(params.period);
|
||||
if (noDependLibssl) {
|
||||
@@ -426,37 +417,46 @@ int main(int argc, char **argv)
|
||||
|
||||
set_bpf_link_inactive();
|
||||
if (add_bpf_link_by_search_pids() != SLI_OK) {
|
||||
- if (noDependLibssl) {
|
||||
- continue;
|
||||
+ if (!noDependLibssl) {
|
||||
+ goto init_err;
|
||||
}
|
||||
- goto init_err;
|
||||
- }
|
||||
-
|
||||
- // attach to libssl
|
||||
- H_ITER(head, item, tmp) {
|
||||
- if (item->v.pid_state == PID_ELF_TOBE_ATTACHED) {
|
||||
- UBPF_ATTACH_ONELINK(pgsli_uprobe, SSL_read, item->v.elf_path, SSL_read,
|
||||
- item->v.bpf_link_read, ret);
|
||||
- if (ret <= 0) {
|
||||
- fprintf(stderr, "Can't attach function SSL_read at elf_path %s.\n", item->v.elf_path);
|
||||
- goto init_err;
|
||||
- }
|
||||
- UBPF_RET_ATTACH_ONELINK(pgsli_uprobe, SSL_read, item->v.elf_path, SSL_read,
|
||||
- item->v.bpf_link_read_ret, ret);
|
||||
- if (ret <= 0) {
|
||||
- fprintf(stderr, "Can't attach ret function SSL_read at elf_path %s.\n", item->v.elf_path);
|
||||
- goto init_err;
|
||||
+ } else {
|
||||
+ // attach to libssl
|
||||
+ H_ITER(head, item, tmp) {
|
||||
+ if (item->v.pid_state == PID_ELF_TOBE_ATTACHED) {
|
||||
+ UBPF_ATTACH_ONELINK(pgsli_uprobe, SSL_read, item->v.elf_path, SSL_read,
|
||||
+ item->v.bpf_link_read, ret);
|
||||
+ if (ret <= 0) {
|
||||
+ fprintf(stderr, "Can't attach function SSL_read at elf_path %s.\n", item->v.elf_path);
|
||||
+ goto init_err;
|
||||
+ }
|
||||
+ UBPF_RET_ATTACH_ONELINK(pgsli_uprobe, SSL_read, item->v.elf_path, SSL_read,
|
||||
+ item->v.bpf_link_read_ret, ret);
|
||||
+ if (ret <= 0) {
|
||||
+ fprintf(stderr, "Can't attach ret function SSL_read at elf_path %s.\n", item->v.elf_path);
|
||||
+ goto init_err;
|
||||
+ }
|
||||
+ UBPF_ATTACH_ONELINK(pgsli_uprobe, SSL_write, item->v.elf_path, SSL_write,
|
||||
+ item->v.bpf_link_write, ret);
|
||||
+ if (ret <= 0) {
|
||||
+ fprintf(stderr, "Can't attach function SSL_write at elf_path %s.\n", item->v.elf_path);
|
||||
+ goto init_err;
|
||||
+ }
|
||||
+ item->v.pid_state = PID_ELF_ATTACHED;
|
||||
}
|
||||
- UBPF_ATTACH_ONELINK(pgsli_uprobe, SSL_write, item->v.elf_path, SSL_write,
|
||||
- item->v.bpf_link_write, ret);
|
||||
- if (ret <= 0) {
|
||||
- fprintf(stderr, "Can't attach function SSL_write at elf_path %s.\n", item->v.elf_path);
|
||||
- goto init_err;
|
||||
- }
|
||||
- item->v.pid_state = PID_ELF_ATTACHED;
|
||||
}
|
||||
+ clear_invalid_bpf_link();
|
||||
+ }
|
||||
+ if (init == 0) {
|
||||
+ load_args(GET_MAP_FD(pgsli_kprobe, args_map), ¶ms);
|
||||
+ err = init_conn_mgt_process(GET_MAP_FD(pgsli_kprobe, output));
|
||||
+ if (err != 0) {
|
||||
+ fprintf(stderr, "Init connection management process failed.\n");
|
||||
+ goto init_err;
|
||||
+ }
|
||||
+ printf("pgsliprobe probe successfully started!\n");
|
||||
+ init = 1;
|
||||
}
|
||||
- clear_invalid_bpf_link();
|
||||
}
|
||||
|
||||
init_err:
|
||||
diff --git a/src/probes/extends/ebpf.probe/src/pgsliprobe/pgsliprobe_bpf.h b/src/probes/extends/ebpf.probe/src/pgsliprobe/pgsliprobe_bpf.h
|
||||
index a2e85b2..a3dfc5d 100644
|
||||
--- a/src/probes/extends/ebpf.probe/src/pgsliprobe/pgsliprobe_bpf.h
|
||||
+++ b/src/probes/extends/ebpf.probe/src/pgsliprobe/pgsliprobe_bpf.h
|
||||
@@ -156,7 +156,7 @@ static __always_inline void periodic_report(u64 ts_nsec, struct conn_data_t *con
|
||||
if (ts_nsec > conn_data->last_report_ts_nsec &&
|
||||
ts_nsec - conn_data->last_report_ts_nsec >= period) {
|
||||
// rtt larger than period is considered an invalid value
|
||||
- if (conn_data->latency.rtt_nsec < period && conn_data->max.rtt_nsec < period) {
|
||||
+ if (conn_data->latency.rtt_nsec < period * 2 && conn_data->max.rtt_nsec < period * 2) {
|
||||
struct msg_event_data_t msg_evt_data = {0};
|
||||
msg_evt_data.tgid = conn_key->tgid;
|
||||
msg_evt_data.fd = conn_key->fd;
|
||||
@@ -224,10 +224,13 @@ static __always_inline void process_rdwr_msg(int fd, const char *buf, int count,
|
||||
}
|
||||
csd->req_cmd = cmd;
|
||||
|
||||
+#ifndef KERNEL_SUPPORT_TSTAMP
|
||||
+ csd->start_ts_nsec = ts_nsec;
|
||||
+#else
|
||||
if (csd->start_ts_nsec == 0) {
|
||||
csd->start_ts_nsec = ts_nsec;
|
||||
}
|
||||
-
|
||||
+#endif
|
||||
csd->status = SAMP_READ_READY;
|
||||
} else { // MSG_WRITE
|
||||
if (csd->status == SAMP_READ_READY) {
|
||||
diff --git a/src/probes/extends/ebpf.probe/src/stackprobe/conf/stackprobe.conf b/src/probes/extends/ebpf.probe/src/stackprobe/conf/stackprobe.conf
|
||||
index f0b3c29..a2edd5d 100644
|
||||
--- a/src/probes/extends/ebpf.probe/src/stackprobe/conf/stackprobe.conf
|
||||
+++ b/src/probes/extends/ebpf.probe/src/stackprobe/conf/stackprobe.conf
|
||||
@@ -12,7 +12,7 @@ flame_name =
|
||||
oncpu = true;
|
||||
offcpu = false;
|
||||
io = false;
|
||||
- memleak = true;
|
||||
+ memleak = false;
|
||||
};
|
||||
|
||||
application =
|
||||
diff --git a/src/probes/extends/ebpf.probe/src/stackprobe/stack_bpf/memleak.bpf.c b/src/probes/extends/ebpf.probe/src/stackprobe/stack_bpf/memleak.bpf.c
|
||||
index e855401..fe2f22b 100644
|
||||
--- a/src/probes/extends/ebpf.probe/src/stackprobe/stack_bpf/memleak.bpf.c
|
||||
+++ b/src/probes/extends/ebpf.probe/src/stackprobe/stack_bpf/memleak.bpf.c
|
||||
@@ -109,20 +109,12 @@ struct bpf_map_def SEC("maps") mmap_allocs = {
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") brk_allocs = {
|
||||
- .type = BPF_MAP_TYPE_HASH,
|
||||
+ .type = BPF_MAP_TYPE_LRU_HASH,
|
||||
.key_size = sizeof(u32), // tgid
|
||||
.value_size = sizeof(struct brk_info_t),
|
||||
.max_entries = 1000000,
|
||||
};
|
||||
|
||||
-// allocated memory for the process
|
||||
-struct bpf_map_def SEC("maps") combined_allocs = {
|
||||
- .type = BPF_MAP_TYPE_HASH,
|
||||
- .key_size = sizeof(struct stack_id_s),
|
||||
- .value_size = sizeof(struct combined_alloc_info_t),
|
||||
- .max_entries = 1000,
|
||||
-};
|
||||
-
|
||||
static __always_inline u64 get_real_start_time()
|
||||
{
|
||||
struct task_struct* task = (struct task_struct*)bpf_get_current_task();
|
||||
@@ -185,7 +177,6 @@ static inline void update_statistics(void *ctx, char stackmap_cur, s64 count, st
|
||||
}
|
||||
}
|
||||
|
||||
-
|
||||
static inline int alloc_exit(void *ctx, u64 addr) {
|
||||
u32 tgid = bpf_get_current_pid_tgid() >> INT_LEN;
|
||||
struct pid_addr_t pa = {0};
|
||||
diff --git a/src/probes/extends/ebpf.probe/src/stackprobe/svg.c b/src/probes/extends/ebpf.probe/src/stackprobe/svg.c
|
||||
index db43aab..78a1cb0 100644
|
||||
--- a/src/probes/extends/ebpf.probe/src/stackprobe/svg.c
|
||||
+++ b/src/probes/extends/ebpf.probe/src/stackprobe/svg.c
|
||||
@@ -156,10 +156,33 @@ static int __create_svg_files(struct stack_svg_s* svg_files, u32 period)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+int __mkdir_with_svg_date(const char *svg_dir, char *svg_date_dir, size_t size)
|
||||
+{
|
||||
+ size_t len = strlen(svg_dir);
|
||||
+ const char *day = get_cur_date();
|
||||
+ if (len <= 1 || len + strlen(day) + 1 >= size) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ (void)snprintf(svg_date_dir, size, "%s/%s", svg_dir, day);
|
||||
+ if (access(svg_date_dir, F_OK) != 0) {
|
||||
+ FILE *fp;
|
||||
+ char command[COMMAND_LEN] = {0};
|
||||
+ (void)snprintf(command, COMMAND_LEN, "/usr/bin/mkdir -p %s", svg_date_dir);
|
||||
+ fp = popen(command, "r");
|
||||
+ if (fp != NULL) {
|
||||
+ (void)pclose(fp);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int stack_get_next_svg_file(struct stack_svgs_s* svgs, char svg_file[], size_t size, int en_type)
|
||||
{
|
||||
int next;
|
||||
char svg_name[PATH_LEN];
|
||||
+ char svg_date_dir[PATH_LEN] = {0};
|
||||
|
||||
if (svgs->svg_files.files == NULL) {
|
||||
return -1;
|
||||
@@ -176,11 +199,15 @@ static int stack_get_next_svg_file(struct stack_svgs_s* svgs, char svg_file[], s
|
||||
svgs->svg_files.files[next] = NULL;
|
||||
}
|
||||
|
||||
+ if (__mkdir_with_svg_date(svgs->svg_dir, svg_date_dir, PATH_LEN) < 0) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
svg_name[0] = 0;
|
||||
- (void)snprintf(svg_name, PATH_LEN, "%s_%s.svg", svg_params[en_type].file_name, get_cur_time());
|
||||
+ (void)snprintf(svg_name, PATH_LEN, "%s.svg", get_cur_time());
|
||||
|
||||
svg_file[0] = 0;
|
||||
- (void)snprintf(svg_file, size, "%s/%s", svgs->svg_dir, svg_name);
|
||||
+ (void)snprintf(svg_file, size, "%s/%s", svg_date_dir, svg_name);
|
||||
__rm_svg(svg_file);
|
||||
|
||||
svgs->svg_files.files[next] = strdup(svg_file);
|
||||
diff --git a/src/probes/extends/python.probe/pg_stat.probe/pg_stat_probe.py b/src/probes/extends/python.probe/pg_stat.probe/pg_stat_probe.py
|
||||
index 45f80b5..fe8f955 100644
|
||||
--- a/src/probes/extends/python.probe/pg_stat.probe/pg_stat_probe.py
|
||||
+++ b/src/probes/extends/python.probe/pg_stat.probe/pg_stat_probe.py
|
||||
@@ -121,5 +121,11 @@ if __name__ == "__main__":
|
||||
|
||||
while True:
|
||||
time.sleep(g_period)
|
||||
- get_metrics()
|
||||
+ try:
|
||||
+ get_metrics()
|
||||
+ except Exception as e:
|
||||
+ print("[pg_stat_probe]get metrics failed. Err:" + str(e))
|
||||
+ stop_conns()
|
||||
+
|
||||
+
|
||||
|
||||
diff --git a/src/probes/system_infos.probe/system_procs.c b/src/probes/system_infos.probe/system_procs.c
|
||||
index 6812bbc..0e1f8a4 100644
|
||||
--- a/src/probes/system_infos.probe/system_procs.c
|
||||
+++ b/src/probes/system_infos.probe/system_procs.c
|
||||
@@ -31,7 +31,7 @@
|
||||
#define PROC_START_TIME_CMD "/usr/bin/cat /proc/%s/stat | awk '{print $22}'"
|
||||
#define PROC_CMDLINE_CMD "/proc/%s/cmdline"
|
||||
#define PROC_FD "/proc/%s/fd"
|
||||
-#define PROC_FD_CNT_CMD "/usr/bin/ls -l /proc/%s/fd | wc -l"
|
||||
+#define PROC_FD_CNT_CMD "/usr/bin/ls -l /proc/%s/fd 2>/dev/null | wc -l 2>/dev/null"
|
||||
#define PROC_IO "/proc/%s/io"
|
||||
#define PROC_IO_CMD "/usr/bin/cat /proc/%s/io"
|
||||
#define PROC_SMAPS "/proc/%s/smaps_rollup"
|
||||
--
|
||||
2.28.0.windows.1
|
||||
|
||||
54
fix-the-problem-that-the-gopher-in-docker-doesn-t-su.patch
Normal file
54
fix-the-problem-that-the-gopher-in-docker-doesn-t-su.patch
Normal file
@ -0,0 +1,54 @@
|
||||
From 7eb391faa77d79b321df6667fbff6c1ffc07fe8d Mon Sep 17 00:00:00 2001
|
||||
From: wo_cow <niuqianqian@huawei.com>
|
||||
Date: Wed, 23 Nov 2022 16:56:58 +0800
|
||||
Subject: [PATCH] fix the problem that the gopher in docker doesn't support tc
|
||||
command and docker command
|
||||
|
||||
---
|
||||
README.md | 2 +-
|
||||
build/Dockerfile_2003_sp1_aarch64 | 2 ++
|
||||
build/Dockerfile_2003_sp1_x86_64 | 2 ++
|
||||
3 files changed, 5 insertions(+), 1 deletions(-)
|
||||
|
||||
diff --git a/README.md b/README.md
|
||||
index fd00153..efcea94 100644
|
||||
--- a/README.md
|
||||
+++ b/README.md
|
||||
@@ -86,7 +86,7 @@ gala-gopher集成了常用的native探针以及知名中间件探针;gala-goph
|
||||
最后按照如下示例命令启动容器:
|
||||
|
||||
```shell
|
||||
- docker run -d --name xxx -p 8888:8888 --privileged -v /etc/machine-id:/etc/machine-id -v /lib/modules:/lib/modules:ro -v /usr/src:/usr/src:ro -v /boot:/boot:ro -v /sys/kernel/debug:/sys/kernel/debug -v /sys/fs/bpf:/sys/fs/bpf -v /root/gopher_user_conf:/gala-gopher/user_conf/ -v /etc/localtime:/etc/localtime:ro --pid=host gala-gopher:0.0.1
|
||||
+ docker run -d --name xxx -p 8888:8888 --privileged -v /etc/machine-id:/etc/machine-id -v /lib/modules:/lib/modules:ro -v /usr/src:/usr/src:ro -v /boot:/boot:ro -v /sys/kernel/debug:/sys/kernel/debug -v /sys/fs/bpf:/sys/fs/bpf -v /root/gopher_user_conf:/gala-gopher/user_conf/ -v /etc/localtime:/etc/localtime:ro -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker/overlay2:/var/lib/docker/overlay2 --pid=host gala-gopher:0.0.1
|
||||
```
|
||||
|
||||
成功启动容器后,通过docker ps可以看到正在运行的容器:
|
||||
diff --git a/build/Dockerfile_2003_sp1_aarch64 b/build/Dockerfile_2003_sp1_aarch64
|
||||
index 36f378a..176987d 100644
|
||||
--- a/build/Dockerfile_2003_sp1_aarch64
|
||||
+++ b/build/Dockerfile_2003_sp1_aarch64
|
||||
@@ -40,6 +40,8 @@ RUN yum update -y \
|
||||
&& yum install -y libbpf-0.3-1.h0.oe1.aarch64.rpm \
|
||||
&& yum install -y libbpf-devel-0.3-1.h0.oe1.aarch64.rpm \
|
||||
&& yum install -y kmod \
|
||||
+ && yum install -y docker \
|
||||
+ && yum install -y iproute \
|
||||
&& yum install -y gala-gopher-v1.1.0-52.aarch64.rpm
|
||||
|
||||
# expose port
|
||||
diff --git a/build/Dockerfile_2003_sp1_x86_64 b/build/Dockerfile_2003_sp1_x86_64
|
||||
index bde0b73..31f1ced 100644
|
||||
--- a/build/Dockerfile_2003_sp1_x86_64
|
||||
+++ b/build/Dockerfile_2003_sp1_x86_64
|
||||
@@ -40,6 +40,8 @@ RUN yum update -y \
|
||||
&& yum install -y libbpf-0.3-1.h0.oe1.x86_64.rpm \
|
||||
&& yum install -y libbpf-devel-0.3-1.h0.oe1.x86_64.rpm \
|
||||
&& yum install -y kmod \
|
||||
+ && yum install -y docker \
|
||||
+ && yum install -y iproute \
|
||||
&& yum install -y gala-gopher-v1.1.0-52.x86_64.rpm
|
||||
|
||||
# expose port
|
||||
--
|
||||
2.28.0.windows.1
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
Summary: Intelligent ops toolkit for openEuler
|
||||
Name: gala-gopher
|
||||
Version: 1.0.0
|
||||
Release: 7
|
||||
Release: 8
|
||||
License: Mulan PSL v2
|
||||
URL: https://gitee.com/openeuler/gala-gopher
|
||||
Source: %{name}-%{version}.tar.gz
|
||||
@ -15,7 +15,7 @@ BuildRequires: libconfig-devel librdkafka-devel libmicrohttpd-devel
|
||||
BuildRequires: uthash-devel libbpf libbpf-devel log4cplus-devel
|
||||
Requires: bash glibc elfutils zlib elfutils-devel bpftool
|
||||
Requires: dmidecode python3-psycopg2 python3-yaml erlang-eflame
|
||||
Requires: flamegraph-stackcollapse
|
||||
Requires: flamegraph-stackcollapse iproute
|
||||
|
||||
patch0: add-vmlinux-for-2203LTS-2203LTS-SP1.patch
|
||||
patch1: fix-pgsliprobe.patch
|
||||
@ -26,6 +26,10 @@ patch3: modify-to-adapt-to-oe2203-LTS-SP1-x86.patch
|
||||
%ifarch aarch64
|
||||
patch3: modify-to-adapt-to-oe2203-LTS-SP1-arm.patch
|
||||
%endif
|
||||
patch4: fix-bugs-for-ksliprobe-pgsliprobe-stackprobe.patch
|
||||
patch5: move-docs-about-creating-and-running-in-docker.patch
|
||||
patch6: fix-the-problem-that-the-gopher-in-docker-doesn-t-su.patch
|
||||
patch7: add-documentation-related-to-docker-images.patch
|
||||
|
||||
%description
|
||||
gala-gopher is a low-overhead eBPF-based probes framework
|
||||
@ -73,6 +77,9 @@ popd
|
||||
|
||||
%changelog
|
||||
|
||||
* Mon Nov 28 2022 wo_cow <niuqianqian@huawei.com> - 1.0.0-8
|
||||
- fix issues raised during 22.03 test
|
||||
|
||||
* Thu Nov 17 2022 wo_cow <niuqianqian@huawei.com> - 1.0.0-7
|
||||
- resolve patch conflict
|
||||
|
||||
|
||||
123
move-docs-about-creating-and-running-in-docker.patch
Normal file
123
move-docs-about-creating-and-running-in-docker.patch
Normal file
@ -0,0 +1,123 @@
|
||||
From b6bb388d21f3eac7565eddcfabaf9845bfa71454 Mon Sep 17 00:00:00 2001
|
||||
From: Vchanger <vchanger123456@163.com>
|
||||
Date: Mon, 21 Nov 2022 14:36:14 +0800
|
||||
Subject: [PATCH] move docs about creating and running in docker
|
||||
|
||||
---
|
||||
README.md | 41 ++++++++++++++++++++++++++++--
|
||||
doc/how_to_build_docker_image.md | 43 --------------------------------
|
||||
2 files changed, 39 insertions(+), 45 deletions(-)
|
||||
|
||||
diff --git a/README.md b/README.md
|
||||
index b38ba22..fd00153 100644
|
||||
--- a/README.md
|
||||
+++ b/README.md
|
||||
@@ -67,12 +67,49 @@ gala-gopher集成了常用的native探针以及知名中间件探针;gala-goph
|
||||
|
||||
用于生成容器镜像的Dockerfile文件归档在[build目录](./build),生成方法详见[如何生成gala-gopher容器镜像](doc/how_to_build_docker_image.md)。
|
||||
|
||||
-- 运行容器
|
||||
+- 创建并运行容器
|
||||
+
|
||||
+ gala-gopher涉及两个配置文件:gala-gopher.conf和gala-gopher-app.conf。gala-gopher.conf主要用于配置探针的数据上报开关、探针参数、探针是否开启等;gala-gopher-app.conf是观测白名单,可以把用户感兴趣的进程名加入白名单,gala-gopher就会观测这个进程了。
|
||||
+
|
||||
+ 容器启动前需要用户自定义配置这两个配置文件,请在宿主机创建配置文件目录,并将[config目录](./config)下两个配置文件保存到该目录,示例如下:
|
||||
|
||||
```shell
|
||||
- # docker run -d --name xxx -p 8888:8888 --privileged -v /lib/modules:/lib/modules:ro -v /usr/src:/usr/src:ro -v /boot:/boot:ro -v /sys/kernel/debug:/sys/kernel/debug -v /sys/fs/bpf:/sys/fs/bpf -v /root/gopher_user_conf:/gala-gopher/user_conf/ -v /etc/machine-id:/etc/machine-id -v /etc/localtime:/etc/localtime:ro --pid=host gala-gopher:0.0.1
|
||||
+ [root@localhost ~]# mkdir gopher_user_conf
|
||||
+ [root@localhost gopher_user_conf]# ll
|
||||
+ total 8.0K
|
||||
+ -rw-r--r--. 1 root root 3.2K Jun 28 09:43 gala-gopher.conf
|
||||
+ -rw-r--r--. 1 root root 108 Jun 27 21:45 gala-gopher-app.conf
|
||||
```
|
||||
|
||||
+ 请按照[配置文件介绍](./doc/conf_introduction.md)自定义修改配置文件。在执行docker run命令时,需要将宿主机上自定义的配置文件目录和容器内/gala-gopher/user_conf目录映射,从而将自定义的配置信息同步到容器内。
|
||||
+
|
||||
+ 最后按照如下示例命令启动容器:
|
||||
+
|
||||
+ ```shell
|
||||
+ docker run -d --name xxx -p 8888:8888 --privileged -v /etc/machine-id:/etc/machine-id -v /lib/modules:/lib/modules:ro -v /usr/src:/usr/src:ro -v /boot:/boot:ro -v /sys/kernel/debug:/sys/kernel/debug -v /sys/fs/bpf:/sys/fs/bpf -v /root/gopher_user_conf:/gala-gopher/user_conf/ -v /etc/localtime:/etc/localtime:ro --pid=host gala-gopher:0.0.1
|
||||
+ ```
|
||||
+
|
||||
+ 成功启动容器后,通过docker ps可以看到正在运行的容器:
|
||||
+
|
||||
+ ```shell
|
||||
+ [root@localhost build]# docker ps
|
||||
+ CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
+ eaxxxxxxxx02 gala-gopher:0.0.1 "/bin/sh -c 'cp -f /…" About a minute ago Up About a minute 0.0.0.0:8888->8888/tcp xxx
|
||||
+ ```
|
||||
+
|
||||
+- 获取数据
|
||||
+
|
||||
+ 如上步骤docker run命令中所示,我们映射了宿主机8888端口和容器的8888端口,因而可以通过8888端口获取数据来验证gala-gopher是否运行成功:
|
||||
+
|
||||
+ ```shell
|
||||
+ [root@localhost build]# curl http://localhost:8888
|
||||
+ ...
|
||||
+ gala_gopher_udp_que_rcv_drops{tgid="1234",s_addr="192.168.12.34",machine_id="xxxxx",hostname="eaxxxxxxxx02"} 0 1656383357000
|
||||
+ ...
|
||||
+ ```
|
||||
+
|
||||
+ 如上有指标数据输出则证明gala-gopher运行成功。
|
||||
+
|
||||
#### 基于源码编译、安装、运行
|
||||
|
||||
##### 仅编译二进制
|
||||
diff --git a/doc/how_to_build_docker_image.md b/doc/how_to_build_docker_image.md
|
||||
index 6955f5b..c2b147d 100644
|
||||
--- a/doc/how_to_build_docker_image.md
|
||||
+++ b/doc/how_to_build_docker_image.md
|
||||
@@ -69,49 +69,6 @@
|
||||
gala-gopher 0.0.1 211913592b58 22 minutes ago 614MB
|
||||
```
|
||||
|
||||
-### 创建并运行容器
|
||||
-
|
||||
-gala-gopher涉及两个配置文件:gala-gopher.conf和task_whitelist.conf。gala-gopher.conf主要用于配置探针的数据上报开关、探针参数、探针是否开启等;task_whitelist.conf是观测白名单,可以把用户感兴趣的进程名加入白名单,gala-gopher就会观测这个进程了。
|
||||
-
|
||||
-容器启动前需要用户自定义配置这两个配置文件,请在宿主机创建配置文件目录,并将[config目录](../config)下两个配置文件保存到该目录,示例如下:
|
||||
-
|
||||
-```shell
|
||||
-[root@localhost ~]# mkdir gopher_user_conf
|
||||
-[root@localhost gopher_user_conf]# ll
|
||||
-total 8.0K
|
||||
--rw-r--r--. 1 root root 3.2K Jun 28 09:43 gala-gopher.conf
|
||||
--rw-r--r--. 1 root root 108 Jun 27 21:45 gala-gopher-app.conf
|
||||
-```
|
||||
-
|
||||
-请按照[配置文件介绍](conf_introduction.md)自定义修改配置文件。在执行docker run命令时,需要将宿主机上自定义的配置文件目录和容器内/gala-gopher/user_conf目录映射,从而将自定义的配置信息同步到容器内。
|
||||
-
|
||||
-最后按照如下示例命令启动容器:
|
||||
-
|
||||
-```shell
|
||||
-docker run -d --name xxx -p 8888:8888 --privileged -v /etc/machine-id:/etc/machine-id -v /lib/modules:/lib/modules:ro -v /usr/src:/usr/src:ro -v /boot:/boot:ro -v /sys/kernel/debug:/sys/kernel/debug -v /sys/fs/bpf:/sys/fs/bpf -v /root/gopher_user_conf:/gala-gopher/user_conf/ -v /etc/localtime:/etc/localtime:ro --pid=host gala-gopher:0.0.1
|
||||
-```
|
||||
-
|
||||
-成功启动容器后,通过docker ps可以看到正在运行的容器:
|
||||
-
|
||||
-```shell
|
||||
-[root@localhost build]# docker ps
|
||||
-CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
-eaxxxxxxxx02 gala-gopher:0.0.1 "/bin/sh -c 'cp -f /…" About a minute ago Up About a minute 0.0.0.0:8888->8888/tcp xxx
|
||||
-```
|
||||
-
|
||||
-### 获取数据
|
||||
-
|
||||
-如上步骤docker run命令中所示,我们映射了宿主机8888端口和容器的8888端口,因而可以通过8888端口获取数据来验证gala-gopher是否运行成功:
|
||||
-
|
||||
-```shell
|
||||
-[root@localhost build]# curl http://localhost:8888
|
||||
-...
|
||||
-gala_gopher_udp_que_rcv_drops{tgid="1234",s_addr="192.168.12.34",machine_id="xxxxx",hostname="eaxxxxxxxx02"} 0 1656383357000
|
||||
-...
|
||||
-```
|
||||
-
|
||||
-如上有指标数据输出则证明gala-gopher运行成功。
|
||||
-
|
||||
### 保存容器镜像
|
||||
|
||||
生成容器镜像后可以将镜像保存为tar文件,其他宿主机可以通过load命令导入容器镜像:
|
||||
--
|
||||
2.36.0.windows.1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user