netdata / kernel-collector

Linux Kernel eBPF Collectors
61 stars 15 forks source link

Add documentation adjust code (RH dists and internal cleanup) #324

Closed thiagoftsm closed 1 year ago

thiagoftsm commented 1 year ago
Summary

This PR is bringing some "small" (RH modified kernel 5.14 and 4.18, so I had to push an additional commit for it.) updates in the code and a documentation to help new eBPF developers (Welcome @stelfrag !).

Test Plan
  1. Get binaries according your LIBC from this link and extract them inside a directory.
  2. Extract them :
    for i in `ls *.zip`; do unzip $i; rm .gitkeep ; rm $i; done
    for i in `ls *.xz`; do tar -xf $i; rm $i* ; done
  3. Compile branch an run the following tests:
    # make; make tester
    # for i in `seq 0 2`; do ./kernel/legacy_test --netdata-path ../directory --content --iteration --pid $i --log-path file_pid$i.txt; done
  4. Every test should finally with Success, unless you do not have a specific target (function) available.
    Additional information

This PR was tested on:

Linux Distribution kernel version real parent parent all
Slackware current 6.1.11 slackware_6_11_pid0.txt slackware_6_11_pid1.txt slackware_6_11_pid2.txt
Arch Linux 6.1.9-arch1-1 arch_6_9_pid0.txt arch_6_9_pid1.txt arch_6_9_pid2.txt
Ubuntu 22.04 5.15.0-56-generic ubuntu_5_15_pid0.txt ubuntu_5_15_pid1.txt ubuntu_5_15_pid2.txt
Alma 9 5.14.0-162.12.1.el9_1.x86_64 alma_5_14_pid0.txt alma_5_14_pid1.txt alma_5_14_pid2.txt
Debian 11 5.10.0-21-amd64 debian_5_10_pid0.txt debian_5_10_pid1.txt debian_5_10_pid2.txt
Slackware Current 5.4.210 slackware_5_4_pid0.txt slackware_5_4_pid1.txt slackware_5_4_pid2.txt
Oracle 8.6* 5.4.17-2136.313.6.el8uek.x86_64 oracle_5_4_pid0.txt oracle_5_4_pid1.txt oracle_5_4_pid2.txt
Alma 8.6 4.18.0-425.3.1.el8.x86_64 alma_4_18_pid0.txt alma_4_18_pid1.txt alma_4_18_pid2.txt
Ubuntu 18.04 4.15.0-180-generic ubuntu_4_15_pid0.txt ubuntu_4_15_pid1.txt ubuntu_4_15_pid2.txt
Slackware Current 4.14.290 slackware_4_14_pid0.txt slackware_4_14_pid1.txt slackware_4_14_pid2.txt
CentOS 7.9 3.10.0-1160.71.1.el7.x86_64. centos_3_10_pid0.txt centos_3_10_pid1.txt centos_3_10_pid2.txt

You can also get all logs here.

MrZammler commented 1 year ago

Just some notes in case any other reviewers need it:

1) Cloned this branch first to a dir (e.g. kernel-collector-324) 2) Downloaded the artifact close to my kernel (artifacts-5.15.63-glibc) into the artifacts/ directory. 3) Did a git submodule update --init --recursive 4) make and make tester. 5) Run the tests as root with for i inseq 0 2; do ./kernel/legacy_test --netdata-path artifacts --content --iteration --pid $i --log-path file_pid$i.txt; done. The netdata-path needs to be the path to the artifacts downloaded before.

Artifacts only contains cachestat, so ignored the errors for not finding the others. For it I got Success:

"/home/evas/tmp/kernel-collector-324/artifacts/rnetdata_ebpf_cachestat.5.15.o" : {
    "Test" : "return",
    "Tables" : {
        "cstat_global" : {
            "Info" : { "Length" : { "Key" : 4, "Value" : 8},
                       "Type" : 6,
                       "FD" : 5,
                       "Data" : [
                                    { "Iteration" :  0, "Total" : 4, "Filled" : 3, "Zero" : 1 }
                                ]
                      }
        },
        "cstat_ctrl" : {
            "Info" : { "Length" : { "Key" : 4, "Value" : 4},
                       "Type" : 2,
                       "FD" : 6,
                       "Data" : [
                                    { "Iteration" : 1, "Total" : 2, "Filled" : 2, "Zero" : 0 }
                                ]
                      }
        },
        "cstat_pid" : {
            "Info" : { "Length" : { "Key" : 4, "Value" : 32},
                       "Type" : 5,
                       "FD" : 7,
                       "Data" : [
                                    { "Iteration" :  0, "Total" : 0, "Filled" : 0, "Zero" : 0 }
                                ]
                      }
        },
        "Total tables" : 3
    },
    "Status" :  "Success"
},

My setup: `Linux 6am 5.15.69-gentoo #1 SMP Sun Oct 9 09:59:07 EEST 2022 x86_64 AMD Ryzen 5 4500U with Radeon Graphics AuthenticAMD GNU/Linux`
stelfrag commented 1 year ago
"/home/stelios/library/rnetdata_ebpf_cachestat.5.15.o" : {
    "Test" : "return",
    "Tables" : {
        "cstat_global" : {
            "Info" : { "Length" : { "Key" : 4, "Value" : 8},
                       "Type" : 6,
                       "FD" : 5,
                       "Data" : [
                                    { "Iteration" :  0, "Total" : 4, "Filled" : 4, "Zero" : 0 }
                                ]
                      }
        },
        "cstat_ctrl" : {
            "Info" : { "Length" : { "Key" : 4, "Value" : 4},
                       "Type" : 2,
                       "FD" : 6,
                       "Data" : [
                                    { "Iteration" : 1, "Total" : 2, "Filled" : 2, "Zero" : 0 }
                                ]
                      }
        },
        "cstat_pid" : {
            "Info" : { "Length" : { "Key" : 4, "Value" : 32},
                       "Type" : 5,
                       "FD" : 7,
                       "Data" : [
                                    { "Iteration" :  0, "Total" : 1, "Filled" : 1, "Zero" : 0 }
                                ]
                      }
        },
        "Total tables" : 3
    },
    "Status" :  "Success"
},
tkatsoulas commented 1 year ago

Approving without reviewing