summaryrefslogtreecommitdiffstats
path: root/netdata-installer.sh
diff options
context:
space:
mode:
Diffstat (limited to 'netdata-installer.sh')
-rwxr-xr-xnetdata-installer.sh415
1 files changed, 28 insertions, 387 deletions
diff --git a/netdata-installer.sh b/netdata-installer.sh
index b8a598dc6..6acd3ac98 100755
--- a/netdata-installer.sh
+++ b/netdata-installer.sh
@@ -211,7 +211,7 @@ USAGE: ${PROGRAM} [options]
--disable-dbengine Explicitly disable DB engine support.
--enable-plugin-go Enable the Go plugin. Default: Enabled when possible.
--disable-plugin-go Disable the Go plugin.
- --disable-go Equivalent to --disable-go-plugin
+ --disable-go Disable all Go components.
--enable-plugin-nfacct Enable nfacct plugin. Default: enable it when libmnl and libnetfilter_acct are available.
--disable-plugin-nfacct Explicitly disable the nfacct plugin.
--enable-plugin-xenstat Enable the xenstat plugin. Default: enable it when libxenstat and libyajl are available.
@@ -245,13 +245,18 @@ USAGE: ${PROGRAM} [options]
HEREDOC
}
+if [ "$(uname -s)" = "Linux" ]; then
+ case "$(uname -m)" in
+ x86_64|i?86) ENABLE_EBPF=1 ;;
+ esac
+fi
+
DONOTSTART=0
DONOTWAIT=0
NETDATA_PREFIX=
LIBS_ARE_HERE=0
NETDATA_ENABLE_ML=""
ENABLE_DBENGINE=1
-ENABLE_EBPF=1
ENABLE_GO=1
ENABLE_H2O=1
ENABLE_CLOUD=1
@@ -323,14 +328,8 @@ while [ -n "${1}" ]; do
# XXX: No longer supported.
;;
"--disable-telemetry") NETDATA_DISABLE_TELEMETRY=1 ;;
- "--enable-ebpf")
- ENABLE_EBPF=1
- NETDATA_DISABLE_EBPF=0
- ;;
- "--disable-ebpf")
- ENABLE_EBPF=0
- NETDATA_DISABLE_EBPF=1
- ;;
+ "--enable-ebpf") ENABLE_EBPF=1 ;;
+ "--disable-ebpf") ENABLE_EBPF=0 ;;
"--skip-available-ram-check") SKIP_RAM_CHECK=1 ;;
"--one-time-build")
# XXX: No longer supported
@@ -557,85 +556,31 @@ fi
trap build_error EXIT
# -----------------------------------------------------------------------------
-build_jsonc() {
- env_cmd=''
+build_fluentbit() {
+ env_cmd="env CFLAGS='-w' CXXFLAGS='-w' LDFLAGS="
if [ -z "${DONT_SCRUB_CFLAGS_EVEN_THOUGH_IT_MAY_BREAK_THINGS}" ]; then
- env_cmd="env CFLAGS='-fPIC -pipe' CXXFLAGS='-fPIC -pipe' LDFLAGS="
+ env_cmd="env CFLAGS='-fPIC -pipe -w' CXXFLAGS='-fPIC -pipe -w' LDFLAGS="
fi
- cd "${1}" > /dev/null || exit 1
- run eval "${env_cmd} ${cmake} ${CMAKE_OPTS} -DBUILD_SHARED_LIBS=OFF -DDISABLE_WERROR=On ."
- run eval "${env_cmd} ${cmake} --build . --parallel ${JOBS} -- ${BUILD_OPTS}"
- cd - > /dev/null || return 1
-}
-
-copy_jsonc() {
- target_dir="${PWD}/externaldeps/jsonc"
-
- run mkdir -p "${target_dir}" "${target_dir}/json-c" || return 1
+ mkdir -p src/fluent-bit/build || return 1
+ cd src/fluent-bit/build > /dev/null || return 1
- run cp "${1}/libjson-c.a" "${target_dir}/libjson-c.a" || return 1
- # shellcheck disable=SC2086
- run cp ${1}/*.h "${target_dir}/json-c" || return 1
-}
+ rm CMakeCache.txt > /dev/null 2>&1
-bundle_jsonc() {
- # If --build-json-c flag or not json-c on system, then bundle our own json-c
- if [ -z "${NETDATA_BUILD_JSON_C}" ] && pkg-config json-c; then
- NETDATA_BUILD_JSON_C=0
- return 0
+ if ! run eval "${env_cmd} $1 -C ../../logsmanagement/fluent_bit_build/config.cmake -B./ -S../"; then
+ cd - > /dev/null || return 1
+ rm -rf src/fluent-bit/build > /dev/null 2>&1
+ return 1
fi
- [ -n "${GITHUB_ACTIONS}" ] && echo "::group::Bundling JSON-C."
-
- progress "Prepare JSON-C"
-
- JSONC_PACKAGE_VERSION="$(cat packaging/jsonc.version)"
-
- tmp="$(mktemp -d -t netdata-jsonc-XXXXXX)"
- JSONC_PACKAGE_BASENAME="json-c-${JSONC_PACKAGE_VERSION}.tar.gz"
-
- if fetch_and_verify "jsonc" \
- "https://github.com/json-c/json-c/archive/${JSONC_PACKAGE_BASENAME}" \
- "${JSONC_PACKAGE_BASENAME}" \
- "${tmp}" \
- "${NETDATA_LOCAL_TARBALL_OVERRIDE_JSONC}"; then
- if run tar --no-same-owner -xf "${tmp}/${JSONC_PACKAGE_BASENAME}" -C "${tmp}" &&
- build_jsonc "${tmp}/json-c-json-c-${JSONC_PACKAGE_VERSION}" &&
- copy_jsonc "${tmp}/json-c-json-c-${JSONC_PACKAGE_VERSION}" &&
- rm -rf "${tmp}"; then
- run_ok "JSON-C built and prepared."
- NETDATA_BUILD_JSON_C=1
- else
- run_failed "Failed to build JSON-C, Netdata Cloud support will be disabled in this build."
- NETDATA_BUILD_JSON_C=0
- ENABLE_CLOUD=0
- fi
- else
- run_failed "Unable to fetch sources for JSON-C, Netdata Cloud support will be disabled in this build."
- NETDATA_BUILD_JSON_C=0
- ENABLE_CLOUD=0
+ if ! run eval "${env_cmd} ${make} ${MAKEOPTS}"; then
+ cd - > /dev/null || return 1
+ rm -rf src/fluent-bit/build > /dev/null 2>&1
+ return 1
fi
- [ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
-}
-
-bundle_jsonc
-
-# -----------------------------------------------------------------------------
-
-get_kernel_version() {
- r="$(uname -r | cut -f 1 -d '-')"
-
- tmpfile="$(mktemp)"
- echo "${r}" | tr '.' ' ' > "${tmpfile}"
-
- read -r maj min patch _ < "${tmpfile}"
-
- rm -f "${tmpfile}"
-
- printf "%03d%03d%03d" "${maj}" "${min}" "${patch}"
+ cd - > /dev/null || return 1
}
detect_libc() {
@@ -663,185 +608,6 @@ detect_libc() {
fi
echo "${libc}"
- return 0
-}
-
-build_libbpf() {
- cd "${1}/src" > /dev/null || return 1
- mkdir root build
- # shellcheck disable=SC2086
- run env CFLAGS='-fPIC -pipe' CXXFLAGS='-fPIC -pipe' LDFLAGS= BUILD_STATIC_ONLY=y OBJDIR=build DESTDIR=.. ${make} ${MAKEOPTS} install
- cd - > /dev/null || return 1
-}
-
-copy_libbpf() {
- target_dir="${PWD}/externaldeps/libbpf"
-
- if [ "$(uname -m)" = x86_64 ]; then
- lib_subdir="lib64"
- else
- lib_subdir="lib"
- fi
-
- run mkdir -p "${target_dir}" || return 1
-
- 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() {
- if { [ -n "${NETDATA_DISABLE_EBPF}" ] && [ "${NETDATA_DISABLE_EBPF}" = 1 ]; } || [ "$(uname -s)" != Linux ]; then
- ENABLE_EBPF=0
- NETDATA_DISABLE_EBPF=1
- return 0
- fi
-
- if [ -z "${make}" ]; then
- warning "No usable copy of Make found, which is required to bundle libbpf. Disabling eBPF support."
- ENABLE_EBPF=0
- NETDATA_DISABLE_EBPF=1
- return 0
- fi
-
- # When libc is not detected, we do not have necessity to compile libbpf and we should not do download of eBPF programs
- libc="${EBPF_LIBC:-"$(detect_libc)"}"
- if [ -z "$libc" ]; then
- NETDATA_DISABLE_EBPF=1
- ENABLE_EBPF=0
- return 0
- fi
-
- [ -n "${GITHUB_ACTIONS}" ] && echo "::group::Bundling libbpf."
-
- progress "Prepare libbpf"
-
- if [ "$(get_kernel_version)" -ge "004014000" ]; then
- LIBBPF_PACKAGE_VERSION="$(cat packaging/current_libbpf.version)"
- LIBBPF_PACKAGE_COMPONENT="current_libbpf"
- else
- LIBBPF_PACKAGE_VERSION="$(cat packaging/libbpf_0_0_9.version)"
- LIBBPF_PACKAGE_COMPONENT="libbpf_0_0_9"
- fi
-
- tmp="$(mktemp -d -t netdata-libbpf-XXXXXX)"
- LIBBPF_PACKAGE_BASENAME="v${LIBBPF_PACKAGE_VERSION}.tar.gz"
-
- if fetch_and_verify "${LIBBPF_PACKAGE_COMPONENT}" \
- "https://github.com/netdata/libbpf/archive/${LIBBPF_PACKAGE_BASENAME}" \
- "${LIBBPF_PACKAGE_BASENAME}" \
- "${tmp}" \
- "${NETDATA_LOCAL_TARBALL_OVERRIDE_LIBBPF}"; then
- if run tar --no-same-owner -xf "${tmp}/${LIBBPF_PACKAGE_BASENAME}" -C "${tmp}" &&
- build_libbpf "${tmp}/libbpf-${LIBBPF_PACKAGE_VERSION}" &&
- copy_libbpf "${tmp}/libbpf-${LIBBPF_PACKAGE_VERSION}" &&
- rm -rf "${tmp}"; then
- run_ok "libbpf built and prepared."
- ENABLE_EBPF=1
- else
- if [ -n "${NETDATA_DISABLE_EBPF}" ] && [ "${NETDATA_DISABLE_EBPF}" = 0 ]; then
- fatal "failed to build libbpf." I0005
- else
- run_failed "Failed to build libbpf. eBPF support will be disabled"
- ENABLE_EBPF=0
- NETDATA_DISABLE_EBPF=1
- fi
- fi
- else
- if [ -n "${NETDATA_DISABLE_EBPF}" ] && [ "${NETDATA_DISABLE_EBPF}" = 0 ]; then
- fatal "Failed to fetch sources for libbpf." I0006
- else
- run_failed "Unable to fetch sources for libbpf. eBPF support will be disabled"
- ENABLE_EBPF=0
- NETDATA_DISABLE_EBPF=1
- fi
- fi
-
- [ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
-}
-
-bundle_libbpf
-
-copy_co_re() {
- cp -R "${1}/includes" "src/libnetdata/ebpf/"
-}
-
-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."
- ENABLE_EBPF=1
- else
- if [ -n "${NETDATA_DISABLE_EBPF}" ] && [ "${NETDATA_DISABLE_EBPF}" = 0 ]; then
- fatal "Failed to get eBPF CO-RE files." I0007
- else
- run_failed "Failed to get eBPF CO-RE files. eBPF support will be disabled"
- NETDATA_DISABLE_EBPF=1
- ENABLE_EBPF=0
- enable_feature PLUGIN_EBPF 0
- fi
- fi
- else
- if [ -n "${NETDATA_DISABLE_EBPF}" ] && [ "${NETDATA_DISABLE_EBPF}" = 0 ]; then
- fatal "Failed to fetch eBPF CO-RE files." I0008
- else
- run_failed "Failed to fetch eBPF CO-RE files. eBPF support will be disabled"
- NETDATA_DISABLE_EBPF=1
- ENABLE_EBPF=0
- enable_feature PLUGIN_EBPF 0
- fi
- fi
-
- [ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
-}
-
-bundle_ebpf_co_re
-
-# -----------------------------------------------------------------------------
-build_fluentbit() {
- env_cmd="env CFLAGS='-w' CXXFLAGS='-w' LDFLAGS="
-
- if [ -z "${DONT_SCRUB_CFLAGS_EVEN_THOUGH_IT_MAY_BREAK_THINGS}" ]; then
- env_cmd="env CFLAGS='-fPIC -pipe -w' CXXFLAGS='-fPIC -pipe -w' LDFLAGS="
- fi
-
- mkdir -p src/fluent-bit/build || return 1
- cd src/fluent-bit/build > /dev/null || return 1
-
- rm CMakeCache.txt > /dev/null 2>&1
-
- if ! run eval "${env_cmd} $1 -C ../../logsmanagement/fluent_bit_build/config.cmake -B./ -S../"; then
- cd - > /dev/null || return 1
- rm -rf src/fluent-bit/build > /dev/null 2>&1
- return 1
- fi
-
- if ! run eval "${env_cmd} ${make} ${MAKEOPTS}"; then
- cd - > /dev/null || return 1
- rm -rf src/fluent-bit/build > /dev/null 2>&1
- return 1
- fi
-
- cd - > /dev/null || return 1
}
bundle_fluentbit() {
@@ -1033,6 +799,10 @@ progress "Install logrotate configuration for netdata"
install_netdata_logrotate
+progress "Install journald configuration for netdata"
+
+install_netdata_journald_conf
+
# -----------------------------------------------------------------------------
progress "Read installation options from netdata.conf"
@@ -1316,135 +1086,6 @@ fi
[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
-should_install_ebpf() {
- if [ "${NETDATA_DISABLE_EBPF:=0}" -eq 1 ]; then
- run_failed "eBPF has been explicitly disabled, it will not be available in this install."
- return 1
- fi
-
- if [ "$(uname -s)" != "Linux" ] || [ "$(uname -m)" != "x86_64" ]; then
- if [ "${NETDATA_DISABLE_EBPF:=1}" -eq 0 ]; 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 plugin"
-
- # Detect libc
- libc="${EBPF_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