diff options
author | Austin S. Hemmelgarn <austin@netdata.cloud> | 2020-05-18 21:03:32 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-19 11:03:32 +1000 |
commit | edeb82fac99246b7d572744fe1d732fd6d9cb34e (patch) | |
tree | 244bf54702edd4f96cc03b974a0174761a1436c9 /packaging/installer | |
parent | 3cf541f25558ef3b2f43b4bc857e64042a2d09e5 (diff) |
install and enable eBPF Plugin by default (#8665)
* netdata_installer_kernels: New kernels
This commit brings new kernels for our netdata-installer
* RH detection
This commit brings the RH detection to netdata-installer, but it cannot be
tested yet until we merge a PR on kernel-collector
* netdata_installer_kernels: RH kernels
This commit brings updates that allows to install and run the collectors
on RH
* netdata_installer_kernels: Kernel variables
This commit brings definitions instead magic number to the isntaller
* netdata_installer_kernels: remove echo
This commit removes echo to avoid new line
* netdata_installer_kernels: Move C code
This commit removes the C code that will be inserted in another PR
* Update eBPF install to use released version.
This updates the install code for the eBPF plugin to properly utilize
(and verify) a tagged release of the plugin instead of pulling the
upstream master branch.
It also adds support for using a local copy of the tarball, and switchs
the default behavior to install the eBPF plugin instead of not
installing it.
* Tidy-up messages relating to eBPF.
* Fix typos in error handling functions.
* ebpf-release: New kernels
This commit brings the kernels necessary to support Debian 10.0
* ebpf-release: Bring support for new package format
* ebpf-release: collector as loader
This commit brings the necessary changes for the collector loads all
the nfiles depending of the kernel it is running
* Update eBPF install to use released version.
This updates the install code for the eBPF plugin to properly utilize
(and verify) a tagged release of the plugin instead of pulling the
upstream master branch.
It also adds support for using a local copy of the tarball, and switchs
the default behavior to install the eBPF plugin instead of not
installing it.
* netdata_installer_kernels: New kernels
This commit brings new kernels for our netdata-installer
* RH detection
This commit brings the RH detection to netdata-installer, but it cannot be
tested yet until we merge a PR on kernel-collector
* netdata_installer_kernels: RH kernels
This commit brings updates that allows to install and run the collectors
on RH
* netdata_installer_kernels: Kernel variables
This commit brings definitions instead magic number to the isntaller
* netdata_installer_kernels: remove echo
This commit removes echo to avoid new line
* netdata_installer_kernels: Move C code
This commit removes the C code that will be inserted in another PR
* Tidy-up messages relating to eBPF.
* Fix typos in error handling functions.
* ebpf-release: New kernels
This commit brings the kernels necessary to support Debian 10.0
* ebpf-release: Bring support for new package format
* ebpf-release: collector as loader
This commit brings the necessary changes for the collector loads all
the nfiles depending of the kernel it is running
* Fix package name handling.
* Bump eBPF kernel-collector to v0.1.0
* Update --help to state eBPF is enabled by default and add --disable-ebpf option in --help output
* Remove deprecated kernel version compatibility checks
* Fix EBPF_TARBALL
* Remove libc path detection logic (deprecated0
* Use the new package structure of kernel-collector
* Relax the glob on netdata_ebpf as we may develop/distirbute other types of ebpf programs
* Fix ownership of ebpf libraries/programs
* Make the check-kernel-config.sh local to the installer
* Make plugins.ebpf = yes (by default)
Co-authored-by: Thiago Marques <thiagoftsm@gmail.com>
Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Diffstat (limited to 'packaging/installer')
-rwxr-xr-x | packaging/installer/check-kernel-config.sh | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/packaging/installer/check-kernel-config.sh b/packaging/installer/check-kernel-config.sh new file mode 100755 index 0000000000..ded3225779 --- /dev/null +++ b/packaging/installer/check-kernel-config.sh @@ -0,0 +1,73 @@ +#!/usr/bin/env bash + +get_kernel_version() { + r="$(uname -r | cut -f 1 -d '-')" + + read -r -a p <<< "$(echo "${r}" | tr '.' ' ')" + + printf "%03d%03d%03d" "${p[0]}" "${p[1]}" "${p[2]}" +} + +get_rh_version() { + if [ ! -f /etc/redhat-release ]; then + printf "000000000" + return + fi + + r="$(cut -f 4 -d ' ' < /etc/redhat-release)" + + read -r -a p <<< "$(echo "${r}" | tr '.' ' ')" + + printf "%03d%03d%03d" "${p[0]}" "${p[1]}" "${p[2]}" +} + +if [ "$(uname -s)" != "Linux" ]; then + echo >&2 "This does not appear to be a Linux system." + exit 1 +fi + +KERNEL_VERSION="$(uname -r)" + +if [ "$(get_kernel_version)" -lt 004014000 ] && [ "$(get_rh_version)" -lt 0070061810 ]; then + echo >&2 "WARNING: Your kernel appears to be older than 4.11 or you are using RH version older than 7.6.1810. This may still work in some cases, but probably won't." +fi + +CONFIG_PATH="" +MODULE_LOADED="" + +if modprobe configs 2> /dev/null; then + MODULE_LOADED=1 +fi + +if [ -r /proc/config.gz ]; then + CONFIG_PATH="/proc/config.gz" +elif [ -r "/lib/modules/${KERNEL_VERSION}/source/.config" ]; then + CONFIG_PATH="/lib/modules/${KERNEL_VERSION}/source/.config" +elif [ -r "/lib/modules/${KERNEL_VERSION}.x86_64/source/.config" ]; then + CONFIG_PATH="/lib/modules/${KERNEL_VERSION}.x86_64/source/.config" +elif [ -n "$(find /boot -name "config-${KERNEL_VERSION}*")" ]; then + CONFIG_PATH="$(find /boot -name "config-${KERNEL_VERSION}*" | head -n 1)" +fi + +if [ -n "${CONFIG_PATH}" ]; then + GREP='grep' + + if echo "${CONFIG_PATH}" | grep -q '.gz'; then + GREP='zgrep' + fi + + REQUIRED_CONFIG="KPROBES KPROBES_ON_FTRACE HAVE_KPROBES BPF BPF_SYSCALL BPF_JIT" + + for required_config in ${REQUIRED_CONFIG}; do + if ! "${GREP}" -q "CONFIG_${required_config}=y" "${CONFIG_PATH}"; then + echo >&2 " Missing Kernel Config: ${required_config}" + exit 1 + fi + done +fi + +if [ -n "${MODULE_LOADED}" ]; then + modprobe -r configs 2> /dev/null || true # Ignore failures from CONFIGS being builtin +fi + +exit 0 |