diff options
author | thiagoftsm <thiagoftsm@gmail.com> | 2022-03-08 17:49:23 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-08 17:49:23 +0000 |
commit | 6123a8e1a66aa1c3d44e454f866588495b5a145e (patch) | |
tree | e6683dfd32a9d31c51c41eb1f6326f0782ad9562 /netdata-installer.sh | |
parent | 2f8f4dd6a7b0dc98563357ad4712e990a7c5c86a (diff) |
CO-RE and syscalls (#12318)
Diffstat (limited to 'netdata-installer.sh')
-rwxr-xr-x | netdata-installer.sh | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/netdata-installer.sh b/netdata-installer.sh index 13560a91c2..b4ef6fbaf0 100755 --- a/netdata-installer.sh +++ b/netdata-installer.sh @@ -967,6 +967,7 @@ copy_libbpf() { run cp "${1}/usr/${lib_subdir}/libbpf.a" "${target_dir}/libbpf.a" || return 1 run cp -r "${1}/usr/include" "${target_dir}" || return 1 + run cp -r "${1}/include/uapi" "${target_dir}/include" || return 1 } bundle_libbpf() { @@ -1025,6 +1026,59 @@ bundle_libbpf() { bundle_libbpf +copy_co_re() { + cp -R "${1}/includes" "collectors/ebpf.plugin/" +} + +bundle_ebpf_co_re() { + if { [ -n "${NETDATA_DISABLE_EBPF}" ] && [ ${NETDATA_DISABLE_EBPF} = 1 ]; } || [ "$(uname -s)" != Linux ]; then + return 0 + fi + + [ -n "${GITHUB_ACTIONS}" ] && echo "::group::Bundling libbpf." + + progress "eBPF CO-RE" + + CORE_PACKAGE_VERSION="$(cat packaging/ebpf-co-re.version)" + + tmp="$(mktemp -d -t netdata-ebpf-co-re-XXXXXX)" + CORE_PACKAGE_BASENAME="netdata-ebpf-co-re-glibc-${CORE_PACKAGE_VERSION}.tar.xz" + + if fetch_and_verify "ebpf-co-re" \ + "https://github.com/netdata/ebpf-co-re/releases/download/${CORE_PACKAGE_VERSION}/${CORE_PACKAGE_BASENAME}" \ + "${CORE_PACKAGE_BASENAME}" \ + "${tmp}" \ + "${NETDATA_LOCAL_TARBALL_OVERRIDE_CORE}"; then + if run tar --no-same-owner -xf "${tmp}/${CORE_PACKAGE_BASENAME}" -C "${tmp}" && + copy_co_re "${tmp}" && + rm -rf "${tmp}"; then + run_ok "libbpf built and prepared." + else + run_failed "Failed to get eBPF CO-RE files." + if [ -n "${NETDATA_DISABLE_EBPF}" ] && [ ${NETDATA_DISABLE_EBPF} = 0 ]; then + exit 1 + else + defer_error_highlighted "Failed to get CO-RE. You will not be able to use eBPF plugin." + NETDATA_DISABLE_EBPF=1 + NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-ebpf)}" | sed 's/$/ --disable-ebpf/g')" + fi + fi + else + run_failed "Unable to fetch sources for libbpf." + if [ -n "${NETDATA_DISABLE_EBPF}" ] && [ ${NETDATA_DISABLE_EBPF} = 0 ]; then + exit 1 + else + defer_error_highlighted "Unable to fetch sources for eBPF CO-RE. You will not be able to use eBPF plugin." + NETDATA_DISABLE_EBPF=1 + NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-ebpf)}" | sed 's/$/ --disable-ebpf/g')" + fi + fi + + [ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::" +} + +bundle_ebpf_co_re + # ----------------------------------------------------------------------------- # If we have the dashboard switching logic, make sure we're on the classic # dashboard during the install (updates don't work correctly otherwise). |