diff options
author | We-unite <3205135446@qq.com> | 2024-08-07 19:08:59 +0800 |
---|---|---|
committer | We-unite <3205135446@qq.com> | 2024-08-07 19:08:59 +0800 |
commit | ea32e017e579f168d87732893335c38d539ac2f1 (patch) | |
tree | 96a893ae0ffd4c5186e1c87f2fd7c60a125e970a /src/global.go | |
parent | 2104c8ac26f320eacc3fa04d608843c3bf0fdc57 (diff) | |
download | godo-collector.tar.gz godo-collector.zip |
Print err in stderr, Find out docker rootfs.collector
When I use godo, error infomation comes along with other output, so
change all err report into stderr. And I listen to `pivot_root` sys-
call to find out the root file system of dockers. However, I'm afraid
of causing too more delay, so don't check rootfs of ppid and record
in the pid. Besides, the method to deal with pivot_root is hardcoded,
which may causes crush.
Shall I listen to the chdir syscall to find out exact cwd? Maybe It's
useful to the pivot_root?
Next step: Find out appropriate data stracture, and add more file
operations to be watched. This task must be completed this week.
Diffstat (limited to 'src/global.go')
-rw-r--r-- | src/global.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/global.go b/src/global.go index b6635c9..349ba6c 100644 --- a/src/global.go +++ b/src/global.go | |||
@@ -14,11 +14,12 @@ const ( | |||
14 | FILEOPEN | 14 | FILEOPEN |
15 | FILECLOSE | 15 | FILECLOSE |
16 | FILEWRITE | 16 | FILEWRITE |
17 | PIVOTROOT | ||
17 | TYPENUM | 18 | TYPENUM |
18 | ) | 19 | ) |
19 | 20 | ||
20 | func (et eventType) String() string { | 21 | func (et eventType) String() string { |
21 | names := []string{"NEWPID", "PIDEXIT", "EXECVE", "FILEOPEN", "FILECLOSE", "FILEWRITE", "TYPENUM"} | 22 | names := []string{"NEWPID", "PIDEXIT", "EXECVE", "FILEOPEN", "FILECLOSE", "FILEWRITE", "PIVOTROOT", "TYPENUM"} |
22 | if et < NEWPID || et > TYPENUM { | 23 | if et < NEWPID || et > TYPENUM { |
23 | return "Unknown" | 24 | return "Unknown" |
24 | } | 25 | } |
@@ -32,12 +33,13 @@ type Event struct { | |||
32 | ppid, parentTgid int | 33 | ppid, parentTgid int |
33 | syscall int | 34 | syscall int |
34 | syscallParam [4]uint64 | 35 | syscallParam [4]uint64 |
35 | pathName string | ||
36 | argc int | 36 | argc int |
37 | argv []string | 37 | argv []string |
38 | cwd string | 38 | cwd string |
39 | exit_code uint64 | 39 | exit_code uint64 |
40 | exit_signal int | 40 | exit_signal int |
41 | srcPath string | ||
42 | destPath string | ||
41 | } | 43 | } |
42 | 44 | ||
43 | var wg sync.WaitGroup // 掌管协程 | 45 | var wg sync.WaitGroup // 掌管协程 |