diff options
author | Austin S. Hemmelgarn <austin@netdata.cloud> | 2024-04-25 09:21:03 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-25 09:21:03 +0300 |
commit | 9b3b4816c16fd2359d61dbdfa12366e8b294e135 (patch) | |
tree | a0e45a7fa4766becb5a3bd7380ae44686969a52a /netdata-installer.sh | |
parent | 0388cb719ea3c881ad6da0c93fe6ff95d1fded3c (diff) |
Move handling of legacy eBPF programs into CMake. (#17512)
* Move handling of legacy eBPF programs into CMake.
* Fix typos.
* Fix more typos
* Fix up packaging code.
Diffstat (limited to 'netdata-installer.sh')
-rwxr-xr-x | netdata-installer.sh | 128 |
1 files changed, 0 insertions, 128 deletions
diff --git a/netdata-installer.sh b/netdata-installer.sh index 717012533d..e95bff7fb8 100755 --- a/netdata-installer.sh +++ b/netdata-installer.sh @@ -1080,134 +1080,6 @@ detect_libc() { echo "${libc}" } -should_install_ebpf() { - if [ "${ENABLE_EBPF:-0}" -eq 0 ]; then - return 1 - fi - - if [ "$(uname -m)" != "x86_64" ]; then - if [ "${ENABLE_EBPF:-0}" -eq 1 ]; then - run_failed "Currently eBPF is only supported on Linux on x86_64." - fi - - return 1 - fi - - # Check Kernel Config - if ! run "${INSTALLER_DIR}"/packaging/check-kernel-config.sh; then - warning "Kernel unsupported or missing required config (eBPF may not work on your system)" - fi - - return 0 -} - -remove_old_ebpf() { - if [ -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/ebpf_process.plugin" ]; then - echo >&2 "Removing alpha eBPF collector." - rm -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/ebpf_process.plugin" - fi - - if [ -f "${NETDATA_PREFIX}/usr/lib/netdata/conf.d/ebpf_process.conf" ]; then - echo >&2 "Removing alpha eBPF stock file" - rm -f "${NETDATA_PREFIX}/usr/lib/netdata/conf.d/ebpf_process.conf" - fi - - if [ -f "${NETDATA_PREFIX}/etc/netdata/ebpf_process.conf" ]; then - echo >&2 "Renaming eBPF configuration file." - mv "${NETDATA_PREFIX}/etc/netdata/ebpf_process.conf" "${NETDATA_PREFIX}/etc/netdata/ebpf.d.conf" - fi - - # Added to remove eBPF programs with name pattern: NAME_VERSION.SUBVERSION.PATCH - if [ -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/pnetdata_ebpf_process.3.10.0.o" ]; then - echo >&2 "Removing old eBPF programs with patch." - rm -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/rnetdata_ebpf"*.?.*.*.o - rm -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/pnetdata_ebpf"*.?.*.*.o - fi - - # Remove old eBPF program to store new eBPF program inside subdirectory - if [ -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/pnetdata_ebpf_process.3.10.o" ]; then - echo >&2 "Removing old eBPF programs installed in old directory." - rm -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/rnetdata_ebpf"*.?.*.o - rm -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/pnetdata_ebpf"*.?.*.o - fi - - # Remove old eBPF programs that did not have "rhf" suffix - if [ ! -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/ebpf.d/pnetdata_ebpf_process.3.10.rhf.o" ]; then - rm -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/ebpf.d/"*.o - fi - - # Remove old reject list from previous directory - if [ -f "${NETDATA_PREFIX}/usr/lib/netdata/conf.d/ebpf_kernel_reject_list.txt" ]; then - echo >&2 "Removing old ebpf_kernel_reject_list.txt." - rm -f "${NETDATA_PREFIX}/usr/lib/netdata/conf.d/ebpf_kernel_reject_list.txt" - fi - - # Remove old reset script - if [ -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/reset_netdata_trace.sh" ]; then - echo >&2 "Removing old reset_netdata_trace.sh." - rm -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/reset_netdata_trace.sh" - fi -} - -install_ebpf() { - if ! should_install_ebpf; then - return 0 - fi - - [ -n "${GITHUB_ACTIONS}" ] && echo "::group::Installing eBPF code." - - remove_old_ebpf - - progress "Installing eBPF programs" - - # Detect libc - libc="$(detect_libc)" - - EBPF_VERSION="$(cat packaging/ebpf.version)" - EBPF_TARBALL="netdata-kernel-collector-${libc}-${EBPF_VERSION}.tar.xz" - - tmp="$(mktemp -d -t netdata-ebpf-XXXXXX)" - - if ! fetch_and_verify "ebpf" \ - "https://github.com/netdata/kernel-collector/releases/download/${EBPF_VERSION}/${EBPF_TARBALL}" \ - "${EBPF_TARBALL}" \ - "${tmp}" \ - "${NETDATA_LOCAL_TARBALL_OVERRIDE_EBPF}"; then - run_failed "Failed to download eBPF collector package" - echo 2>&" Removing temporary directory ${tmp} ..." - rm -rf "${tmp}" - - [ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::" - return 1 - fi - - echo >&2 " Extracting ${EBPF_TARBALL} ..." - tar --no-same-owner -xf "${tmp}/${EBPF_TARBALL}" -C "${tmp}" - - # chown everything to root:netdata before we start copying out of our package - run chown -R root:netdata "${tmp}" - - if [ ! -d "${NETDATA_PREFIX}"/usr/libexec/netdata/plugins.d/ebpf.d ]; then - mkdir "${NETDATA_PREFIX}"/usr/libexec/netdata/plugins.d/ebpf.d - RET=$? - if [ "${RET}" != "0" ]; then - rm -rf "${tmp}" - - [ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::" - return 1 - fi - fi - - run cp -a -v "${tmp}"/*netdata_ebpf_*.o "${NETDATA_PREFIX}"/usr/libexec/netdata/plugins.d/ebpf.d - - rm -rf "${tmp}" - - [ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::" -} - -progress "eBPF Kernel Collector" -install_ebpf - should_install_fluentbit() { if [ "$(uname -s)" = "Darwin" ]; then return 1 |