diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-05-08 16:27:08 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-05-08 16:27:08 +0000 |
commit | 81581f9719bc56f01d5aa08952671d65fda9867a (patch) | |
tree | 0f5c6b6138bf169c23c9d24b1fc0a3521385cb18 /packaging/installer | |
parent | Releasing debian version 1.38.1-1. (diff) | |
download | netdata-81581f9719bc56f01d5aa08952671d65fda9867a.tar.xz netdata-81581f9719bc56f01d5aa08952671d65fda9867a.zip |
Merging upstream version 1.39.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
38 files changed, 1046 insertions, 1007 deletions
diff --git a/packaging/installer/README.md b/packaging/installer/README.md index 90d3b8de..869684da 100644 --- a/packaging/installer/README.md +++ b/packaging/installer/README.md @@ -1,116 +1,147 @@ -<!-- -title: "Installation guide" -custom_edit_url: https://github.com/netdata/netdata/edit/master/packaging/installer/README.md ---> +import { OneLineInstallWget, OneLineInstallCurl } from '@site/src/components/OneLineInstall/' +import { InstallRegexLink, InstallBoxRegexLink } from '@site/src/components/InstallRegexLink/' +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; -import { Install, InstallBox } from '@site/src/components/Install/' +# Install Netdata -import { OneLineInstallWget, OneLineInstallCurl } from '@site/src/components/OneLineInstall/' +This document will guide you through installing the open-source Netdata monitoring Agent on Linux, Docker, Kubernetes, and many others, often with one command. -# Installation guide +## Get started -Netdata is a monitoring agent designed to run on all your systems: physical and virtual servers, containers, even -IoT/edge devices. Netdata runs on Linux, FreeBSD, macOS, Kubernetes, Docker, and all their derivatives. +Netdata is a free and open-source (FOSS) monitoring agent that collects thousands of hardware and software metrics from +any physical or virtual system (we call them _nodes_). These metrics are organized in an easy-to-use and -navigate interface. -The best way to install Netdata is with our [**automatic one-line installation -script**](#automatic-one-line-installation-script), which works with all Linux distributions and most macOS environments. +Together with [Netdata Cloud](https://github.com/netdata/netdata/blob/master/docs/quickstart/infrastructure.md), you can monitor your entire infrastructure in +real time and troubleshoot problems that threaten the health of your nodes. -If you want to install Netdata with Docker, on a Kubernetes cluster, or a different operating system, see [Have a -different operating system, or want to try another -method?](#have-a-different-operating-system-or-want-to-try-another-method) +Netdata runs permanently on all your physical/virtual servers, containers, cloud deployments, and edge/IoT devices. It +runs on Linux distributions (Ubuntu, Debian, CentOS, and more), container/microservice platforms (Kubernetes clusters, +Docker), and many other operating systems (FreeBSD, macOS), with no `sudo` required. -Some third parties, such as the packaging teams at various Linux distributions, distribute old, broken, or altered -packages. We recommend you install Netdata using one of the methods listed below to guarantee you get the latest -checksum-verified packages. +To install Netdata in minutes on your platform: -Netdata collects anonymous usage information by default and sends it to our self hosted [PostHog](https://github.com/PostHog/posthog) installation. PostHog is an open source product analytics platform, you can read -about the information collected, and learn how to-opt, on our [anonymous statistics](https://github.com/netdata/netdata/blob/master/docs/anonymous-statistics.md) -page. +1. Sign up to <https://app.netdata.cloud/> +2. You will be presented with an empty space, and a prompt to "Connect Nodes" with the install command for each platform +3. Select the platform you want to install Netdata to, copy and paste the script into your node's terminal, and run it -The usage statistics are _vital_ for us, as we use them to discover bugs and prioritize new features. We thank you for -_actively_ contributing to Netdata's future. +Upon installation completing successfully, you should be able to see the node live in your Netdata Space and live charts +in the Overview tab. [Read more about the cloud features](https://github.com/netdata/netdata/blob/master/docs/quickstart/infrastructure.md). -## Automatic one-line installation script +Where you go from here is based on your use case, immediate needs, and experience with monitoring and troubleshooting, +but we have some hints on what you might want to do next. -![](https://registry.my-netdata.io/api/v1/badge.svg?chart=web_log_nginx.requests_by_url_pattern&options=unaligned&dimensions=kickstart&group=sum&after=-3600&label=last+hour&units=installations&value_color=orange&precision=0) ![](https://registry.my-netdata.io/api/v1/badge.svg?chart=web_log_nginx.requests_by_url_pattern&options=unaligned&dimensions=kickstart&group=sum&after=-86400&label=today&units=installations&precision=0) +### What's next? -This method is fully automatic on all Linux distributions, including Ubuntu, Debian, Fedora, CentOS, and others, as well as on mac OS environments. +Explore our [general advanced installation options and troubleshooting](#advanced-installation-options-and-troubleshooting), specific options +for the [single line installer](#install-on-linux-with-one-line-installer), or [other installation methods](#other-installation-methods). -To install Netdata, including all dependencies required to connect to Netdata Cloud, and get _automatic nightly -updates_, run the following as your normal user: +#### Agent user interface -<OneLineInstallWget/> +To access the UI provided by the locally installed agent, open a browser and navigate to `http://NODE:19999`, replacing `NODE` with either `localhost` or +the hostname/IP address of the remote node. You can also read more about +[the agent dashboard](https://github.com/netdata/netdata/blob/master/web/gui/README.md). -Or, if you have cURL but not wget (such as on macOS): +#### Configuration -<OneLineInstallCurl/> +Discover the recommended way to [configure Netdata's settings or behavior](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md) using our built-in +`edit-config` script, then apply that knowledge to mission-critical tweaks, such as [changing how long Netdata stores +metrics](https://github.com/netdata/netdata/blob/master/docs/store/change-metrics-storage.md). -This script will preferentially use native DEB/RPM packages if we provide them for your platform. +#### Data collection -To see more information about this installation script, including how to disable automatic updates, get nightly vs. -stable releases, or disable anonymous statistics, see the [`kickstart.sh` method -page](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/kickstart.md). +If Netdata didn't autodetect all the hardware, containers, services, or applications running on your node, you should +learn more about [how data collectors work](https://github.com/netdata/netdata/blob/master/collectors/README.md). If there's a [supported +collector](https://github.com/netdata/netdata/blob/master/collectors/COLLECTORS.md) for metrics you need, [configure the collector](https://github.com/netdata/netdata/blob/master/collectors/REFERENCE.md) +or read about its requirements to configure your endpoint to publish metrics in the correct format and endpoint. -Scroll down for details about [automatic updates](#automatic-updates) or [nightly vs. stable -releases](#nightly-vs-stable-releases). +#### Alarms & notifications -### Post-installation +Netdata comes with hundreds of preconfigured alarms, designed by our monitoring gurus in parallel with our open-source +community, but you may want to [edit alarms](https://github.com/netdata/netdata/blob/master/health/REFERENCE.md) or +[enable notifications](https://github.com/netdata/netdata/blob/master/docs/monitor/enable-notifications.md) to customize your Netdata experience. -When you're finished with installation, check out our [single-node](https://github.com/netdata/netdata/blob/master/docs/quickstart/single-node.md) or -[infrastructure](https://github.com/netdata/netdata/blob/master/docs/quickstart/infrastructure.md) monitoring quickstart guides based on your use case. +#### Make your deployment production ready -Or, skip straight to [configuring the Netdata Agent](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md). +Go through our [deployment strategies](https://github.com/netdata/netdata/edit/master/docs/category-overview-pages/deployment-strategies.md), +for suggested configuration changes for production deployments. -Read through Netdata's [documentation](https://learn.netdata.cloud/docs), which is structured based on actions and -solutions, to enable features like health monitoring, alarm notifications, long-term metrics storage, exporting to -external databases, and more. +## Install on Linux with one-line installer -## Have a different operating system, or want to try another method? +The **recommended** way to install Netdata on a Linux node (physical, virtual, container, IoT) is our one-line +[kickstart script](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/kickstart.md). +This script automatically installs dependencies and builds Netdata from its source code. -Netdata works on many different platforms. To see all supported platforms, check out our [platform support -policy](https://github.com/netdata/netdata/blob/master/packaging/PLATFORM_SUPPORT.md). +To install, copy the script, paste it into your node's terminal, and hit `Enter` to begin the installation process. -Below, you can find a few additional installation methods, followed by separate instructions for a variety of unique -operating systems. + <Tabs> + <TabItem value="wget" label=<code>wget</code>> -### Alternative methods + <OneLineInstallWget/> -<Install> - <InstallBox - to="/docs/agent/packaging/installer/methods/kickstart" - os="General Linux with one-line installer (recommended)" - svg="linux" /> - <InstallBox - to="/docs/agent/packaging/installer/methods/packages" - os="Native DEB/RPM packages for Linux" - svg="linux" /> - <InstallBox - to="/docs/agent/packaging/docker" + </TabItem> + <TabItem value="curl" label=<code>curl</code>> + + <OneLineInstallCurl/> + + </TabItem> +</Tabs> + +> ### Note +> +> If you plan to also claim the node to Netdata Cloud, make sure to replace `YOUR_CLAIM_TOKEN` with the claim token of your space, and `YOUR_ROOM_ID` with the ID of the room you are claiming to. +> You can leave the room id blank to have your node claimed to the default "All nodes" room. + +Jump down to [what's next](#whats-next) to learn how to view your new dashboard and take your next steps monitoring and +troubleshooting with Netdata. + +## Other installation methods + +<InstallRegexLink> + <InstallBoxRegexLink + to="[](https://github.com/netdata/netdata/blob/master/packaging/docker/README.md)" os="Run with Docker" svg="docker" /> - <InstallBox - to="/docs/agent/packaging/installer/methods/kubernetes" + <InstallBoxRegexLink + to="[](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/kubernetes.md)" os="Deploy on Kubernetes" svg="kubernetes" /> - <InstallBox - to="/docs/agent/packaging/installer/methods/macos" + <InstallBoxRegexLink + to="[](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/macos.md)" os="Install on macOS" svg="macos" /> - <InstallBox - to="/docs/agent/packaging/installer/methods/manual" + <InstallBoxRegexLink + to="[](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/packages.md)" + os="Native DEB/RPM packages" + svg="linux" /> + <InstallBoxRegexLink + to="[](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/manual.md)" os="Linux from Git" svg="linux" /> - <InstallBox - to="/docs/agent/packaging/installer/methods/source" + <InstallBoxRegexLink + to="[](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/source.md)" os="Linux from source" svg="linux" /> - <InstallBox - to="/docs/agent/packaging/installer/methods/offline" + <InstallBoxRegexLink + to="[](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/offline.md)" os="Linux for offline nodes" svg="linux" /> -</Install> +</InstallRegexLink> + +- [Native DEB/RPM packages](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/packages.md) +- [Run with Docker](https://github.com/netdata/netdata/blob/master/packaging/docker/README.md) +- [Deploy on Kubernetes](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/kubernetes.md) +- [Install on macOS](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/macos.md) +- [Linux from Git](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/manual.md) +- [Linux from source](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/source.md) +- [Linux for offline nodes](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/offline.md) + +The full list of all installation methods for various systems is available in [Netdata Learn](https://learn.netdata.cloud), +under [Installation](https://github.com/netdata/netdata/blob/master/docs/category-overview-pages/installation-overview.md). -## Automatic updates +## Advanced installation options and troubleshooting + +### Automatic updates By default, Netdata's installation scripts enable automatic updates for both nightly and stable release channels. @@ -125,7 +156,7 @@ wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/ With automatic updates disabled, you can choose exactly when and how you [update Netdata](https://github.com/netdata/netdata/blob/master/packaging/installer/UPDATE.md). -### Network usage of Netdata’s automatic updater +#### Network usage of Netdata’s automatic updater The auto-update functionality set up by the installation scripts requires working internet access to function correctly. In particular, it currently requires access to GitHub (to check if a newer version of the updater script @@ -136,7 +167,7 @@ Note that the auto-update functionality will check for updates to itself indepen and will try to use the latest version of the updater script whenever possible. This is intended to reduce the amount of effort required by users to get updates working again in the event of a bug in the updater code. -## Nightly vs. stable releases +### Nightly vs. stable releases The Netdata team maintains two releases of the Netdata agent: **nightly** and **stable**. By default, Netdata's installation scripts will give you **automatic, nightly** updates, as that is our recommended configuration. @@ -153,22 +184,29 @@ the community helps fix any bugs that might have been introduced in previous rel **Pros of using nightly releases:** -- Get the latest features and bug fixes as soon as they're available -- Receive security-related fixes immediately -- Use stable, fully-tested code that's always improving -- Leverage the same Netdata experience our community is using +- Get the latest features and bug fixes as soon as they're available +- Receive security-related fixes immediately +- Use stable, fully-tested code that's always improving +- Leverage the same Netdata experience our community is using **Pros of using stable releases:** -- Protect yourself from the rare instance when major bugs slip through our testing and negatively affect a Netdata +- Protect yourself from the rare instance when major bugs slip through our testing and negatively affect a Netdata installation -- Retain more control over the Netdata version you use +- Retain more control over the Netdata version you use + +### Anonymous statistics -## Troubleshooting and known issues +Starting with v1.30, Netdata collects anonymous usage information by default and sends it to a self-hosted PostHog instance within the Netdata infrastructure. Read about the information collected, and learn how to-opt, on our [anonymous statistics](https://github.com/netdata/netdata/blob/master/docs/anonymous-statistics.md) page. + +The usage statistics are _vital_ for us, as we use them to discover bugs and prioritize new features. We thank you for +_actively_ contributing to Netdata's future. + +### Troubleshooting and known issues We are tracking a few issues related to installation and packaging. -### Older distributions (Ubuntu 14.04, Debian 8, CentOS 6) and OpenSSL +#### Older distributions (Ubuntu 14.04, Debian 8, CentOS 6) and OpenSSL If you're running an older Linux distribution or one that has reached EOL, such as Ubuntu 14.04 LTS, Debian 8, or CentOS 6, your Agent may not be able to securely connect to Netdata Cloud due to an outdated version of OpenSSL. These old @@ -179,13 +217,13 @@ If you choose to continue using the outdated version of OpenSSL, your node will with hostname verification disabled. Without verification, your Netdata Cloud connection could be vulnerable to man-in-the-middle attacks. -### CentOS 6 and CentOS 8 +#### CentOS 6 and CentOS 8 To install the Agent on certain CentOS and RHEL systems, you must enable non-default repositories, such as EPEL or PowerTools, to gather hard dependencies. See the [CentOS 6](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/manual.md#centos--rhel-6x) and [CentOS 8](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/manual.md#centos--rhel-8x) sections for more information. -### Access to file is not permitted +#### Access to file is not permitted If you see an error similar to `Access to file is not permitted: /usr/share/netdata/web//index.html` when you try to visit the Agent dashboard at `http://NODE:19999`, you need to update Netdata's permissions to match those of your @@ -207,16 +245,14 @@ These files need to have the same user and group used to install your netdata. S # chown -R netdata.netdata /usr/share/netdata/web ``` -### Multiple versions of OpenSSL +#### Multiple versions of OpenSSL We've received reports from the community about issues with running the `kickstart.sh` script on systems that have both a distribution-installed version of OpenSSL and a manually-installed local version. The Agent's installer cannot handle both. -### Clang compiler on Linux +#### Clang compiler on Linux Our current build process has some issues when using certain configurations of the `clang` C compiler on Linux. See [the section on `nonrepresentable section on output` errors](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/manual.md#nonrepresentable-section-on-output-errors) for a workaround. - - diff --git a/packaging/installer/REINSTALL.md b/packaging/installer/REINSTALL.md index c24fdee8..82cea498 100644 --- a/packaging/installer/REINSTALL.md +++ b/packaging/installer/REINSTALL.md @@ -1,14 +1,4 @@ -<!-- -title: "Reinstall the Netdata Agent" -description: "Troubleshooting installation issues or force an update of the Netdata Agent by reinstalling it using the same method you used during installation." -custom_edit_url: "https://github.com/netdata/netdata/edit/master/packaging/installer/REINSTALL.md" -sidebar_label: "Reinstall the Netdata Agent" -learn_status: "Published" -learn_topic_type: "Tasks" -learn_rel_path: "Installation" ---> - -# Reinstall the Netdata Agent +# Reinstall Netdata In certain situations, such as needing to enable a feature or troubleshoot an issue, you may need to reinstall the Netdata Agent on your node. diff --git a/packaging/installer/UNINSTALL.md b/packaging/installer/UNINSTALL.md index 2ff22f5c..a66bd7a2 100644 --- a/packaging/installer/UNINSTALL.md +++ b/packaging/installer/UNINSTALL.md @@ -1,18 +1,9 @@ -<!-- -title: "Uninstall Netdata" -description: "If you are no longer interested in using the Netdata Agent, use the self-contained uninstaller to remove all traces of binaries and configuration files." -custom_edit_url: "https://github.com/netdata/netdata/edit/master/packaging/installer/UNINSTALL.md" -sidebar_label: "Uninstall Netdata" -learn_status: "Published" -learn_topic_type: "Tasks" -learn_rel_path: "Installation" ---> - # Uninstall Netdata -> ⚠️ If you're having trouble updating Netdata, moving from one installation method to another, or generally having -> issues with your Netdata Agent installation, consider our [**reinstall Netdata** -> doc](https://github.com/netdata/netdata/blob/master/packaging/installer/REINSTALL.md) instead of removing the Netdata Agent entirely. +> ### Note +> +> If you're having trouble updating Netdata, moving from one installation method to another, or generally having +> issues with your Netdata Agent installation, consider our [reinstalling Netdata](https://github.com/netdata/netdata/blob/master/packaging/installer/REINSTALL.md) instead of removing the Netdata Agent entirely. The recommended method to uninstall Netdata on a system is to use our kickstart installer script with the `--uninstall` option like so: @@ -27,9 +18,7 @@ curl https://my-netdata.io/kickstart.sh > /tmp/netdata-kickstart.sh && sh /tmp/n ``` This will work in most cases without you needing to do anything more other than accepting removal of configuration -and data files. You can confirm whether this approach will work for you by adding `--dry-run` to the list of -options. If that produces a line with a message like `Would attempt to uninstall existing install`, then this -method will work on your system. +and data files. If you used a non-standard installation prefix, you may need to specify that prefix using the `--old-install-prefix` option when uninstalling this way. diff --git a/packaging/installer/UPDATE.md b/packaging/installer/UPDATE.md index 9d4289f8..3df84023 100644 --- a/packaging/installer/UPDATE.md +++ b/packaging/installer/UPDATE.md @@ -1,14 +1,4 @@ -<!-- -title: "Update the Netdata Agent" -description: "If you opted out of automatic updates, you need to update your Netdata Agent to the latest nightly or stable version." -custom_edit_url: "https://github.com/netdata/netdata/edit/master/packaging/installer/UPDATE.md" -sidebar_label: "Update the Netdata Agent" -learn_status: "Published" -learn_topic_type: "Tasks" -learn_rel_path: "Installation" ---> - -# Update the Netdata Agent +# Update Netdata By default, the Netdata Agent automatically updates with the latest nightly or stable version depending on which you installed. If you opted out of automatic updates, you need to update your Netdata Agent to the latest nightly diff --git a/packaging/installer/dependencies/alpine.sh b/packaging/installer/dependencies/alpine.sh index 65999dc3..321d5770 100755 --- a/packaging/installer/dependencies/alpine.sh +++ b/packaging/installer/dependencies/alpine.sh @@ -31,6 +31,7 @@ package_tree=" util-linux-dev libmnl-dev json-c-dev + yaml-dev " usage() { diff --git a/packaging/installer/dependencies/arch.sh b/packaging/installer/dependencies/arch.sh index cdda5273..c0890d92 100755 --- a/packaging/installer/dependencies/arch.sh +++ b/packaging/installer/dependencies/arch.sh @@ -20,6 +20,7 @@ declare -a package_tree=( util-linux libmnl json-c + libyaml libuv lz4 openssl diff --git a/packaging/installer/dependencies/centos.sh b/packaging/installer/dependencies/centos.sh index a05bce8f..845f1113 100755 --- a/packaging/installer/dependencies/centos.sh +++ b/packaging/installer/dependencies/centos.sh @@ -19,6 +19,7 @@ declare -a package_tree=( libuuid-devel libmnl-devel json-c-devel + libyaml-devel libuv-devel lz4-devel openssl-devel @@ -96,7 +97,7 @@ check_flags() { validate_tree_centos() { local opts= - export local package_manager= + package_manager= if [[ "${NON_INTERACTIVE}" == "1" ]]; then echo >&2 "Running in non-interactive mode" opts="-y" diff --git a/packaging/installer/dependencies/clearlinux.sh b/packaging/installer/dependencies/clearlinux.sh index 832dac55..f6f616d6 100755 --- a/packaging/installer/dependencies/clearlinux.sh +++ b/packaging/installer/dependencies/clearlinux.sh @@ -15,6 +15,7 @@ declare -a package_tree=( devpkg-util-linux devpkg-libmnl devpkg-json-c + yaml-dev devpkg-libuv devpkg-lz4 devpkg-openssl diff --git a/packaging/installer/dependencies/debian.sh b/packaging/installer/dependencies/debian.sh index a2c421a9..8186940e 100755 --- a/packaging/installer/dependencies/debian.sh +++ b/packaging/installer/dependencies/debian.sh @@ -31,6 +31,7 @@ package_tree=" liblz4-dev libssl-dev libelf-dev + libyaml-dev python python3 " diff --git a/packaging/installer/dependencies/fedora.sh b/packaging/installer/dependencies/fedora.sh index a1c3a1df..58912288 100755 --- a/packaging/installer/dependencies/fedora.sh +++ b/packaging/installer/dependencies/fedora.sh @@ -39,6 +39,7 @@ declare -a package_tree=( libuuid-devel libmnl-devel json-c-devel + libyaml-devel libuv-devel lz4-devel openssl-devel diff --git a/packaging/installer/dependencies/freebsd.sh b/packaging/installer/dependencies/freebsd.sh index 91451356..69a650a6 100755 --- a/packaging/installer/dependencies/freebsd.sh +++ b/packaging/installer/dependencies/freebsd.sh @@ -21,6 +21,7 @@ package_tree=" lzlib e2fsprogs-libuuid json-c + libyaml libuv liblz4 openssl diff --git a/packaging/installer/dependencies/gentoo.sh b/packaging/installer/dependencies/gentoo.sh index e7ed6445..cbe8c8e5 100755 --- a/packaging/installer/dependencies/gentoo.sh +++ b/packaging/installer/dependencies/gentoo.sh @@ -24,6 +24,7 @@ package_tree=" sys-apps/util-linux net-libs/libmnl dev-libs/json-c + dev-libs/libyaml dev-libs/libuv app-arch/lz4 dev-libs/openssl diff --git a/packaging/installer/dependencies/ol.sh b/packaging/installer/dependencies/ol.sh index 0f1f90e6..2166bcc5 100755 --- a/packaging/installer/dependencies/ol.sh +++ b/packaging/installer/dependencies/ol.sh @@ -24,6 +24,7 @@ declare -a package_tree=( libuuid-devel libmnl-devel json-c-devel + libyaml-devel libuv-devel lz4-devel openssl-devel diff --git a/packaging/installer/dependencies/opensuse.sh b/packaging/installer/dependencies/opensuse.sh index b1f0c218..81291ef7 100755 --- a/packaging/installer/dependencies/opensuse.sh +++ b/packaging/installer/dependencies/opensuse.sh @@ -25,6 +25,7 @@ declare -a package_tree=( libuuid-devel libmnl-devel libjson-c-devel + libyaml-devel libuv-devel liblz4-devel libopenssl-devel diff --git a/packaging/installer/dependencies/rockylinux.sh b/packaging/installer/dependencies/rockylinux.sh index 63981df4..7ac98f5e 100755 --- a/packaging/installer/dependencies/rockylinux.sh +++ b/packaging/installer/dependencies/rockylinux.sh @@ -23,6 +23,7 @@ declare -a package_tree=( libuuid-devel libmnl-devel json-c-devel + libyaml-devel libuv-devel lz4-devel openssl-devel diff --git a/packaging/installer/dependencies/ubuntu.sh b/packaging/installer/dependencies/ubuntu.sh index 295dbf01..e3d734c6 100755 --- a/packaging/installer/dependencies/ubuntu.sh +++ b/packaging/installer/dependencies/ubuntu.sh @@ -27,6 +27,7 @@ package_tree=" uuid-dev libmnl-dev libjson-c-dev + libyaml-dev libuv1-dev liblz4-dev libssl-dev diff --git a/packaging/installer/functions.sh b/packaging/installer/functions.sh index ebb4aab7..b12a9a58 100644 --- a/packaging/installer/functions.sh +++ b/packaging/installer/functions.sh @@ -95,10 +95,19 @@ progress() { echo >&2 " --- ${TPUT_DIM}${TPUT_BOLD}${*}${TPUT_RESET} --- " } +check_for_curl() { + if [ -z "${curl}" ]; then + curl="$(PATH="${PATH}:/opt/netdata/bin" command -v curl 2>/dev/null && true)" + fi +} + get() { url="${1}" - if command -v curl > /dev/null 2>&1; then - curl -q -o - -sSL --connect-timeout 10 --retry 3 "${url}" + + check_for_curl + + if [ -n "${curl}" ]; then + "${curl}" -q -o - -sSL --connect-timeout 10 --retry 3 "${url}" elif command -v wget > /dev/null 2>&1; then wget -T 15 -O - "${url}" else @@ -112,8 +121,10 @@ download_file() { name="${3}" opt="${4}" - if command -v curl > /dev/null 2>&1; then - run curl -q -sSL --connect-timeout 10 --retry 3 --output "${dest}" "${url}" + check_for_curl + + if [ -n "${curl}" ]; then + run "${curl}" -q -sSL --connect-timeout 10 --retry 3 --output "${dest}" "${url}" elif command -v wget > /dev/null 2>&1; then run wget -T 15 -O "${dest}" "${url}" else @@ -400,7 +411,7 @@ get_group(){ if command -v getent > /dev/null 2>&1; then getent group "${1:-""}" else - cat /etc/group | grep "^${1}:" + grep "^${1}:" /etc/group fi } @@ -459,21 +470,21 @@ install_non_systemd_init() { if [ -d /etc/init.d ] && [ ! -f /etc/init.d/netdata ]; then if expr "${key}" : "^(gentoo|alpine).*"; then echo >&2 "Installing OpenRC init file..." - run cp system/netdata-openrc /etc/init.d/netdata && + run cp system/openrc/init.d/netdata /etc/init.d/netdata && run chmod 755 /etc/init.d/netdata && run rc-update add netdata default && return 0 elif expr "${key}" : "^devuan*" || [ "${key}" = "debian-7" ] || [ "${key}" = "ubuntu-12.04" ] || [ "${key}" = "ubuntu-14.04" ]; then echo >&2 "Installing LSB init file..." - run cp system/netdata-lsb /etc/init.d/netdata && + run cp system/lsb/init.d/netdata /etc/init.d/netdata && run chmod 755 /etc/init.d/netdata && run update-rc.d netdata defaults && run update-rc.d netdata enable && return 0 elif expr "${key}" : "^(amzn-201[5678]|ol|CentOS release 6|Red Hat Enterprise Linux Server release 6|Scientific Linux CERN SLC release 6|CloudLinux Server release 6).*"; then echo >&2 "Installing init.d file..." - run cp system/netdata-init-d /etc/init.d/netdata && + run cp system/initd/init.d/netdata /etc/init.d/netdata && run chmod 755 /etc/init.d/netdata && run chkconfig netdata on && return 0 @@ -571,7 +582,7 @@ install_netdata_service() { echo >&2 "Installing MacOS X plist file..." # This is used by netdata-installer.sh # shellcheck disable=SC2034 - run cp system/netdata.plist /Library/LaunchDaemons/com.github.netdata.plist && + run cp system/launchd/netdata.plist /Library/LaunchDaemons/com.github.netdata.plist && run launchctl load /Library/LaunchDaemons/com.github.netdata.plist && NETDATA_START_CMD="launchctl start com.github.netdata" && NETDATA_STOP_CMD="launchctl stop com.github.netdata" @@ -581,7 +592,7 @@ install_netdata_service() { elif [ "${uname}" = "FreeBSD" ]; then # This is used by netdata-installer.sh # shellcheck disable=SC2034 - run cp system/netdata-freebsd /etc/rc.d/netdata && NETDATA_START_CMD="service netdata start" && + run cp system/freebsd/rc.d/netdata /etc/rc.d/netdata && NETDATA_START_CMD="service netdata start" && NETDATA_STOP_CMD="service netdata stop" && NETDATA_INSTALLER_START_CMD="service netdata onestart" && myret=$? @@ -589,7 +600,7 @@ install_netdata_service() { echo >&2 "Note: To explicitly enable netdata automatic start, set 'netdata_enable' to 'YES' in /etc/rc.conf" echo >&2 "" - return ${myret} + return "${myret}" elif issystemd; then # systemd is running on this system @@ -610,7 +621,7 @@ install_netdata_service() { fi echo >&2 "Installing systemd service..." - run cp system/netdata.service "${SYSTEMD_DIRECTORY}/netdata.service" && + run cp system/systemd/netdata.service "${SYSTEMD_DIRECTORY}/netdata.service" && run systemctl daemon-reload && ${ENABLE_NETDATA_IF_PREVIOUSLY_ENABLED} && return 0 @@ -834,10 +845,12 @@ restart_netdata() { # install netdata logrotate install_netdata_logrotate() { + src="${NETDATA_PREFIX}/usr/lib/netdata/system/logrotate/netdata" + if [ "${UID}" -eq 0 ]; then if [ -d /etc/logrotate.d ]; then if [ ! -f /etc/logrotate.d/netdata ]; then - run cp system/netdata.logrotate /etc/logrotate.d/netdata + run cp "${src}" /etc/logrotate.d/netdata fi if [ -f /etc/logrotate.d/netdata ]; then @@ -873,8 +886,10 @@ create_netdata_conf() { export http_proxy= export https_proxy= - if command -v curl 1> /dev/null 2>&1; then - run curl -sSL --connect-timeout 10 --retry 3 "${url}" > "${path}.new" + check_for_curl + + if [ -n "${curl}" ]; then + run "${curl}" -sSL --connect-timeout 10 --retry 3 "${url}" > "${path}.new" elif command -v wget 1> /dev/null 2>&1; then run wget -T 15 -O - "${url}" > "${path}.new" fi @@ -903,32 +918,29 @@ portable_add_user() { [ -z "${homedir}" ] && homedir="/tmp" # Check if user exists - if cut -d ':' -f 1 < /etc/passwd | grep "^${username}$" 1> /dev/null 2>&1; then - echo >&2 "User '${username}' already exists." - return 0 + if command -v getent > /dev/null 2>&1; then + if getent passwd "${username}" > /dev/null 2>&1; then + echo >&2 "User '${username}' already exists." + return 0 + fi + else + if cut -d ':' -f 1 < /etc/passwd | grep "^${username}$" 1> /dev/null 2>&1; then + echo >&2 "User '${username}' already exists." + return 0 + fi fi echo >&2 "Adding ${username} user account with home ${homedir} ..." nologin="$(command -v nologin || echo '/bin/false')" - # Linux if command -v useradd 1> /dev/null 2>&1; then run useradd -r -g "${username}" -c "${username}" -s "${nologin}" --no-create-home -d "${homedir}" "${username}" && return 0 - fi - - # FreeBSD - if command -v pw 1> /dev/null 2>&1; then + elif command -v pw 1> /dev/null 2>&1; then run pw useradd "${username}" -d "${homedir}" -g "${username}" -s "${nologin}" && return 0 - fi - - # BusyBox - if command -v adduser 1> /dev/null 2>&1; then + elif command -v adduser 1> /dev/null 2>&1; then run adduser -h "${homedir}" -s "${nologin}" -D -G "${username}" "${username}" && return 0 - fi - - # mac OS - if command -v sysadminctl 1> /dev/null 2>&1; then + elif command -v sysadminctl 1> /dev/null 2>&1; then run sysadminctl -addUser "${username}" && return 0 fi @@ -951,20 +963,11 @@ portable_add_group() { # Linux if command -v groupadd 1> /dev/null 2>&1; then run groupadd -r "${groupname}" && return 0 - fi - - # FreeBSD - if command -v pw 1> /dev/null 2>&1; then + elif command -v pw 1> /dev/null 2>&1; then run pw groupadd "${groupname}" && return 0 - fi - - # BusyBox - if command -v addgroup 1> /dev/null 2>&1; then + elif command -v addgroup 1> /dev/null 2>&1; then run addgroup "${groupname}" && return 0 - fi - - # mac OS - if command -v dseditgroup 1> /dev/null 2>&1; then + elif command -v dseditgroup 1> /dev/null 2>&1; then dseditgroup -o create "${groupname}" && return 0 fi @@ -995,20 +998,11 @@ portable_add_user_to_group() { # Linux if command -v usermod 1> /dev/null 2>&1; then run usermod -a -G "${groupname}" "${username}" && return 0 - fi - - # FreeBSD - if command -v pw 1> /dev/null 2>&1; then + elif command -v pw 1> /dev/null 2>&1; then run pw groupmod "${groupname}" -m "${username}" && return 0 - fi - - # BusyBox - if command -v addgroup 1> /dev/null 2>&1; then + elif command -v addgroup 1> /dev/null 2>&1; then run addgroup "${username}" "${groupname}" && return 0 - fi - - # mac OS - if command -v dseditgroup 1> /dev/null 2>&1; then + elif command -v dseditgroup 1> /dev/null 2>&1; then dseditgroup -u "${username}" "${groupname}" && return 0 fi @@ -1063,8 +1057,8 @@ install_netdata_updater() { fi if issystemd && [ -n "$(get_systemd_service_dir)" ]; then - cat "${NETDATA_SOURCE_DIR}/system/netdata-updater.timer" > "$(get_systemd_service_dir)/netdata-updater.timer" - cat "${NETDATA_SOURCE_DIR}/system/netdata-updater.service" > "$(get_systemd_service_dir)/netdata-updater.service" + cat "${NETDATA_SOURCE_DIR}/system/systemd/netdata-updater.timer" > "$(get_systemd_service_dir)/netdata-updater.timer" + cat "${NETDATA_SOURCE_DIR}/system/systemd/netdata-updater.service" > "$(get_systemd_service_dir)/netdata-updater.service" fi sed -i -e "s|THIS_SHOULD_BE_REPLACED_BY_INSTALLER_SCRIPT|${NETDATA_USER_CONFIG_DIR}/.environment|" "${NETDATA_PREFIX}/usr/libexec/netdata/netdata-updater.sh" || return 1 diff --git a/packaging/installer/install-required-packages.sh b/packaging/installer/install-required-packages.sh index c906cce3..9b1f6518 100755 --- a/packaging/installer/install-required-packages.sh +++ b/packaging/installer/install-required-packages.sh @@ -676,6 +676,20 @@ declare -A pkg_json_c_dev=( ['default']="json-c-devel" ) +#TODO:: clearlinux ? +declare -A pkg_libyaml_dev=( + ['alpine']="yaml-dev" + ['arch']="libyaml" + ['clearlinux']="yaml-dev" + ['debian']="libyaml-dev" + ['gentoo']="dev-libs/libyaml" + ['sabayon']="dev-libs/libyaml" + ['suse']="libyaml-devel" + ['freebsd']="libyaml" + ['macos']="libyaml" + ['default']="libyaml-devel" +) + declare -A pkg_libatomic=( ['arch']="NOTREQUIRED" ['clearlinux']="NOTREQUIRED" @@ -1227,6 +1241,7 @@ packages() { suitable_package libuuid-dev suitable_package libmnl-dev suitable_package json-c-dev + suitable_package libyaml-dev fi # ------------------------------------------------------------------------- @@ -1376,6 +1391,7 @@ validate_tree_freebsd() { echo >&2 " > Checking for gmake ..." if ! pkg query %n-%v | grep -q gmake; then if prompt "gmake is required to build on FreeBSD and is not installed. Shall I install it?"; then + # shellcheck disable=2086 run ${sudo} pkg install ${opts} gmake fi fi @@ -1425,13 +1441,16 @@ validate_tree_centos() { echo >&2 " > Checking for config-manager ..." if ! run ${sudo} dnf config-manager --help; then if prompt "config-manager not found, shall I install it?"; then + # shellcheck disable=2086 run ${sudo} dnf ${opts} install 'dnf-command(config-manager)' fi fi echo >&2 " > Checking for CRB ..." + # shellcheck disable=2086 if ! run dnf ${sudo} repolist | grep CRB; then if prompt "CRB not found, shall I install it?"; then + # shellcheck disable=2086 run ${sudo} dnf ${opts} config-manager --set-enabled crb fi fi @@ -1439,24 +1458,29 @@ validate_tree_centos() { echo >&2 " > Checking for config-manager ..." if ! run ${sudo} yum config-manager --help; then if prompt "config-manager not found, shall I install it?"; then + # shellcheck disable=2086 run ${sudo} yum ${opts} install 'dnf-command(config-manager)' fi fi echo >&2 " > Checking for PowerTools ..." + # shellcheck disable=2086 if ! run yum ${sudo} repolist | grep PowerTools; then if prompt "PowerTools not found, shall I install it?"; then + # shellcheck disable=2086 run ${sudo} yum ${opts} config-manager --set-enabled powertools fi fi echo >&2 " > Updating libarchive ..." + # shellcheck disable=2086 run ${sudo} yum ${opts} install libarchive elif [[ "${version}" =~ ^7(\..*)?$ ]]; then echo >&2 " > Checking for EPEL ..." if ! rpm -qa | grep epel-release > /dev/null; then if prompt "EPEL not found, shall I install it?"; then + # shellcheck disable=2086 run ${sudo} yum ${opts} install epel-release fi fi @@ -1465,6 +1489,7 @@ validate_tree_centos() { echo >&2 " > Checking for Okay ..." if ! rpm -qa | grep okay > /dev/null; then if prompt "okay not found, shall I install it?"; then + # shellcheck disable=2086 run ${sudo} yum ${opts} install http://repo.okay.com.mx/centos/6/x86_64/release/okay-release-1-3.el6.noarch.rpm fi fi @@ -1627,7 +1652,7 @@ install_equo() { PACMAN_DB_SYNCED=0 validate_install_pacman() { - if [ ${PACMAN_DB_SYNCED} -eq 0 ]; then + if [ "${PACMAN_DB_SYNCED}" -eq 0 ]; then echo >&2 " > Running pacman -Sy to sync the database" local x x=$(pacman -Sy) diff --git a/packaging/installer/kickstart.sh b/packaging/installer/kickstart.sh index 30c7b4ca..28491119 100755 --- a/packaging/installer/kickstart.sh +++ b/packaging/installer/kickstart.sh @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: GPL-3.0-or-later # -# Next unused error code: F050F +# Next unused error code: F0515 # ====================================================================== # Constants @@ -34,7 +34,7 @@ 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" -TELEMETRY_URL="https://posthog.netdata.cloud/capture/" +TELEMETRY_URL="https://app.posthog.com/capture/" # ====================================================================== # Defaults for environment variables @@ -44,14 +44,11 @@ SELECTED_INSTALL_METHOD="none" INSTALL_TYPE="unknown" INSTALL_PREFIX="" NETDATA_AUTO_UPDATES="default" -NETDATA_CLAIM_ONLY=0 NETDATA_CLAIM_URL="https://api.netdata.cloud" NETDATA_COMMAND="default" NETDATA_DISABLE_CLOUD=0 NETDATA_INSTALLER_OPTIONS="" -NETDATA_ONLY_BUILD=0 -NETDATA_ONLY_NATIVE=0 -NETDATA_ONLY_STATIC=0 +NETDATA_FORCE_METHOD="" NETDATA_OFFLINE_INSTALL_SOURCE="" NETDATA_REQUIRE_CLOUD=1 NETDATA_WARNINGS="" @@ -69,7 +66,7 @@ NETDATA_TARBALL_BASEURL="${NETDATA_TARBALL_BASEURL:-https://github.com/netdata/n TELEMETRY_API_KEY="${NETDATA_POSTHOG_API_KEY:-mqkwGT0JNFqO-zX2t0mW6Tec9yooaVu7xCBlXtHnt5Y}" if echo "${0}" | grep -q 'kickstart-static64'; then - NETDATA_ONLY_STATIC=1 + NETDATA_FORCE_METHOD='static' fi if [ ! -t 1 ]; then @@ -78,6 +75,8 @@ else INTERACTIVE=1 fi +CURL="$(PATH="${PATH}:/opt/netdata/bin" command -v curl 2>/dev/null && true)" + # ====================================================================== # Shared messages used in multiple places throughout the script. @@ -103,7 +102,7 @@ main() { uninstall cleanup - ACTION= + ACTION='' INSTALL_PREFIX="${NEW_INSTALL_PREFIX}" # shellcheck disable=SC2086 main @@ -175,12 +174,9 @@ USAGE: kickstart.sh [options] --auto-update Enable automatic updates. --auto-update-type Specify a particular scheduling type for auto-updates (valid types: systemd, interval, crontab) --disable-telemetry Opt-out of anonymous statistics. - --repositories-only Only install appropriate repository configuration packages (only for native install). --native-only Only install if native binary packages are available. --static-only Only install if a static build is available. --build-only Only install using a local build. - --reinstall Explicitly reinstall instead of updating any existing install. - --reinstall-even-if-unsafe Even try to reinstall if we don't think we can do so safely (implies --reinstall). --disable-cloud Disable support for Netdata Cloud (default: detect) --require-cloud Only install if Netdata Cloud can be enabled. Overrides --disable-cloud. --install-prefix <path> Specify an installation prefix for local builds (default: autodetect based on system type). @@ -188,13 +184,19 @@ USAGE: kickstart.sh [options] --install-version <version> Specify the version of Netdata to install. --claim-token Use a specified token for claiming to Netdata Cloud. --claim-rooms When claiming, add the node to the specified rooms. - --claim-only If there is an existing install, only try to claim it, not update it. --claim-* Specify other options for the claiming script. --no-cleanup Don't do any cleanup steps. This is intended to help with debugging the installer. - --uninstall Uninstall an existing installation of Netdata. - --reinstall-clean Clean reinstall Netdata. --local-build-options Specify additional options to pass to the installer code when building locally. Only valid if --build-only is also specified. --static-install-options Specify additional options to pass to the static installer code. Only valid if --static-only is also specified. + +The following options are mutually exclusive and specifiy special operations other than trying to install Netdata normally or update an existing install: + + --reinstall If there is an existing install, reinstall it instead of trying to update it. If there is no existing install, install netdata normally. + --reinstall-even-if-unsafe If there is an existing install, reinstall it instead of trying to update it, even if doing so is known to potentially break things. If there is no existing install, install Netdata normally. + --reinstall-clean If there is an existing install, uninstall it before trying to install Netdata. Fails if there is no existing install. + --uninstall Uninstall an existing installation of Netdata. Fails if there is no existing install. + --claim-only If there is an existing install, only try to claim it without attempting to update it. If there is no existing install, install and claim Netdata normally. + --repositories-only Only install repository configuration packages instead of doing a full install of Netdata. Automatically sets --native-only. --prepare-offline-install-source Instead of installing the agent, prepare a directory that can be used to install on another system without needing to download anything. Additionally, this script may use the following environment variables: @@ -299,8 +301,8 @@ telemetry_event() { EOF )" - if command -v curl > /dev/null 2>&1; then - curl --silent -o /dev/null -X POST --max-time 2 --header "Content-Type: application/json" -d "${REQ_BODY}" "${TELEMETRY_URL}" > /dev/null + if [ -n "${CURL}" ]; then + "${CURL}" --silent -o /dev/null -X POST --max-time 2 --header "Content-Type: application/json" -d "${REQ_BODY}" "${TELEMETRY_URL}" > /dev/null elif command -v wget > /dev/null 2>&1; then if wget --help 2>&1 | grep BusyBox > /dev/null 2>&1; then # BusyBox-compatible version of wget, there is no --no-check-certificate option @@ -329,9 +331,7 @@ trap_handler() { printf >&2 "%s\n\n" "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} ERROR ${TPUT_RESET} Installer exited unexpectedly (${code}-${lineno})" case "${code}" in - 0) - printf >&2 "%s\n" "This is almost certainly the result of a bug. If you have time, please report it at ${AGENT_BUG_REPORT_URL}." - ;; + 0) printf >&2 "%s\n" "This is almost certainly the result of a bug. If you have time, please report it at ${AGENT_BUG_REPORT_URL}." ;; *) printf >&2 "%s\n" "This is probably a result of a transient issue on your system. Things should work correctly if you try again." printf >&2 "%s\n" "If you continue to experience this issue, you can reacn out to us for support on:" @@ -406,7 +406,7 @@ success_banner() { cleanup() { if [ -z "${NO_CLEANUP}" ] && [ -n "${tmpdir}" ]; then cd || true - ${ROOTCMD} rm -rf "${tmpdir}" + run_as_root rm -rf "${tmpdir}" fi } @@ -497,6 +497,16 @@ run() { return ${ret} } +run_as_root() { + confirm_root_support + + if [ "$(id -u)" -ne "0" ]; then + printf >&2 "Root privileges required to run %s\n" "${*}" + fi + + run ${ROOTCMD} "${@}" +} + run_script() { set_tmpdir @@ -571,8 +581,8 @@ check_for_remote_file() { if echo "${url}" | grep -Eq "^file:///"; then [ -e "${url#file://}" ] || return 1 - elif command -v curl > /dev/null 2>&1; then - curl --output /dev/null --silent --head --fail "${url}" || return 1 + elif [ -n "${CURL}" ]; then + "${CURL}" --output /dev/null --silent --head --fail "${url}" || return 1 elif command -v wget > /dev/null 2>&1; then wget -S --spider "${url}" 2>&1 | grep -q 'HTTP/1.1 200 OK' || return 1 else @@ -586,8 +596,8 @@ download() { if echo "${url}" | grep -Eq "^file:///"; then run cp "${url#file://}" "${dest}" || return 1 - elif command -v curl > /dev/null 2>&1; then - run curl --fail -q -sSL --connect-timeout 10 --retry 3 --output "${dest}" "${url}" || return 1 + elif [ -n "${CURL}" ]; then + run "${CURL}" --fail -q -sSL --connect-timeout 10 --retry 3 --output "${dest}" "${url}" || return 1 elif command -v wget > /dev/null 2>&1; then run wget -T 15 -O "${dest}" "${url}" || return 1 else @@ -598,8 +608,8 @@ download() { get_redirect() { url="${1}" - if command -v curl > /dev/null 2>&1; then - run sh -c "curl ${url} -s -L -I -o /dev/null -w '%{url_effective}' | grep -o '[^/]*$'" || return 1 + if [ -n "${CURL}" ]; then + run sh -c "${CURL} ${url} -s -L -I -o /dev/null -w '%{url_effective}' | grep -o '[^/]*$'" || return 1 elif command -v wget > /dev/null 2>&1; then run sh -c "wget -S -O /dev/null ${url} 2>&1 | grep -m 1 Location | grep -o '[^/]*$'" || return 1 else @@ -620,75 +630,65 @@ safe_sha256sum() { } get_system_info() { + SYSARCH="$(uname -m)" + case "$(uname -s)" in Linux) SYSTYPE="Linux" - os_release_file= - if [ -s "/etc/os-release" ] && [ -r "/etc/os-release" ]; then - os_release_file="/etc/os-release" - elif [ -s "/usr/lib/os-release" ] && [ -r "/usr/lib/os-release" ]; then - os_release_file="/usr/lib/os-release" - else - warning "Cannot find usable OS release information. Native packages will not be available for this install." - fi - - if [ -n "${os_release_file}" ]; then - # shellcheck disable=SC1090 - . "${os_release_file}" - - DISTRO="${ID}" - SYSVERSION="${VERSION_ID}" - SYSCODENAME="${VERSION_CODENAME}" - SYSARCH="$(uname -m)" + if [ -z "${SKIP_DISTRO_DETECTION}" ]; then + os_release_file= + if [ -s "/etc/os-release" ] && [ -r "/etc/os-release" ]; then + os_release_file="/etc/os-release" + elif [ -s "/usr/lib/os-release" ] && [ -r "/usr/lib/os-release" ]; then + os_release_file="/usr/lib/os-release" + else + warning "Cannot find usable OS release information. Native packages will not be available for this install." + fi - supported_compat_names="debian ubuntu centos fedora opensuse ol arch" + if [ -n "${os_release_file}" ]; then + # shellcheck disable=SC1090 + . "${os_release_file}" - if str_in_list "${DISTRO}" "${supported_compat_names}"; then - DISTRO_COMPAT_NAME="${DISTRO}" + DISTRO="${ID}" + SYSVERSION="${VERSION_ID}" + SYSCODENAME="${VERSION_CODENAME}" 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" - ;; - esac + DISTRO="unknown" + DISTRO_COMPAT_NAME="unknown" + SYSVERSION="unknown" + SYSCODENAME="unknown" fi + else + warning "Distribution auto-detection overridden by user. This is not guaranteed to work, and is not officially supported." + fi - case "${DISTRO_COMPAT_NAME}" in - centos|ol) - SYSVERSION=$(echo "$SYSVERSION" | cut -d'.' -f1) - ;; - esac + supported_compat_names="debian ubuntu centos fedora opensuse ol amzn arch" + + if str_in_list "${DISTRO}" "${supported_compat_names}"; then + DISTRO_COMPAT_NAME="${DISTRO}" else - DISTRO="unknown" - DISTRO_COMPAT_NAME="unknown" - SYSVERSION="unknown" - SYSCODENAME="unknown" - SYSARCH="$(uname -m)" + 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" ;; + esac fi + + case "${DISTRO_COMPAT_NAME}" in + centos|ol) SYSVERSION=$(echo "$SYSVERSION" | cut -d'.' -f1) ;; + esac ;; Darwin) SYSTYPE="Darwin" SYSVERSION="$(sw_vers -buildVersion)" - SYSARCH="$(uname -m)" ;; FreeBSD) SYSTYPE="FreeBSD" SYSVERSION="$(uname -K)" - SYSARCH="$(uname -m)" - ;; - *) - fatal "Unsupported system type detected. Netdata cannot be installed on this system using this script." F0200 ;; + *) fatal "Unsupported system type detected. Netdata cannot be installed on this system using this script." F0200 ;; esac } @@ -800,6 +800,7 @@ uninstall() { return 0 else progress "Found existing netdata-uninstaller. Running it.." + # shellcheck disable=SC2086 if ! run_script "${uninstaller}" ${FLAGS}; then warning "Uninstaller failed. Some parts of Netdata may still be present on the system." fi @@ -813,6 +814,7 @@ uninstall() { progress "Downloading netdata-uninstaller ..." download "${uninstaller_url}" "${tmpdir}/netdata-uninstaller.sh" chmod +x "${tmpdir}/netdata-uninstaller.sh" + # shellcheck disable=SC2086 if ! run_script "${tmpdir}/netdata-uninstaller.sh" ${FLAGS}; then warning "Uninstaller failed. Some parts of Netdata may still be present on the system." fi @@ -858,7 +860,7 @@ detect_existing_install() { if [ -n "${ndprefix}" ]; then typefile="${ndprefix}/etc/netdata/.install-type" if [ -r "${typefile}" ]; then - ${ROOTCMD} sh -c "cat \"${typefile}\" > \"${tmpdir}/install-type\"" + run_as_root sh -c "cat \"${typefile}\" > \"${tmpdir}/install-type\"" # shellcheck disable=SC1090,SC1091 . "${tmpdir}/install-type" else @@ -868,7 +870,7 @@ detect_existing_install() { envfile="${ndprefix}/etc/netdata/.environment" if [ "${INSTALL_TYPE}" = "unknown" ] || [ "${INSTALL_TYPE}" = "custom" ]; then if [ -r "${envfile}" ]; then - ${ROOTCMD} sh -c "cat \"${envfile}\" > \"${tmpdir}/environment\"" + run_as_root sh -c "cat \"${envfile}\" > \"${tmpdir}/environment\"" # shellcheck disable=SC1091 . "${tmpdir}/environment" if [ -n "${NETDATA_IS_STATIC_INSTALL}" ]; then @@ -903,15 +905,15 @@ handle_existing_install() { progress "Found an existing netdata install at ${ndprefix}, with installation type '${INSTALL_TYPE}'." fi - if [ -n "${NETDATA_REINSTALL}" ] || [ -n "${NETDATA_UNSAFE_REINSTALL}" ]; then + if [ "${ACTION}" = "reinstall" ] || [ "${ACTION}" = "unsafe-reinstall" ]; then progress "Found an existing netdata install at ${ndprefix}, but user requested reinstall, continuing." case "${INSTALL_TYPE}" in - binpkg-*) NETDATA_ONLY_NATIVE=1 ;; - *-build) NETDATA_ONLY_BUILD=1 ;; - *-static) NETDATA_ONLY_STATIC=1 ;; + binpkg-*) NETDATA_FORCE_METHOD='native' ;; + *-build) NETDATA_FORCE_METHOD='build' ;; + *-static) NETDATA_FORCE_METHOD='static' ;; *) - if [ -n "${NETDATA_UNSAFE_REINSTALL}" ]; then + if [ "${ACTION}" = "unsafe-reinstall" ]; then warning "Reinstalling over top of a ${INSTALL_TYPE} installation may be unsafe, but the user has requested we proceed." elif [ "${INTERACTIVE}" -eq 0 ]; then fatal "User requested reinstall, but we cannot safely reinstall over top of a ${INSTALL_TYPE} installation, exiting." F0104 @@ -941,9 +943,9 @@ handle_existing_install() { 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?" fi - if [ "${INTERACTIVE}" -eq 0 ] && [ "${NETDATA_CLAIM_ONLY}" -eq 0 ]; then + if [ "${INTERACTIVE}" -eq 0 ] && [ "${ACTION}" != "claim" ]; then fatal "${failmsg}" F0106 - elif [ "${INTERACTIVE}" -eq 1 ] && [ "${NETDATA_CLAIM_ONLY}" -eq 0 ]; then + elif [ "${INTERACTIVE}" -eq 1 ] && [ "${ACTION}" != "claim" ]; then if confirm "${promptmsg}"; then progress "OK, continuing" else @@ -954,7 +956,7 @@ handle_existing_install() { ret=0 - if [ "${NETDATA_CLAIM_ONLY}" -eq 0 ]; then + if [ "${ACTION}" != "claim" ]; then if ! update; then warning "Failed to update existing Netdata install at ${ndprefix}." else @@ -969,7 +971,7 @@ handle_existing_install() { INSTALL_PREFIX="${ndprefix}" claim ret=$? - elif [ "${NETDATA_CLAIM_ONLY}" -eq 1 ]; then + elif [ "${ACTION}" = "claim" ]; then fatal "User asked to claim, but did not proide a claiming token." F0202 else progress "Not attempting to claim existing install at ${ndprefix} (no claiming token provided)." @@ -985,8 +987,8 @@ handle_existing_install() { fatal "This is an OCI container, use the regular container lifecycle management commands for your container tools instead of this script for managing it." F0203 ;; *) - if [ -n "${NETDATA_REINSTALL}" ] || [ -n "${NETDATA_UNSAFE_REINSTALL}" ]; then - if [ -n "${NETDATA_UNSAFE_REINSTALL}" ]; then + if [ "${ACTION}" = "reinstall" ] || [ "${ACTION}" = "unsafe-reinstall" ]; then + if [ "${ACTION}" = "unsafe-reinstall" ]; then warning "Reinstalling over top of a ${INSTALL_TYPE} installation may be unsafe, but the user has requested we proceed." elif [ "${INTERACTIVE}" -eq 0 ]; then fatal "User requested reinstall, but we cannot safely reinstall over top of a ${INSTALL_TYPE} installation, exiting." F0104 @@ -1007,7 +1009,7 @@ handle_existing_install() { cleanup trap - EXIT exit $ret - elif [ "${NETDATA_CLAIM_ONLY}" -eq 1 ]; then + elif [ "${ACTION}" = "claim" ]; then fatal "User asked to claim, but did not proide a claiming token." F0202 else fatal "Found an existing netdata install at ${ndprefix}, but the install type is '${INSTALL_TYPE}', which is not supported by this script, refusing to proceed." F0103 @@ -1022,30 +1024,30 @@ soft_disable_cloud() { cloud_prefix="${INSTALL_PREFIX}/var/lib/netdata/cloud.d" - run ${ROOTCMD} mkdir -p "${cloud_prefix}" + run_as_root mkdir -p "${cloud_prefix}" cat > "${tmpdir}/cloud.conf" << EOF [global] enabled = no EOF - run ${ROOTCMD} cp "${tmpdir}/cloud.conf" "${cloud_prefix}/cloud.conf" + run_as_root cp "${tmpdir}/cloud.conf" "${cloud_prefix}/cloud.conf" if [ -z "${NETDATA_NO_START}" ]; then case "${SYSTYPE}" in - Darwin) run ${ROOTCMD} launchctl kickstart -k com.github.netdata ;; - FreeBSD) run ${ROOTCMD} service netdata restart ;; + Darwin) run_as_root launchctl kickstart -k com.github.netdata ;; + FreeBSD) run_as_root service netdata restart ;; Linux) - initpath="$(${ROOTCMD} readlink /proc/1/exe)" + initpath="$(run_as_root readlink /proc/1/exe)" if command -v service > /dev/null 2>&1; then - run ${ROOTCMD} service netdata restart + run_as_root service netdata restart elif command -v rc-service > /dev/null 2>&1; then - run ${ROOTCMD} rc-service netdata restart + run_as_root rc-service netdata restart elif [ "$(basename "${initpath}" 2> /dev/null)" = "systemd" ]; then - run ${ROOTCMD} systemctl restart netdata + run_as_root systemctl restart netdata elif [ -f /etc/init.d/netdata ]; then - run ${ROOTCMD} /etc/init.d/netdata restart + run_as_root /etc/init.d/netdata restart fi ;; esac @@ -1053,7 +1055,7 @@ EOF } confirm_install_prefix() { - if [ -n "${INSTALL_PREFIX}" ] && [ "${NETDATA_ONLY_BUILD}" -ne 1 ]; then + if [ -n "${INSTALL_PREFIX}" ] && [ "${NETDATA_FORCE_METHOD}" != 'build' ]; then fatal "The --install-prefix option is only supported together with the --build-only option." F0204 fi @@ -1135,8 +1137,14 @@ claim() { NETDATA_CLAIM_PATH="${INSTALL_PREFIX}/netdata/usr/sbin/netdata-claim.sh" fi - if [ ! -x "${NETDATA_CLAIM_PATH}" ]; then + if [ -z "${NETDATA_CLAIM_PATH}" ]; then fatal "Unable to find usable claiming script. Reinstalling Netdata may resolve this." F050B + elif [ ! -e "${NETDATA_CLAIM_PATH}" ]; then + fatal "${NETDATA_CLAIM_PATH} does not exist." F0512 + elif [ ! -f "${NETDATA_CLAIM_PATH}" ]; then + fatal "${NETDATA_CLAIM_PATH} is not a file." F0513 + elif [ ! -x "${NETDATA_CLAIM_PATH}" ]; then + fatal "Claiming script at ${NETDATA_CLAIM_PATH} is not executable. Reinstalling Netdata may resolve this." F0514 fi if ! is_netdata_running; then @@ -1144,58 +1152,30 @@ claim() { fi # shellcheck disable=SC2086 - run ${ROOTCMD} "${NETDATA_CLAIM_PATH}" -token="${NETDATA_CLAIM_TOKEN}" -rooms="${NETDATA_CLAIM_ROOMS}" -url="${NETDATA_CLAIM_URL}" ${NETDATA_CLAIM_EXTRA} + run_as_root "${NETDATA_CLAIM_PATH}" -token="${NETDATA_CLAIM_TOKEN}" -rooms="${NETDATA_CLAIM_ROOMS}" -url="${NETDATA_CLAIM_URL}" ${NETDATA_CLAIM_EXTRA} case $? in 0) progress "Successfully claimed node" return 0 ;; - 1) - warning "Unable to claim node due to invalid claiming options. If you are seeing this message, you’ve probably found a bug and should open a bug report at ${AGENT_BUG_REPORT_URL}" - ;; - 2) - warning "Unable to claim node due to issues creating the claiming directory or preparing the local claiming key. Make sure you have a working openssl command and that ${INSTALL_PREFIX}/var/lib/netdata/cloud.d exists, then try again." - ;; - 3) - warning "Unable to claim node due to missing dependencies. Usually this means that the Netdata Agent was built without support for Netdata Cloud. If you built the agent from source, please install all needed dependencies for Cloud support. If you used the regular installation script and see this error, please file a bug report at ${AGENT_BUG_REPORT_URL}." - ;; - 4) - warning "Failed to claim node due to inability to connect to ${NETDATA_CLAIM_URL}. Usually this either means that the specified claiming URL is wrong, or that you are having networking problems." - ;; + 1) warning "Unable to claim node due to invalid claiming options. If you are seeing this message, you’ve probably found a bug and should open a bug report at ${AGENT_BUG_REPORT_URL}" ;; + 2) warning "Unable to claim node due to issues creating the claiming directory or preparing the local claiming key. Make sure you have a working openssl command and that ${INSTALL_PREFIX}/var/lib/netdata/cloud.d exists, then try again." ;; + 3) warning "Unable to claim node due to missing dependencies. Usually this means that the Netdata Agent was built without support for Netdata Cloud. If you built the agent from source, please install all needed dependencies for Cloud support. If you used the regular installation script and see this error, please file a bug report at ${AGENT_BUG_REPORT_URL}." ;; + 4) warning "Failed to claim node due to inability to connect to ${NETDATA_CLAIM_URL}. Usually this either means that the specified claiming URL is wrong, or that you are having networking problems." ;; 5) progress "Successfully claimed node, but was not able to notify the Netdata Agent. You will need to restart the Netdata service on this node before it will show up in the Cloud." return 0 ;; - 8) - warning "Failed to claim node due to an invalid agent ID. You can usually resolve this by removing ${INSTALL_PREFIX}/var/lib/netdata/registry/netdata.public.unique.id and restarting the agent. Then try to claim it again using the same options." - ;; - 9) - warning "Failed to claim node due to an invalid node name. This probably means you tried to specify a custom name for this node (for example, using the --claim-hostname option), but the hostname itself was either empty or consisted solely of whitespace. You can resolve this by specifying a valid host name and trying again." - ;; - 10) - warning "Failed to claim node due to an invalid room ID. This issue is most likely caused by a typo. Please check if the room(s) you are trying to add appear on the list of rooms provided to the --claim-rooms option ('${NETDATA_CLAIM_ROOMS}'). Then verify if the rooms are visible in Netdata Cloud and try again." - ;; - 11) - warning "Failed to claim node due to an issue with the generated RSA key pair. You can usually resolve this by removing all files in ${INSTALL_PREFIX}/var/lib/netdata/cloud.d and then trying again." - ;; - 12) - warning "Failed to claim node due to an invalid or expired claiming token. Please check that the token specified with the --claim-token option ('${NETDATA_CLAIM_TOKEN}') matches what you see in the Cloud and try again." - ;; - 13) - warning "Failed to claim node because the Cloud thinks it is already claimed. If this node was created by cloning a VM or as a container from a template, please remove the file ${INSTALL_PREFIX}/var/lib/netdata/registry/netdata.public.unique.id and restart the agent. Then try to claim it again with the same options. Otherwise, if you are certain this node has never been claimed before, you can use the --claim-id option to specify a new node ID to use for claiming, for example by using the uuidgen command like so: --claim-id \"\$(uuidgen)\"" - ;; - 14) - warning "Failed to claim node because the node is already in the process of being claimed. You should not need to do anything to resolve this, the node should show up properly in the Cloud soon. If it does not, please report a bug at ${AGENT_BUG_REPORT_URL}." - ;; - 15|16|17) - warning "Failed to claim node due to an internal server error in the Cloud. Please retry claiming this node later, and if you still see this message file a bug report at ${CLOUD_BUG_REPORT_URL}." - ;; - 18) - warning "Unable to claim node because this Netdata installation does not have a unique ID yet. Make sure the agent is running and started up correctly, and then try again." - ;; - *) - warning "Failed to claim node for an unknown reason. This usually means either networking problems or a bug. Please retry claiming later, and if you still see this message file a bug report at ${AGENT_BUG_REPORT_URL}" - ;; + 8) warning "Failed to claim node due to an invalid agent ID. You can usually resolve this by removing ${INSTALL_PREFIX}/var/lib/netdata/registry/netdata.public.unique.id and restarting the agent. Then try to claim it again using the same options." ;; + 9) warning "Failed to claim node due to an invalid node name. This probably means you tried to specify a custom name for this node (for example, using the --claim-hostname option), but the hostname itself was either empty or consisted solely of whitespace. You can resolve this by specifying a valid host name and trying again." ;; + 10) warning "Failed to claim node due to an invalid room ID. This issue is most likely caused by a typo. Please check if the room(s) you are trying to add appear on the list of rooms provided to the --claim-rooms option ('${NETDATA_CLAIM_ROOMS}'). Then verify if the rooms are visible in Netdata Cloud and try again." ;; + 11) warning "Failed to claim node due to an issue with the generated RSA key pair. You can usually resolve this by removing all files in ${INSTALL_PREFIX}/var/lib/netdata/cloud.d and then trying again." ;; + 12) warning "Failed to claim node due to an invalid or expired claiming token. Please check that the token specified with the --claim-token option ('${NETDATA_CLAIM_TOKEN}') matches what you see in the Cloud and try again." ;; + 13) warning "Failed to claim node because the Cloud thinks it is already claimed. If this node was created by cloning a VM or as a container from a template, please remove the file ${INSTALL_PREFIX}/var/lib/netdata/registry/netdata.public.unique.id and restart the agent. Then try to claim it again with the same options. Otherwise, if you are certain this node has never been claimed before, you can use the --claim-id option to specify a new node ID to use for claiming, for example by using the uuidgen command like so: --claim-id \"\$(uuidgen)\"" ;; + 14) warning "Failed to claim node because the node is already in the process of being claimed. You should not need to do anything to resolve this, the node should show up properly in the Cloud soon. If it does not, please report a bug at ${AGENT_BUG_REPORT_URL}." ;; + 15|16|17) warning "Failed to claim node due to an internal server error in the Cloud. Please retry claiming this node later, and if you still see this message file a bug report at ${CLOUD_BUG_REPORT_URL}." ;; + 18) warning "Unable to claim node because this Netdata installation does not have a unique ID yet. Make sure the agent is running and started up correctly, and then try again." ;; + *) warning "Failed to claim node for an unknown reason. This usually means either networking problems or a bug. Please retry claiming later, and if you still see this message file a bug report at ${AGENT_BUG_REPORT_URL}" ;; esac if [ -z "${NETDATA_NEW_INSTALL}" ]; then @@ -1224,16 +1204,16 @@ set_auto_updates() { if [ "${DRY_RUN}" -eq 1 ]; then progress "Would have attempted to enable automatic updates." # This first case is for catching using a new kickstart script with an old build. It can be safely removed after v1.34.0 is released. - elif ! grep -q '\-\-enable-auto-updates' ${updater}; then + elif ! grep -q '\-\-enable-auto-updates' "${updater}"; then echo - elif ! ${ROOTCMD} ${updater} --enable-auto-updates "${NETDATA_AUTO_UPDATE_TYPE}"; then + elif ! run_as_root "${updater}" --enable-auto-updates "${NETDATA_AUTO_UPDATE_TYPE}"; then warning "Failed to enable auto updates. Netdata will still work, but you will need to update manually." fi else if [ "${DRY_RUN}" -eq 1 ]; then progress "Would have attempted to disable automatic updates." else - ${ROOTCMD} ${updater} --disable-auto-updates + run_as_root "${updater}" --disable-auto-updates fi fi } @@ -1251,7 +1231,7 @@ pkg_installed() { dpkg-query --show --showformat '${Status}' "${1}" 2>&1 | cut -f 1 -d ' ' | grep -q '^install$' return $? ;; - centos|fedora|opensuse|ol) + centos|fedora|opensuse|ol|amzn) rpm -q "${1}" > /dev/null 2>&1 return $? ;; @@ -1263,9 +1243,7 @@ pkg_installed() { pacman -Qi "${1}" > /dev/null 2>&1 return $? ;; - *) - return 1 - ;; + *) return 1 ;; esac ;; Darwin) @@ -1295,7 +1273,7 @@ netdata_avail_check() { env DEBIAN_FRONTEND=noninteractive apt-cache policy netdata | grep -q repo.netdata.cloud/repos/; return $? ;; - centos|fedora|ol) + centos|fedora|ol|amzn) # shellcheck disable=SC2086 ${pm_cmd} search --nogpgcheck -v netdata | grep -qE 'Repo *: netdata(-edge)?$' return $? @@ -1304,9 +1282,7 @@ netdata_avail_check() { zypper packages -r "$(zypper repos | grep -E 'netdata |netdata-edge ' | cut -f 1 -d '|' | tr -d ' ')" | grep -E 'netdata ' return $? ;; - *) - return 1 - ;; + *) return 1 ;; esac } @@ -1323,7 +1299,7 @@ check_special_native_deps() { progress "EPEL is available, attempting to install so that required dependencies are available." # shellcheck disable=SC2086 - if ! run ${ROOTCMD} env ${env} ${pm_cmd} install ${pkg_install_opts} epel-release; then + if ! run_as_root env ${env} ${pm_cmd} install ${pkg_install_opts} epel-release; then warning "Failed to install EPEL, even though it is required to install native packages on this system." return 1 fi @@ -1334,12 +1310,39 @@ check_special_native_deps() { fi } +common_rpm_opts() { + pkg_type="rpm" + pkg_suffix=".noarch" + pkg_vsep="-" + INSTALL_TYPE="binpkg-rpm" + NATIVE_VERSION="${INSTALL_VERSION:+"-${INSTALL_VERSION}.${SYSARCH}"}" +} + +common_dnf_opts() { + if command -v dnf > /dev/null; then + pm_cmd="dnf" + repo_subcmd="makecache" + else + pm_cmd="yum" + fi + pkg_install_opts="${interactive_opts}" + repo_update_opts="${interactive_opts}" + uninstall_subcmd="remove" +} + try_package_install() { failed_refresh_msg="Failed to refresh repository metadata. ${BADNET_MSG} or by misconfiguration of one or more rpackage repositories in the system package manager configuration." - if [ -z "${DISTRO}" ] || [ "${DISTRO}" = "unknown" ]; then + if [ -z "${DISTRO_COMPAT_NAME}" ] || [ "${DISTRO_COMPAT_NAME}" = "unknown" ]; then warning "Unable to determine Linux distribution for native packages." return 2 + elif [ -z "${SYSCODENAME}" ]; then + case "${DISTRO_COMPAT_NAME}" in + debian|ubuntu) + warning "Release codename not set. Unable to check availability of native packages for this system." + return 2 + ;; + esac fi set_tmpdir @@ -1365,97 +1368,43 @@ try_package_install() { fi case "${DISTRO_COMPAT_NAME}" in - debian) - needs_early_refresh=1 - pm_cmd="apt-get" - repo_subcmd="update" - repo_prefix="debian/${SYSCODENAME}" - pkg_type="deb" - pkg_suffix="+debian${SYSVERSION}_all" - pkg_vsep="_" - pkg_install_opts="${interactive_opts}" - repo_update_opts="${interactive_opts}" - uninstall_subcmd="purge" - INSTALL_TYPE="binpkg-deb" - NATIVE_VERSION="${INSTALL_VERSION:+"=${INSTALL_VERSION}"}" - ;; - ubuntu) + debian|ubuntu) needs_early_refresh=1 pm_cmd="apt-get" repo_subcmd="update" - repo_prefix="ubuntu/${SYSCODENAME}" pkg_type="deb" - pkg_suffix="+ubuntu${SYSVERSION}_all" pkg_vsep="_" pkg_install_opts="${interactive_opts}" repo_update_opts="${interactive_opts}" uninstall_subcmd="purge" + repo_prefix="${DISTRO_COMPAT_NAME}/${SYSCODENAME}" + pkg_suffix="+${DISTRO_COMPAT_NAME}${SYSVERSION}_all" INSTALL_TYPE="binpkg-deb" NATIVE_VERSION="${INSTALL_VERSION:+"=${INSTALL_VERSION}"}" ;; centos) - if command -v dnf > /dev/null; then - pm_cmd="dnf" - repo_subcmd="makecache" - else - pm_cmd="yum" - fi + common_rpm_opts + common_dnf_opts repo_prefix="el/${SYSVERSION}" - pkg_type="rpm" - pkg_suffix=".noarch" - pkg_vsep="-" - pkg_install_opts="${interactive_opts}" - repo_update_opts="${interactive_opts}" - uninstall_subcmd="remove" - INSTALL_TYPE="binpkg-rpm" - NATIVE_VERSION="${INSTALL_VERSION:+"-${INSTALL_VERSION}.${SYSARCH}"}" ;; - fedora) - if command -v dnf > /dev/null; then - pm_cmd="dnf" - repo_subcmd="makecache" - else - pm_cmd="yum" - fi - repo_prefix="fedora/${SYSVERSION}" - pkg_type="rpm" - pkg_suffix=".noarch" - pkg_vsep="-" - pkg_install_opts="${interactive_opts}" - repo_update_opts="${interactive_opts}" - uninstall_subcmd="remove" - INSTALL_TYPE="binpkg-rpm" - NATIVE_VERSION="${INSTALL_VERSION:+"-${INSTALL_VERSION}.${SYSARCH}"}" + fedora|ol) + common_rpm_opts + common_dnf_opts + repo_prefix="${DISTRO_COMPAT_NAME}/${SYSVERSION}" ;; opensuse) + common_rpm_opts pm_cmd="zypper" repo_subcmd="--gpg-auto-import-keys refresh" repo_prefix="opensuse/${SYSVERSION}" - pkg_type="rpm" - pkg_suffix=".noarch" - pkg_vsep="-" pkg_install_opts="${interactive_opts} --allow-unsigned-rpm" repo_update_opts="" uninstall_subcmd="remove" - INSTALL_TYPE="binpkg-rpm" - NATIVE_VERSION="${INSTALL_VERSION:+"-${INSTALL_VERSION}.${SYSARCH}"}" ;; - ol) - if command -v dnf > /dev/null; then - pm_cmd="dnf" - repo_subcmd="makecache" - else - pm_cmd="yum" - fi - repo_prefix="ol/${SYSVERSION}" - pkg_type="rpm" - pkg_suffix=".noarch" - pkg_vsep="-" - pkg_install_opts="${interactive_opts}" - repo_update_opts="${interactive_opts}" - uninstall_subcmd="remove" - INSTALL_TYPE="binpkg-rpm" - NATIVE_VERSION="${INSTALL_VERSION:+"-${INSTALL_VERSION}.${SYSARCH}"}" + amzn) + common_rpm_opts + common_dnf_opts + repo_prefix="amazonlinux/${SYSVERSION}" ;; *) warning "We do not provide native packages for ${DISTRO}." @@ -1463,6 +1412,10 @@ try_package_install() { ;; esac + if [ -n "${SKIP_DISTRO_DETECTION}" ]; then + warning "Attempting to use native packages with a distro override. This is not officially supported, but may work in some cases. If your system requires a distro override to use native packages, please open an feature request at ${AGENT_BUG_REPORT_URL} about it so that we can update the installer to auto-detect this." + fi + if [ -n "${INSTALL_VERSION}" ]; then if echo "${INSTALL_VERSION}" | grep -q "nightly"; then new_release="-edge" @@ -1503,21 +1456,21 @@ try_package_install() { if [ -n "${needs_early_refresh}" ]; then # shellcheck disable=SC2086 - if ! run ${ROOTCMD} env ${env} ${pm_cmd} ${repo_subcmd} ${repo_update_opts}; then + if ! run_as_root env ${env} ${pm_cmd} ${repo_subcmd} ${repo_update_opts}; then warning "${failed_refresh_msg}" return 2 fi fi # shellcheck disable=SC2086 - if ! run ${ROOTCMD} env ${env} ${pm_cmd} install ${pkg_install_opts} "${tmpdir}/${repoconfig_file}"; then + if ! run_as_root env ${env} ${pm_cmd} install ${pkg_install_opts} "${tmpdir}/${repoconfig_file}"; then warning "Failed to install repository configuration package." return 2 fi if [ -n "${repo_subcmd}" ]; then # shellcheck disable=SC2086 - if ! run ${ROOTCMD} env ${env} ${pm_cmd} ${repo_subcmd} ${repo_update_opts}; then + if ! run_as_root env ${env} ${pm_cmd} ${repo_subcmd} ${repo_update_opts}; then fatal "${failed_refresh_msg}" F0205 fi fi @@ -1525,8 +1478,8 @@ try_package_install() { progress "Repository configuration is already present, attempting to install netdata." fi - if [ "${REPO_ACTION}" = "repositories-only" ]; then - progress "Successfully installed repository configuration package." + if [ "${ACTION}" = "repositories-only" ]; then + progress "Successfully installed repository configuraion package." deferred_warnings cleanup trap - EXIT @@ -1538,7 +1491,7 @@ try_package_install() { if [ -z "${NO_CLEANUP}" ]; then progress "Attempting to uninstall repository configuration package." # shellcheck disable=SC2086 - run ${ROOTCMD} env ${env} ${pm_cmd} ${uninstall_subcmd} ${pkg_install_opts} "${repoconfig_name}" + run_as_root env ${env} ${pm_cmd} ${uninstall_subcmd} ${pkg_install_opts} "${repoconfig_name}" fi return 2 fi @@ -1548,23 +1501,23 @@ try_package_install() { if [ -z "${NO_CLEANUP}" ]; then progress "Attempting to uninstall repository configuration package." # shellcheck disable=SC2086 - run ${ROOTCMD} env ${env} ${pm_cmd} ${uninstall_subcmd} ${pkg_install_opts} "${repoconfig_name}" + run_as_root env ${env} ${pm_cmd} ${uninstall_subcmd} ${pkg_install_opts} "${repoconfig_name}" fi return 2 fi if [ "${NETDATA_DISABLE_TELEMETRY}" -eq 1 ]; then - run ${ROOTCMD} mkdir -p "/etc/netdata" - run ${ROOTCMD} touch "/etc/netdata/.opt-out-from-anonymous-statistics" + run_as_root mkdir -p "/etc/netdata" + run_as_root touch "/etc/netdata/.opt-out-from-anonymous-statistics" fi # shellcheck disable=SC2086 - if ! run ${ROOTCMD} env ${env} ${pm_cmd} install ${pkg_install_opts} "netdata${NATIVE_VERSION}"; then + if ! run_as_root env ${env} ${pm_cmd} install ${pkg_install_opts} "netdata${NATIVE_VERSION}"; then warning "Failed to install Netdata package." if [ -z "${NO_CLEANUP}" ]; then progress "Attempting to uninstall repository configuration package." # shellcheck disable=SC2086 - run ${ROOTCMD} env ${env} ${pm_cmd} ${uninstall_subcmd} ${pkg_install_opts} "${repoconfig_name}" + run_as_root env ${env} ${pm_cmd} ${uninstall_subcmd} ${pkg_install_opts} "${repoconfig_name}" fi return 2 fi @@ -1657,7 +1610,7 @@ try_static_install() { progress "Installing netdata" # shellcheck disable=SC2086 - if ! run ${ROOTCMD} sh "${tmpdir}/${netdata_agent}" ${opts} -- ${NETDATA_INSTALLER_OPTIONS}; then + if ! run_as_root sh "${tmpdir}/${netdata_agent}" ${opts} -- ${NETDATA_INSTALLER_OPTIONS}; then warning "Failed to install static build of Netdata on ${SYSARCH}." run rm -rf /opt/netdata return 2 @@ -1666,16 +1619,16 @@ try_static_install() { if [ "${DRY_RUN}" -ne 1 ]; then install_type_file="/opt/netdata/etc/netdata/.install-type" if [ -f "${install_type_file}" ]; then - ${ROOTCMD} sh -c "cat \"${install_type_file}\" > \"${tmpdir}/install-type\"" - ${ROOTCMD} chown "$(id -u)":"$(id -g)" "${tmpdir}/install-type" + run_as_root sh -c "cat \"${install_type_file}\" > \"${tmpdir}/install-type\"" + run_as_root chown "$(id -u)":"$(id -g)" "${tmpdir}/install-type" # shellcheck disable=SC1090,SC1091 . "${tmpdir}/install-type" cat > "${tmpdir}/install-type" <<- EOF INSTALL_TYPE='kickstart-static' PREBUILT_ARCH='${PREBUILT_ARCH}' EOF - ${ROOTCMD} chown netdata:netdata "${tmpdir}/install-type" - ${ROOTCMD} cp "${tmpdir}/install-type" "${install_type_file}" + run_as_root chown netdata:netdata "${tmpdir}/install-type" + run_as_root cp "${tmpdir}/install-type" "${install_type_file}" fi fi } @@ -1728,14 +1681,8 @@ install_local_build_dependencies() { opts="--dont-wait --non-interactive" fi - if [ "${SYSTYPE}" = "Darwin" ]; then - sudo="" - else - sudo="${ROOTCMD}" - fi - # shellcheck disable=SC2086 - if ! run ${sudo} "${bash}" "${tmpdir}/install-required-packages.sh" ${opts} netdata; then + if ! run_as_root "${bash}" "${tmpdir}/install-required-packages.sh" ${opts} netdata; then warning "Failed to install all required packages, but installation might still be possible." fi } @@ -1776,9 +1723,7 @@ build_and_install() { fatal "netdata-installer.sh failed to run: Encountered an unhandled error in the installer code." I0000 fi ;; - 2) - fatal "Insufficient RAM to install netdata." F0008 - ;; + 2) fatal "Insufficient RAM to install netdata." F0008 ;; esac } @@ -1858,34 +1803,36 @@ prepare_offline_install_source() { run cd "${1}" || fatal "Failed to switch to target directory for offline install preparation." F0505 - if [ "${NETDATA_ONLY_NATIVE}" -ne 1 ] && [ "${NETDATA_ONLY_BUILD}" -ne 1 ]; then - set_static_archive_urls "${SELECTED_RELEASE_CHANNEL}" "x86_64" + case "${NETDATA_FORCE_METHOD}" in + static|'') + set_static_archive_urls "${SELECTED_RELEASE_CHANNEL}" "x86_64" - if check_for_remote_file "${NETDATA_STATIC_ARCHIVE_URL}"; then - for arch in ${STATIC_INSTALL_ARCHES}; do - set_static_archive_urls "${SELECTED_RELEASE_CHANNEL}" "${arch}" + if check_for_remote_file "${NETDATA_STATIC_ARCHIVE_URL}"; then + for arch in ${STATIC_INSTALL_ARCHES}; do + set_static_archive_urls "${SELECTED_RELEASE_CHANNEL}" "${arch}" - progress "Fetching ${NETDATA_STATIC_ARCHIVE_URL}" - if ! download "${NETDATA_STATIC_ARCHIVE_URL}" "netdata-${arch}-latest.gz.run"; then - warning "Failed to download static installer archive for ${arch}. ${BADNET_MSG}." - fi - done - legacy=0 - else - warning "Selected version of Netdata only provides static builds for x86_64. You will only be able to install on x86_64 systems with this offline install source." - progress "Fetching ${NETDATA_STATIC_ARCHIVE_OLD_URL}" - legacy=1 + progress "Fetching ${NETDATA_STATIC_ARCHIVE_URL}" + if ! download "${NETDATA_STATIC_ARCHIVE_URL}" "netdata-${arch}-latest.gz.run"; then + warning "Failed to download static installer archive for ${arch}. ${BADNET_MSG}." + fi + done + legacy=0 + else + warning "Selected version of Netdata only provides static builds for x86_64. You will only be able to install on x86_64 systems with this offline install source." + progress "Fetching ${NETDATA_STATIC_ARCHIVE_OLD_URL}" + legacy=1 - if ! download "${NETDATA_STATIC_ARCHIVE_OLD_URL}" "netdata-x86_64-latest.gz.run"; then - warning "Failed to download static installer archive for x86_64. ${BADNET_MSG}." + if ! download "${NETDATA_STATIC_ARCHIVE_OLD_URL}" "netdata-x86_64-latest.gz.run"; then + warning "Failed to download static installer archive for x86_64. ${BADNET_MSG}." + fi fi - fi - progress "Fetching ${NETDATA_STATIC_ARCHIVE_CHECKSUM_URL}" - if ! download "${NETDATA_STATIC_ARCHIVE_CHECKSUM_URL}" "sha256sums.txt"; then - fatal "Failed to download checksum file. ${BADNET_MSG}." F0506 - fi - fi + progress "Fetching ${NETDATA_STATIC_ARCHIVE_CHECKSUM_URL}" + if ! download "${NETDATA_STATIC_ARCHIVE_CHECKSUM_URL}" "sha256sums.txt"; then + fatal "Failed to download checksum file. ${BADNET_MSG}." F0506 + fi + ;; + esac if [ "${legacy:-0}" -eq 1 ]; then sed -e 's/netdata-latest.gz.run/netdata-x86_64-latest.gz.run' sha256sums.txt > sha256sums.tmp @@ -1935,7 +1882,7 @@ prepare_offline_install_source() { # Per system-type install logic install_on_linux() { - if [ "${NETDATA_ONLY_STATIC}" -ne 1 ] && [ "${NETDATA_ONLY_BUILD}" -ne 1 ] && [ -z "${NETDATA_OFFLINE_INSTALL_SOURCE}" ]; then + if [ "${NETDATA_FORCE_METHOD}" != 'static' ] && [ "${NETDATA_FORCE_METHOD}" != 'build' ] && [ -z "${NETDATA_OFFLINE_INSTALL_SOURCE}" ]; then SELECTED_INSTALL_METHOD="native" try_package_install @@ -1944,20 +1891,17 @@ install_on_linux() { NETDATA_INSTALL_SUCCESSFUL=1 INSTALL_PREFIX="/" ;; - 1) - fatal "Unable to install on this system." F0300 - ;; + 1) fatal "Unable to install on this system." F0300 ;; 2) - if [ "${NETDATA_ONLY_NATIVE}" -eq 1 ]; then - fatal "Could not install native binary packages." F0301 - else - warning "Could not install native binary packages, falling back to alternative installation method." - fi + case "${NETDATA_FORCE_METHOD}" in + native) fatal "Could not install native binary packages." F0301 ;; + *) warning "Could not install native binary packages, falling back to alternative installation method." ;; + esac ;; esac fi - if [ "${NETDATA_ONLY_NATIVE}" -ne 1 ] && [ "${NETDATA_ONLY_BUILD}" -ne 1 ] && [ -z "${NETDATA_INSTALL_SUCCESSFUL}" ]; then + if [ "${NETDATA_FORCE_METHOD}" != 'native' ] && [ "${NETDATA_FORCE_METHOD}" != 'build' ] && [ -z "${NETDATA_INSTALL_SUCCESSFUL}" ]; then SELECTED_INSTALL_METHOD="static" INSTALL_TYPE="kickstart-static" try_static_install @@ -1967,75 +1911,60 @@ install_on_linux() { NETDATA_INSTALL_SUCCESSFUL=1 INSTALL_PREFIX="/opt/netdata" ;; - 1) - fatal "Unable to install on this system." F0302 - ;; + 1) fatal "Unable to install on this system." F0302 ;; 2) - if [ "${NETDATA_ONLY_STATIC}" -eq 1 ]; then - fatal "Could not install static build." F0303 - else - warning "Could not install static build, falling back to alternative installation method." - fi + case "${NETDATA_FORCE_METHOD}" in + static) fatal "Could not install static build." F0303 ;; + *) warning "Could not install static build, falling back to alternative installation method." ;; + esac ;; esac fi - if [ "${NETDATA_ONLY_NATIVE}" -ne 1 ] && [ "${NETDATA_ONLY_STATIC}" -ne 1 ] && [ -z "${NETDATA_INSTALL_SUCCESSFUL}" ]; then + if [ "${NETDATA_FORCE_METHOD}" != 'native' ] && [ "${NETDATA_FORCE_METHOD}" != 'static' ] && [ -z "${NETDATA_INSTALL_SUCCESSFUL}" ]; then SELECTED_INSTALL_METHOD="build" INSTALL_TYPE="kickstart-build" try_build_install case "$?" in - 0) - NETDATA_INSTALL_SUCCESSFUL=1 - ;; - *) - fatal "Unable to install on this system." F0304 - ;; + 0) NETDATA_INSTALL_SUCCESSFUL=1 ;; + *) fatal "Unable to install on this system." F0304 ;; esac fi } install_on_macos() { - if [ "${NETDATA_ONLY_NATIVE}" -eq 1 ]; then - fatal "User requested native package, but native packages are not available for macOS. Try installing without \`--only-native\` option." F0305 - elif [ "${NETDATA_ONLY_STATIC}" -eq 1 ]; then - fatal "User requested static build, but static builds are not available for macOS. Try installing without \`--only-static\` option." F0306 - else - SELECTED_INSTALL_METHOD="build" - INSTALL_TYPE="kickstart-build" - try_build_install + case "${NETDATA_FORCE_METHOD}" in + native) fatal "User requested native package, but native packages are not available for macOS. Try installing without \`--only-native\` option." F0305 ;; + static) fatal "User requested static build, but static builds are not available for macOS. Try installing without \`--only-static\` option." F0306 ;; + *) + SELECTED_INSTALL_METHOD="build" + INSTALL_TYPE="kickstart-build" + try_build_install - case "$?" in - 0) - NETDATA_INSTALL_SUCCESSFUL=1 - ;; - *) - fatal "Unable to install on this system." F0307 - ;; - esac - fi + case "$?" in + 0) NETDATA_INSTALL_SUCCESSFUL=1 ;; + *) fatal "Unable to install on this system." F0307 ;; + esac + ;; + esac } install_on_freebsd() { - if [ "${NETDATA_ONLY_NATIVE}" -eq 1 ]; then - fatal "User requested native package, but native packages are not available for FreeBSD. Try installing without \`--only-native\` option." F0308 - elif [ "${NETDATA_ONLY_STATIC}" -eq 1 ]; then - fatal "User requested static build, but static builds are not available for FreeBSD. Try installing without \`--only-static\` option." F0309 - else - SELECTED_INSTALL_METHOD="build" - INSTALL_TYPE="kickstart-build" - try_build_install + case "${NETDATA_FORCE_METHOD}" in + native) fatal "User requested native package, but native packages are not available for FreeBSD. Try installing without \`--only-native\` option." F0308 ;; + static) fatal "User requested static build, but static builds are not available for FreeBSD. Try installing without \`--only-static\` option." F0309 ;; + *) + SELECTED_INSTALL_METHOD="build" + INSTALL_TYPE="kickstart-build" + try_build_install - case "$?" in - 0) - NETDATA_INSTALL_SUCCESSFUL=1 - ;; - *) - fatal "Unable to install on this system." F030A - ;; - esac - fi + case "$?" in + 0) NETDATA_INSTALL_SUCCESSFUL=1 ;; + *) fatal "Unable to install on this system." F030A ;; + esac + ;; + esac } # ====================================================================== @@ -2044,26 +1973,32 @@ install_on_freebsd() { validate_args() { check_claim_opts + if [ -n "${NETDATA_FORCE_METHOD}" ]; then + SELECTED_INSTALL_METHOD="${NETDATA_FORCE_METHOD}" + fi + + if [ "${ACTION}" = "repositories-only" ] && [ "${NETDATA_FORCE_METHOD}" != "native" ]; then + fatal "Repositories can only be installed for native installs." F050D + fi + if [ -n "${NETDATA_OFFLINE_INSTALL_SOURCE}" ]; then - if [ "${NETDATA_ONLY_NATIVE}" -eq 1 ] || [ "${NETDATA_ONLY_BUILD}" -eq 1 ]; then - fatal "Offline installs are only supported for static builds currently." F0502 - fi + case "${NETDATA_FORCE_METHOD}" in + native|build) fatal "Offline installs are only supported for static builds currently." F0502 ;; + esac fi if [ -n "${LOCAL_BUILD_OPTIONS}" ]; then - if [ "${NETDATA_ONLY_BUILD}" -eq 1 ]; then - NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS} ${LOCAL_BUILD_OPTIONS}" - else - fatal "Specifying local build options is only supported when the --build-only option is also specified." F0401 - fi + case "${NETDATA_FORCE_METHOD}" in + build) NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS} ${LOCAL_BUILD_OPTIONS}" ;; + *) fatal "Specifying local build options is only supported when the --build-only option is also specified." F0401 ;; + esac fi if [ -n "${STATIC_INSTALL_OPTIONS}" ]; then - if [ "${NETDATA_ONLY_STATIC}" -eq 1 ]; then - NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS} ${STATIC_INSTALL_OPTIONS}" - else - fatal "Specifying installer options options is only supported when the --static-only option is also specified." F0402 - fi + case "${NETDATA_FORCE_METHOD}" in + static) NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS} ${STATIC_INSTALL_OPTIONS}" ;; + *) fatal "Specifying installer options options is only supported when the --static-only option is also specified." F0402 ;; + esac fi if [ -n "${NETDATA_OFFLINE_INSTALL_SOURCE}" ] && [ -n "${INSTALL_VERSION}" ]; then @@ -2101,6 +2036,17 @@ validate_args() { fi } +set_action() { + new_action="${1}" + + if [ -n "${ACTION}" ]; then + warning "Ignoring previously specified '${ACTION}' operation in favor of '${new_action}' specified later on the command line." + fi + + ACTION="${new_action}" + NETDATA_COMMAND="${new_action}" +} + parse_args() { while [ -n "${1}" ]; do case "${1}" in @@ -2114,33 +2060,35 @@ parse_args() { "--dont-wait"|"--non-interactive") INTERACTIVE=0 ;; "--interactive") INTERACTIVE=1 ;; "--dry-run") DRY_RUN=1 ;; + "--release-channel") + RELEASE_CHANNEL="$(echo "${2}" | tr '[:upper:]' '[:lower:]')" + case "${RELEASE_CHANNEL}" in + nightly|stable|default) shift 1 ;; + *) + echo "Unrecognized value for --release-channel. Valid release channels are: stable, nightly, default" + exit 1 + ;; + esac + ;; "--stable-channel") RELEASE_CHANNEL="stable" ;; + "--nightly-channel") RELEASE_CHANNEL="nightly" ;; + "--reinstall") set_action 'reinstall' ;; + "--reinstall-even-if-unsafe") set_action 'unsafe-reinstall' ;; + "--reinstall-clean") set_action 'reinstall-clean' ;; + "--uninstall") set_action 'uninstall' ;; + "--claim-only") set_action 'claim' ;; "--no-updates") NETDATA_AUTO_UPDATES=0 ;; "--auto-update") NETDATA_AUTO_UPDATES="1" ;; "--auto-update-method") NETDATA_AUTO_UPDATE_TYPE="$(echo "${2}" | tr '[:upper:]' '[:lower:]')" case "${NETDATA_AUTO_UPDATE_TYPE}" in - systemd|interval|crontab) - shift 1 - ;; + systemd|interval|crontab) shift 1 ;; *) echo "Unrecognized value for --auto-update-type. Valid values are: systemd, interval, crontab" exit 1 ;; esac ;; - "--reinstall") - NETDATA_REINSTALL=1 - NETDATA_COMMAND="reinstall" - ;; - "--reinstall-even-if-unsafe") - NETDATA_UNSAFE_REINSTALL=1 - NETDATA_COMMAND="unsafe-reinstall" - ;; - "--claim-only") - NETDATA_CLAIM_ONLY=1 - NETDATA_COMMAND="claim-only" - ;; "--disable-cloud") NETDATA_DISABLE_CLOUD=1 NETDATA_REQUIRE_CLOUD=0 @@ -2170,36 +2118,29 @@ parse_args() { AUTO_UPDATE=0 shift 1 ;; - "--uninstall") - ACTION="uninstall" - NETDATA_COMMAND="uninstall" - ;; - "--reinstall-clean") - ACTION="reinstall-clean" - NETDATA_COMMAND="reinstall-clean" + "--distro-override") + if [ -n "${2}" ]; then + SKIP_DISTRO_DETECTION=1 + DISTRO="$(echo "${2}" | cut -f 1 -d ':' | tr '[:upper:]' '[:lower:]')" + SYSVERSION="$(echo "${2}" | cut -f 2 -d ':')" + SYSCODENAME="$(echo "${2}" | cut -f 3 -d ':' | tr '[:upper:]' '[:lower:]')" + + if [ -z "${SYSVERSION}" ]; then + fatal "You must specify a release as well as a distribution name." F0510 + fi + + shift 1 + else + fatal "A distribution name and release must be specified for the --distro-override option." F050F + fi ;; "--repositories-only") - REPO_ACTION="repositories-only" - NETDATA_COMMAND="repositories" - ;; - "--native-only") - NETDATA_ONLY_NATIVE=1 - NETDATA_ONLY_STATIC=0 - NETDATA_ONLY_BUILD=0 - SELECTED_INSTALL_METHOD="native" - ;; - "--static-only") - NETDATA_ONLY_STATIC=1 - NETDATA_ONLY_NATIVE=0 - NETDATA_ONLY_BUILD=0 - SELECTED_INSTALL_METHOD="static" - ;; - "--build-only") - NETDATA_ONLY_BUILD=1 - NETDATA_ONLY_NATIVE=0 - NETDATA_ONLY_STATIC=0 - SELECTED_INSTALL_METHOD="build" + set_action 'repositories-only' + NETDATA_FORCE_METHOD="native" ;; + "--native-only") NETDATA_FORCE_METHOD="native" ;; + "--static-only") NETDATA_FORCE_METHOD="static" ;; + "--build-only") NETDATA_FORCE_METHOD="build" ;; "--claim-token") NETDATA_CLAIM_TOKEN="${2}" shift 1 @@ -2219,12 +2160,8 @@ parse_args() { NETDATA_CLAIM_EXTRA="${NETDATA_CLAIM_EXTRA} -${optname}=${2}" shift 1 ;; - verbose|insecure|noproxy|noreload|daemon-not-running) - NETDATA_CLAIM_EXTRA="${NETDATA_CLAIM_EXTRA} -${optname}" - ;; - *) - warning "Ignoring unrecognized claiming option ${optname}" - ;; + verbose|insecure|noproxy|noreload|daemon-not-running) NETDATA_CLAIM_EXTRA="${NETDATA_CLAIM_EXTRA} -${optname}" ;; + *) warning "Ignoring unrecognized claiming option ${optname}" ;; esac ;; "--local-build-options") @@ -2237,8 +2174,7 @@ parse_args() { ;; "--prepare-offline-install-source") if [ -n "${2}" ]; then - ACTION="prepare-offline" - NETDATA_COMMAND="prepare-offline" + set_action 'prepare-offline' OFFLINE_TARGET="${2}" shift 1 else @@ -2253,9 +2189,7 @@ 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 - ;; + *) 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 ;; esac shift 1 done diff --git a/docs/guides/deploy/ansible.md b/packaging/installer/methods/ansible.md index 0472bdc6..6b4c69f0 100644 --- a/docs/guides/deploy/ansible.md +++ b/packaging/installer/methods/ansible.md @@ -1,17 +1,16 @@ <!-- -title: Deploy Netdata with Ansible +title: "Deploy Netdata with Ansible" description: "Deploy an infrastructure monitoring solution in minutes with the Netdata Agent and Ansible. Use and customize a simple playbook for monitoring as code." image: /img/seo/guides/deploy/ansible.png -custom_edit_url: https://github.com/netdata/netdata/edit/master/docs/guides/deploy/ansible.md -sidebar_label: "Install Netdata with Ansible" +custom_edit_url: https://github.com/netdata/netdata/edit/master/packaging/installer/methods/ansible.md +sidebar_label: "Ansible" learn_status: "Published" -learn_topic_type: "Tasks" -learn_rel_path: "Installation" +learn_rel_path: "Installation/Install on specific environments" --> # Deploy Netdata with Ansible -Netdata's [one-line kickstart](https://github.com/netdata/netdata/blob/master/docs/get-started.mdx) is zero-configuration, highly adaptable, and compatible with tons +Netdata's [one-line kickstart](https://github.com/netdata/netdata/blob/master/packaging/installer/README.md#install-on-linux-with-one-line-installer) is zero-configuration, highly adaptable, and compatible with tons of different operating systems and Linux distributions. You can use it on bare metal, VMs, containers, and everything in-between. @@ -36,7 +35,7 @@ Idempotency means you can run an Ansible playbook against your nodes any number operate. When you deploy Netdata with Ansible, you're also deploying _monitoring as code_. In this guide, we'll walk through the process of using an [Ansible -playbook](https://github.com/netdata/community/tree/main/netdata-agent-deployment/ansible-quickstart) to automatically +playbook](https://github.com/netdata/community/tree/main/configuration-management/ansible-quickstart/) to automatically deploy the Netdata Agent to any number of distributed nodes, manage the configuration of each node, and connect them to your Netdata Cloud account. You'll go from some unmonitored nodes to a infrastructure monitoring solution in a matter of minutes. @@ -51,7 +50,7 @@ minutes. ## Download and configure the playbook First, download the -[playbook](https://github.com/netdata/community/tree/main/netdata-agent-deployment/ansible-quickstart), move it to the +[playbook](https://github.com/netdata/community/tree/main/configuration-management/ansible-quickstart/), move it to the current directory, and remove the rest of the cloned repository, as it's not required for using the Ansible playbook. ```bash @@ -131,7 +130,7 @@ hostname of the node, the playbook disables that local dashboard by setting `web security boost by not allowing any unwanted access to the local dashboard. You can read more about this decision, or other ways you might lock down the local dashboard, in our [node security -doc](https://github.com/netdata/netdata/blob/master/docs/configure/secure-nodes.md). +doc](https://github.com/netdata/netdata/blob/master/docs/netdata-security.md). > Curious about why Netdata's dashboard is open by default? Read our [blog > post](https://www.netdata.cloud/blog/netdata-agent-dashboard/) on that zero-configuration design decision. @@ -155,26 +154,3 @@ task results in a changed, failure, or was skipped entirely. The task to install Netdata will take a few minutes per node, so be patient! Once the playbook reaches the connect to Cloud task, your nodes start populating your Space in Netdata Cloud. - -## What's next? - -Go use Netdata! - -If you need a bit more guidance for how you can use Netdata for health monitoring and performance troubleshooting, see -our [documentation](https://learn.netdata.cloud/docs). It's designed like a comprehensive guide, based on what you might -want to do with Netdata, so use those categories to dive in. - -Some of the best places to start: - -- [Enable or configure a collector](https://github.com/netdata/netdata/blob/master/docs/collect/enable-configure.md) -- [Supported collectors list](https://github.com/netdata/netdata/blob/master/collectors/COLLECTORS.md) -- [See an overview of your infrastructure](https://github.com/netdata/netdata/blob/master/docs/visualize/overview-infrastructure.md) -- [Interact with dashboards and charts](https://github.com/netdata/netdata/blob/master/docs/visualize/interact-dashboards-charts.md) -- [Change how long Netdata stores metrics](https://github.com/netdata/netdata/blob/master/docs/store/change-metrics-storage.md) - -We're looking for more deployment and configuration management strategies, whether via Ansible or other -provisioning/infrastructure as code software, such as Chef or Puppet, in our [community -repo](https://github.com/netdata/community). Anyone is able to fork the repo and submit a PR, either to improve this -playbook, extend it, or create an entirely new experience for deploying Netdata across entire infrastructure. - - diff --git a/packaging/installer/methods/cloud-providers.md b/packaging/installer/methods/aws.md index 6b8fa6de..c0b92a03 100644 --- a/packaging/installer/methods/cloud-providers.md +++ b/packaging/installer/methods/aws.md @@ -1,40 +1,28 @@ <!-- -title: "Install Netdata on cloud providers" +title: "Install Netdata on AWS" description: "The Netdata Agent runs on all popular cloud providers, but often requires additional steps and configuration for full functionality." -custom_edit_url: https://github.com/netdata/netdata/edit/master/packaging/installer/methods/cloud-providers.md +custom_edit_url: https://github.com/netdata/netdata/edit/master/packaging/installer/methods/aws.md +sidebar_label: "AWS" +learn_status: "Published" +learn_rel_path: "Installation/Install on specific environments" --> -# Install Netdata on cloud providers +# Install Netdata on AWS -Netdata is fully compatible with popular cloud providers like Google Cloud Platform (GCP), Amazon Web Services (AWS), -Azure, and others. You can install Netdata on cloud instances to monitor the apps/services running there, or use +Netdata is fully compatible with Amazon Web Services (AWS). +You can install Netdata on cloud instances to monitor the apps/services running there, or use multiple instances in a [parent-child streaming](https://github.com/netdata/netdata/blob/master/streaming/README.md) configuration. -In some cases, using Netdata on these cloud providers requires unique installation or configuration steps. This page -aims to document some of those steps for popular cloud providers. - -> This document is a work-in-progress! If you find new issues specific to a cloud provider, or would like to help -> clarify the correct workaround, please [create an -> issue](https://github.com/netdata/netdata/issues/new?labels=feature+request,+needs+triage&template=feature_request.md) -> with your process and instructions on using the provider's interface to complete the workaround. - -- [Recommended installation methods for cloud providers](#recommended-installation-methods-for-cloud-providers) -- [Post-installation configuration](#post-installation-configuration) - - [Add a firewall rule to access Netdata's dashboard](#add-a-firewall-rule-to-access-netdatas-dashboard) - -## Recommended installation methods for cloud providers +## Recommended installation method The best installation method depends on the instance's operating system, distribution, and version. For Linux instances, -we recommend the [`kickstart.sh` automatic installation script](kickstart.md). +we recommend the [`kickstart.sh` automatic installation script](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/kickstart.md). If you have issues with Netdata after installation, look to the sections below to find the issue you're experiencing, followed by the solution for your provider. ## Post-installation configuration -Some cloud providers require you take additional steps to properly configure your instance or its networking to access -all of Netdata's features. - ### Add a firewall rule to access Netdata's dashboard If you cannot access Netdata's dashboard on your cloud instance via `http://HOST:19999`, and instead get an error page @@ -59,31 +47,6 @@ Another option is to put Netdata behind web server, which will proxy requests th - [HAProxy](https://github.com/netdata/netdata/blob/master/docs/Running-behind-haproxy.md) - [lighttpd](https://github.com/netdata/netdata/blob/master/docs/Running-behind-lighttpd.md) -The next few sections outline how to add firewall rules to GCP, AWS, and Azure instances. - -#### Google Cloud Platform (GCP) - -To add a firewall rule, go to the [Firewall rules page](https://console.cloud.google.com/networking/firewalls/list) and -click **Create firewall rule**. - -The following configuration has previously worked for Netdata running on GCP instances -([see #7786](https://github.com/netdata/netdata/issues/7786)): - -```conf -Name: <name> -Type: Ingress -Targets: <name-tag> -Filters: 0.0.0.0/0 -Protocols/ports: 19999 -Action: allow -Priority: 1000 -``` - -Read GCP's [firewall documentation](https://cloud.google.com/vpc/docs/using-firewalls) for specific instructions on how -to create a new firewall rule. - -#### Amazon Web Services (AWS) / EC2 - Sign in to the [AWS console](https://console.aws.amazon.com/) and navigate to the EC2 dashboard. Click on the **Security Groups** link in the navigation, beneath the **Network & Security** heading. Find the Security Group your instance belongs to, and either right-click on it or click the **Actions** button above to see a dropdown menu with **Edit @@ -102,25 +65,3 @@ Description: Netdata You can also choose **My IP** as the source if you prefer. Click **Save** to apply your new inbound firewall rule. - -#### Azure - -Sign in to the [Azure portal](https://portal.azure.com) and open the virtual machine running Netdata. Click on the -**Networking** link beneath the **Settings** header, then click on the **Add inbound security rule** button. - -Add a new rule with the following options: - -```conf -Source: Any -Source port ranges: 19999 -Destination: Any -Destination port ranges: 19999 -Protocol: TCP -Action: Allow -Priority: 310 -Name: Netdata -``` - -Click **Add** to apply your new inbound security rule. - - diff --git a/packaging/installer/methods/azure.md b/packaging/installer/methods/azure.md new file mode 100644 index 00000000..4c39a00a --- /dev/null +++ b/packaging/installer/methods/azure.md @@ -0,0 +1,68 @@ +<!-- +title: "Install Netdata on Azure" +description: "The Netdata Agent runs on all popular cloud providers, but often requires additional steps and configuration for full functionality." +custom_edit_url: https://github.com/netdata/netdata/edit/master/packaging/installer/methods/azure.md +sidebar_label: "Azure" +learn_status: "Published" +learn_rel_path: "Installation/Install on specific environments" +--> + +# Install Netdata on Azure + +Netdata is fully compatible with Azure. +You can install Netdata on cloud instances to monitor the apps/services running there, or use +multiple instances in a [parent-child streaming](https://github.com/netdata/netdata/blob/master/streaming/README.md) configuration. + +## Recommended installation method + +The best installation method depends on the instance's operating system, distribution, and version. For Linux instances, +we recommend the [`kickstart.sh` automatic installation script](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/kickstart.md). + +If you have issues with Netdata after installation, look to the sections below to find the issue you're experiencing, +followed by the solution for your provider. + +## Post-installation configuration + +### Add a firewall rule to access Netdata's dashboard + +If you cannot access Netdata's dashboard on your cloud instance via `http://HOST:19999`, and instead get an error page +from your browser that says, "This site can't be reached" (Chrome) or "Unable to connect" (Firefox), you may need to +configure your cloud provider's firewall. + +Cloud providers often create network-level firewalls that run separately from the instance itself. Both AWS and Google +Cloud Platform calls them Virtual Private Cloud (VPC) networks. These firewalls can apply even if you've disabled +firewalls on the instance itself. Because you can modify these firewalls only via the cloud provider's web interface, +it's easy to overlook them when trying to configure and access Netdata's dashboard. + +You can often confirm a firewall issue by querying the dashboard while connected to the instance via SSH: `curl +http://localhost:19999/api/v1/info`. If you see JSON output, Netdata is running properly. If you try the same `curl` +command from a remote system, and it fails, it's likely that a firewall is blocking your requests. + +Another option is to put Netdata behind web server, which will proxy requests through standard HTTP/HTTPS ports +(80/443), which are likely already open on your instance. We have a number of guides available: + +- [Apache](https://github.com/netdata/netdata/blob/master/docs/Running-behind-apache.md) +- [Nginx](https://github.com/netdata/netdata/blob/master/docs/Running-behind-nginx.md) +- [Caddy](https://github.com/netdata/netdata/blob/master/docs/Running-behind-caddy.md) +- [HAProxy](https://github.com/netdata/netdata/blob/master/docs/Running-behind-haproxy.md) +- [lighttpd](https://github.com/netdata/netdata/blob/master/docs/Running-behind-lighttpd.md) + +Sign in to the [Azure portal](https://portal.azure.com) and open the virtual machine running Netdata. Click on the +**Networking** link beneath the **Settings** header, then click on the **Add inbound security rule** button. + +Add a new rule with the following options: + +```conf +Source: Any +Source port ranges: 19999 +Destination: Any +Destination port ranges: 19999 +Protocol: TCP +Action: Allow +Priority: 310 +Name: Netdata +``` + +Click **Add** to apply your new inbound security rule. + + diff --git a/packaging/installer/methods/freebsd.md b/packaging/installer/methods/freebsd.md index ea7099b3..21670cdc 100644 --- a/packaging/installer/methods/freebsd.md +++ b/packaging/installer/methods/freebsd.md @@ -2,6 +2,9 @@ title: "Install Netdata on FreeBSD" description: "Install Netdata on FreeBSD to monitor the health and performance of bare metal or VMs with thousands of real-time, per-second metrics." custom_edit_url: https://github.com/netdata/netdata/edit/master/packaging/installer/methods/freebsd.md +sidebar_label: "FreeBSD" +learn_status: "Published" +learn_rel_path: "Installation/Install on specific environments" --> # Install Netdata on FreeBSD @@ -13,20 +16,41 @@ custom_edit_url: https://github.com/netdata/netdata/edit/master/packaging/instal > PR](https://github.com/netdata/netdata/edit/master/packaging/installer/methods/freebsd.md) with your recommended > improvements or changes. Thank you! -## Install latest version +## Install dependencies -This is how to install the latest Netdata version on FreeBSD: - -Install required packages (**need root permission**): +This step needs root privileges. ```sh pkg install bash e2fsprogs-libuuid git curl autoconf automake pkgconf pidof liblz4 libuv json-c cmake gmake ``` +Please respond in the affirmative for any relevant prompts during the installation process. + +## Install Netdata + +The simplest method is to use the single line [kickstart script](https://learn.netdata.cloud/docs/agent/packaging/installer/methods/kickstart) + +If you have a Netdata cloud account then clicking on the **Connect Nodes** button will generate the kickstart command you should use. Use the command from the "Linux" tab, it should look something like this: + +```sh +wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh --claim-token <CLAIM_TOKEN> --claim-url https://app.netdata.cloud +``` +Please respond in the affirmative for any relevant prompts during the installation process. + +Once the installation is completed, you should be able to start monitoring the FreeBSD server using Netdata. + +![image](https://user-images.githubusercontent.com/24860547/202489210-3c5a3346-8f53-4b7b-9832-f9383b34d864.png) + +Netdata can also be installed via [FreeBSD ports](https://www.freshports.org/net-mgmt/netdata). + +## Manual installation + +If you would prefer to manually install Netdata, the following steps can help you do this. + Download Netdata: ```sh -fetch https://github.com/netdata/netdata/releases/download/v1.26.0/netdata-v1.26.0.tar.gz +fetch https://github.com/netdata/netdata/releases/download/v1.36.1/netdata-v1.36.1.tar.gz ``` > ⚠️ Verify the latest version by either navigating to [Netdata's latest @@ -73,35 +97,52 @@ If you have not passed the `--auto-update` or `-u` parameter for the installer t The `netdata-updater.sh` script will update your Agent. ## Optional parameters to alter your installation -| parameters | Description | -|:-----:|-----------| -|`--install-prefix <path>`| Install netdata in `<path>.` Ex: `--install-prefix /opt` will put netdata in `/opt/netdata`| -| `--dont-start-it` | Do not (re)start netdata after installation| -| `--dont-wait` | Run installation in non-interactive mode| -| `--auto-update` or `-u` | Install netdata-updater in cron to update netdata automatically once per day| -| `--stable-channel` | Use packages from GitHub release pages instead of GCS (nightly updates). This results in less frequent updates| -| `--nightly-channel` | Use most recent nightly updates instead of GitHub releases. This results in more frequent updates| -| `--disable-go` | Disable installation of go.d.plugin| -| `--disable-ebpf` | Disable eBPF Kernel plugin (Default: enabled)| -| `--disable-cloud` | Disable all Netdata Cloud functionality| -| `--require-cloud` | Fail the install if it can't build Netdata Cloud support| -| `--enable-plugin-freeipmi` | Enable the FreeIPMI plugin. Default: enable it when libipmimonitoring is available| -| `--disable-plugin-freeipmi` | Enable the FreeIPMI plugin| -| `--disable-https` | Explicitly disable TLS support| -| `--disable-dbengine` | Explicitly disable DB engine support| -| `--enable-plugin-nfacct` | Enable nfacct plugin. Default: enable it when libmnl and libnetfilter_acct are available| -| `--disable-plugin-nfacct` | Disable nfacct plugin. Default: enable it when libmnl and libnetfilter_acct are available| -| `--enable-plugin-xenstat` | Enable the xenstat plugin. Default: enable it when libxenstat and libyajl are available| -| `--disable-plugin-xenstat` | Disable the xenstat plugin| -| `--disable-exporting-kinesis` | Disable AWS Kinesis exporting connector. Default: enable it when libaws_cpp_sdk_kinesis and libraries (it depends on are available)| -| `--enable-exporting-prometheus-remote-write` | Enable Prometheus remote write exporting connector. Default: enable it when libprotobuf and libsnappy are available| -| `--disable-exporting-prometheus-remote-write` | Disable Prometheus remote write exporting connector. Default: enable it when libprotobuf and libsnappy are available| -| `--enable-exporting-mongodb` | Enable MongoDB exporting connector. Default: enable it when libmongoc is available| -| `--disable-exporting-mongodb` | Disable MongoDB exporting connector| -| `--enable-lto` | Enable Link-Time-Optimization. Default: enabled| -| `--disable-lto` | Disable Link-Time-Optimization. Default: enabled| -| `--disable-x86-sse` | Disable SSE instructions. By default SSE optimizations are enabled| -| `--zlib-is-really-here` or `--libs-are-really-here` | If you get errors about missing zlib or libuuid but you know it is available, you might have a broken pkg-config. Use this option to proceed without checking pkg-config| -|`--disable-telemetry` | Use this flag to opt-out from our anonymous telemetry program. (DISABLE_TELEMETRY=1)| - +The `kickstart.sh` script accepts a number of optional parameters to control how the installation process works: + +- `--non-interactive`: Don’t prompt for anything and assume yes whenever possible, overriding any automatic detection of an interactive run. +- `--interactive`: Act as if running interactively, even if automatic detection indicates a run is non-interactive. +- `--dont-wait`: Synonym for `--non-interactive` +- `--dry-run`: Show what the installer would do, but don’t actually do any of it. +- `--dont-start-it`: Don’t auto-start the daemon after installing. This parameter is not guaranteed to work. +- `--release-channel`: Specify a particular release channel to install from. Currently supported release channels are: + - `nightly`: Installs a nightly build (this is currently the default). + - `stable`: Installs a stable release. + - `default`: Explicitly request whatever the current default is. +- `--nightly-channel`: Synonym for `--release-channel nightly`. +- `--stable-channel`: Synonym for `--release-channel stable`. +- `--auto-update`: Enable automatic updates (this is the default). +- `--no-updates`: Disable automatic updates. +- `--disable-telemetry`: Disable anonymous statistics. +- `--native-only`: Only install if native binary packages are available. +- `--static-only`: Only install if a static build is available. +- `--build-only`: Only install using a local build. +- `--disable-cloud`: For local builds, don’t build any of the cloud code at all. For native packages and static builds, + use runtime configuration to disable cloud support. +- `--require-cloud`: Only install if Netdata Cloud can be enabled. Overrides `--disable-cloud`. +- `--install-prefix`: Specify an installation prefix for local builds (by default, we use a sane prefix based on the type of system). +- `--install-version`: Specify the version of Netdata to install. +- `--old-install-prefix`: Specify the custom local build's installation prefix that should be removed. +- `--local-build-options`: Specify additional options to pass to the installer code when building locally. Only valid if `--build-only` is also specified. +- `--static-install-options`: Specify additional options to pass to the static installer code. Only valid if --static-only is also specified. + +The following options are mutually exclusive and specifiy special operations other than trying to install Netdata normally or update an existing install: + +- `--reinstall`: If there is an existing install, reinstall it instead of trying to update it. If there is not an existing install, install netdata normally. +- `--reinstall-even-if-unsafe`: If there is an existing install, reinstall it instead of trying to update it, even if doing so is known to potentially break things (for example, if we cannot detect what tyep of installation it is). If there is not an existing install, install Netdata normally. +- `--reinstall-clean`: If there is an existing install, uninstall it before trying to install Netdata. Fails if there is no existing install. +- `--uninstall`: Uninstall an existing installation of Netdata. Fails if there is no existing install. +- `--claim-only`: If there is an existing install, only try to claim it without attempting to update it. If there is no existing install, install and claim Netdata normally. +- `--repositories-only`: Only install repository configuration packages instead of doing a full install of Netdata. Automatically sets --native-only. +- `--prepare-offline-install-source`: Instead of insallling the agent, prepare a directory that can be used to install on another system without needing to download anything. See our [offline installation documentation](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/offline.md) for more info. + +Additionally, the following environment variables may be used to further customize how the script runs (most users +should not need to use special values for any of these): + +- `TMPDIR`: Used to specify where to put temporary files. On most systems, the default we select automatically + should be fine. The user running the script needs to both be able to write files to the temporary directory, + and run files from that location. +- `ROOTCMD`: Used to specify a command to use to run another command with root privileges if needed. By default + we try to use sudo, doas, or pkexec (in that order of preference), but if you need special options for one of + those to work, or have a different tool to do the same thing on your system, you can specify it here. +- `DISABLE_TELEMETRY`: If set to a value other than 0, behave as if `--disable-telemetry` was specified. diff --git a/packaging/installer/methods/freenas.md b/packaging/installer/methods/freenas.md deleted file mode 100644 index a69f1e3f..00000000 --- a/packaging/installer/methods/freenas.md +++ /dev/null @@ -1,24 +0,0 @@ -<!-- -title: "Install Netdata on FreeNAS" -custom_edit_url: https://github.com/netdata/netdata/edit/master/packaging/installer/methods/freenas.md ---> - -# Install Netdata on FreeNAS - -On FreeNAS-Corral-RELEASE (>=10.0.3 and <11.3), Netdata is pre-installed. - -To use Netdata, the service will need to be enabled and started from the FreeNAS [CLI](https://github.com/freenas/cli). - -To enable the Netdata service: - -```sh -service netdata config set enable=true -``` - -To start the Netdata service: - -```sh -service netdata start -``` - - diff --git a/packaging/installer/methods/gcp.md b/packaging/installer/methods/gcp.md new file mode 100644 index 00000000..0b16b109 --- /dev/null +++ b/packaging/installer/methods/gcp.md @@ -0,0 +1,70 @@ +<!-- +title: "Install Netdata on GCP" +description: "The Netdata Agent runs on all popular cloud providers, but often requires additional steps and configuration for full functionality." +custom_edit_url: https://github.com/netdata/netdata/edit/master/packaging/installer/methods/gcp.md +sidebar_label: "GCP" +learn_status: "Published" +learn_topic_type: "Tasks" +learn_rel_path: "Installation/Install on specific environments" +--> + +# Install Netdata on GCP + +Netdata is fully compatible with the Google Cloud Platform (GCP). +You can install Netdata on cloud instances to monitor the apps/services running there, or use +multiple instances in a [parent-child streaming](https://github.com/netdata/netdata/blob/master/streaming/README.md) configuration. + +## Recommended installation method + +The best installation method depends on the instance's operating system, distribution, and version. For Linux instances, +we recommend the [`kickstart.sh` automatic installation script](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/kickstart.md). + +If you have issues with Netdata after installation, look to the sections below to find the issue you're experiencing, +followed by the solution for your provider. + +## Post-installation configuration + +### Add a firewall rule to access Netdata's dashboard + +If you cannot access Netdata's dashboard on your cloud instance via `http://HOST:19999`, and instead get an error page +from your browser that says, "This site can't be reached" (Chrome) or "Unable to connect" (Firefox), you may need to +configure your cloud provider's firewall. + +Cloud providers often create network-level firewalls that run separately from the instance itself. Both AWS and Google +Cloud Platform calls them Virtual Private Cloud (VPC) networks. These firewalls can apply even if you've disabled +firewalls on the instance itself. Because you can modify these firewalls only via the cloud provider's web interface, +it's easy to overlook them when trying to configure and access Netdata's dashboard. + +You can often confirm a firewall issue by querying the dashboard while connected to the instance via SSH: `curl +http://localhost:19999/api/v1/info`. If you see JSON output, Netdata is running properly. If you try the same `curl` +command from a remote system, and it fails, it's likely that a firewall is blocking your requests. + +Another option is to put Netdata behind web server, which will proxy requests through standard HTTP/HTTPS ports +(80/443), which are likely already open on your instance. We have a number of guides available: + +- [Apache](https://github.com/netdata/netdata/blob/master/docs/Running-behind-apache.md) +- [Nginx](https://github.com/netdata/netdata/blob/master/docs/Running-behind-nginx.md) +- [Caddy](https://github.com/netdata/netdata/blob/master/docs/Running-behind-caddy.md) +- [HAProxy](https://github.com/netdata/netdata/blob/master/docs/Running-behind-haproxy.md) +- [lighttpd](https://github.com/netdata/netdata/blob/master/docs/Running-behind-lighttpd.md) + + +To add a firewall rule, go to the [Firewall rules page](https://console.cloud.google.com/networking/firewalls/list) and +click **Create firewall rule**. + +The following configuration has previously worked for Netdata running on GCP instances +([see #7786](https://github.com/netdata/netdata/issues/7786)): + +```conf +Name: <name> +Type: Ingress +Targets: <name-tag> +Filters: 0.0.0.0/0 +Protocols/ports: 19999 +Action: allow +Priority: 1000 +``` + +Read GCP's [firewall documentation](https://cloud.google.com/vpc/docs/using-firewalls) for specific instructions on how +to create a new firewall rule. + diff --git a/packaging/installer/methods/kickstart.md b/packaging/installer/methods/kickstart.md index 7c1f60d1..374ac594 100644 --- a/packaging/installer/methods/kickstart.md +++ b/packaging/installer/methods/kickstart.md @@ -2,12 +2,16 @@ title: "Install Netdata with kickstart.sh" description: "The kickstart.sh script installs Netdata from source, including all dependencies required to connect to Netdata Cloud, with a single command." custom_edit_url: "https://github.com/netdata/netdata/edit/master/packaging/installer/methods/kickstart.md" -sidebar_label: "Install Netdata with kickstart.sh" +sidebar_label: "One line installer (kickstart.sh)" learn_status: "Published" -learn_topic_type: "Tasks" -learn_rel_path: "Installation" +learn_rel_path: "Installation/Installation methods" +sidebar_position: 10 --> + import { OneLineInstallWget, OneLineInstallCurl } from '@site/src/components/OneLineInstall/' +import { Install, InstallBox } from '@site/src/components/Install/' +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; # Install Netdata with kickstart.sh @@ -18,17 +22,32 @@ This page covers detailed instructions on using and configuring the automatic on The kickstart script works on all Linux distributions and macOS environments. By default, automatic nightly updates are enabled. If you are installing on macOS, make sure to check the [install documentation for macOS](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/macos.md) before continuing. -> If you are unsure whether you want nightly or stable releases, read the [installation guide](https://github.com/netdata/netdata/blob/master/packaging/installer/README.md#nightly-vs-stable-releases). + +> :bulb: Tip +> +> If you are unsure whether you want nightly or stable releases, read the [installation guide](https://github.com/netdata/netdata/blob/master/packaging/installer/README.md#nightly-vs-stable-releases). + > If you want to turn off [automatic updates](https://github.com/netdata/netdata/blob/master/packaging/installer/README.md#automatic-updates), use the `--no-updates` option. You can find more installation options below. To install Netdata, run the following as your normal user: -<OneLineInstallWget/> +<Tabs> + <TabItem value="wget" label="wget"> + + <OneLineInstallWget/> + + </TabItem> + <TabItem value="curl" label="curl"> -Or, if you have cURL but not wget (such as on macOS): + <OneLineInstallCurl/> -<OneLineInstallCurl/> + </TabItem> +</Tabs> +> :bookmark_tabs: Note +> +> If you plan to also connect the node to Netdata Cloud, make sure to replace `YOUR_CLAIM_TOKEN` with the claim token of your space, +> and `YOUR_ROOM_ID` with the ID of the room you are willing to connect the node to. ## What does `kickstart.sh` do? @@ -39,7 +58,7 @@ The `kickstart.sh` script does the following after being downloaded and run usin - Attempts to install Netdata using our [official native binary packages](#native-packages). - If there are no official native binary packages for your system (or installing that way failed), tries to install using a [static build of Netdata](#static-builds) if one is available. -- If no static build is available, installs required dependencies and then attempts to install by +- If no static build is available, installs required dependencies and then attempts to install by [building Netdata locally](#local-builds) (by downloading the sources and building them directly). - Installs `netdata-updater.sh` to `cron.daily`, so your Netdata installation will be updated with new nightly versions, unless you override that with an [optional parameter](#optional-parameters-to-alter-your-installation). @@ -55,30 +74,41 @@ The `kickstart.sh` script accepts a number of optional parameters to control how - `--dry-run`: Show what the installer would do, but don’t actually do any of it. - `--dont-start-it`: Don’t auto-start the daemon after installing. This parameter is not guaranteed to work. - `--release-channel`: Specify a particular release channel to install from. Currently supported release channels are: - - `nightly`: Installs a nightly build (this is currently the default). - - `stable`: Installs a stable release. - - `default`: Explicitly request whatever the current default is. + - `nightly`: Installs a nightly build (this is currently the default). + - `stable`: Installs a stable release. + - `default`: Explicitly request whatever the current default is. - `--nightly-channel`: Synonym for `--release-channel nightly`. - `--stable-channel`: Synonym for `--release-channel stable`. - `--auto-update`: Enable automatic updates (this is the default). - `--no-updates`: Disable automatic updates. - `--disable-telemetry`: Disable anonymous statistics. -- `--repositories-only`: Only install appropriate repository configuration packages (only for native install). - `--native-only`: Only install if native binary packages are available. - `--static-only`: Only install if a static build is available. - `--build-only`: Only install using a local build. -- `--reinstall`: If an existing install is found, reinstall instead of trying to update it in place. -- `--reinstall-even-if-unsafe`: Even try to reinstall if we don't think we can do so safely (implies `--reinstall`). - `--disable-cloud`: For local builds, don’t build any of the cloud code at all. For native packages and static builds, use runtime configuration to disable cloud support. - `--require-cloud`: Only install if Netdata Cloud can be enabled. Overrides `--disable-cloud`. - `--install-prefix`: Specify an installation prefix for local builds (by default, we use a sane prefix based on the type of system). - `--install-version`: Specify the version of Netdata to install. - `--old-install-prefix`: Specify the custom local build's installation prefix that should be removed. -- `--uninstall`: Uninstall an existing installation of Netdata. -- `--reinstall-clean`: Performs an uninstall of Netdata and clean installation. - `--local-build-options`: Specify additional options to pass to the installer code when building locally. Only valid if `--build-only` is also specified. - `--static-install-options`: Specify additional options to pass to the static installer code. Only valid if --static-only is also specified. +- `--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. +- `--claim-rooms`: Specify a comma-separated list of tokens for each War Room this node should appear in. +- `--claim-proxy`: Specify a proxy to use when connecting to the cloud in the form of `http://[user:pass@]host:ip` for an HTTP(S) proxy. + See [connecting through a proxy](https://github.com/netdata/netdata/blob/master/claim/README.md#connect-through-a-proxy) for details. +- `--claim-url`: Specify a URL to use when connecting to the cloud. Defaults to `https://api.netdata.cloud`. +- `--override-distro`: Override the distro detection logic and assume the system is using a specific Linux distribution and release. Takes a single argument consisting of the values of the `ID`, `VERSION_ID`, and `VERSION_CODENAME` fields from `/etc/os-release` for the desired distribution. + +The following options are mutually exclusive and specifiy special operations other than trying to install Netdata normally or update an existing install: + +- `--reinstall`: If there is an existing install, reinstall it instead of trying to update it. If there is not an existing install, install netdata normally. +- `--reinstall-even-if-unsafe`: If there is an existing install, reinstall it instead of trying to update it, even if doing so is known to potentially break things (for example, if we cannot detect what tyep of installation it is). If there is not an existing install, install Netdata normally. +- `--reinstall-clean`: If there is an existing install, uninstall it before trying to install Netdata. Fails if there is no existing install. +- `--uninstall`: Uninstall an existing installation of Netdata. Fails if there is no existing install. +- `--claim-only`: If there is an existing install, only try to claim it without attempting to update it. If there is no existing install, install and claim Netdata normally. +- `--repositories-only`: Only install repository configuration packages instead of doing a full install of Netdata. Automatically sets --native-only. - `--prepare-offline-install-source`: Instead of insallling the agent, prepare a directory that can be used to install on another system without needing to download anything. See our [offline installation documentation](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/offline.md) for more info. Additionally, the following environment variables may be used to further customize how the script runs (most users @@ -92,31 +122,6 @@ should not need to use special values for any of these): those to work, or have a different tool to do the same thing on your system, you can specify it here. - `DISABLE_TELEMETRY`: If set to a value other than 0, behave as if `--disable-telemetry` was specified. -### Connect node to Netdata Cloud during installation - -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. - -> Note: You either need to run the command with root privileges or run it with the user that is running the agent. More details: [Connect an agent without root privileges](https://github.com/netdata/netdata/blob/master/claim/README.md#connect-an-agent-without-root-privileges) section. - -To automatically claim nodes after installation: - -1. Sign in to [Netdata Cloud](https://app.netdata.cloud/sign-in?cloudRoute=/spaces) -2. Go to the [Spaces management area](https://learn.netdata.cloud/docs/cloud/spaces#manage-spaces) -3. Click on **Connect Nodes** -4. Find the `token` and `rooms` strings and specify your nodes: - -- `--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. -- `--claim-rooms`: Specify a comma-separated list of tokens for each War Room this node should appear in. -- `--claim-proxy`: Specify a proxy to use when connecting to the cloud in the form of `http://[user:pass@]host:ip` for an HTTP(S) proxy. - See [connecting through a proxy](https://github.com/netdata/netdata/blob/master/claim/README.md#connect-through-a-proxy) for details. -- `--claim-url`: Specify a URL to use when connecting to the cloud. Defaults to `https://api.netdata.cloud`. - -For example: - -```bash -wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh --claim-token TOKEN --claim-rooms ROOM1,ROOM2 -``` ### Native packages @@ -149,7 +154,6 @@ If you want to enforce the usage of a local build (perhaps because you require a which is not supported with native packages or static builds), you can do so by adding `--build-only` to the options you pass to the installer. - ## Verify script integrity To use `md5sum` to verify the integrity of the `kickstart.sh` script you will download using the one-line command above, @@ -160,16 +164,3 @@ run the following: ``` If the script is valid, this command will return `OK, VALID`. - -## What's next? - -When you're finished with installation, check out our [single-node](https://github.com/netdata/netdata/blob/master/docs/quickstart/single-node.md) or -[infrastructure](https://github.com/netdata/netdata/blob/master/docs/quickstart/infrastructure.md) monitoring quickstart guides based on your use case. - -Or, skip straight to [configuring the Netdata Agent](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md). - -Read through Netdata's [documentation](https://learn.netdata.cloud/docs), which is structured based on actions and -solutions, to enable features like health monitoring, alarm notifications, long-term metrics storage, exporting to -external databases, and more. - - diff --git a/packaging/installer/methods/kubernetes.md b/packaging/installer/methods/kubernetes.md index 142c098b..4dde3f40 100644 --- a/packaging/installer/methods/kubernetes.md +++ b/packaging/installer/methods/kubernetes.md @@ -1,112 +1,122 @@ -<!-- -title: "Deploy Kubernetes monitoring with Netdata" -description: "Deploy Netdata to monitor a Kubernetes cluster to monitor the health, performance, resource utilization, and application metrics of a Kubernetes cluster in real time." -custom_edit_url: "https://github.com/netdata/netdata/edit/master/packaging/installer/methods/kubernetes.md" -sidebar_label: "Deploy Kubernetes monitoring with Netdata" -learn_status: "Published" -learn_topic_type: "Tasks" -learn_rel_path: "Installation" ---> - -# Deploy Kubernetes monitoring with Netdata - -This document details how to install Netdata on an existing Kubernetes (k8s) cluster. By following these directions, you -will use Netdata's [Helm chart](https://github.com/netdata/helmchart) to create a Kubernetes monitoring deployment on -your cluster. - -The Helm chart installs one `parent` pod for storing metrics and managing alarm notifications, plus an additional +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Install Netdata on Kubernetes + +This document details how to install Netdata on an existing Kubernetes (k8s) cluster, and connect it to Netdata Cloud. Read our [Kubernetes visualizations](https://github.com/netdata/netdata/blob/master/docs/cloud/visualize/kubernetes.md) documentation, to see what you will get. + +The [Netdata Helm chart](https://github.com/netdata/helmchart/blob/master/charts/netdata/README.md) installs one `parent` pod for storing metrics and managing alarm notifications, plus an additional `child` pod for every node in the cluster, responsible for collecting metrics from the node, Kubernetes control planes, pods/containers, and [supported application-specific metrics](https://github.com/netdata/helmchart#service-discovery-and-supported-services). +### Prerequisites + To deploy Kubernetes monitoring with Netdata, you need: -- A working cluster running Kubernetes v1.9 or newer. -- The [kubectl](https://kubernetes.io/docs/reference/kubectl/overview/) command line tool, within [one minor version +- A working cluster running Kubernetes v1.9 or newer. +- The [kubectl](https://kubernetes.io/docs/reference/kubectl/overview/) command line tool, within [one minor version difference](https://kubernetes.io/docs/tasks/tools/install-kubectl/#before-you-begin) of your cluster, on an administrative system. -- The [Helm package manager](https://helm.sh/) v3.0.0 or newer on the same administrative system. +- The [Helm package manager](https://helm.sh/) v3.0.0 or newer on the same administrative system. +- A Netdata Cloud account with a Space to connect the cluster to. -## Install the Netdata Helm chart +## Deploy Netdata on your Kubernetes Cluster -We recommend you install the Helm chart using our Helm repository. In the `helm install` command, replace `netdata` with -the release name of your choice. +First, you need to add the Netdata helm repository, and then install Netdata. +The installation process securely connects your Kubernetes cluster to stream metrics data to Netdata Cloud, enabling Kubernetes-specific visualizations like the health map and time-series composite charts. -```bash -helm repo add netdata https://netdata.github.io/helmchart/ -helm install netdata netdata/netdata -``` +<Tabs groupId="installation_type"> +<TabItem value="new_installations" label="New Installations"> -Run `kubectl get services` and `kubectl get pods` to confirm that your cluster now runs a `netdata` service, one -parent pod, and multiple child pods. +<h3> Install Netdata via the <code>helm install</code> command </h3> -You've now installed Netdata on your Kubernetes cluster. Next, it's time to opt-in and enable the powerful Kubernetes -dashboards available in Netdata Cloud. +#### Steps -## Connect your Kubernetes cluster to Netdata Cloud +1. Add the Netdata Helm chart repository by running: -To start [Kubernetes monitoring](https://github.com/netdata/netdata/blob/master/docs/cloud/visualize/kubernetes.md), you must first -[connect](https://github.com/netdata/netdata/blob/master/claim/README.md) your Kubernetes cluster to [Netdata Cloud](https://app.netdata.cloud). The connection process securely -connects your Kubernetes cluster to stream metrics data to Netdata Cloud, enabling Kubernetes-specific visualizations -like the health map and time-series composite charts. + ```bash + helm repo add netdata https://netdata.github.io/helmchart/ + ``` -### New installations +2. To install Netdata using the `helm install` command, run: -First, find the script to run an `helm install` command. You can get it by clicking on your Space's dropdown, then **Manage your Space**. -Click the **Nodes** tab and select the environment your node is running, in this case **kubernetes**, to reveal the script for your Space in Netdata Cloud. You need the `TOKEN` -and `ROOM` values. + ```bash + helm install netdata netdata/netdata + ``` -The script should be similar to: + > ### Note + > + > If you plan to connect the node to Netdata Cloud, you can find the command with the right parameters by clicking the "Add Nodes" button in your Space's Nodes tab. -```bash -helm install netdata netdata/netdata --set parent.claiming.enabled="true" --set parent.claiming.token="TOKEN" --set parent.claiming.rooms="ROOM" --set child.claiming.enabled=true --set child.claiming.token="TOKEN" --set child.claiming.rooms="ROOM" -``` + For more installation options, please read our [Netdata Helm chart for Kubernetes](https://github.com/netdata/helmchart/blob/master/charts/netdata/README.md) reference. -### Existing installations +#### Expected Result -On an existing installation, you will need to override the configuration values by running the `helm upgrade` command and provide a file with the values to override. You can start with creating a file called `override.yml`. +Run `kubectl get services` and `kubectl get pods` to confirm that your cluster now runs a `netdata` service, one parent pod, and multiple child pods. -```bash -touch override.yml -``` +</TabItem> +<TabItem value="existing_installations" label="Existing Installations"> -Paste the following into your `override.yml` file, replacing instances of `ROOM` and `TOKEN` with those from the script from Netdata Cloud. These settings connect your `parent`/`child` nodes to Netdata Cloud and store more -metrics in the nodes' time-series databases. - -```yaml -parent: - claiming: - enabled: true - token: "TOKEN" - rooms: "ROOM" - -child: - claiming: - enabled: true - token: "TOKEN" - rooms: "ROOM" - configs: - netdata: - data: | - [global] - memory mode = ram - history = 3600 - [health] - enabled = no -``` +<h3> Connect an existing Netdata installation to Netdata Cloud </h3> -> ❗ These override settings, along with the Helm chart's defaults, will retain an hour's worth of metrics (`history = -> 3600`, or `3600 seconds`) on each child node. Based on your metrics retention needs, and the resources available on -> your cluster, you may want to increase the `history` setting. +On an existing installation, in order to connect it to Netdata Cloud you will need to override the configuration values by running the `helm upgrade` command and provide a file with the values to override. -Apply these new settings: +#### Steps -```bash -helm upgrade -f override.yml netdata netdata/netdata -``` +1. You can start with creating a file called `override.yml` -The cluster terminates the old pods and creates new ones with the proper persistence and connection configuration. You'll -see your nodes, containers, and pods appear in Netdata Cloud in a few seconds. + ```bash + touch override.yml + ``` + +2. Paste the following into your `override.yml` file. + + ```yaml + parent: + claiming: + enabled: true + token: YOUR_CLAIM_TOKEN + rooms: YOUR_ROOM_ID_A,YOUR_ROOM_ID_B + + child: + claiming: + enabled: true + token: YOUR_CLAIM_TOKEN + rooms: YOUR_ROOM_ID_A,YOUR_ROOM_ID_B + configs: + netdata: + data: | + [global] + memory mode = ram + history = 3600 + [health] + enabled = no + ``` + + > :bookmark_tabs: Note + > + > Make sure to replace `YOUR_CLAIM_TOKEN` with the claim token of your space, + > and `YOUR_ROOM_ID` with the ID of the room you are willing to connect to. + + These settings connect your `parent`/`child` nodes to Netdata Cloud and store more metrics in the nodes' time-series databases. + + > :bookmark_tabs: Info + > + > These override settings, along with the Helm chart's defaults, will retain an hour's worth of metrics (`history = 3600`, or `3600 seconds`) on each child node. Based on your metrics retention needs, and the resources available on your cluster, you may want to increase the `history` setting. + +3. To apply these new settings, run: + + ```bash + helm upgrade -f override.yml netdata netdata/netdata + ``` + +#### Expected Result + +The cluster terminates the old pods and creates new ones with the proper persistence and connection configuration. You'll see your nodes, containers, and pods appear in Netdata Cloud in a few seconds. + +</TabItem> +</Tabs> ![Netdata's Kubernetes monitoring visualizations](https://user-images.githubusercontent.com/1153921/107801491-5dcb0f00-6d1d-11eb-9ab1-876c39f556e2.png) @@ -119,8 +129,7 @@ in Netdata, in addition to more guides and resources. Read up on the various configuration options in the [Helm chart documentation](https://github.com/netdata/helmchart#configuration) if you need to tweak your Kubernetes monitoring. -Your first option is to create an `override.yml` file, if you haven't created one already for -[connect](#connect-your-kubernetes-cluster-to-netdata-cloud), then apply the new configuration to your cluster with `helm +Your first option is to create an `override.yml` file, if you haven't created one already upon [deploying](#deploy-netdata-on-your-kubernetes-cluster), then apply the new configuration to your cluster with `helm upgrade`. ```bash @@ -140,8 +149,7 @@ Netdata's [service discovery](https://github.com/netdata/agent-service-discovery of the Helm chart installation, finds what services are running in a cluster's containers and automatically collects service-level metrics from them. -Service discovery supports [popular applications](https://github.com/netdata/helmchart#applications) and [Prometheus -endpoints](https://github.com/netdata/helmchart#prometheus-endpoints). +Service discovery supports [popular applications](https://github.com/netdata/helmchart#applications) and [Prometheus endpoints](https://github.com/netdata/helmchart#prometheus-endpoints). If your cluster runs services on non-default ports or uses non-default names, you may need to configure service discovery to start collecting metrics from your services. You have to edit the default ConfigMap that is shipped with @@ -153,8 +161,7 @@ First, copy the default file to your administrative system. curl https://raw.githubusercontent.com/netdata/helmchart/master/charts/netdata/sdconfig/child.yml -o child.yml ``` -Edit the new `child.yml` file according to your needs. See the [Helm chart -configuration](https://github.com/netdata/helmchart#configuration) and the file itself for details. +Edit the new `child.yml` file according to your needs. See the [Helm chart configuration](https://github.com/netdata/helmchart#configuration) and the file itself for details. You can then run `helm upgrade` with the `--set-file` argument to use your configured `child.yml` file instead of the default, changing the path if you copied it elsewhere. @@ -184,18 +191,10 @@ helm upgrade netdata netdata/netdata ## What's next? -[Start Kubernetes monitoring](https://github.com/netdata/netdata/blob/master/docs/cloud/visualize/kubernetes.md) in Netdata Cloud, which -comes with meaningful visualizations out of the box. - -Read our guide, [_Kubernetes monitoring with Netdata: Overview and -visualizations_](https://github.com/netdata/netdata/blob/master/docs/guides/monitor/kubernetes-k8s-netdata.md), for a complete walkthrough of Netdata's Kubernetes -monitoring capabilities, including a health map of every container in your infrastructure, aggregated resource -utilization metrics, and application metrics. +[Start Kubernetes monitoring](https://github.com/netdata/netdata/blob/master/docs/cloud/visualize/kubernetes.md) in Netdata Cloud, which comes with meaningful visualizations out of the box. ### Related reference documentation - [Netdata Cloud · Kubernetes monitoring](https://github.com/netdata/netdata/blob/master/docs/cloud/visualize/kubernetes.md) - [Netdata Helm chart](https://github.com/netdata/helmchart) - [Netdata service discovery](https://github.com/netdata/agent-service-discovery/) - - diff --git a/packaging/installer/methods/macos.md b/packaging/installer/methods/macos.md index f80f4c13..11884f7d 100644 --- a/packaging/installer/methods/macos.md +++ b/packaging/installer/methods/macos.md @@ -1,10 +1,9 @@ <!-- title: "Install Netdata on macOS" custom_edit_url: "https://github.com/netdata/netdata/edit/master/packaging/installer/methods/macos.md" -sidebar_label: "Install Netdata on macOS" +sidebar_label: "macOS" learn_status: "Published" -learn_topic_type: "Tasks" -learn_rel_path: "Installation" +learn_rel_path: "Installation/Install on specific environments" --> # Install Netdata on macOS @@ -35,13 +34,11 @@ curl https://my-netdata.io/kickstart.sh > /tmp/netdata-kickstart.sh && sh /tmp/n The Netdata Agent is installed under `/usr/local/netdata`. Dependencies are handled via Homebrew. **Automatically connect to Netdata Cloud during installation** -<!-- Potential reuse: https://learn.netdata.cloud/docs/agent/claim#connect-an-agent-running-in-macos--> -<!--Potential reuse https://learn.netdata.cloud/docs/agent/packaging/installer/methods/kickstart#connect-node-to-netdata-cloud-during-installation The following information is copied from this link.--> 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/cloud.mdx#manage-spaces). +area](https://github.com/netdata/netdata/blob/master/docs/cloud/spaces.md). - `--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. @@ -81,7 +78,7 @@ We don't recommend installing Netdata from source on macOS, as it can be difficu ``` 2. Click **Install** on the Software Update popup window that appears. -3. Use the same terminal session to install some of Netdata's prerequisites using Homebrew. If you don't want to use [Netdata Cloud](https://github.com/netdata/netdata/blob/master/docs/cloud/cloud.mdx), you can omit `cmake`. +3. Use the same terminal session to install some of Netdata's prerequisites using Homebrew. If you don't want to use [Netdata Cloud](https://github.com/netdata/netdata/blob/master/docs/quickstart/infrastructure.md), you can omit `cmake`. ```bash brew install ossp-uuid autoconf automake pkg-config libuv lz4 json-c openssl libtool cmake @@ -103,13 +100,3 @@ We don't recommend installing Netdata from source on macOS, as it can be difficu > Your Netdata configuration directory will be at `/usr/local/netdata/`. > Your stock configuration directory will be at `/usr/local/lib/netdata/conf.d/`. > The installer will also install a startup plist to start Netdata when your macOS system boots. - -## What's next? - -When you're finished with installation, check out our [single-node](https://github.com/netdata/netdata/blob/master/docs/quickstart/single-node.md) or -[infrastructure](https://github.com/netdata/netdata/blob/master/docs/quickstart/infrastructure.md) monitoring quickstart guides based on your use case. - -Or, skip straight to [configuring the Netdata Agent](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md). - - - diff --git a/packaging/installer/methods/manual.md b/packaging/installer/methods/manual.md index 46bc9a33..9910f7f9 100644 --- a/packaging/installer/methods/manual.md +++ b/packaging/installer/methods/manual.md @@ -2,10 +2,10 @@ title: "Install Netdata on Linux from a Git checkout" description: "Use the Netdata Agent source code from GitHub, plus helper scripts to set up your system, to install Netdata without packages or binaries." custom_edit_url: "https://github.com/netdata/netdata/edit/master/packaging/installer/methods/manual.md" -sidebar_label: "Install Netdata on Linux from a Git checkout" +sidebar_label: "From a Git checkout" learn_status: "Published" -learn_topic_type: "Tasks" -learn_rel_path: "Installation" +learn_rel_path: "Installation/Installation methods" +sidebar_position: 30 --> # Install Netdata on Linux from a Git checkout @@ -226,16 +226,3 @@ Our current build process unfortunately has some issues when using certain confi If the installation fails with errors like `/bin/ld: externaldeps/libwebsockets/libwebsockets.a(context.c.o): relocation R_X86_64_32 against '.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC`, and you are trying to build with `clang` on Linux, you will need to build Netdata using GCC to get a fully functional install. In most cases, you can do this by running `CC=gcc ./netdata-installer.sh`. - -## What's next? - -When you're finished with installation, check out our [single-node](https://github.com/netdata/netdata/blob/master/docs/quickstart/single-node.md) or -[infrastructure](https://github.com/netdata/netdata/blob/master/docs/quickstart/infrastructure.md) monitoring quickstart guides based on your use case. - -Or, skip straight to [configuring the Netdata Agent](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md). - -Read through Netdata's [documentation](https://learn.netdata.cloud/docs), which is structured based on actions and -solutions, to enable features like health monitoring, alarm notifications, long-term metrics storage, exporting to -external databases, and more. - - diff --git a/packaging/installer/methods/methods.md b/packaging/installer/methods/methods.md new file mode 100644 index 00000000..f9ca2253 --- /dev/null +++ b/packaging/installer/methods/methods.md @@ -0,0 +1,26 @@ +<!-- +title: "Installation methods" +description: "Netdata can be installed as a DEB/RPM package, a static binary, a docker container or from source" +custom_edit_url: https://github.com/netdata/netdata/edit/master/packaging/installer/methods/methods.md +sidebar_label: "Installation methods" +learn_status: "Published" +learn_rel_path: "Installation/Installation methods" +sidebar_position: 30 +--> + +# Installation methods + +Netdata can be installed: + +- [As a DEB/RPM package](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/packages.md) +- [As a static binary](https://github.com/netdata/netdata/blob/master/packaging/makeself/README.md) +- [From a git checkout](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/manual.md) +- [As a docker container](https://github.com/netdata/netdata/blob/master/packaging/docker/README.md) + +The [one line installer kickstart.sh](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/kickstart.md) +picks the most appropriate method out of the first three for any system +and is the recommended installation method, if you don't use containers. + +`kickstart.sh` can also be used for +[offline installation](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/offline.md), +suitable for air-gapped systems. diff --git a/packaging/installer/methods/offline.md b/packaging/installer/methods/offline.md index e49f1d2e..f2b6cc41 100644 --- a/packaging/installer/methods/offline.md +++ b/packaging/installer/methods/offline.md @@ -2,15 +2,15 @@ title: "Install Netdata on offline systems" description: "Install the Netdata Agent on offline/air gapped systems to benefit from real-time, per-second monitoring without connecting to the internet." custom_edit_url: "https://github.com/netdata/netdata/edit/master/packaging/installer/methods/offline.md" -sidebar_label: "Install Netdata on offline systems" +sidebar_label: "Offline systems" learn_status: "Published" -learn_topic_type: "Tasks" -learn_rel_path: "Installation" +learn_rel_path: "Installation/Installation methods" +sidebar_position: 50 --> # Install Netdata on offline systems -Our kickstart install script provides support for installing the Netdata Agent on systems which do not have a +Our kickstart install script provides support for installing the Netdata Agent on air-gapped systems which do not have a usable internet connection by prefetching all of the required files so that they can be copied to the target system. Currently, we only support using static installs with this method. There are tentative plans to support building locally on offline systems as well, but there is currently no estimate of when this functionality may be implemented. @@ -57,14 +57,3 @@ offline install source directory. It accepts all the [same options as the kickst script](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/kickstart.md#optional-parameters-to-alter-your-installation) for further customization of the installation, though it will default to not enabling automatic updates (as they are not supported on offline installs). - -## What's next? - -When you're finished with installation, check out our [single-node](https://github.com/netdata/netdata/blob/master/docs/quickstart/single-node.md) or -[infrastructure](https://github.com/netdata/netdata/blob/master/docs/quickstart/infrastructure.md) monitoring quickstart guides based on your use case. - -Or, skip straight to [configuring the Netdata Agent](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md). - -Read through Netdata's [documentation](https://learn.netdata.cloud/docs), which is structured based on actions and -solutions, to enable features like health monitoring, alarm notifications, long-term metrics storage, exporting to -external databases, and more. diff --git a/packaging/installer/methods/packages.md b/packaging/installer/methods/packages.md index 13551280..1b687046 100644 --- a/packaging/installer/methods/packages.md +++ b/packaging/installer/methods/packages.md @@ -2,13 +2,13 @@ title: "Install Netdata using native DEB/RPM packages." description: "Instructions for how to install Netdata using native DEB or RPM packages." custom_edit_url: "https://github.com/netdata/netdata/edit/master/packaging/installer/methods/packages.md" -sidebar_label: "Install Netdata using native DEB/RPM packages." +sidebar_label: "Native DEB/RPM packages" learn_status: "Published" -learn_topic_type: "Tasks" -learn_rel_path: "Installation" +learn_rel_path: "Installation/Installation methods" +sidebar_position: 20 --> -# Installing Netdata using native DEB or RPM packages. +# Install Netdata using native DEB/RPM packages. For most common Linux distributions that use either DEB or RPM packages, Netdata provides pre-built native packages for current releases in-line with @@ -41,7 +41,7 @@ Under each of those directories is a directory for each supported release of tha directory for each supported CPU architecture which contains the actual repository. For example, for stable release packages for RHEL 9 on 64-bit x86, the full URL for the repository would be -https://repo.netdata.cloud/repos/stable/el/9/x86\_64/ +https://repo.netdata.cloud/repos/stable/el/9/x86_64/ Our RPM packages and repository metadata are signed using a GPG key with a user name of ‘Netdatabot’. The current key fingerprint is `6588FDD7B14721FE7C3115E6F9177B5265F56346`. The associated public key can be fetched from diff --git a/packaging/installer/methods/pfsense.md b/packaging/installer/methods/pfsense.md index e0556629..1a03afb5 100644 --- a/packaging/installer/methods/pfsense.md +++ b/packaging/installer/methods/pfsense.md @@ -2,6 +2,9 @@ title: "Install Netdata on pfSense" description: "Install Netdata on pfSense to monitor the health and performance of firewalls with thousands of real-time, per-second metrics." custom_edit_url: https://github.com/netdata/netdata/edit/master/packaging/installer/methods/pfsense.md +sidebar_label: "pfSense" +learn_status: "Published" +learn_rel_path: "Installation/Install on specific environments" --> # Install Netdata on pfSense diff --git a/packaging/installer/methods/source.md b/packaging/installer/methods/source.md index ecf35382..7b6b88d4 100644 --- a/packaging/installer/methods/source.md +++ b/packaging/installer/methods/source.md @@ -4,8 +4,8 @@ description: "Package maintainers and power users may be interested in manually custom_edit_url: "https://github.com/netdata/netdata/edit/master/packaging/installer/methods/source.md" sidebar_label: "Manually build Netdata from source" learn_status: "Published" -learn_topic_type: "Tasks" -learn_rel_path: "Installation" +learn_rel_path: "Installation/Package maintainers" +sidebar_position: 100 --> # Manually build Netdata from source @@ -233,7 +233,7 @@ using glibc or musl. To use one of these: Alternatively, you may wish to build the eBPF code locally yourself. For instructions, please consult [the README file for our kernel-collector -repository](https://github.com/netdata/kernel-collector/blob/master/README.md), +repository](https://github.com/netdata/kernel-collector/#readme), which outlines both the required dependencies, as well as multiple options for building the code. diff --git a/packaging/installer/methods/synology.md b/packaging/installer/methods/synology.md index e3602df5..3910859b 100644 --- a/packaging/installer/methods/synology.md +++ b/packaging/installer/methods/synology.md @@ -2,6 +2,9 @@ title: "Install Netdata on Synology" description: "The Netdata Agent can be installed on AMD64-compatible NAS systems using the 64-bit pre-compiled static binary." custom_edit_url: https://github.com/netdata/netdata/edit/master/packaging/installer/methods/synology.md +sidebar_label: "Synology" +learn_status: "Published" +learn_rel_path: "Installation/Install on specific environments" --> # Install Netdata on Synology @@ -14,7 +17,9 @@ custom_edit_url: https://github.com/netdata/netdata/edit/master/packaging/instal > with your recommended improvements or changes. Thank you! -The good news is that our [one-line installation script](kickstart.md) works fine if your NAS is one that uses the amd64 architecture. It +The good news is that our +[one-line installation script](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/kickstart.md) +works fine if your NAS is one that uses the amd64 architecture. It will install the content into `/opt/netdata`, making future removal safe and simple. ## Run as netdata user @@ -25,8 +30,8 @@ installations run it as the `netdata` user, you might wish to do the same. This 1. Create a group `netdata` via the Synology group interface. Give it no access to anything. 2. Create a user `netdata` via the Synology user interface. Give it no access to anything and a random password. Assign the user to the `netdata` group. Netdata will chuid to this user when running. -3. Change ownership of the following directories, as defined in [Netdata - Security](https://github.com/netdata/netdata/blob/master/docs/netdata-security.md#security-design): +3. Change ownership of the following directories, as defined in + [Netdata Security](https://github.com/netdata/netdata/blob/master/docs/netdata-security.md#security-design): ```sh chown -R root:netdata /opt/netdata/usr/share/netdata diff --git a/packaging/installer/methods/systems.md b/packaging/installer/methods/systems.md new file mode 100644 index 00000000..e53c4f4a --- /dev/null +++ b/packaging/installer/methods/systems.md @@ -0,0 +1,18 @@ +<!-- +title: "Install on specific environments" +description: "Netdata can be installed as a DEB/RPM package, a static binary, a docker container or from source" +custom_edit_url: https://github.com/netdata/netdata/edit/master/packaging/installer/methods/systems.md +sidebar_label: "Install on specific environments" +learn_status: "Published" +learn_rel_path: "Installation/Install on specific environments" +--> + +# Install on specific environments + +This category contains specific instructions for some popular environments. +If you have a standard environment that is not yet listed here, just use the +[one line installer kickstart.sh](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/kickstart.md) + +If your environment is somewhat old or unusual, check our +[platform support policy](https://github.com/netdata/netdata/blob/master/packaging/PLATFORM_SUPPORT.md). + diff --git a/packaging/installer/netdata-uninstaller.sh b/packaging/installer/netdata-uninstaller.sh index 2f2e89ff..419002e6 100755 --- a/packaging/installer/netdata-uninstaller.sh +++ b/packaging/installer/netdata-uninstaller.sh @@ -239,15 +239,18 @@ if [ -x "$(command -v apt-get)" ] && [ "${INSTALL_TYPE}" = "binpkg-deb" ]; then if dpkg -s netdata > /dev/null; then echo "Found netdata native installation" if user_input "Do you want to remove netdata? "; then + # shellcheck disable=SC2086 apt-get remove netdata ${FLAG} fi if dpkg -s netdata-repo-edge > /dev/null; then if user_input "Do you want to remove netdata-repo-edge? "; then + # shellcheck disable=SC2086 apt-get remove netdata-repo-edge ${FLAG} fi fi if dpkg -s netdata-repo > /dev/null; then if user_input "Do you want to remove netdata-repo? "; then + # shellcheck disable=SC2086 apt-get remove netdata-repo ${FLAG} fi fi @@ -257,15 +260,18 @@ elif [ -x "$(command -v dnf)" ] && [ "${INSTALL_TYPE}" = "binpkg-rpm" ]; then if rpm -q netdata > /dev/null; then echo "Found netdata native installation." if user_input "Do you want to remove netdata? "; then + # shellcheck disable=SC2086 dnf remove netdata ${FLAG} fi if rpm -q netdata-repo-edge > /dev/null; then if user_input "Do you want to remove netdata-repo-edge? "; then + # shellcheck disable=SC2086 dnf remove netdata-repo-edge ${FLAG} fi fi if rpm -q netdata-repo > /dev/null; then if user_input "Do you want to remove netdata-repo? "; then + # shellcheck disable=SC2086 dnf remove netdata-repo ${FLAG} fi fi @@ -275,15 +281,18 @@ elif [ -x "$(command -v yum)" ] && [ "${INSTALL_TYPE}" = "binpkg-rpm" ]; then if rpm -q netdata > /dev/null; then echo "Found netdata native installation." if user_input "Do you want to remove netdata? "; then + # shellcheck disable=SC2086 yum remove netdata ${FLAG} fi if rpm -q netdata-repo-edge > /dev/null; then if user_input "Do you want to remove netdata-repo-edge? "; then + # shellcheck disable=SC2086 yum remove netdata-repo-edge ${FLAG} fi fi if rpm -q netdata-repo > /dev/null; then if user_input "Do you want to remove netdata-repo? "; then + # shellcheck disable=SC2086 yum remove netdata-repo ${FLAG} fi fi @@ -296,15 +305,18 @@ elif [ -x "$(command -v zypper)" ] && [ "${INSTALL_TYPE}" = "binpkg-rpm" ]; then if zypper search -i netdata > /dev/null; then echo "Found netdata native installation." if user_input "Do you want to remove netdata? "; then + # shellcheck disable=SC2086 zypper ${FLAG} remove netdata fi if zypper search -i netdata-repo-edge > /dev/null; then if user_input "Do you want to remove netdata-repo-edge? "; then + # shellcheck disable=SC2086 zypper ${FLAG} remove netdata-repo-edge fi fi if zypper search -i netdata-repo > /dev/null; then if user_input "Do you want to remove netdata-repo? "; then + # shellcheck disable=SC2086 zypper ${FLAG} remove netdata-repo fi fi diff --git a/packaging/installer/netdata-updater.sh b/packaging/installer/netdata-updater.sh index 130507c1..f8edb6d7 100755 --- a/packaging/installer/netdata-updater.sh +++ b/packaging/installer/netdata-updater.sh @@ -21,7 +21,7 @@ # - TMPDIR (set to a usable temporary directory) # - NETDATA_NIGHTLIES_BASEURL (set the base url for downloading the dist tarball) # -# Copyright: 2018-2020 Netdata Inc. +# Copyright: 2018-2023 Netdata Inc. # SPDX-License-Identifier: GPL-3.0-or-later # # Author: Paweł Krupa <paulfantom@gmail.com> @@ -225,9 +225,8 @@ enable_netdata_updater() { ;; "crontab") if [ -d "/etc/cron.d" ]; then - cat > "/etc/cron.d/netdata-updater" <<-EOF - 2 57 * * * root ${NETDATA_PREFIX}/netdata-updater.sh - EOF + [ -f "/etc/cron.d/netdata-updater" ] && rm -f "/etc/cron.d/netdata-updater" + install -p -m 0644 -o 0 -g 0 "${NETDATA_PREFIX}/usr/lib/system/cron/netdata-updater-daily" "/etc/cron.d/netdata-updater-daily" info "Auto-updating has been ENABLED through cron, using a crontab at /etc/cron.d/netdata-updater\n" info "If the update process fails and you have email notifications set up correctly for cron on this system, you should receive an email notification of the failure." @@ -262,6 +261,7 @@ disable_netdata_updater() { if [ -d /etc/cron.d ]; then rm -f /etc/cron.d/netdata-updater + rm -f /etc/cron.d/netdata-updater-daily fi info "Auto-updates have been DISABLED." @@ -341,11 +341,20 @@ create_tmp_directory() { fi } +check_for_curl() { + if [ -z "${curl}" ]; then + curl="$(PATH="${PATH}:/opt/netdata/bin" command -v curl 2>/dev/null && true)" + fi +} + _safe_download() { url="${1}" dest="${2}" - if command -v curl > /dev/null 2>&1; then - curl -sSL --connect-timeout 10 --retry 3 "${url}" > "${dest}" + + check_for_curl + + if [ -n "${curl}" ]; then + "${curl}" -sSL --connect-timeout 10 --retry 3 "${url}" > "${dest}" return $? elif command -v wget > /dev/null 2>&1; then wget -T 15 -O - "${url}" > "${dest}" @@ -375,8 +384,10 @@ get_netdata_latest_tag() { url="${1}/latest" dest="${2}" - if command -v curl >/dev/null 2>&1; then - tag=$(curl "${url}" -s -L -I -o /dev/null -w '%{url_effective}' | grep -m 1 -o '[^/]*$') + check_for_curl + + if [ -n "${curl}" ]; then + tag=$("${curl}" "${url}" -s -L -I -o /dev/null -w '%{url_effective}' | grep -m 1 -o '[^/]*$') elif command -v wget >/dev/null 2>&1; then tag=$(wget -S -O /dev/null "${url}" 2>&1 | grep -m 1 Location | grep -o '[^/]*$') else @@ -704,7 +715,7 @@ update_binpkg() { DISTRO="${ID}" - supported_compat_names="debian ubuntu centos fedora opensuse" + supported_compat_names="debian ubuntu centos fedora opensuse ol amzn" if str_in_list "${DISTRO}" "${supported_compat_names}"; then DISTRO_COMPAT_NAME="${DISTRO}" @@ -731,16 +742,7 @@ update_binpkg() { fi case "${DISTRO_COMPAT_NAME}" in - debian) - pm_cmd="apt-get" - repo_subcmd="update" - upgrade_cmd="--only-upgrade install" - pkg_install_opts="${interactive_opts}" - repo_update_opts="${interactive_opts}" - pkg_installed_check="dpkg -s" - INSTALL_TYPE="binpkg-deb" - ;; - ubuntu) + debian|ubuntu) pm_cmd="apt-get" repo_subcmd="update" upgrade_cmd="--only-upgrade install" @@ -749,20 +751,7 @@ update_binpkg() { pkg_installed_check="dpkg -s" INSTALL_TYPE="binpkg-deb" ;; - centos) - if command -v dnf > /dev/null; then - pm_cmd="dnf" - repo_subcmd="makecache" - else - pm_cmd="yum" - fi - upgrade_cmd="upgrade" - pkg_install_opts="${interactive_opts}" - repo_update_opts="${interactive_opts}" - pkg_installed_check="rpm -q" - INSTALL_TYPE="binpkg-rpm" - ;; - fedora) + centos|fedora|ol|amzn) if command -v dnf > /dev/null; then pm_cmd="dnf" repo_subcmd="makecache" @@ -815,11 +804,10 @@ update_binpkg() { # Simple function to encapsulate original updater behavior. update_legacy() { set_tarball_urls "${RELEASE_CHANNEL}" "${IS_NETDATA_STATIC_BINARY}" - if [ "${IS_NETDATA_STATIC_BINARY}" = "yes" ]; then - update_static && exit 0 - else - update_build && exit 0 - fi + case "${IS_NETDATA_STATIC_BINARY}" in + yes) update_static && exit 0 ;; + *) update_build && exit 0 ;; + esac } logfile= @@ -827,8 +815,8 @@ ndtmpdir= trap cleanup EXIT -if [ -t 2 ]; then - # we are running on a terminal +if [ -t 2 ] || [ "${GITHUB_ACTIONS}" ]; then + # we are running on a terminal or under CI # open fd 3 and send it to stderr exec 3>&2 else @@ -890,9 +878,7 @@ while [ -n "${1}" ]; do disable_netdata_updater exit $? ;; - *) - fatal "Unrecognized option ${1}" U001A - ;; + *) fatal "Unrecognized option ${1}" U001A ;; esac shift 1 @@ -934,9 +920,7 @@ case "${INSTALL_TYPE}" in set_tarball_urls "${RELEASE_CHANNEL}" "${IS_NETDATA_STATIC_BINARY}" update_static && exit 0 ;; - *binpkg*) - update_binpkg && exit 0 - ;; + *binpkg*) update_binpkg && exit 0 ;; "") # Fallback case for no `.install-type` file. This just works like the old install type detection. validate_environment_file update_legacy @@ -950,10 +934,6 @@ case "${INSTALL_TYPE}" in fatal "This script does not support updating custom installations without valid environment files." U0012 fi ;; - oci) - fatal "This script does not support updating Netdata inside our official Docker containers, please instead update the container itself." U0013 - ;; - *) - fatal "Unrecognized installation type (${INSTALL_TYPE}), unable to update." U0014 - ;; + oci) fatal "This script does not support updating Netdata inside our official Docker containers, please instead update the container itself." U0013 ;; + *) fatal "Unrecognized installation type (${INSTALL_TYPE}), unable to update." U0014 ;; esac |