summaryrefslogtreecommitdiffstats
path: root/packaging/installer
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-03-21 17:19:04 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-03-21 17:19:04 +0000
commit310edf444908b09ea6d00c03baceb7925f3bb7a2 (patch)
tree7064577c7fa7a851e2e930beb606ea8237b0bbd2 /packaging/installer
parentReleasing debian version 1.44.3-2. (diff)
downloadnetdata-310edf444908b09ea6d00c03baceb7925f3bb7a2.tar.xz
netdata-310edf444908b09ea6d00c03baceb7925f3bb7a2.zip
Merging upstream version 1.45.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'packaging/installer')
-rw-r--r--packaging/installer/README.md131
-rw-r--r--packaging/installer/REINSTALL.md4
-rw-r--r--packaging/installer/UNINSTALL.md4
-rw-r--r--packaging/installer/UPDATE.md6
-rw-r--r--packaging/installer/functions.sh272
-rwxr-xr-xpackaging/installer/install-required-packages.sh2
-rwxr-xr-xpackaging/installer/kickstart.sh79
-rw-r--r--packaging/installer/methods/ansible.md2
-rw-r--r--packaging/installer/methods/aws.md2
-rw-r--r--packaging/installer/methods/azure.md2
-rw-r--r--packaging/installer/methods/freebsd.md2
-rw-r--r--packaging/installer/methods/gcp.md2
-rw-r--r--packaging/installer/methods/kickstart.md161
-rw-r--r--packaging/installer/methods/macos.md18
-rw-r--r--packaging/installer/methods/manual.md4
-rw-r--r--packaging/installer/methods/offline.md4
-rw-r--r--packaging/installer/methods/packages.md2
-rw-r--r--packaging/installer/methods/source.md2
-rw-r--r--packaging/installer/methods/synology.md25
-rw-r--r--packaging/installer/methods/systems.md2
-rwxr-xr-xpackaging/installer/netdata-uninstaller.sh20
-rwxr-xr-xpackaging/installer/netdata-updater.sh125
22 files changed, 521 insertions, 350 deletions
diff --git a/packaging/installer/README.md b/packaging/installer/README.md
index a99e869b8..9260fb6e4 100644
--- a/packaging/installer/README.md
+++ b/packaging/installer/README.md
@@ -3,23 +3,16 @@ import { InstallRegexLink, InstallBoxRegexLink } from '@site/src/components/Inst
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
-# Install Netdata
+# Netdata Agent Installation
-This document will guide you through installing the open-source Netdata monitoring Agent on Linux, Docker, Kubernetes, and many others, often with one command.
+Netdata is very flexible and can be used to monitor all kinds of infrastructure. Read more about possible [Deployment guides](https://github.com/netdata/netdata/blob/master/docs/deployment-guides/README.md) to understand what better suites your needs.
-Netdata is very flexible and can be used to monitor all kinds of infrastructure. Read more about possible [Deployment strategies](https://github.com/netdata/netdata/blob/master/docs/category-overview-pages/deployment-strategies.md) to understand what better suites your needs.
+## Install through Netdata Cloud
-## Get started
+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.
-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.
-
-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.
-
-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.
+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.
To install Netdata in minutes on your platform:
@@ -27,113 +20,27 @@ To install Netdata in minutes on your platform:
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
-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).
-
-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.
-
-### What's next?
-
-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).
-
-#### Configuration
-
-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).
-
-#### Data collection
-
-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.
-
-#### Alerts & notifications
-
-Netdata comes with hundreds of preconfigured alerts, designed by our monitoring gurus in parallel with our open-source
-community, but you may want to [edit alerts](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.
-
-#### Make your deployment production ready
-
-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.
-
-## Install on Linux with one-line installer
-
-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.
-
-To install, copy the script, paste it into your node's terminal, and hit `Enter` to begin the installation process.
+Upon installation completing successfully, you should be able to see the node live in your Netdata Space and live charts in the Overview tab. [Take a look at our Dashboards and Charts](https://github.com/netdata/netdata/blob/master/docs/category-overview-pages/accessing-netdata-dashboards.md) section to read more about Netdata's features.
- <Tabs>
- <TabItem value="wget" label=<code>wget</code>>
+## Maintaining a Netdata Agent installation
- <OneLineInstallWget/>
+For actions like starting, stopping, restarting, updating and uninstalling the Netdata Agent take a look at your specific installation platform in the current section of our Documentation.
- </TabItem>
- <TabItem value="curl" label=<code>curl</code>>
+## Configuration
- <OneLineInstallCurl/>
+If you are looking to configure your Netdata Agent installation, refer to the [respective section in our Documentation](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration.md).
- </TabItem>
-</Tabs>
+## Data collection
-> ### 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.
+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/src/collectors/README.md). If there's a [supported collector](https://github.com/netdata/netdata/blob/master/src/collectors/COLLECTORS.md) for metrics you need, [configure the collector](https://github.com/netdata/netdata/blob/master/src/collectors/REFERENCE.md) or read about its requirements to configure your endpoint to publish metrics in the correct format and endpoint.
-Jump up to [what's next](#whats-next) to learn how to view your new dashboard and take your next steps in monitoring and
-troubleshooting with Netdata.
+## Alerts & notifications
-## Other installation methods
+Netdata comes with hundreds of pre-configured alerts, designed by our monitoring gurus in parallel with our open-source community, but you may want to [edit alerts](https://github.com/netdata/netdata/blob/master/src/health/REFERENCE.md) or [enable notifications](https://github.com/netdata/netdata/blob/master/docs/monitor/enable-notifications.md) to customize your Netdata experience.
-<InstallRegexLink>
- <InstallBoxRegexLink
- to="[](https://github.com/netdata/netdata/blob/master/packaging/docker/README.md)"
- os="Run with Docker"
- svg="docker" />
- <InstallBoxRegexLink
- to="[](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/kubernetes.md)"
- os="Deploy on Kubernetes"
- svg="kubernetes" />
- <InstallBoxRegexLink
- to="[](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/macos.md)"
- os="Install on macOS"
- svg="macos" />
- <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" />
- <InstallBoxRegexLink
- to="[](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/source.md)"
- os="Linux from source"
- svg="linux" />
- <InstallBoxRegexLink
- to="[](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/offline.md)"
- os="Linux for offline nodes"
- svg="linux" />
-</InstallRegexLink>
+## Make your deployment production ready
-- [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).
+Go through our [deployment guides](https://github.com/netdata/netdata/blob/master/docs/deployment-guides/README.md), for suggested configuration changes for production deployments.
## Advanced installation options and troubleshooting
@@ -146,7 +53,7 @@ option when you install or update Netdata using the [automatic one-line installa
script](#automatic-one-line-installation-script).
```bash
-wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh --no-updates
+wget -O /tmp/netdata-kickstart.sh https://get.netdata.cloud/kickstart.sh && sh /tmp/netdata-kickstart.sh --no-updates
```
With automatic updates disabled, you can choose exactly when and how you [update
@@ -215,7 +122,7 @@ There are three potential workarounds for this:
affect many projects other than just Netdata, and there are unfortunately a number of other services out there
that do not provide IPv6 connectivity, so taking this route is likely to save you time in the future as well.
2. If you are using a system that we publish native packages for (see our [platform support
- policy](https://github.com/netdata/netdata/blob/master/packaging/PLATFORM_SUPPORT.md) for more details),
+ policy](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/versions-and-platforms.md) for more details),
you can manually set up our native package repositories as outlined in our [native package install
documentation](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/packages.md). Our official
package repositories do provide service over IPv6, so they work without issue on hosts without IPv4 connectivity.
diff --git a/packaging/installer/REINSTALL.md b/packaging/installer/REINSTALL.md
index 82cea498a..91dd3d5f3 100644
--- a/packaging/installer/REINSTALL.md
+++ b/packaging/installer/REINSTALL.md
@@ -18,7 +18,7 @@ used, read the contents of the `.environment` file and look for a `REINSTALL_OPT
optional parameters.
```bash
-wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh --reinstall
+wget -O /tmp/netdata-kickstart.sh https://get.netdata.cloud/kickstart.sh && sh /tmp/netdata-kickstart.sh --reinstall
```
### Performing a clean reinstall
@@ -35,7 +35,7 @@ used, read the contents of the `.environment` file and look for a `REINSTALL_OPT
optional parameters.
```bash
-wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh --reinstall-clean
+wget -O /tmp/netdata-kickstart.sh https://get.netdata.cloud/kickstart.sh && sh /tmp/netdata-kickstart.sh --reinstall-clean
```
### Changing the install type of an existing installation
diff --git a/packaging/installer/UNINSTALL.md b/packaging/installer/UNINSTALL.md
index a66bd7a28..dc1dec0c2 100644
--- a/packaging/installer/UNINSTALL.md
+++ b/packaging/installer/UNINSTALL.md
@@ -8,13 +8,13 @@
The recommended method to uninstall Netdata on a system is to use our kickstart installer script with the `--uninstall` option like so:
```sh
-wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh --uninstall
+wget -O /tmp/netdata-kickstart.sh https://get.netdata.cloud/kickstart.sh && sh /tmp/netdata-kickstart.sh --uninstall
```
Or (if you have curl but not wget):
```sh
-curl https://my-netdata.io/kickstart.sh > /tmp/netdata-kickstart.sh && sh /tmp/netdata-kickstart.sh --uninstall
+curl https://get.netdata.cloud/kickstart.sh > /tmp/netdata-kickstart.sh && sh /tmp/netdata-kickstart.sh --uninstall
```
This will work in most cases without you needing to do anything more other than accepting removal of configuration
diff --git a/packaging/installer/UPDATE.md b/packaging/installer/UPDATE.md
index 7275ee524..50d8c8270 100644
--- a/packaging/installer/UPDATE.md
+++ b/packaging/installer/UPDATE.md
@@ -52,7 +52,7 @@ installation script in dry-run mode to attempt to determine what method to use t
command:
```bash
-wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh --dry-run
+wget -O /tmp/netdata-kickstart.sh https://get.netdata.cloud/kickstart.sh && sh /tmp/netdata-kickstart.sh --dry-run
```
Note that if you installed Netdata using an installation prefix, you will need to add an `--install-prefix` option
@@ -75,7 +75,7 @@ If you installed Netdata using an installation prefix, you will need to add an `
that prefix to this command to make sure it finds Netdata.
```bash
-wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh
+wget -O /tmp/netdata-kickstart.sh https://get.netdata.cloud/kickstart.sh && sh /tmp/netdata-kickstart.sh
```
### Issues with older binpkg installs
@@ -204,6 +204,8 @@ The following configuration options are currently supported:
as a scheduled task. This random delay helps avoid issues resulting from too many nodes trying to reconnect to
the Cloud at the same time. The default value is 3600, which corresponds to one hour. Most users should not ever
need to change this.
+- `NETDATA_MAJOR_VERSION_UPDATES`: If set to a value other than 0, then new major versions will be installed
+ without user confirmation. Must be set to a non-zero value for automated updates to install new major versions.
- `NETDATA_NO_SYSTEMD_JOURNAL`: If set to a value other than 0, skip attempting to install the
`netdata-plugin-systemd-journal` package on supported systems on update. This optional package will be installed
by default on supported systems by the updater if this option is not set. Only affects systems using native packages.
diff --git a/packaging/installer/functions.sh b/packaging/installer/functions.sh
index dd3158d6d..9060930ce 100644
--- a/packaging/installer/functions.sh
+++ b/packaging/installer/functions.sh
@@ -192,6 +192,133 @@ netdata_banner() {
}
# -----------------------------------------------------------------------------
+# Feature management and configuration commands
+
+enable_feature() {
+ NETDATA_CMAKE_OPTIONS="$(echo "${NETDATA_CMAKE_OPTIONS}" | sed -e "s/-DENABLE_${1}=Off[[:space:]]*//g" -e "s/-DENABLE_${1}=On[[:space:]]*//g")"
+ if [ "${2}" -eq 1 ]; then
+ NETDATA_CMAKE_OPTIONS="$(echo "${NETDATA_CMAKE_OPTIONS}" | sed "s/$/ -DENABLE_${1}=On/")"
+ else
+ NETDATA_CMAKE_OPTIONS="$(echo "${NETDATA_CMAKE_OPTIONS}" | sed "s/$/ -DENABLE_${1}=Off/")"
+ fi
+}
+
+check_for_module() {
+ if [ -z "${pkgconf}" ]; then
+ pkgconf="$(command -v pkgconf 2>/dev/null)"
+ [ -z "${pkgconf}" ] && pkgconf="$(command -v pkg-config 2>/dev/null)"
+ [ -z "${pkgconf}" ] && fatal "Unable to find a usable pkgconf/pkg-config command, cannot build Netdata." I0013
+ fi
+
+ "${pkgconf}" "${1}"
+ return "${?}"
+}
+
+check_for_feature() {
+ feature_name="${1}"
+ feature_state="${2}"
+ shift 2
+ feature_modules="${*}"
+
+ if [ -z "${feature_state}" ]; then
+ # shellcheck disable=SC2086
+ if check_for_module ${feature_modules}; then
+ enable_feature "${feature_name}" 1
+ else
+ enable_feature "${feature_name}" 0
+ fi
+ else
+ enable_feature "${feature_name}" "${feature_state}"
+ fi
+}
+
+prepare_cmake_options() {
+ NETDATA_CMAKE_OPTIONS="-S ./ -B ${NETDATA_BUILD_DIR} ${CMAKE_OPTS} ${NETDATA_PREFIX+-DCMAKE_INSTALL_PREFIX="${NETDATA_PREFIX}"} ${NETDATA_USER:+-DNETDATA_USER=${NETDATA_USER}} ${NETDATA_CMAKE_OPTIONS} "
+
+ NEED_OLD_CXX=0
+
+ if [ "${FORCE_LEGACY_CXX:-0}" -eq 1 ]; then
+ NEED_OLD_CXX=1
+ else
+ if command -v gcc >/dev/null 2>&1; then
+ if [ "$(gcc --version | head -n 1 | sed 's/(.*) //' | cut -f 2 -d ' ' | cut -f 1 -d '.')" -lt 5 ]; then
+ NEED_OLD_CXX=1
+ fi
+ fi
+
+ if command -v clang >/dev/null 2>&1; then
+ if [ "$(clang --version | head -n 1 | cut -f 3 -d ' ' | cut -f 1 -d '.')" -lt 4 ]; then
+ NEED_OLD_CXX=1
+ fi
+ fi
+ fi
+
+ if [ "${NEED_OLD_CXX}" -eq 1 ]; then
+ NETDATA_CMAKE_OPTIONS="${NETDATA_CMAKE_OPTIONS} -DUSE_CXX_11=On"
+ fi
+
+ if [ "${ENABLE_GO:-1}" -eq 1 ]; then
+ enable_feature PLUGIN_GO 1
+ else
+ enable_feature PLUGIN_GO 0
+ fi
+
+ if [ "${USE_SYSTEM_PROTOBUF:-0}" -eq 1 ]; then
+ enable_feature BUNDLED_PROTOBUF 0
+ else
+ enable_feature BUNDLED_PROTOBUF 1
+ fi
+
+ if [ -z "${ENABLE_SYSTEMD_JOURNAL}" ]; then
+ if check_for_module libsystemd; then
+ if check_for_module libelogind; then
+ ENABLE_SYSTEMD_JOURNAL=0
+ else
+ ENABLE_SYSTEMD_JOURNAL=1
+ fi
+ else
+ ENABLE_SYSTEMD_JOURNAL=0
+ fi
+ fi
+
+ enable_feature PLUGIN_SYSTEMD_JOURNAL "${ENABLE_SYSTEMD_JOURNAL}"
+
+ if command -v cups-config >/dev/null 2>&1 || check_for_module libcups || check_for_module cups; then
+ ENABLE_CUPS=1
+ else
+ ENABLE_CUPS=0
+ fi
+
+ enable_feature PLUGIN_CUPS "${ENABLE_CUPS}"
+
+ IS_LINUX=0
+ [ "$(uname -s)" = "Linux" ] && IS_LINUX=1
+ enable_feature PLUGIN_DEBUGFS "${IS_LINUX}"
+ enable_feature PLUGIN_PERF "${IS_LINUX}"
+ enable_feature PLUGIN_SLABINFO "${IS_LINUX}"
+ enable_feature PLUGIN_CGROUP_NETWORK "${IS_LINUX}"
+ enable_feature PLUGIN_LOCAL_LISTENERS "${IS_LINUX}"
+ enable_feature PLUGIN_NETWORK_VIEWER "${IS_LINUX}"
+ enable_feature PLUGIN_EBPF "${ENABLE_EBPF:-0}"
+ enable_feature PLUGIN_LOGS_MANAGEMENT "${ENABLE_LOGS_MANAGEMENT:-0}"
+ enable_feature LOGS_MANAGEMENT_TESTS "${ENABLE_LOGS_MANAGEMENT_TESTS:-0}"
+
+ enable_feature ACLK "${ENABLE_CLOUD:-1}"
+ enable_feature CLOUD "${ENABLE_CLOUD:-1}"
+ enable_feature BUNDLED_JSONC "${NETDATA_BUILD_JSON_C:-0}"
+ enable_feature DBENGINE "${ENABLE_DBENGINE:-1}"
+ enable_feature H2O "${ENABLE_H2O:-1}"
+ enable_feature ML "${NETDATA_ENABLE_ML:-1}"
+ enable_feature PLUGIN_APPS "${ENABLE_APPS:-1}"
+
+ check_for_feature EXPORTER_PROMETHEUS_REMOTE_WRITE "${EXPORTER_PROMETHEUS}" snappy
+ check_for_feature EXPORTER_MONGODB "${EXPORTER_MONGODB}" libmongoc-1.0
+ check_for_feature PLUGIN_FREEIPMI "${ENABLE_FREEIPMI}" libipmimonitoring
+ check_for_feature PLUGIN_NFACCT "${ENABLE_NFACCT}" libnetfilter_acct libnml
+ check_for_feature PLUGIN_XENSTAT "${ENABLE_XENSTAT}" xenstat xenlight
+}
+
+# -----------------------------------------------------------------------------
# portable service command
service_cmd="$(command -v service 2> /dev/null || true)"
@@ -463,45 +590,6 @@ get_systemd_service_dir() {
fi
}
-install_non_systemd_init() {
- [ "${UID}" != 0 ] && return 1
- key="$(get_os_key)"
-
- 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/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/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/initd/init.d/netdata /etc/init.d/netdata &&
- run chmod 755 /etc/init.d/netdata &&
- run chkconfig netdata on &&
- return 0
- else
- warning "Could not determine what type of init script to install on this system."
- return 1
- fi
- elif [ -f /etc/init.d/netdata ]; then
- echo >&2 "file '/etc/init.d/netdata' already exists."
- return 0
- else
- warning "Could not determine what type of init script to install on this system."
- fi
-
- return 1
-}
-
run_install_service_script() {
if [ -z "${tmpdir}" ]; then
tmpdir="${TMPDIR:-/tmp}"
@@ -565,90 +653,7 @@ install_netdata_service() {
if [ -x "${NETDATA_PREFIX}/usr/libexec/netdata/install-service.sh" ]; then
run_install_service_script && return 0
else
- # This is used by netdata-installer.sh
- # shellcheck disable=SC2034
- NETDATA_STOP_CMD="netdatacli shutdown-agent"
-
- NETDATA_START_CMD="netdata"
- NETDATA_INSTALLER_START_CMD=""
-
- uname="$(uname 2> /dev/null)"
-
- if [ "${uname}" = "Darwin" ]; then
- if [ -f "/Library/LaunchDaemons/com.github.netdata.plist" ]; then
- echo >&2 "file '/Library/LaunchDaemons/com.github.netdata.plist' already exists."
- return 0
- else
- echo >&2 "Installing MacOS X plist file..."
- # This is used by netdata-installer.sh
- # shellcheck disable=SC2034
- 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"
- return 0
- fi
-
- elif [ "${uname}" = "FreeBSD" ]; then
- # This is used by netdata-installer.sh
- # shellcheck disable=SC2034
- 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=$?
-
- echo >&2 "Note: To explicitly enable netdata automatic start, set 'netdata_enable' to 'YES' in /etc/rc.conf"
- echo >&2 ""
-
- return "${myret}"
-
- elif issystemd; then
- # systemd is running on this system
- NETDATA_START_CMD="systemctl start netdata"
- # This is used by netdata-installer.sh
- # shellcheck disable=SC2034
- NETDATA_STOP_CMD="systemctl stop netdata"
- NETDATA_INSTALLER_START_CMD="${NETDATA_START_CMD}"
-
- SYSTEMD_DIRECTORY="$(get_systemd_service_dir)"
-
- if [ "${SYSTEMD_DIRECTORY}x" != "x" ]; then
- ENABLE_NETDATA_IF_PREVIOUSLY_ENABLED="run systemctl enable netdata"
- IS_NETDATA_ENABLED="$(systemctl is-enabled netdata 2> /dev/null || echo "Netdata not there")"
- if [ "${IS_NETDATA_ENABLED}" = "disabled" ]; then
- echo >&2 "Netdata was there and disabled, make sure we don't re-enable it ourselves"
- ENABLE_NETDATA_IF_PREVIOUSLY_ENABLED="true"
- fi
-
- echo >&2 "Installing systemd service..."
- run cp system/systemd/netdata.service "${SYSTEMD_DIRECTORY}/netdata.service" &&
- run systemctl daemon-reload &&
- ${ENABLE_NETDATA_IF_PREVIOUSLY_ENABLED} &&
- return 0
- else
- warning "Could not find a systemd service directory, unable to install Netdata systemd service."
- fi
- else
- install_non_systemd_init
- ret=$?
-
- if [ ${ret} -eq 0 ]; then
- if [ -n "${service_cmd}" ]; then
- NETDATA_START_CMD="service netdata start"
- # This is used by netdata-installer.sh
- # shellcheck disable=SC2034
- NETDATA_STOP_CMD="service netdata stop"
- elif [ -n "${rcservice_cmd}" ]; then
- NETDATA_START_CMD="rc-service netdata start"
- # This is used by netdata-installer.sh
- # shellcheck disable=SC2034
- NETDATA_STOP_CMD="rc-service netdata stop"
- fi
- NETDATA_INSTALLER_START_CMD="${NETDATA_START_CMD}"
- fi
-
- return ${ret}
- fi
+ warning "Could not find service install script, not installing Netdata as a system service."
fi
fi
@@ -928,6 +933,11 @@ portable_add_user() {
echo >&2 "User '${username}' already exists."
return 0
fi
+ elif command -v dscl > /dev/null 2>&1; then
+ if dscl . read /Users/"${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."
@@ -946,7 +956,13 @@ portable_add_user() {
elif command -v adduser 1> /dev/null 2>&1; then
run adduser -h "${homedir}" -s "${nologin}" -D -G "${username}" "${username}" && return 0
elif command -v sysadminctl 1> /dev/null 2>&1; then
- run sysadminctl -addUser "${username}" && return 0
+ gid=$(dscl . read /Groups/"${username}" 2>/dev/null | grep PrimaryGroupID | grep -Eo "[0-9]+")
+ if run sysadminctl -addUser "${username}" -shell /usr/bin/false -home /var/empty -GID "$gid"; then
+ # FIXME: I think the proper solution is to create a role account:
+ # -roleAccount + name starting with _ and UID in 200-400 range.
+ run dscl . create /Users/"${username}" IsHidden 1
+ return 0
+ fi
fi
warning "Failed to add ${username} user account!"
@@ -1061,9 +1077,11 @@ install_netdata_updater() {
cat "${NETDATA_SOURCE_DIR}/packaging/installer/netdata-updater.sh" > "${NETDATA_PREFIX}/usr/libexec/netdata/netdata-updater.sh" || return 1
fi
- if issystemd && [ -n "$(get_systemd_service_dir)" ]; then
- 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"
+ # these files are installed by cmake
+ libsysdir="${NETDATA_PREFIX}/usr/lib/netdata/system/systemd/"
+ if [ -d "${libsysdir}" ] && issystemd && [ -n "$(get_systemd_service_dir)" ]; then
+ cat "${libsysdir}/netdata-updater.timer" > "$(get_systemd_service_dir)/netdata-updater.timer"
+ cat "${libsysdir}/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 bdd529397..179cbd5e9 100755
--- a/packaging/installer/install-required-packages.sh
+++ b/packaging/installer/install-required-packages.sh
@@ -946,7 +946,7 @@ declare -A pkg_postfix=(
)
declare -A pkg_pkg_config=(
- ['alpine']="pkgconfig"
+ ['alpine']="pkgconf"
['arch']="pkgconfig"
['centos']="pkgconfig"
['debian']="pkg-config"
diff --git a/packaging/installer/kickstart.sh b/packaging/installer/kickstart.sh
index f7c078274..6d9f4ea0e 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: F0516
+# Next unused error code: F0517
# ======================================================================
# Constants
@@ -21,10 +21,10 @@ KICKSTART_SOURCE="$(
)"
DEFAULT_PLUGIN_PACKAGES=""
PATH="${PATH}:/usr/local/bin:/usr/local/sbin"
-REPOCONFIG_DEB_VERSION="2-1"
-REPOCONFIG_RPM_VERSION="2-1"
+REPOCONFIG_DEB_VERSION="2-2"
+REPOCONFIG_RPM_VERSION="2-2"
START_TIME="$(date +%s)"
-STATIC_INSTALL_ARCHES="x86_64 armv7l aarch64 ppc64le"
+STATIC_INSTALL_ARCHES="x86_64 armv7l armv6l aarch64 ppc64le"
# ======================================================================
# URLs used throughout the script
@@ -125,6 +125,7 @@ main() {
;;
esac
+ handle_existing_install
set_tmpdir
if [ -n "${INSTALL_VERSION}" ]; then
@@ -402,6 +403,9 @@ support_list() {
}
success_banner() {
+ printf >&2 "%s\n" "To view your system's real-time performance metrics, open your web browser and enter http://NODE:19999."
+ printf >&2 "%s\n\n" "Replace NODE with the IP address or hostname of your Netdata server to access the dashboard."
+
printf >&2 "%s\n\n" "Official documentation can be found online at ${DOCS_URL}."
if [ -z "${CLAIM_TOKEN}" ]; then
@@ -591,6 +595,8 @@ check_for_remote_file() {
if echo "${url}" | grep -Eq "^file:///"; then
[ -e "${url#file://}" ] || return 1
+ elif [ -n "${NETDATA_ASSUME_REMOTE_FILES_ARE_PRESENT}" ]; then
+ return 0
elif [ -n "${CURL}" ]; then
"${CURL}" --output /dev/null --silent --head --fail "${url}" || return 1
elif command -v wget > /dev/null 2>&1; then
@@ -635,9 +641,9 @@ get_redirect() {
url="${1}"
if [ -n "${CURL}" ]; then
- run sh -c "${CURL} ${url} -s -L -I -o /dev/null -w '%{url_effective}' | grep -o '[^/]*$'" || return 1
+ run sh -c "${CURL} ${url} -s -L -I -o /dev/null -w '%{url_effective}' | grep -Eo '[^/]+$'" || 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
+ run sh -c "wget -S -O /dev/null ${url} 2>&1 | grep -m 1 Location | grep -Eo '[^/]+$'" || return 1
else
fatal "${ERROR_F0003}" F0003
fi
@@ -1325,7 +1331,7 @@ netdata_avail_check() {
;;
centos|fedora|ol|amzn)
# shellcheck disable=SC2086
- ${pm_cmd} search --nogpgcheck -v netdata | grep -qE 'Repo *: netdata(-edge)?$'
+ LC_ALL=C ${pm_cmd} search --nogpgcheck -v netdata | grep -qE 'Repo *: netdata(-edge)?$'
return $?
;;
opensuse)
@@ -1341,7 +1347,7 @@ check_special_native_deps() {
if [ "${DISTRO_COMPAT_NAME}" = "centos" ] && [ "${SYSVERSION}" -gt 6 ]; then
progress "EPEL is required on this system, checking if it’s available."
- if ${pm_cmd} search --nogpgcheck -v epel-release | grep -q "No matches found"; then
+ if LC_ALL=C ${pm_cmd} search --nogpgcheck -v epel-release | grep -q "No matches found"; then
warning "Unable to find a suitable source for libuv, cannot install using native packages on this system."
return 1
else
@@ -1356,6 +1362,14 @@ check_special_native_deps() {
fi
}
+cleanup_apt_cache() {
+ cache_dir="/var/cache/apt/archives"
+
+ if [ -d "${cache_dir}" ]; then
+ run_as_root find "${cache_dir}" -type f -name 'netdata*.deb' -delete
+ fi
+}
+
common_rpm_opts() {
pkg_type="rpm"
pkg_suffix=".noarch"
@@ -1422,6 +1436,7 @@ try_package_install() {
install_subcmd="install"
fi
needs_early_refresh=1
+ needs_apt_cache_cleanup=1
pm_cmd="apt-get"
repo_subcmd="update"
pkg_type="deb"
@@ -1496,15 +1511,21 @@ try_package_install() {
deb)
repoconfig_file="${repoconfig_name}${pkg_vsep}${REPOCONFIG_DEB_VERSION}${pkg_suffix}.${pkg_type}"
repoconfig_url="${REPOCONFIG_DEB_URL_PREFIX}/${repo_prefix}/${repoconfig_file}"
+ ref_check_url="${REPOCONFIG_DEB_URL_PREFIX}"
;;
rpm)
repoconfig_file="${repoconfig_name}${pkg_vsep}${REPOCONFIG_RPM_VERSION}${pkg_suffix}.${pkg_type}"
repoconfig_url="${REPOCONFIG_RPM_URL_PREFIX}/${repo_prefix}/${SYSARCH}/${repoconfig_file}"
+ ref_check_url="${REPOCONFIG_RPM_URL_PREFIX}"
;;
esac
if ! pkg_installed "${repoconfig_name}"; then
progress "Checking for availability of repository configuration package."
+ if ! check_for_remote_file "${ref_check_url}"; then
+ NETDATA_ASSUME_REMOTE_FILES_ARE_PRESENT=1
+ fi
+
if ! check_for_remote_file "${repoconfig_url}"; then
warning "No repository configuration package available for ${DISTRO} ${SYSVERSION}. Cannot install native packages on this system."
return 2
@@ -1520,6 +1541,10 @@ try_package_install() {
warning "${failed_refresh_msg}"
return 2
fi
+
+ if [ -n "${needs_apt_cache_cleanup}" ]; then
+ cleanup_apt_cache
+ fi
fi
# shellcheck disable=SC2086
@@ -1643,6 +1668,10 @@ try_static_install() {
progress "Attempting to install using static build..."
fi
+ if ! check_for_remote_file "${NETDATA_TARBALL_BASEURL}"; then
+ NETDATA_ASSUME_REMOTE_FILES_ARE_PRESENT=1
+ fi
+
# Check status code first, so that we can provide nicer fallback for dry runs.
if check_for_remote_file "${NETDATA_STATIC_ARCHIVE_URL}"; then
netdata_agent="${NETDATA_STATIC_ARCHIVE_NAME}"
@@ -1650,7 +1679,7 @@ try_static_install() {
netdata_agent="${NETDATA_STATIC_ARCHIVE_OLD_NAME}"
export NETDATA_STATIC_ARCHIVE_URL="${NETDATA_STATIC_ARCHIVE_OLD_URL}"
else
- warning "There is no static build available for ${SYSARCH} CPUs. This usually means we simply do not currently provide static builds for ${SYSARCH} CPUs."
+ warning "Could not find a ${SELECTED_RELEASE_CHANNEL} static build for ${SYSARCH} CPUs. This usually means there is some networking issue preventing access to https://github.com/ from this system."
return 2
fi
@@ -1750,8 +1779,14 @@ install_local_build_dependencies() {
fi
# shellcheck disable=SC2086
- 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."
+ if [ "$(uname -s)" = "Darwin" ]; then
+ if ! run "${bash}" "${tmpdir}/install-required-packages.sh" ${opts} netdata; then
+ warning "Failed to install all required packages, but installation might still be possible."
+ fi
+ else
+ 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
fi
}
@@ -1875,13 +1910,21 @@ prepare_offline_install_source() {
static|'')
set_static_archive_urls "${SELECTED_RELEASE_CHANNEL}" "x86_64"
+ if ! check_for_remote_file "${NETDATA_TARBALL_BASEURL}"; then
+ NETDATA_ASSUME_REMOTE_FILES_ARE_PRESENT=1
+ fi
+
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}."
+ if check_for_remote_file "${NETDATA_STATIC_ARCH_URL}"; then
+ 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
+ else
+ progress "Skipping ${NETDATA_STATIC_ARCHIVE_URL} as it does not exist on the server."
fi
done
legacy=0
@@ -1895,6 +1938,10 @@ prepare_offline_install_source() {
fi
fi
+ if ! find . -name '*.gz.run'; then
+ fatal "Did not actually download any static installer archives, cannot continue. ${BADNET_MSG}." F0516
+ 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
@@ -2325,8 +2372,4 @@ confirm_root_support
get_system_info
confirm_install_prefix
-if [ -z "${ACTION}" ]; then
- handle_existing_install
-fi
-
main
diff --git a/packaging/installer/methods/ansible.md b/packaging/installer/methods/ansible.md
index 6ce4e8f0f..85c982fa1 100644
--- a/packaging/installer/methods/ansible.md
+++ b/packaging/installer/methods/ansible.md
@@ -130,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/netdata-security.md).
+doc](https://github.com/netdata/netdata/blob/master/docs/security-and-privacy-design/README.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.
diff --git a/packaging/installer/methods/aws.md b/packaging/installer/methods/aws.md
index c0b92a036..bd3b091a8 100644
--- a/packaging/installer/methods/aws.md
+++ b/packaging/installer/methods/aws.md
@@ -11,7 +11,7 @@ learn_rel_path: "Installation/Install on specific environments"
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.
+multiple instances in a [parent-child streaming](https://github.com/netdata/netdata/blob/master/src/streaming/README.md) configuration.
## Recommended installation method
diff --git a/packaging/installer/methods/azure.md b/packaging/installer/methods/azure.md
index 4c39a00ad..0d8e1ed14 100644
--- a/packaging/installer/methods/azure.md
+++ b/packaging/installer/methods/azure.md
@@ -11,7 +11,7 @@ learn_rel_path: "Installation/Install on specific environments"
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.
+multiple instances in a [parent-child streaming](https://github.com/netdata/netdata/blob/master/src/streaming/README.md) configuration.
## Recommended installation method
diff --git a/packaging/installer/methods/freebsd.md b/packaging/installer/methods/freebsd.md
index 21670cdc9..b34a3b879 100644
--- a/packaging/installer/methods/freebsd.md
+++ b/packaging/installer/methods/freebsd.md
@@ -33,7 +33,7 @@ The simplest method is to use the single line [kickstart script](https://learn.n
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
+wget -O /tmp/netdata-kickstart.sh https://get.netdata.cloud/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.
diff --git a/packaging/installer/methods/gcp.md b/packaging/installer/methods/gcp.md
index 0b16b1096..873afbcdb 100644
--- a/packaging/installer/methods/gcp.md
+++ b/packaging/installer/methods/gcp.md
@@ -12,7 +12,7 @@ learn_rel_path: "Installation/Install on specific environments"
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.
+multiple instances in a [parent-child streaming](https://github.com/netdata/netdata/blob/master/src/streaming/README.md) configuration.
## Recommended installation method
diff --git a/packaging/installer/methods/kickstart.md b/packaging/installer/methods/kickstart.md
index b21f4dde9..043b3ecc4 100644
--- a/packaging/installer/methods/kickstart.md
+++ b/packaging/installer/methods/kickstart.md
@@ -1,13 +1,3 @@
-<!--
-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: "One line installer (kickstart.sh)"
-learn_status: "Published"
-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';
@@ -19,28 +9,13 @@ import TabItem from '@theme/TabItem';
`kickstart.sh` is the recommended way of installing Netdata.
-This script works on all Linux distributions and macOS environments, by detecting the optimal method of installing Netdata directly to the operating system (it will never install a docker image of Netdata - to run Netdata in a container [check Installing with Docker](https://learn.netdata.cloud/docs/installing/docker)).
-
-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.
-
-
-## Verify script integrity
-
-To use `md5sum` to verify the integrity of the `kickstart.sh` script you will download using the one-line command above,
-run the following:
-
-```bash
-[ "<checksum-will-be-added-in-documentation-processing>" = "$(curl -Ss https://my-netdata.io/kickstart.sh | md5sum | cut -d ' ' -f 1)" ] && echo "OK, VALID" || echo "FAILED, INVALID"
-```
-
-If the script is valid, this command will return `OK, VALID`.
-
+This script works on all Linux distributions and macOS environments, by detecting the optimal method of installing Netdata directly to the operating system.
## Installation
> :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 are unsure whether you want nightly or stable releases, read the [related section](https://github.com/netdata/netdata/blob/master/packaging/installer/README.md#nightly-vs-stable-releases) of our Documentation, detailing the pros and cons of each release type.
To install Netdata, run the following as your normal user:
@@ -58,10 +33,20 @@ To install Netdata, run the following as your normal user:
</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.
+## Verify script integrity
+
+To use `md5sum` to verify the integrity of the `kickstart.sh` script you will download using the one-line command above,
+run the following:
+
+```bash
+[ "@KICKSTART_CHECKSUM@" = "$(curl -Ss https://get.netdata.cloud/kickstart.sh | md5sum | cut -d ' ' -f 1)" ] && echo "OK, VALID" || echo "FAILED, INVALID"
+```
+
+If the script is valid, this command will return `OK, VALID`.
## What does `kickstart.sh` do?
@@ -78,6 +63,116 @@ The `kickstart.sh` script does the following after being downloaded and run usin
versions, unless you override that with an [optional parameter](#optional-parameters-to-alter-your-installation).
- Prints a message whether installation succeeded or failed for QA purposes.
+## Start stop or restart the Netdata Agent
+
+You will most often need to _restart_ the Agent to load new or edited configuration files.
+
+> **Note**
+> Stopping or restarting the Netdata Agent will cause gaps in stored metrics until the `netdata` process initiates collectors and the database engine.
+>
+> You do not need to restart the Netdata Agent between changes to health configuration files, see the relevant section on [reloading health configuration](https://github.com/netdata/netdata/blob/master/src/health/REFERENCE.md#reload-health-configuration).
+
+### Using `systemctl` or `service`
+
+This is the recommended way to start, stop, or restart the Netdata daemon.
+
+- To **start** Netdata, run `sudo systemctl start netdata`.
+- To **stop** Netdata, run `sudo systemctl stop netdata`.
+- To **restart** Netdata, run `sudo systemctl restart netdata`.
+
+If the above commands fail, or you know that you're using a non-systemd system, try using the `service` command:
+
+- Starting: `sudo service netdata start`.
+- Stopping: `sudo service netdata stop`.
+- Restarting: `sudo service netdata restart`.
+
+### Using the `netdata` command
+
+Use the `netdata` command, typically located at `/usr/sbin/netdata`, to start the Netdata daemon:
+
+```bash
+sudo netdata
+```
+
+If you start the daemon this way, close it with `sudo killall netdata`.
+
+### Shutdown using `netdatacli`
+
+The Netdata Agent also comes with a [CLI tool](https://github.com/netdata/netdata/blob/master/src/cli/README.md) capable of performing shutdowns. Start the Agent back up using your preferred method listed above.
+
+```bash
+sudo netdatacli shutdown-agent
+```
+
+## Starting Netdata at boot
+
+In the `system` directory you can find scripts and configurations for the
+various distros.
+
+### systemd
+
+The installer already installs `netdata.service` if it detects a systemd system.
+
+To install `netdata.service` by hand, run:
+
+```sh
+# stop Netdata
+killall netdata
+
+# copy netdata.service to systemd
+cp system/netdata.service /etc/systemd/system/
+
+# let systemd know there is a new service
+systemctl daemon-reload
+
+# enable Netdata at boot
+systemctl enable netdata
+
+# start Netdata
+systemctl start netdata
+```
+
+### init.d
+
+In the system directory you can find `netdata-lsb`. Copy it to the proper place according to your distribution's documentation. For Ubuntu, this can be done via running the following commands as root.
+
+```sh
+# copy the Netdata startup file to /etc/init.d
+cp system/netdata-lsb /etc/init.d/netdata
+
+# make sure it is executable
+chmod +x /etc/init.d/netdata
+
+# enable it
+update-rc.d netdata defaults
+```
+
+### openrc / Gentoo Linux
+
+In the `system` directory you can find `netdata-openrc`. Copy it to the proper
+place according to your distribution documentation.
+
+### CentOS / Red Hat Enterprise Linux
+
+For older versions of RHEL/CentOS that don't have systemd, an init script is included in the system directory. This can be installed by running the following commands as root.
+
+```sh
+# copy the Netdata startup file to /etc/init.d
+cp system/netdata-init-d /etc/init.d/netdata
+
+# make sure it is executable
+chmod +x /etc/init.d/netdata
+
+# enable it
+chkconfig --add netdata
+```
+
+_There have been some recent work on the init script, see the following PR <https://github.com/netdata/netdata/pull/403>_
+
+### Other operating systems
+
+You can start Netdata by running it from `/etc/rc.local` or your system's equivalent.
+
## Optional parameters to alter your installation
The `kickstart.sh` script accepts a number of optional parameters to control how the installation process works:
@@ -147,7 +242,7 @@ By default, the kickstart script will provide a Netdata agent installation that
- `--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.
+ 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/src/claim/README.md#connect-through-a-proxy) for details.
- `--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.
- `--require-cloud`
@@ -177,11 +272,12 @@ By default, the agent is sending anonymous telemetry data to help us take identi
Uninstall an existing installation of Netdata. Fails if there is no existing install.
### other options
+
- `--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.
-- `--override-distro`
+- `--distro-override`
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 specify special operations other than trying to install Netdata normally or update an existing install:
@@ -204,10 +300,9 @@ 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.
-
## Native packages
-We publish official DEB/RPM packages for a number of common Linux distributions as part of our releases and nightly
+We publish [official DEB/RPM packages](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/packages.md) for a number of common Linux distributions as part of our releases and nightly
builds. These packages are available for 64-bit x86 systems. Depending on the distribution and release they may
also be available for 32-bit x86, ARMv7, and AArch64 systems. If a native package is available, it will be used as the
default installation method. This allows you to handle Netdata updates as part of your usual system update procedure.
@@ -217,7 +312,7 @@ you can do so by adding `--native-only` to the options you pass to the installer
## Static builds
-We publish pre-built static builds of Netdata for Linux systems. Currently, these are published for 64-bit x86, ARMv7,
+We publish pre-built [static builds](https://github.com/netdata/netdata/blob/master/packaging/makeself/README.md) of Netdata for Linux systems. Currently, these are published for 64-bit x86, ARMv7,
AArch64, and POWER8+ hardware. These static builds are able to operate in a mostly self-contained manner and only
require a POSIX compliant shell and a supported init system. These static builds install under `/opt/netdata`. If
you are on a platform which we provide static builds for but do not provide native packages for, a static build
diff --git a/packaging/installer/methods/macos.md b/packaging/installer/methods/macos.md
index 480a41283..07ba9f989 100644
--- a/packaging/installer/methods/macos.md
+++ b/packaging/installer/methods/macos.md
@@ -9,8 +9,8 @@ learn_rel_path: "Installation/Install on specific environments"
# Install Netdata on macOS
Netdata works on macOS, albeit with some limitations.
-The number of charts displaying system metrics is limited, but you can use any of Netdata's [external plugins](https://github.com/netdata/netdata/blob/master/collectors/plugins.d/README.md) to monitor any services you might have installed on your macOS system.
-You could also use a macOS system as the parent node in a [streaming configuration](https://github.com/netdata/netdata/blob/master/streaming/README.md).
+The number of charts displaying system metrics is limited, but you can use any of Netdata's [external plugins](https://github.com/netdata/netdata/blob/master/src/collectors/plugins.d/README.md) to monitor any services you might have installed on your macOS system.
+You could also use a macOS system as the parent node in a [streaming configuration](https://github.com/netdata/netdata/blob/master/src/streaming/README.md).
You can install Netdata in one of the three following ways:
@@ -21,7 +21,7 @@ You can install Netdata in one of the three following ways:
Each of these installation option requires [Homebrew](https://brew.sh/) for handling dependencies.
> The Netdata Homebrew package is community-created and -maintained.
-> Community-maintained packages _may_ receive support from Netdata, but are only a best-effort affair. Learn more about [Netdata's platform support policy](https://github.com/netdata/netdata/blob/master/packaging/PLATFORM_SUPPORT.md).
+> Community-maintained packages _may_ receive support from Netdata, but are only a best-effort affair. Learn more about [Netdata's platform support policy](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/versions-and-platforms.md).
## Install Netdata with our automatic one-line installation script
@@ -29,13 +29,13 @@ Each of these installation option requires [Homebrew](https://brew.sh/) for hand
To install Netdata using our automatic [kickstart](https://github.com/netdata/netdata/blob/master/packaging/installer/README.md#automatic-one-line-installation-script) open a new terminal and run:
```bash
-curl https://my-netdata.io/kickstart.sh > /tmp/netdata-kickstart.sh && sh /tmp/netdata-kickstart.sh
+curl https://get.netdata.cloud/kickstart.sh > /tmp/netdata-kickstart.sh && sh /tmp/netdata-kickstart.sh
```
The Netdata Agent is installed under `/usr/local/netdata`. Dependencies are handled via Homebrew.
**Automatically connect 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
+The `kickstart.sh` script accepts additional parameters to automatically [connect](https://github.com/netdata/netdata/blob/master/src/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/manage/organize-your-infrastrucutre-invite-your-team.md#netdata-cloud-spaces).
@@ -44,16 +44,16 @@ area](https://github.com/netdata/netdata/blob/master/docs/cloud/manage/organize-
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.
+ See [connecting through a proxy](https://github.com/netdata/netdata/blob/master/src/claim/README.md#connect-through-a-proxy) for details.
- `--claim-url`: Specify a URL to use when connecting to the cloud. Defaults to `https://app.netdata.cloud`.
For example:
```bash
-curl https://my-netdata.io/kickstart.sh > /tmp/netdata-kickstart.sh && sh /tmp/netdata-kickstart.sh --install-prefix /usr/local/ --claim-token TOKEN --claim-rooms ROOM1,ROOM2 --claim-url https://app.netdata.cloud
+curl https://get.netdata.cloud/kickstart.sh > /tmp/netdata-kickstart.sh && sh /tmp/netdata-kickstart.sh --install-prefix /usr/local/ --claim-token TOKEN --claim-rooms ROOM1,ROOM2 --claim-url https://app.netdata.cloud
```
The Netdata Agent is installed under `/usr/local/netdata` on your machine. Your machine will also show up as a node in your Netdata Cloud.
-If you experience issues while claiming your node, follow the steps in our [Troubleshooting](https://github.com/netdata/netdata/blob/master/claim/README.md#troubleshooting) documentation.
+If you experience issues while claiming your node, follow the steps in our [Troubleshooting](https://github.com/netdata/netdata/blob/master/src/claim/README.md#troubleshooting) documentation.
## Install Netdata via Homebrew
### For macOS Intel
@@ -94,7 +94,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/quickstart/infrastructure.md), 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/netdata-cloud/README.md), you can omit `cmake`.
```bash
brew install ossp-uuid autoconf automake pkg-config libuv lz4 json-c openssl libtool cmake
diff --git a/packaging/installer/methods/manual.md b/packaging/installer/methods/manual.md
index 269b67c1a..dd4e5a0a0 100644
--- a/packaging/installer/methods/manual.md
+++ b/packaging/installer/methods/manual.md
@@ -218,9 +218,9 @@ cd netdata
### Connect node to Netdata Cloud during installation
Unlike the [`kickstart.sh`](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/kickstart.md), the `netdata-installer.sh` script does
-not allow you to automatically [connect](https://github.com/netdata/netdata/blob/master/claim/README.md) your node to Netdata Cloud immediately after installation.
+not allow you to automatically [connect](https://github.com/netdata/netdata/blob/master/src/claim/README.md) your node to Netdata Cloud immediately after installation.
-See the [connect to cloud](https://github.com/netdata/netdata/blob/master/claim/README.md) doc for details on connecting a node with a manual installation of Netdata.
+See the [connect to cloud](https://github.com/netdata/netdata/blob/master/src/claim/README.md) doc for details on connecting a node with a manual installation of Netdata.
### 'nonrepresentable section on output' errors
diff --git a/packaging/installer/methods/offline.md b/packaging/installer/methods/offline.md
index f2b6cc415..fd69f74c7 100644
--- a/packaging/installer/methods/offline.md
+++ b/packaging/installer/methods/offline.md
@@ -31,13 +31,13 @@ be as a regular user from any internet connected system that has the following t
To prepare the offline installation source, simply run:
```bash
-wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh --prepare-offline-install-source ./netdata-offline
+wget -O /tmp/netdata-kickstart.sh https://get.netdata.cloud/kickstart.sh && sh /tmp/netdata-kickstart.sh --prepare-offline-install-source ./netdata-offline
```
or
```bash
-curl https://my-netdata.io/kickstart.sh > /tmp/netdata-kickstart.sh && sh /tmp/netdata-kickstart.sh --prepare-offline-install-source ./netdata-offline
+curl https://get.netdata.cloud/kickstart.sh > /tmp/netdata-kickstart.sh && sh /tmp/netdata-kickstart.sh --prepare-offline-install-source ./netdata-offline
```
> The exact name used for the directory does not matter, you can specify any other name you want in place of `./netdata-offline`.
diff --git a/packaging/installer/methods/packages.md b/packaging/installer/methods/packages.md
index d49e21394..bd0072d21 100644
--- a/packaging/installer/methods/packages.md
+++ b/packaging/installer/methods/packages.md
@@ -12,7 +12,7 @@ sidebar_position: 20
For most common Linux distributions that use either DEB or RPM packages, Netdata provides pre-built native packages
for current releases in-line with
-our [official platform support policy](https://github.com/netdata/netdata/blob/master/packaging/PLATFORM_SUPPORT.md).
+our [official platform support policy](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/versions-and-platforms.md).
These packages will be used by default when attempting to install on a supported platform using our
[kickstart.sh installer script](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/kickstart.md).
diff --git a/packaging/installer/methods/source.md b/packaging/installer/methods/source.md
index 8f34218a2..b70e39850 100644
--- a/packaging/installer/methods/source.md
+++ b/packaging/installer/methods/source.md
@@ -46,7 +46,7 @@ Additionally, the following build time features require additional dependencies:
## Preparing the source tree
Certain features in Netdata require custom versions of specific libraries,
-which the the build system will link statically into Netdata. These
+which the build system will link statically into Netdata. These
libraries and their header files must be copied into specific locations
in the source tree to be used.
diff --git a/packaging/installer/methods/synology.md b/packaging/installer/methods/synology.md
index 3910859b4..10ead7215 100644
--- a/packaging/installer/methods/synology.md
+++ b/packaging/installer/methods/synology.md
@@ -27,23 +27,22 @@ will install the content into `/opt/netdata`, making future removal safe and sim
When Netdata is first installed, it will run as _root_. This may or may not be acceptable for you, and since other
installations run it as the `netdata` user, you might wish to do the same. This requires some extra work:
-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
+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:
-```sh
-chown -R root:netdata /opt/netdata/usr/share/netdata
-chown -R netdata:netdata /opt/netdata/var/lib/netdata /opt/netdata/var/cache/netdata
-chown -R netdata:root /opt/netdata/var/log/netdata
-```
+ ```sh
+ chown -R root:netdata /opt/netdata/usr/share/netdata
+ chown -R netdata:netdata /opt/netdata/var/lib/netdata /opt/netdata/var/cache/netdata
+ chown -R netdata:root /opt/netdata/var/log/netdata
+ ```
4. Restart Netdata
-```sh
-/etc/rc.netdata restart
-```
+ ```sh
+ /etc/rc.netdata restart
+ ```
## Create startup script
@@ -59,6 +58,6 @@ installed. You'll have to do this manually:
[ -x /etc/rc.netdata ] && /etc/rc.netdata start
```
-3. Make sure `/etc/rc.netdata` is executable: `chmod 0755 /etc/rc.netdata`.
+3. Make sure `/etc/rc.local` is executable: `chmod 0755 /etc/rc.local`.
diff --git a/packaging/installer/methods/systems.md b/packaging/installer/methods/systems.md
index e53c4f4a0..acefdeb0a 100644
--- a/packaging/installer/methods/systems.md
+++ b/packaging/installer/methods/systems.md
@@ -14,5 +14,5 @@ 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).
+[platform support policy](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/versions-and-platforms.md).
diff --git a/packaging/installer/netdata-uninstaller.sh b/packaging/installer/netdata-uninstaller.sh
index 4326ebe25..dcd9d965d 100755
--- a/packaging/installer/netdata-uninstaller.sh
+++ b/packaging/installer/netdata-uninstaller.sh
@@ -520,6 +520,15 @@ portable_del_user_from_group() {
groupname="${1}"
username="${2}"
+ if command -v getent > /dev/null 2>&1; then
+ getent group "${1:-""}" | grep -q "${2}"
+ else
+ grep "^${1}:" /etc/group | grep -q "${2}"
+ fi
+
+ ret=$?
+ [ "${ret}" != "0" ] && return 0
+
# username is not in group
info "Deleting ${username} user from ${groupname} group ..."
@@ -758,8 +767,10 @@ fi
FILE_REMOVAL_STATUS=1
-#### REMOVE NETDATA USER FROM ADDED GROUPS
-if [ -n "$NETDATA_ADDED_TO_GROUPS" ]; then
+#### REMOVE USER
+if user_input "Do you want to delete 'netdata' system user ? "; then
+ portable_del_user "netdata" || :
+elif [ -n "$NETDATA_ADDED_TO_GROUPS" ]; then
if user_input "Do you want to delete 'netdata' from following groups: '$NETDATA_ADDED_TO_GROUPS' ? "; then
for group in $NETDATA_ADDED_TO_GROUPS; do
portable_del_user_from_group "${group}" "netdata"
@@ -767,11 +778,6 @@ if [ -n "$NETDATA_ADDED_TO_GROUPS" ]; then
fi
fi
-#### REMOVE USER
-if user_input "Do you want to delete 'netdata' system user ? "; then
- portable_del_user "netdata" || :
-fi
-
### REMOVE GROUP
if user_input "Do you want to delete 'netdata' system group ? "; then
portable_del_group "netdata" || :
diff --git a/packaging/installer/netdata-updater.sh b/packaging/installer/netdata-updater.sh
index 80faea0a0..220de6e4c 100755
--- a/packaging/installer/netdata-updater.sh
+++ b/packaging/installer/netdata-updater.sh
@@ -28,7 +28,7 @@
# Author: Pavlos Emm. Katsoulakis <paul@netdata.cloud>
# Author: Austin S. Hemmelgarn <austin@netdata.cloud>
-# Next unused error code: U001B
+# Next unused error code: U001D
set -e
@@ -36,10 +36,12 @@ PACKAGES_SCRIPT="https://raw.githubusercontent.com/netdata/netdata/master/packag
NETDATA_STABLE_BASE_URL="${NETDATA_BASE_URL:-https://github.com/netdata/netdata/releases}"
NETDATA_NIGHTLY_BASE_URL="${NETDATA_BASE_URL:-https://github.com/netdata/netdata-nightlies/releases}"
+NETDATA_DEFAULT_ACCEPT_MAJOR_VERSIONS="1 2"
# Following variables are intended to be overridden by the updater config file.
NETDATA_UPDATER_JITTER=3600
NETDATA_NO_SYSTEMD_JOURNAL=0
+NETDATA_ACCEPT_MAJOR_VERSIONS=''
script_dir="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)"
@@ -171,6 +173,38 @@ _get_scheduler_type() {
fi
}
+confirm() {
+ prompt="${1} [y/n]"
+
+ while true; do
+ echo "${prompt}"
+ read -r yn
+
+ case "$yn" in
+ [Yy]*) return 0;;
+ [Nn]*) return 1;;
+ *) echo "Please answer yes or no.";;
+ esac
+ done
+}
+
+warn_major_update() {
+ nmv_suffix="New major versions generally involve breaking changes, and may not work in the same way as older versions."
+
+ if [ "${INTERACTIVE}" -eq 0 ]; then
+ warning "Would update to a new major version of Netdata. ${nmv_suffix}"
+ warning "To install the new major version anyway, either run the updater interactively, or include the new major version number in the NETDATA_ACCEPT_MAJOR_VERSIONS variable in ${UPDATER_CONFIG_PATH}."
+ fatal "Aborting update to new major version to avoid breaking things." U001B
+ else
+ warning "This update will install a new major version of Netdata. ${nmv_suffix}"
+ if confirm "Are you sure you want to update to a new major version of Netdata?"; then
+ notice "User accepted update to new major version of Netdata."
+ else
+ fatal "Aborting update to new major version at user request." U001C
+ fi
+ fi
+}
+
install_build_dependencies() {
bash="$(command -v bash 2> /dev/null)"
@@ -366,7 +400,7 @@ _safe_download() {
check_for_curl
if [ -n "${curl}" ]; then
- "${curl}" -sSL --connect-timeout 10 --retry 3 "${url}" > "${dest}"
+ "${curl}" -fsSL --connect-timeout 10 --retry 3 "${url}" > "${dest}"
return $?
elif command -v wget > /dev/null 2>&1; then
wget -T 15 -O - "${url}" > "${dest}"
@@ -394,19 +428,33 @@ download() {
get_netdata_latest_tag() {
url="${1}/latest"
- dest="${2}"
check_for_curl
if [ -n "${curl}" ]; then
- tag=$("${curl}" "${url}" -s -L -I -o /dev/null -w '%{url_effective}' | grep -m 1 -o '[^/]*$')
+ tag=$("${curl}" "${url}" -s -L -I -o /dev/null -w '%{url_effective}' | grep -Eom 1 '[^/]*/?$')
elif command -v wget >/dev/null 2>&1; then
- tag=$(wget -S -O /dev/null "${url}" 2>&1 | grep -m 1 Location | grep -o '[^/]*$')
+ tag=$(wget -S -O /dev/null "${url}" 2>&1 | grep -m 1 Location | grep -Eo '[^/]*/?$')
else
fatal "I need curl or wget to proceed, but neither of them are available on this system." U0006
fi
- echo "${tag}" >"${dest}"
+ # Fallback case for simpler local testing.
+ if echo "${tag}" | grep -Eq 'latest/?$'; then
+ if _safe_download "${url}/latest-version.txt" ./ndupdate-version.txt; then
+ tag="$(cat ./ndupdate-version.txt)"
+
+ if grep -q 'Not Found' ./ndupdate-version.txt; then
+ tag="latest"
+ fi
+
+ rm -f ./ndupdate-version.txt
+ else
+ tag="latest"
+ fi
+ fi
+
+ echo "${tag}"
}
newer_commit_date() {
@@ -494,9 +542,9 @@ parse_version() {
get_latest_version() {
if [ "${RELEASE_CHANNEL}" = "stable" ]; then
- get_netdata_latest_tag "${NETDATA_STABLE_BASE_URL}" /dev/stdout
+ get_netdata_latest_tag "${NETDATA_STABLE_BASE_URL}"
else
- get_netdata_latest_tag "${NETDATA_NIGHTLY_BASE_URL}" /dev/stdout
+ get_netdata_latest_tag "${NETDATA_NIGHTLY_BASE_URL}"
fi
}
@@ -513,6 +561,7 @@ update_available() {
info "Force update requested"
return 0
fi
+
basepath="$(dirname "$(dirname "$(dirname "${NETDATA_LIB_DIR}")")")"
searchpath="${basepath}/bin:${basepath}/sbin:${basepath}/usr/bin:${basepath}/usr/sbin:${PATH}"
searchpath="${basepath}/netdata/bin:${basepath}/netdata/sbin:${basepath}/netdata/usr/bin:${basepath}/netdata/usr/sbin:${searchpath}"
@@ -542,6 +591,27 @@ update_available() {
return 1
else
info "Update available"
+
+ if [ "${current_version}" -ne 0 ] && [ "${latest_version}" -ne 0 ]; then
+ current_major="$(${ndbinary} -v | cut -f 2 -d ' ' | cut -f 1 -d '.' | tr -d 'v')"
+ latest_major="$(echo "${latest_tag}" | cut -f 1 -d '.' | tr -d 'v')"
+
+ if [ "${current_major}" -ne "${latest_major}" ]; then
+ update_safe=0
+
+ for v in ${NETDATA_ACCEPT_MAJOR_VERSIONS}; do
+ if [ "${latest_major}" -eq "${v}" ]; then
+ update_safe=1
+ break
+ fi
+ done
+
+ if [ "${update_safe}" -eq 0 ]; then
+ warn_major_update
+ fi
+ fi
+ fi
+
return 0
fi
}
@@ -553,6 +623,7 @@ set_tarball_urls() {
if [ -e /opt/netdata/etc/netdata/.install-type ]; then
# shellcheck disable=SC1091
. /opt/netdata/etc/netdata/.install-type
+ [ -z "${PREBUILT_ARCH:-}" ] && PREBUILT_ARCH="$(uname -m)"
filename="netdata-${PREBUILT_ARCH}-latest.gz.run"
else
filename="netdata-x86_64-latest.gz.run"
@@ -560,11 +631,11 @@ set_tarball_urls() {
fi
if [ "$1" = "stable" ]; then
- latest="$(get_netdata_latest_tag "${NETDATA_STABLE_BASE_URL}" /dev/stdout)"
+ latest="$(get_netdata_latest_tag "${NETDATA_STABLE_BASE_URL}")"
export NETDATA_TARBALL_URL="${NETDATA_STABLE_BASE_URL}/download/$latest/${filename}"
export NETDATA_TARBALL_CHECKSUM_URL="${NETDATA_STABLE_BASE_URL}/download/$latest/sha256sums.txt"
else
- tag="$(get_netdata_latest_tag "${NETDATA_NIGHTLY_BASE_URL}" /dev/stdout)"
+ tag="$(get_netdata_latest_tag "${NETDATA_NIGHTLY_BASE_URL}")"
export NETDATA_TARBALL_URL="${NETDATA_NIGHTLY_BASE_URL}/download/${tag}/${filename}"
export NETDATA_TARBALL_CHECKSUM_URL="${NETDATA_NIGHTLY_BASE_URL}/download/${tag}/sha256sums.txt"
fi
@@ -713,6 +784,15 @@ update_static() {
exit 0
}
+get_new_binpkg_major() {
+ case "${pm_cmd}" in
+ apt-get) apt-get --just-print upgrade 2>&1 | grep Inst | grep ' netdata ' | cut -f 3 -d ' ' | tr -d '[]' | cut -f 1 -d '.' ;;
+ yum) yum check-update netdata | grep -E '^netdata ' | awk '{print $2}' | cut -f 1 -d '.' ;;
+ dnf) dnf check-update netdata | grep -E '^netdata ' | awk '{print $2}' | cut -f 1 -d '.' ;;
+ zypper) zypper list-updates | grep '| netdata |' | cut -f 5 -d '|' | tr -d ' ' | cut -f 1 -d '.' ;;
+ esac
+}
+
update_binpkg() {
os_release_file=
if [ -s "/etc/os-release" ] && [ -r "/etc/os-release" ]; then
@@ -823,6 +903,24 @@ update_binpkg() {
fi
done
+ current_major="$(netdata -v | cut -f 2 -d ' ' | cut -f 1 -d '.' | tr -d 'v')"
+ latest_major="$(get_new_binpkg_major)"
+
+ if [ -n "${latest_major}" ] && [ "${latest_major}" -ne "${current_major}" ]; then
+ update_safe=0
+
+ for v in ${NETDATA_ACCEPT_MAJOR_VERSIONS}; do
+ if [ "${latest_major}" -eq "${v}" ]; then
+ update_safe=1
+ break
+ fi
+ done
+
+ if [ "${update_safe}" -eq 0 ]; then
+ warn_major_update
+ fi
+ fi
+
# shellcheck disable=SC2086
env ${env} ${pm_cmd} ${upgrade_subcmd} ${pkg_install_opts} netdata >&3 2>&3 || fatal "Failed to update Netdata package." U000F
@@ -901,11 +999,14 @@ if [ -r "$(dirname "${ENVIRONMENT_FILE}")/.install-type" ]; then
. "$(dirname "${ENVIRONMENT_FILE}")/.install-type" || fatal "Failed to source $(dirname "${ENVIRONMENT_FILE}")/.install-type" U0015
fi
-if [ -r "$(dirname "${ENVIRONMENT_FILE}")/netdata-updater.conf" ]; then
+UPDATER_CONFIG_PATH="$(dirname "${ENVIRONMENT_FILE}")/netdata-updater.conf"
+if [ -r "${UPDATER_CONFIG_PATH}" ]; then
# shellcheck source=/dev/null
- . "$(dirname "${ENVIRONMENT_FILE}")/netdata-updater.conf"
+ . "${UPDATER_CONFIG_PATH}"
fi
+[ -z "${NETDATA_ACCEPT_MAJOR_VERSIONS}" ] && NETDATA_ACCEPT_MAJOR_VERSIONS="${NETDATA_DEFAULT_ACCEPT_MAJOR_VERSIONS}"
+
while [ -n "${1}" ]; do
case "${1}" in
--not-running-from-cron) NETDATA_NOT_RUNNING_FROM_CRON=1 ;;