diff options
Diffstat (limited to '')
-rw-r--r-- | packaging/installer/README.md | 2 | ||||
-rw-r--r-- | packaging/installer/UPDATE.md | 18 | ||||
-rwxr-xr-x | packaging/installer/install-required-packages.sh | 11 | ||||
-rwxr-xr-x | packaging/installer/kickstart.sh | 53 | ||||
-rw-r--r-- | packaging/installer/methods/macos.md | 2 | ||||
-rw-r--r-- | packaging/installer/methods/pfsense.md | 31 | ||||
-rwxr-xr-x | packaging/installer/netdata-updater.sh | 52 |
7 files changed, 116 insertions, 53 deletions
diff --git a/packaging/installer/README.md b/packaging/installer/README.md index 869684da3..9a9beb720 100644 --- a/packaging/installer/README.md +++ b/packaging/installer/README.md @@ -7,6 +7,8 @@ import TabItem from '@theme/TabItem'; This document will guide you through installing the open-source Netdata monitoring Agent on Linux, Docker, Kubernetes, and many others, often with one command. +Netdata is very flexible and can be used to monitor all kinds of infrastructure. Read more about possible [Deployment strategies](https://github.com/netdata/netdata/blob/master/docs/category-overview-pages/deployment-strategies.md) to understand what better suites your needs. + ## Get started Netdata is a free and open-source (FOSS) monitoring agent that collects thousands of hardware and software metrics from diff --git a/packaging/installer/UPDATE.md b/packaging/installer/UPDATE.md index 3df84023b..492f464e4 100644 --- a/packaging/installer/UPDATE.md +++ b/packaging/installer/UPDATE.md @@ -28,7 +28,7 @@ The exact update method to use depends on the install type: Starting with netdata v1.33.0, you can use Netdata itself to determine the installation type by running: ```bash -netdata -W buildinfo | grep 'Install type:' +netdata -W buildinfo | grep -E 'Installation Type|Install type:' ``` If you are using an older version of Netdata, or the above command produces no output, you can run our one-line @@ -166,3 +166,19 @@ and: ```bash /opt/netdata/usr/libexec/netdata/netdata-updater.sh --disable-auto-updates ``` + +## Control runtime behavior of the updater script. + +Starting with v1.40.0, the `netdata-updater.sh` script supports a config file called `netdata-updater.conf`, +located in the same directory as the main `netdata.conf` file. This file uses POSIX shell script syntax to define +variables that are used by the updater. + +This configuration file can be edited [using our `edit-config` +script](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md). + +The following configuration options are currently supported: + +- `NETDATA_UPDATER_JITTER`: Sets an upper limit in seconds on the random delay in the updater script when running + as a scheduled task. This random delay helps avoid issues resulting from too many nodes trying to reconnect to + the Cloud at the same time. The default value is 3600, which corresponds to one hour. Most users should not ever + need to change this. diff --git a/packaging/installer/install-required-packages.sh b/packaging/installer/install-required-packages.sh index ce5ab4044..a05d7440e 100755 --- a/packaging/installer/install-required-packages.sh +++ b/packaging/installer/install-required-packages.sh @@ -180,10 +180,15 @@ get_os_release() { eval "$(grep -E "^(NAME|ID|ID_LIKE|VERSION|VERSION_ID)=" "${os_release_file}")" for x in "${ID}" ${ID_LIKE}; do case "${x,,}" in - almalinux | alpine | arch | centos | clear-linux-os | debian | fedora | gentoo | manjaro | opensuse-leap | ol | rhel | rocky | sabayon | sles | suse | ubuntu) + almalinux | alpine | arch | centos | clear-linux-os | debian | fedora | gentoo | manjaro | opensuse-leap | opensuse-tumbleweed | ol | rhel | rocky | sabayon | sles | suse | ubuntu) distribution="${x}" - version="${VERSION_ID}" - codename="${VERSION}" + if [ "${ID}" = "opensuse-tumbleweed" ]; then + version="tumbleweed" + codename="tumbleweed" + else + version="${VERSION_ID}" + codename="${VERSION}" + fi detection="${os_release_file}" break ;; diff --git a/packaging/installer/kickstart.sh b/packaging/installer/kickstart.sh index 5c6e39cf7..31930f9d4 100755 --- a/packaging/installer/kickstart.sh +++ b/packaging/installer/kickstart.sh @@ -7,13 +7,7 @@ # ====================================================================== # Constants -AGENT_BUG_REPORT_URL="https://github.com/netdata/netdata/issues/new/choose" -CLOUD_BUG_REPORT_URL="https://github.com/netdata/netdata-cloud/issues/new/choose" DEFAULT_RELEASE_CHANNEL="nightly" -DISCORD_INVITE="https://discord.gg/5ygS846fR6" -DISCUSSIONS_URL="https://github.com/netdata/netdata/discussions" -DOCS_URL="https://learn.netdata.cloud/docs/" -FORUM_URL="https://community.netdata.cloud/" KICKSTART_OPTIONS="${*}" KICKSTART_SOURCE="$( self=${0} @@ -25,16 +19,27 @@ KICKSTART_SOURCE="$( cd "${self%/*}" || exit 1 echo "$(pwd -P)/${self##*/}" )" -PACKAGES_SCRIPT="https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer/install-required-packages.sh" DEFAULT_PLUGIN_PACKAGES="" PATH="${PATH}:/usr/local/bin:/usr/local/sbin" -PUBLIC_CLOUD_URL="https://app.netdata.cloud" -REPOCONFIG_DEB_URL_PREFIX="https://repo.netdata.cloud/repos/repoconfig" REPOCONFIG_DEB_VERSION="2-1" -REPOCONFIG_RPM_URL_PREFIX="https://repo.netdata.cloud/repos/repoconfig" REPOCONFIG_RPM_VERSION="2-1" START_TIME="$(date +%s)" STATIC_INSTALL_ARCHES="x86_64 armv7l aarch64 ppc64le" + +# ====================================================================== +# URLs used throughout the script + +AGENT_BUG_REPORT_URL="https://github.com/netdata/netdata/issues/new/choose" +CLOUD_BUG_REPORT_URL="https://github.com/netdata/netdata-cloud/issues/new/choose" +DISCORD_INVITE="https://discord.gg/5ygS846fR6" +DISCUSSIONS_URL="https://github.com/netdata/netdata/discussions" +DOCS_URL="https://learn.netdata.cloud/docs/" +FORUM_URL="https://community.netdata.cloud/" +INSTALL_DOC_URL="https://learn.netdata.cloud/docs/install-the-netdata-agent/one-line-installer-for-all-linux-systems" +PACKAGES_SCRIPT="https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer/install-required-packages.sh" +PUBLIC_CLOUD_URL="https://app.netdata.cloud" +REPOCONFIG_DEB_URL_PREFIX="https://repo.netdata.cloud/repos/repoconfig" +REPOCONFIG_RPM_URL_PREFIX="https://repo.netdata.cloud/repos/repoconfig" TELEMETRY_URL="https://us-east1-netdata-analytics-bi.cloudfunctions.net/ingest_agent_events" # ====================================================================== @@ -83,6 +88,7 @@ CURL="$(PATH="${PATH}:/opt/netdata/bin" command -v curl 2>/dev/null && true)" BADCACHE_MSG="Usually this is a result of an older copy of the file being cached somewhere upstream and can be resolved by retrying in an hour" BADNET_MSG="This is usually a result of a networking issue" ERROR_F0003="Could not find a usable HTTP client. Either curl or wget is required to proceed with installation." +BADOPT_MSG="If you are following a third-party guide online, please see ${INSTALL_DOC_URL} for current instructions for using this script. If you are using a local copy of this script instead of fetching it from our servers, consider updating it. If you intended to pass this option to the installer code, please use either --local-build-options or --static-install-options to specify it instead." # ====================================================================== # Core program logic @@ -668,10 +674,22 @@ get_system_info() { DISTRO_COMPAT_NAME="${DISTRO}" else case "${DISTRO}" in - opensuse-leap) DISTRO_COMPAT_NAME="opensuse" ;; - cloudlinux|almalinux|rocky|rhel) DISTRO_COMPAT_NAME="centos" ;; - artix|manjaro|obarun) DISTRO_COMPAT_NAME="arch" ;; - *) DISTRO_COMPAT_NAME="unknown" ;; + opensuse-leap) + DISTRO_COMPAT_NAME="opensuse" + ;; + opensuse-tumbleweed) + DISTRO_COMPAT_NAME="opensuse" + SYSVERSION="tumbleweed" + ;; + cloudlinux|almalinux|rocky|rhel) + DISTRO_COMPAT_NAME="centos" + ;; + artix|manjaro|obarun) + DISTRO_COMPAT_NAME="arch" + ;; + *) + DISTRO_COMPAT_NAME="unknown" + ;; esac fi @@ -896,7 +914,7 @@ handle_existing_install() { kickstart-*|legacy-*|binpkg-*|manual-static|unknown) if [ "${INSTALL_TYPE}" = "unknown" ]; then if [ "${EXISTING_INSTALL_IS_NATIVE}" -eq 1 ]; then - warning "Found an existing netdata install managed by the system package manager, but could not determine the install type. Usually this means you installed an unsupported third-party netdata package." + warning "Found an existing netdata install managed by the system package manager, but could not determine the install type. Usually this means you installed an unsupported third-party netdata package. This script supports claiming most such installs, but attempting to update or reinstall them using this script may be dangerous." else warning "Found an existing netdata install at ${ndprefix}, but could not determine the install type. Usually this means you installed Netdata through your distribution’s regular package repositories or some other unsupported method." fi @@ -940,7 +958,7 @@ handle_existing_install() { promptmsg="Attempting to update an installation managed by the system package manager is known to not work in most cases. If you are trying to install the latest version of Netdata, you will need to manually uninstall it through your system package manager. ${claimonly_notice} Are you sure you want to continue?" else failmsg="We do not support trying to update or claim installations when we cannot determine the install type. You will need to uninstall the existing install using the same method you used to install it to proceed. ${claimonly_notice}" - promptmsg="Attempting to update an existing install is not officially supported. It may work, but it also might break your system. ${claimonly_notice} Are you sure you want to continue?" + promptmsg="Attempting to update an existing install with an unknown installation type is not officially supported. It may work, but it also might break your system. ${claimonly_notice} Are you sure you want to continue?" fi if [ "${INTERACTIVE}" -eq 0 ] && [ "${ACTION}" != "claim" ]; then fatal "${failmsg}" F0106 @@ -2213,7 +2231,8 @@ parse_args() { fatal "A source directory must be specified with the --offline-install-source option." F0501 fi ;; - *) fatal "Unrecognized option '${1}'. If you intended to pass this option to the installer code, please use either --local-build-options or --static-install-options to specify it instead." F050E ;; + "--"|"all"|"--yes"|"-y"|"--force"|"--accept") warning "Option '${1}' is not recognized, ignoring it. ${BADOPT_MSG}" ;; + *) fatal "Unrecognized option '${1}'. ${BADOPT_MSG}" F050E ;; esac shift 1 done diff --git a/packaging/installer/methods/macos.md b/packaging/installer/methods/macos.md index 11884f7d7..b09632fa1 100644 --- a/packaging/installer/methods/macos.md +++ b/packaging/installer/methods/macos.md @@ -38,7 +38,7 @@ The Netdata Agent is installed under `/usr/local/netdata`. Dependencies are hand The `kickstart.sh` script accepts additional parameters to automatically [connect](https://github.com/netdata/netdata/blob/master/claim/README.md) your node to Netdata Cloud immediately after installation. Find the `token` and `rooms` strings by [signing in to Netdata Cloud](https://app.netdata.cloud/sign-in?cloudRoute=/spaces), then clicking on **Connect Nodes** in the [Spaces management -area](https://github.com/netdata/netdata/blob/master/docs/cloud/spaces.md). +area](https://github.com/netdata/netdata/blob/master/docs/cloud/manage/organize-your-infrastrucutre-invite-your-team.md#netdata-cloud-spaces). - `--claim-token`: Specify a unique claiming token associated with your Space in Netdata Cloud to be used to connect to the node after the install. diff --git a/packaging/installer/methods/pfsense.md b/packaging/installer/methods/pfsense.md index 1a03afb57..407127e93 100644 --- a/packaging/installer/methods/pfsense.md +++ b/packaging/installer/methods/pfsense.md @@ -18,7 +18,8 @@ learn_rel_path: "Installation/Install on specific environments" ## Install prerequisites/dependencies -To install Netdata on pfSense, first run the following command (within a shell or under the **Diagnostics/Command** +To install Netdata on pfSense, first enable the [FreeBSD package repo](https://docs.netgate.com/pfsense/en/latest/recipes/freebsd-pkg-repo.html) +Then run the following command (within a shell or under the **Diagnostics/Command** prompt within the pfSense web interface). ```bash @@ -28,22 +29,22 @@ pkg install -y pkgconf bash e2fsprogs-libuuid libuv nano Then run the following commands to download various dependencies from the FreeBSD repository. ```sh -pkg add http://pkg.freebsd.org/FreeBSD:12:amd64/latest/All/json-c-0.15_1.txz -pkg add http://pkg.freebsd.org/FreeBSD:12:amd64/latest/All/py38-certifi-2021.10.8.txz -pkg add http://pkg.freebsd.org/FreeBSD:12:amd64/latest/All/py38-asn1crypto-1.4.0.txz -pkg add http://pkg.freebsd.org/FreeBSD:12:amd64/latest/All/py38-pycparser-2.20.txz -pkg add http://pkg.freebsd.org/FreeBSD:12:amd64/latest/All/py38-cffi-1.14.6.txz -pkg add http://pkg.freebsd.org/FreeBSD:12:amd64/latest/All/py38-six-1.16.0.txz -pkg add http://pkg.freebsd.org/FreeBSD:12:amd64/latest/All/py38-cryptography-3.3.2.txz -pkg add http://pkg.freebsd.org/FreeBSD:12:amd64/latest/All/py38-idna-2.10.txz -pkg add http://pkg.freebsd.org/FreeBSD:12:amd64/latest/All/py38-openssl-20.0.1.txz -pkg add http://pkg.freebsd.org/FreeBSD:12:amd64/latest/All/py38-pysocks-1.7.1.txz -pkg add http://pkg.freebsd.org/FreeBSD:12:amd64/latest/All/py38-urllib3-1.26.7,1.txz -pkg add http://pkg.freebsd.org/FreeBSD:12:amd64/latest/All/py38-yaml-5.4.1.txz +pkg install json-c-0.15_1 +pkg install py39-certifi-2023.5.7 +pkg install py39-asn1crypto +pkg install py39-pycparser +pkg install py39-cffi +pkg install py39-six +pkg install py39-cryptography +pkg install py39-idna +pkg install py39-openssl +pkg install py39-pysocks +pkg install py39-urllib3 +pkg install py39-yaml ``` > ⚠️ If any of the above commands return a `Not Found` error, you need to manually search for the latest package in the -> [FreeBSD repository](https://www.freebsd.org/ports/). Search for the package's name, such as `py37-cffi`, find the +> [FreeBSD repository](https://www.freebsd.org/ports/) or by running `pkg search`. Search for the package's name, such as `py37-cffi`, find the > latest version number, and update the command accordingly. > ⚠️ On pfSense 2.4.5, Python version 3.7 may be installed by the system, in which case you should should not install @@ -58,7 +59,7 @@ pkg add http://pkg.freebsd.org/FreeBSD:12:amd64/latest/All/py38-yaml-5.4.1.txz You can now install Netdata from the FreeBSD repository. ```bash -pkg add http://pkg.freebsd.org/FreeBSD:12:amd64/latest/All/netdata-1.31.0_1.txz +pkg install netdata ``` > ⚠️ If the above command returns a `Not Found` error, you need to manually search for the latest version of Netdata in diff --git a/packaging/installer/netdata-updater.sh b/packaging/installer/netdata-updater.sh index f8edb6d71..8e06923e4 100755 --- a/packaging/installer/netdata-updater.sh +++ b/packaging/installer/netdata-updater.sh @@ -37,6 +37,8 @@ PACKAGES_SCRIPT="https://raw.githubusercontent.com/netdata/netdata/master/packag NETDATA_STABLE_BASE_URL="${NETDATA_BASE_URL:-https://github.com/netdata/netdata/releases}" NETDATA_NIGHTLY_BASE_URL="${NETDATA_BASE_URL:-https://github.com/netdata/netdata-nightlies/releases}" +NETDATA_UPDATER_JITTER=3600 + script_dir="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)" if [ -x "${script_dir}/netdata-updater" ]; then @@ -103,6 +105,14 @@ exit_reason() { fi } +is_integer () { + case "${1#[+-]}" in + *[!0123456789]*) return 1 ;; + '') return 1 ;; + *) return 0 ;; + esac +} + issystemd() { # if the directory /lib/systemd/system OR /usr/lib/systemd/system (SLES 12.x) does not exit, it is not systemd if [ ! -d /lib/systemd/system ] && [ ! -d /usr/lib/systemd/system ]; then @@ -668,7 +678,8 @@ update_static() { cd "${ndtmpdir}" || fatal "Failed to change current working directory to ${ndtmpdir}" U0019 if update_available; then - sysarch="$(uname -m)" + sysarch="${PREBUILT_ARCH}" + [ -z "$sysarch" ] && sysarch="$(uname -m)" download "${NETDATA_TARBALL_CHECKSUM_URL}" "${ndtmpdir}/sha256sum.txt" download "${NETDATA_TARBALL_URL}" "${ndtmpdir}/netdata-${sysarch}-latest.gz.run" if ! grep "netdata-${sysarch}-latest.gz.run" "${ndtmpdir}/sha256sum.txt" | safe_sha256sum -c - > /dev/null 2>&1; then @@ -721,7 +732,7 @@ update_binpkg() { DISTRO_COMPAT_NAME="${DISTRO}" else case "${DISTRO}" in - opensuse-leap) + opensuse-leap|opensuse-tumbleweed) DISTRO_COMPAT_NAME="opensuse" ;; cloudlinux|almalinux|rocky|rhel) @@ -859,6 +870,11 @@ if [ -r "$(dirname "${ENVIRONMENT_FILE}")/.install-type" ]; then . "$(dirname "${ENVIRONMENT_FILE}")/.install-type" || fatal "Failed to source $(dirname "${ENVIRONMENT_FILE}")/.install-type" U0015 fi +if [ -r "$(dirname "${ENVIRONMENT_FILE}")/netdata-updater.conf" ]; then + # shellcheck source=/dev/null + . "$(dirname "${ENVIRONMENT_FILE}")/netdata-updater.conf" +fi + while [ -n "${1}" ]; do case "${1}" in --not-running-from-cron) NETDATA_NOT_RUNNING_FROM_CRON=1 ;; @@ -867,17 +883,17 @@ while [ -n "${1}" ]; do --non-interactive) INTERACTIVE=0 ;; --interactive) INTERACTIVE=1 ;; --tmpdir-path) - NETDATA_TMPDIR_PATH="${2}" - shift 1 - ;; + NETDATA_TMPDIR_PATH="${2}" + shift 1 + ;; --enable-auto-updates) - enable_netdata_updater "${2}" - exit $? - ;; + enable_netdata_updater "${2}" + exit $? + ;; --disable-auto-updates) - disable_netdata_updater - exit $? - ;; + disable_netdata_updater + exit $? + ;; *) fatal "Unrecognized option ${1}" U001A ;; esac @@ -888,12 +904,16 @@ done # and disconnecting/reconnecting at the same time (or near to). # But only we're not a controlling terminal (tty) # Randomly sleep between 1s and 60m -if [ ! -t 1 ] && [ -z "${NETDATA_NOT_RUNNING_FROM_CRON}" ]; then - rnd="$(awk ' +if [ ! -t 1 ] && \ + [ -z "${GITHUB_ACTIONS}" ] && \ + [ -z "${NETDATA_NOT_RUNNING_FROM_CRON}" ] && \ + is_integer "${NETDATA_UPDATER_JITTER}" && \ + [ "${NETDATA_UPDATER_JITTER}" -gt 1 ]; then + rnd="$(awk " BEGIN { srand() - printf("%d\n", 3600 * rand()) - }')" - sleep $(((rnd % 3600) + 1)) + printf(\"%d\\n\", ${NETDATA_UPDATER_JITTER} * rand()) + }")" + sleep $(((rnd % NETDATA_UPDATER_JITTER) + 1)) fi # We dont expect to find lib dir variable on older installations, so load this path if none found |