summaryrefslogtreecommitdiffstats
path: root/packaging/installer
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--packaging/installer/README.md4
-rw-r--r--packaging/installer/UNINSTALL.md52
-rwxr-xr-xpackaging/installer/dependencies/alpine.sh1
-rwxr-xr-xpackaging/installer/dependencies/arch.sh1
-rwxr-xr-xpackaging/installer/dependencies/centos.sh1
-rwxr-xr-xpackaging/installer/dependencies/debian.sh1
-rwxr-xr-xpackaging/installer/dependencies/fedora.sh1
-rwxr-xr-xpackaging/installer/dependencies/freebsd.sh1
-rwxr-xr-xpackaging/installer/dependencies/gentoo.sh1
-rwxr-xr-xpackaging/installer/dependencies/ol.sh1
-rwxr-xr-xpackaging/installer/dependencies/opensuse.sh1
-rwxr-xr-xpackaging/installer/dependencies/rockylinux.sh1
-rwxr-xr-xpackaging/installer/dependencies/ubuntu.sh1
-rw-r--r--packaging/installer/functions.sh239
-rwxr-xr-xpackaging/installer/install-required-packages.sh85
-rwxr-xr-xpackaging/installer/kickstart.sh251
-rw-r--r--packaging/installer/methods/kickstart.md4
-rw-r--r--packaging/installer/methods/macos.md4
-rw-r--r--packaging/installer/methods/manual.md3
-rwxr-xr-xpackaging/installer/netdata-updater.sh25
20 files changed, 403 insertions, 275 deletions
diff --git a/packaging/installer/README.md b/packaging/installer/README.md
index 2854d0723..3a4237d52 100644
--- a/packaging/installer/README.md
+++ b/packaging/installer/README.md
@@ -3,9 +3,9 @@ title: "Installation guide"
custom_edit_url: https://github.com/netdata/netdata/edit/master/packaging/installer/README.md
-->
-import { Install, InstallBox } from '../../../src/components/Install/'
+import { Install, InstallBox } from '@site/src/components/Install/'
-import { OneLineInstallWget, OneLineInstallCurl } from '../../../src/components/OneLineInstall/'
+import { OneLineInstallWget, OneLineInstallCurl } from '@site/src/components/OneLineInstall/'
# Installation guide
diff --git a/packaging/installer/UNINSTALL.md b/packaging/installer/UNINSTALL.md
index 54ca771f9..af2314f65 100644
--- a/packaging/installer/UNINSTALL.md
+++ b/packaging/installer/UNINSTALL.md
@@ -10,17 +10,41 @@ custom_edit_url: https://github.com/netdata/netdata/edit/master/packaging/instal
> issues with your Netdata Agent installation, consider our [**reinstall Netdata**
> doc](/packaging/installer/REINSTALL.md) instead of removing the Netdata Agent entirely.
-Our self-contained uninstaller is able to remove Netdata installations created with shell installer. It doesn't need any
-other Netdata repository files to be run. All it needs is an `.environment` file, which is created during installation
-(with shell installer) and put in `${NETDATA_USER_CONFIG_DIR}/.environment` (by default `/etc/netdata/.environment`).
-That file contains some parameters which are passed to our installer and which are needed during uninstallation process.
-Mainly two parameters are needed:
+The recommended method to uninstall Netdata on a system is to use our kickstart installer script with the `--uninstall` option like so:
```sh
-NETDATA_PREFIX
-NETDATA_ADDED_TO_GROUPS
+wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/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
+```
+
+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.
+
+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.
+
+## Unofficial installs
+
+If you used a third-party package to install Netdata, then the above method will usually not work, and you will
+need to use whatever mechanism you used to originally install Netdata to uninstall it.
+
+## Uninstalling manually
+
+Most official installs of Netdata include an uninstaller script that can be manually invoked instead of using the
+kickstart script (internally, the kickstart script also uses this uninstaller script, it just handles the process
+outlined below for you).
+
+This uninstaller script is self-contained other than requiring a `.environment` file that was generated during
+installation. In most cases, this will be found in `/etc/netdata/.environment`, though if you used a non-standard
+installation prefix it will usually be located in a similar place under that prefix.
+
A workflow for uninstallation looks like this:
1. Find your `.environment` file, which is usually `/etc/netdata/.environment` in a default installation.
@@ -35,7 +59,9 @@ NETDATA_ADDED_TO_GROUPS="<additional groups>" # Additional groups for a user ru
3.1 **Interactive mode (Default)**
- The default mode in the uninstaller script is **interactive**. This means that the script provides the user the option to reply with "yes" (`y`/`Y`) or "no" (`n`/`N`) to control the removal of each Netdata asset in the filesystem.
+ The default mode in the uninstaller script is **interactive**. This means that the script provides you
+ the option to reply with "yes" (`y`/`Y`) or "no" (`n`/`N`) to control the removal of each Netdata asset in
+ the filesystem.
```sh
${NETDATA_PREFIX}/usr/libexec/netdata/netdata-uninstaller.sh --yes --env <environment_file>
@@ -43,7 +69,9 @@ NETDATA_ADDED_TO_GROUPS="<additional groups>" # Additional groups for a user ru
3.2 **Non-interactive mode**
- If you are sure and you know what you are doing, you can speed up the removal of the Netdata assets from the filesystem without any questions by using the force option (`-f`/`--force`). This option will remove all the Netdata assets in a **non-interactive** mode.
+ If you are sure and you know what you are doing, you can speed up the removal of the Netdata assets from the
+ filesystem without any questions by using the force option (`-f`/`--force`). This option will remove all the
+ Netdata assets in a **non-interactive** mode.
```sh
${NETDATA_PREFIX}/usr/libexec/netdata/netdata-uninstaller.sh --yes --force --env <environment_file>
@@ -58,9 +86,7 @@ chmod +x ./netdata-uninstaller.sh
./netdata-uninstaller.sh --yes --env <environment_file>
```
-The default `environment_file` is `/etc/netdata/.environment`.
+The default `environment_file` is `/etc/netdata/.environment`.
> Note: This uninstallation method assumes previous installation with `netdata-installer.sh` or the kickstart script.
-> Currently using it when Netdata was installed by a package manager can work or cause unexpected results.
-
-
+> Using it when Netdata was installed in some other way will usually not work correctly, and may make it harder to uninstall Netdata.
diff --git a/packaging/installer/dependencies/alpine.sh b/packaging/installer/dependencies/alpine.sh
index cc3908d29..65999dc3b 100755
--- a/packaging/installer/dependencies/alpine.sh
+++ b/packaging/installer/dependencies/alpine.sh
@@ -22,7 +22,6 @@ package_tree="
tar
curl
gzip
- netcat-openbsd
libuv-dev
lz4-dev
openssl-dev
diff --git a/packaging/installer/dependencies/arch.sh b/packaging/installer/dependencies/arch.sh
index dc37bcb9a..cdda52733 100755
--- a/packaging/installer/dependencies/arch.sh
+++ b/packaging/installer/dependencies/arch.sh
@@ -16,7 +16,6 @@ declare -a package_tree=(
automake
libtool
cmake
- gnu-netcat
zlib
util-linux
libmnl
diff --git a/packaging/installer/dependencies/centos.sh b/packaging/installer/dependencies/centos.sh
index f5f478ac1..a05bce8f0 100755
--- a/packaging/installer/dependencies/centos.sh
+++ b/packaging/installer/dependencies/centos.sh
@@ -15,7 +15,6 @@ declare -a package_tree=(
libtool
pkgconfig
cmake
- nmap-ncat
zlib-devel
libuuid-devel
libmnl-devel
diff --git a/packaging/installer/dependencies/debian.sh b/packaging/installer/dependencies/debian.sh
index 61ff3e4aa..a2c421a92 100755
--- a/packaging/installer/dependencies/debian.sh
+++ b/packaging/installer/dependencies/debian.sh
@@ -23,7 +23,6 @@ package_tree="
tar
curl
gzip
- netcat
zlib1g-dev
uuid-dev
libmnl-dev
diff --git a/packaging/installer/dependencies/fedora.sh b/packaging/installer/dependencies/fedora.sh
index 4cfe7cbb1..a1c3a1df6 100755
--- a/packaging/installer/dependencies/fedora.sh
+++ b/packaging/installer/dependencies/fedora.sh
@@ -35,7 +35,6 @@ declare -a package_tree=(
libatomic
libtool
cmake
- nmap-ncat
zlib-devel
libuuid-devel
libmnl-devel
diff --git a/packaging/installer/dependencies/freebsd.sh b/packaging/installer/dependencies/freebsd.sh
index 6afaca337..914513563 100755
--- a/packaging/installer/dependencies/freebsd.sh
+++ b/packaging/installer/dependencies/freebsd.sh
@@ -18,7 +18,6 @@ package_tree="
cmake
curl
gzip
- netcat
lzlib
e2fsprogs-libuuid
json-c
diff --git a/packaging/installer/dependencies/gentoo.sh b/packaging/installer/dependencies/gentoo.sh
index ae82cf3b3..e7ed64455 100755
--- a/packaging/installer/dependencies/gentoo.sh
+++ b/packaging/installer/dependencies/gentoo.sh
@@ -21,7 +21,6 @@ package_tree="
app-arch/tar
net-misc/curl
app-arch/gzip
- net-analyzer/netcat
sys-apps/util-linux
net-libs/libmnl
dev-libs/json-c
diff --git a/packaging/installer/dependencies/ol.sh b/packaging/installer/dependencies/ol.sh
index 020bf63cc..0f1f90e67 100755
--- a/packaging/installer/dependencies/ol.sh
+++ b/packaging/installer/dependencies/ol.sh
@@ -19,7 +19,6 @@ declare -a package_tree=(
libtool
pkgconfig
cmake
- nmap-ncat
tar
zlib-devel
libuuid-devel
diff --git a/packaging/installer/dependencies/opensuse.sh b/packaging/installer/dependencies/opensuse.sh
index 51a6d909e..b1f0c2182 100755
--- a/packaging/installer/dependencies/opensuse.sh
+++ b/packaging/installer/dependencies/opensuse.sh
@@ -21,7 +21,6 @@ declare -a package_tree=(
libtool
pkg-config
cmake
- netcat-openbsd
zlib-devel
libuuid-devel
libmnl-devel
diff --git a/packaging/installer/dependencies/rockylinux.sh b/packaging/installer/dependencies/rockylinux.sh
index 92050a457..63981df4b 100755
--- a/packaging/installer/dependencies/rockylinux.sh
+++ b/packaging/installer/dependencies/rockylinux.sh
@@ -19,7 +19,6 @@ declare -a package_tree=(
libtool
pkgconfig
cmake
- nmap-ncat
zlib-devel
libuuid-devel
libmnl-devel
diff --git a/packaging/installer/dependencies/ubuntu.sh b/packaging/installer/dependencies/ubuntu.sh
index b99098821..295dbf013 100755
--- a/packaging/installer/dependencies/ubuntu.sh
+++ b/packaging/installer/dependencies/ubuntu.sh
@@ -23,7 +23,6 @@ package_tree="
tar
curl
gzip
- netcat
zlib1g-dev
uuid-dev
libmnl-dev
diff --git a/packaging/installer/functions.sh b/packaging/installer/functions.sh
index 8bf7fafcf..e354ac651 100644
--- a/packaging/installer/functions.sh
+++ b/packaging/installer/functions.sh
@@ -253,9 +253,17 @@ exit_reason() {
EXIT_REASON="${1}"
EXIT_CODE="${2}"
if [ -n "${NETDATA_PROPAGATE_WARNINGS}" ]; then
- export EXIT_REASON
- export EXIT_CODE
- export NETDATA_WARNINGS="${NETDATA_WARNINGS}${SAVED_WARNINGS}"
+ if [ -n "${NETDATA_SCRIPT_STATUS_PATH}" ]; then
+ {
+ echo "EXIT_REASON=\"${EXIT_REASON}\""
+ echo "EXIT_CODE=\"${EXIT_CODE}\""
+ echo "NETDATA_WARNINGS=\"${NETDATA_WARNINGS}${SAVED_WARNINGS}\""
+ } >> "${NETDATA_SCRIPT_STATUS_PATH}"
+ else
+ export EXIT_REASON
+ export EXIT_CODE
+ export NETDATA_WARNINGS="${NETDATA_WARNINGS}${SAVED_WARNINGS}"
+ fi
fi
fi
}
@@ -475,92 +483,153 @@ install_non_systemd_init() {
return 1
}
-# This is used by netdata-installer.sh
-# shellcheck disable=SC2034
-NETDATA_STOP_CMD="netdatacli shutdown-agent"
-
-NETDATA_START_CMD="netdata"
-NETDATA_INSTALLER_START_CMD=""
-
-install_netdata_service() {
- uname="$(uname 2> /dev/null)"
-
- if [ "${UID}" -eq 0 ]; then
- if [ "${uname}" = "Darwin" ]; then
+run_install_service_script() {
+ if [ -z "${tmpdir}" ]; then
+ tmpdir="${TMPDIR:-/tmp}"
+ fi
- 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/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
+ # shellcheck disable=SC2154
+ save_path="${tmpdir}/netdata-service-cmds"
+ # shellcheck disable=SC2068
+ "${NETDATA_PREFIX}/usr/libexec/netdata/install-service.sh" --save-cmds "${save_path}" ${@}
+
+ case $? in
+ 0)
+ if [ -r "${save_path}" ]; then
+ # shellcheck disable=SC1090
+ . "${save_path}"
fi
- 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" &&
- 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}
+ if [ -z "${NETDATA_INSTALLER_START_CMD}" ]; then
+ if [ -n "${NETDATA_START_CMD}" ]; then
+ NETDATA_INSTALLER_START_CMD="${NETDATA_START_CMD}"
+ else
+ NETDATA_INSTALLER_START_CMD="netdata"
+ fi
+ fi
+ ;;
+ 1)
+ if [ -z "${NETDATA_SERVICE_WARNED_1}" ]; then
+ warning "Intenral error encountered while attempting to install or manage Netdata as a system service. This is probably a bug."
+ NETDATA_SERVICE_WARNED_1=1
+ fi
+ ;;
+ 2)
+ if [ -z "${NETDATA_SERVICE_WARNED_2}" ]; then
+ warning "Failed to detect system service manager type. Cannot cleanly install or manage Netdata as a system service. If you are running this script in a container, this is expected and can safely be ignored."
+ NETDATA_SERVICE_WARNED_2=1
+ fi
+ ;;
+ 3)
+ if [ -z "${NETDATA_SERVICE_WARNED_3}" ]; then
+ warning "Detected an unsupported system service manager. Manual setup will be required to manage Netdata as a system service."
+ NETDATA_SERVICE_WARNED_3=1
+ fi
+ ;;
+ 4)
+ if [ -z "${NETDATA_SERVICE_WARNED_4}" ]; then
+ warning "Detected a supported system service manager, but failed to install Netdata as a system service. Usually this is a result of incorrect permissions. Manually running ${NETDATA_PREFIX}/usr/libexec/netdata/install-service.sh may provide more information about the exact issue."
+ NETDATA_SERVICE_WARNED_4=1
+ fi
+ ;;
+ 5)
+ if [ -z "${NETDATA_SERVICE_WARNED_5}" ]; then
+ warning "We do not support managing Netdata as a system service on this platform. Manual setup will be required."
+ NETDATA_SERVICE_WARNED_5=1
+ fi
+ ;;
+ esac
+}
- elif issystemd; then
- # systemd is running on this system
- NETDATA_START_CMD="systemctl start netdata"
+install_netdata_service() {
+ if [ "${UID}" -eq 0 ]; then
+ 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="systemctl stop netdata"
- NETDATA_INSTALLER_START_CMD="${NETDATA_START_CMD}"
+ NETDATA_STOP_CMD="netdatacli shutdown-agent"
- SYSTEMD_DIRECTORY="$(get_systemd_service_dir)"
+ NETDATA_START_CMD="netdata"
+ NETDATA_INSTALLER_START_CMD=""
- 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
+ uname="$(uname 2> /dev/null)"
- echo >&2 "Installing systemd service..."
- run cp system/netdata.service "${SYSTEMD_DIRECTORY}/netdata.service" &&
- run systemctl daemon-reload &&
- ${ENABLE_NETDATA_IF_PREVIOUSLY_ENABLED} &&
+ 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
- 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"
+ else
+ echo >&2 "Installing MacOS X plist file..."
# 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"
+ run cp system/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/netdata-freebsd /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}"
- fi
- return ${ret}
+ 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/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
fi
fi
@@ -642,11 +711,21 @@ netdata_pids() {
stop_all_netdata() {
stop_success=0
+ if [ -x "${NETDATA_PREFIX}/usr/libexec/netdata/install-service.sh" ]; then
+ run_install_service_script --cmds-only
+ fi
+
if [ "${UID}" -eq 0 ]; then
+
uname="$(uname 2>/dev/null)"
# Any of these may fail, but we need to not bail if they do.
- if issystemd; then
+ if [ -n "${NETDATA_STOP_CMD}" ]; then
+ if ${NETDATA_STOP_CMD}; then
+ stop_success=1
+ sleep 5
+ fi
+ elif issystemd; then
if systemctl stop netdata; then
stop_success=1
sleep 5
@@ -693,8 +772,16 @@ restart_netdata() {
progress "Restarting netdata instance"
+ if [ -x "${NETDATA_PREFIX}/usr/libexec/netdata/install-service.sh" ]; then
+ run_install_service_script --cmds-only
+ fi
+
if [ -z "${NETDATA_INSTALLER_START_CMD}" ]; then
- NETDATA_INSTALLER_START_CMD="${netdata}"
+ if [ -n "${NETDATA_START_CMD}" ]; then
+ NETDATA_INSTALLER_START_CMD="${NETDATA_START_CMD}"
+ else
+ NETDATA_INSTALLER_START_CMD="${netdata}"
+ fi
fi
if [ "${UID}" -eq 0 ]; then
diff --git a/packaging/installer/install-required-packages.sh b/packaging/installer/install-required-packages.sh
index da3cf5e4a..6547dd82e 100755
--- a/packaging/installer/install-required-packages.sh
+++ b/packaging/installer/install-required-packages.sh
@@ -20,7 +20,6 @@ fi
PACKAGES_NETDATA=${PACKAGES_NETDATA-1}
PACKAGES_NETDATA_PYTHON=${PACKAGES_NETDATA_PYTHON-0}
PACKAGES_NETDATA_PYTHON3=${PACKAGES_NETDATA_PYTHON3-1}
-PACKAGES_NETDATA_PYTHON_POSTGRES=${PACKAGES_NETDATA_PYTHON_POSTGRES-0}
PACKAGES_NETDATA_PYTHON_MONGO=${PACKAGES_NETDATA_PYTHON_MONGO-0}
PACKAGES_DEBUG=${PACKAGES_DEBUG-0}
PACKAGES_IPRANGE=${PACKAGES_IPRANGE-0}
@@ -97,8 +96,7 @@ Supported installers (IN):
Supported packages (you can append many of them):
- netdata-all all packages required to install netdata
- including postgres client,
- node.js, python, sensors, etc
+ including python, sensors, etc
- netdata minimum packages required to install netdata
(includes python)
@@ -107,10 +105,6 @@ Supported packages (you can append many of them):
- python3 install python3
- - python-postgres install psycopg2
- (for monitoring postgres, will install python3 version
- if python3 is enabled or detected)
-
- python-pymongo install python-pymongo (or python3-pymongo for python3)
- sensors install lm_sensors for monitoring h/w sensors
@@ -884,26 +878,6 @@ declare -A pkg_make=(
['default']="make"
)
-declare -A pkg_netcat=(
- ['alpine']="netcat-openbsd"
- ['arch']="netcat"
- ['centos']="nmap-ncat"
- ['debian']="netcat"
- ['gentoo']="net-analyzer/netcat"
- ['sabayon']="net-analyzer/gnu-netcat"
- ['rhel']="nmap-ncat"
- ['ol']="nmap-ncat"
- ['suse']="netcat-openbsd"
- ['clearlinux']="sysadmin-basic"
- ['arch']="gnu-netcat"
- ['macos']="NOTREQUIRED"
- ['default']="netcat"
-
- # exceptions
- ['centos-6']="nc"
- ['rhel-6']="nc"
-)
-
declare -A pkg_nginx=(
['gentoo']="www-servers/nginx"
['default']="nginx"
@@ -941,42 +915,6 @@ declare -A pkg_python=(
['centos-8']="python2"
)
-declare -A pkg_python_psycopg2=(
- ['alpine']="py-psycopg2"
- ['arch']="python2-psycopg2"
- ['centos']="python-psycopg2"
- ['debian']="python-psycopg2"
- ['gentoo']="dev-python/psycopg"
- ['sabayon']="dev-python/psycopg:2"
- ['rhel']="python-psycopg2"
- ['ol']="python-psycopg2"
- ['suse']="python-psycopg2"
- ['clearlinux']="WARNING|"
- ['macos']="WARNING|"
- ['default']="python-psycopg2"
-)
-
-declare -A pkg_python3_psycopg2=(
- ['alpine']="py3-psycopg2"
- ['arch']="python-psycopg2"
- ['centos']="WARNING|"
- ['debian']="WARNING|"
- ['gentoo']="dev-python/psycopg"
- ['sabayon']="dev-python/psycopg:2"
- ['rhel']="WARNING|"
- ['ol']="WARNING|"
- ['suse']="WARNING|"
- ['clearlinux']="WARNING|"
- ['macos']="WARNING|"
- ['default']="WARNING|"
-
- ['centos-7']="python3-psycopg2"
- ['centos-8']="python38-psycopg2"
- ['rhel-7']="python3-psycopg2"
- ['rhel-8']="python38-psycopg2"
- ['ol-8']="python3-psycopg2"
-)
-
declare -A pkg_python_pip=(
['alpine']="py-pip"
['gentoo']="dev-python/pip"
@@ -1295,7 +1233,6 @@ packages() {
require_cmd tar || suitable_package tar
require_cmd curl || suitable_package curl
require_cmd gzip || suitable_package gzip
- require_cmd nc || suitable_package netcat
fi
# -------------------------------------------------------------------------
@@ -1359,8 +1296,6 @@ packages() {
[ "${PACKAGES_NETDATA_PYTHON_MONGO}" -ne 0 ] && suitable_package python-pymongo
# suitable_package python-requests
# suitable_package python-pip
-
- [ "${PACKAGES_NETDATA_PYTHON_POSTGRES}" -ne 0 ] && suitable_package python-psycopg2
fi
# -------------------------------------------------------------------------
@@ -1372,8 +1307,6 @@ packages() {
[ "${PACKAGES_NETDATA_PYTHON_MONGO}" -ne 0 ] && suitable_package python3-pymongo
# suitable_package python3-requests
# suitable_package python3-pip
-
- [ "${PACKAGES_NETDATA_PYTHON_POSTGRES}" -ne 0 ] && suitable_package python3-psycopg2
fi
# -------------------------------------------------------------------------
@@ -1913,7 +1846,7 @@ EOF
remote_log() {
# log success or failure on our system
# to help us solve installation issues
- curl > /dev/null 2>&1 -Ss --max-time 3 "https://registry.my-netdata.io/log/installer?status=${1}&error=${2}&distribution=${distribution}&version=${version}&installer=${package_installer}&tree=${tree}&detection=${detection}&netdata=${PACKAGES_NETDATA}&python=${PACKAGES_NETDATA_PYTHON}&python3=${PACKAGES_NETDATA_PYTHON3}&postgres=${PACKAGES_NETDATA_PYTHON_POSTGRES}&pymongo=${PACKAGES_NETDATA_PYTHON_MONGO}&sensors=${PACKAGES_NETDATA_SENSORS}&database=${PACKAGES_NETDATA_DATABASE}&ebpf=${PACKAGES_NETDATA_EBPF}&firehol=${PACKAGES_FIREHOL}&fireqos=${PACKAGES_FIREQOS}&iprange=${PACKAGES_IPRANGE}&update_ipsets=${PACKAGES_UPDATE_IPSETS}&demo=${PACKAGES_NETDATA_DEMO_SITE}"
+ curl > /dev/null 2>&1 -Ss --max-time 3 "https://registry.my-netdata.io/log/installer?status=${1}&error=${2}&distribution=${distribution}&version=${version}&installer=${package_installer}&tree=${tree}&detection=${detection}&netdata=${PACKAGES_NETDATA}&python=${PACKAGES_NETDATA_PYTHON}&python3=${PACKAGES_NETDATA_PYTHON3}&pymongo=${PACKAGES_NETDATA_PYTHON_MONGO}&sensors=${PACKAGES_NETDATA_SENSORS}&database=${PACKAGES_NETDATA_DATABASE}&ebpf=${PACKAGES_NETDATA_EBPF}&firehol=${PACKAGES_FIREHOL}&fireqos=${PACKAGES_FIREQOS}&iprange=${PACKAGES_IPRANGE}&update_ipsets=${PACKAGES_UPDATE_IPSETS}&demo=${PACKAGES_NETDATA_DEMO_SITE}"
}
if [ -z "${1}" ]; then
@@ -1976,11 +1909,9 @@ while [ -n "${1}" ]; do
PACKAGES_NETDATA=1
if [ "${pv}" -eq 2 ]; then
PACKAGES_NETDATA_PYTHON=1
- PACKAGES_NETDATA_PYTHON_POSTGRES=1
PACKAGES_NETDATA_PYTHON_MONGO=1
else
PACKAGES_NETDATA_PYTHON3=1
- PACKAGES_NETDATA_PYTHON3_POSTGRES=1
PACKAGES_NETDATA_PYTHON3_MONGO=1
fi
PACKAGES_NETDATA_SENSORS=1
@@ -2003,16 +1934,6 @@ while [ -n "${1}" ]; do
PACKAGES_NETDATA_PYTHON3=1
;;
- python-postgres | postgres-python | psycopg2 | netdata-postgres)
- if [ "${pv}" -eq 2 ]; then
- PACKAGES_NETDATA_PYTHON=1
- PACKAGES_NETDATA_PYTHON_POSTGRES=1
- else
- PACKAGES_NETDATA_PYTHON3=1
- PACKAGES_NETDATA_PYTHON3_POSTGRES=1
- fi
- ;;
-
python-pymongo)
if [ "${pv}" -eq 2 ]; then
PACKAGES_NETDATA_PYTHON=1
@@ -2042,11 +1963,9 @@ while [ -n "${1}" ]; do
PACKAGES_NETDATA=1
if [ "${pv}" -eq 2 ]; then
PACKAGES_NETDATA_PYTHON=1
- PACKAGES_NETDATA_PYTHON_POSTGRES=1
PACKAGES_NETDATA_PYTHON_MONGO=1
else
PACKAGES_NETDATA_PYTHON3=1
- PACKAGES_NETDATA_PYTHON3_POSTGRES=1
PACKAGES_NETDATA_PYTHON3_MONGO=1
fi
PACKAGES_DEBUG=1
diff --git a/packaging/installer/kickstart.sh b/packaging/installer/kickstart.sh
index 10f6b9664..295fcdca0 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: F050A
+# Next unused error code: F050D
# ======================================================================
# Constants
@@ -12,7 +12,6 @@ CLOUD_BUG_REPORT_URL="https://github.com/netdata/netdata-cloud/issues/new/choose
DEFAULT_RELEASE_CHANNEL="nightly"
DISCORD_INVITE="https://discord.gg/5ygS846fR6"
DISCUSSIONS_URL="https://github.com/netdata/netdata/discussions"
-DISCUSSIONS_URL="https://github.com/netdata/netdata/discussions"
DOCS_URL="https://learn.netdata.cloud/docs/"
FORUM_URL="https://community.netdata.cloud/"
KICKSTART_OPTIONS="${*}"
@@ -44,7 +43,8 @@ INSTALL_TYPE="unknown"
INSTALL_PREFIX=""
NETDATA_AUTO_UPDATES="default"
NETDATA_CLAIM_ONLY=0
-NETDATA_CLAIM_URL="${PUBLIC_CLOUD_URL}"
+NETDATA_CLAIM_URL="api.netdata.cloud"
+NETDATA_COMMAND="default"
NETDATA_DISABLE_CLOUD=0
NETDATA_ONLY_BUILD=0
NETDATA_ONLY_NATIVE=0
@@ -77,6 +77,13 @@ else
fi
# ======================================================================
+# Shared messages used in multiple places throughout the script.
+
+BADCACHE_MSG="Usually this is a result of an older copy of the file being cached somewhere upstream and can be resolved by retrying in an hour"
+BADNET_MSG="This is usually a result of a networking issue"
+ERROR_F0003="Could not find a usable HTTP client. Either curl or wget is required to proceed with installation."
+
+# ======================================================================
# Core program logic
main() {
@@ -241,10 +248,16 @@ telemetry_event() {
TOTAL_RAM="$((TOTAL_RAM * 1024))"
fi
- if [ -f /etc/machine-id ]; then
- DISTINCT_ID="$(cat /etc/machine-id)"
+ if [ "${KERNEL_NAME}" = Darwin ] && command -v ioreg >/dev/null 2>&1; then
+ DISTINCT_ID="macos-$(ioreg -rd1 -c IOPlatformExpertDevice | awk '/IOPlatformUUID/ { split($0, line, "\""); printf("%s\n", line[4]); }')"
+ elif [ -f /etc/machine-id ]; then
+ DISTINCT_ID="machine-$(cat /etc/machine-id)"
+ elif [ -f /var/db/dbus/machine-id ]; then
+ DISTINCT_ID="dbus-$(cat /var/db/dbus/machine-id)"
+ elif [ -f /var/lib/dbus/machine-id ]; then
+ DISTINCT_ID="dbus-$(cat /var/lib/dbus/machine-id)"
elif command -v uuidgen > /dev/null 2>&1; then
- DISTINCT_ID="$(uuidgen | tr '[:upper:]' '[:lower:]')"
+ DISTINCT_ID="uuid-$(uuidgen | tr '[:upper:]' '[:lower:]')"
else
DISTINCT_ID="null"
fi
@@ -266,6 +279,7 @@ telemetry_event() {
"install_options": "${KICKSTART_OPTIONS}",
"install_interactivity": "${INTERACTIVE}",
"install_auto_updates": "${NETDATA_AUTO_UPDATES}",
+ "install_command": "${NETDATA_COMMAND}",
"total_runtime": "${total_duration}",
"selected_install_method": "${SELECTED_INSTALL_METHOD}",
"netdata_release_channel": "${RELEASE_CHANNEL:-null}",
@@ -473,6 +487,26 @@ run() {
return ${ret}
}
+run_script() {
+ set_tmpdir
+
+ export NETDATA_SCRIPT_STATUS_PATH="${tmpdir}/.script-status"
+
+ export NETDATA_SAVE_WARNINGS=1
+ export NETDATA_PROPAGATE_WARNINGS=1
+ # shellcheck disable=SC2090
+ export NETDATA_WARNINGS="${NETDATA_WARNINGS}"
+
+ # shellcheck disable=SC2086
+ run ${ROOTCMD} "${@}"
+
+ if [ -r "${NETDATA_SCRIPT_STATUS_PATH}" ]; then
+ # shellcheck disable=SC1090
+ . "${NETDATA_SCRIPT_STATUS_PATH}"
+ rm -f "${NETDATA_SCRIPT_STATUS_PATH}"
+ fi
+}
+
warning() {
printf >&2 "%s\n\n" "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} WARNING ${TPUT_RESET} ${*}"
NETDATA_WARNINGS="${NETDATA_WARNINGS}\n - ${*}"
@@ -515,7 +549,7 @@ create_tmp_directory() {
}
set_tmpdir() {
- if [ -z "${tmpdir}" ]; then
+ if [ -z "${tmpdir}" ] || [ ! -d "${tmpdir}" ]; then
tmpdir="$(create_tmp_directory)"
progress "Using ${tmpdir} as a temporary directory."
cd "${tmpdir}" || fatal "Failed to change current working directory to ${tmpdir}." F000A
@@ -532,7 +566,7 @@ check_for_remote_file() {
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
- fatal "I need curl or wget to proceed, but neither of them are available on this system." F0003
+ fatal "${ERROR_F0003}" F0003
fi
}
@@ -547,7 +581,7 @@ download() {
elif command -v wget > /dev/null 2>&1; then
run wget -T 15 -O "${dest}" "${url}" || return 1
else
- fatal "I need curl or wget to proceed, but neither of them are available on this system." F0003
+ fatal "${ERROR_F0003}" F0003
fi
}
@@ -559,7 +593,7 @@ get_redirect() {
elif command -v wget > /dev/null 2>&1; then
run sh -c "wget --max-redirect=0 ${url} 2>&1 | grep Location | cut -d ' ' -f2 | grep -o '[^/]*$'" || return 1
else
- fatal "I need curl or wget to proceed, but neither of them are available on this system." F0003
+ fatal "${ERROR_F0003}" F0003
fi
}
@@ -571,7 +605,7 @@ safe_sha256sum() {
elif command -v sha256sum > /dev/null 2>&1; then
sha256sum "$@"
else
- fatal "I could not find a suitable checksum binary to use" F0004
+ fatal "Could not find a usable checksum tool. Either sha256sum, or a version of shasum supporting SHA256 checksums is required to proceed with installation." F0004
fi
}
@@ -586,7 +620,7 @@ get_system_info() {
elif [ -s "/usr/lib/os-release" ] && [ -r "/usr/lib/os-release" ]; then
os_release_file="/usr/lib/os-release"
else
- warning "Cannot find an os-release file ..."
+ warning "Cannot find usable OS release information. Native packages will not be available for this install."
fi
if [ -n "${os_release_file}" ]; then
@@ -598,7 +632,7 @@ get_system_info() {
SYSCODENAME="${VERSION_CODENAME}"
SYSARCH="$(uname -m)"
- supported_compat_names="debian ubuntu centos fedora opensuse ol"
+ supported_compat_names="debian ubuntu centos fedora opensuse ol arch"
if str_in_list "${DISTRO}" "${supported_compat_names}"; then
DISTRO_COMPAT_NAME="${DISTRO}"
@@ -607,9 +641,12 @@ get_system_info() {
opensuse-leap)
DISTRO_COMPAT_NAME="opensuse"
;;
- almalinux|rocky|rhel)
+ cloudlinux|almalinux|rocky|rhel)
DISTRO_COMPAT_NAME="centos"
;;
+ artix|manjaro|obarun)
+ DISTRO_COMPAT_NAME="arch"
+ ;;
*)
DISTRO_COMPAT_NAME="unknown"
;;
@@ -673,7 +710,7 @@ confirm_root_support() {
fi
if [ -z "${ROOTCMD}" ]; then
- fatal "We need root privileges to continue, but cannot find a way to gain them. Either re-run this script as root, or set \$ROOTCMD to a command that can be used to gain root privileges" F0201
+ fatal "We need root privileges to continue, but cannot find a way to gain them (we support sudo, doas, and pkexec). Either re-run this script as root, or set \$ROOTCMD to a command that can be used to gain root privileges." F0201
fi
fi
}
@@ -711,22 +748,18 @@ update() {
opts="--interactive"
fi
- export NETDATA_SAVE_WARNINGS=1
- export NETDATA_PROPAGATE_WARNINGS=1
- # shellcheck disable=SC2090
- export NETDATA_WARNINGS="${NETDATA_WARNINGS}"
- if run ${ROOTCMD} "${updater}" ${opts} --not-running-from-cron; then
+ if run_script "${updater}" ${opts} --not-running-from-cron; then
progress "Updated existing install at ${ndprefix}"
return 0
else
if [ -n "${EXIT_REASON}" ]; then
fatal "Failed to update existing Netdata install at ${ndprefix}: ${EXIT_REASON}" "${EXIT_CODE}"
else
- fatal "Failed to update existing Netdata install at ${ndprefix}." U0000
+ fatal "Failed to update existing Netdata install at ${ndprefix}: Encountered an unhandled error in the updater. Further information about this error may be displayed above." U0000
fi
fi
else
- warning "Could not find a usable copy of the updater script."
+ warning "Could not find a usable copy of the updater script. We are unable to update this system in place."
return 1
fi
}
@@ -757,11 +790,7 @@ uninstall() {
return 0
else
progress "Found existing netdata-uninstaller. Running it.."
- export NETDATA_SAVE_WARNINGS=1
- export NETDATA_PROPAGATE_WARNINGS=1
- # shellcheck disable=SC2090
- export NETDATA_WARNINGS="${NETDATA_WARNINGS}"
- if ! run ${ROOTCMD} "${uninstaller}" $FLAGS; then
+ if ! run_script "${uninstaller}" ${FLAGS}; then
warning "Uninstaller failed. Some parts of Netdata may still be present on the system."
fi
fi
@@ -774,11 +803,7 @@ uninstall() {
progress "Downloading netdata-uninstaller ..."
download "${uninstaller_url}" "${tmpdir}/netdata-uninstaller.sh"
chmod +x "${tmpdir}/netdata-uninstaller.sh"
- export NETDATA_SAVE_WARNINGS=1
- export NETDATA_PROPAGATE_WARNINGS=1
- # shellcheck disable=SC2090
- export NETDATA_WARNINGS="${NETDATA_WARNINGS}"
- if ! run ${ROOTCMD} "${tmpdir}/netdata-uninstaller.sh" $FLAGS; then
+ if ! run_script "${tmpdir}/netdata-uninstaller.sh" ${FLAGS}; then
warning "Uninstaller failed. Some parts of Netdata may still be present on the system."
fi
fi
@@ -792,7 +817,9 @@ detect_existing_install() {
if pkg_installed netdata; then
ndprefix="/"
+ EXISTING_INSTALL_IS_NATIVE="1"
else
+ EXISTING_INSTALL_IS_NATIVE="0"
if [ -n "${INSTALL_PREFIX}" ]; then
searchpath="${INSTALL_PREFIX}/bin:${INSTALL_PREFIX}/sbin:${INSTALL_PREFIX}/usr/bin:${INSTALL_PREFIX}/usr/sbin:${PATH}"
searchpath="${INSTALL_PREFIX}/netdata/bin:${INSTALL_PREFIX}/netdata/sbin:${INSTALL_PREFIX}/netdata/usr/bin:${INSTALL_PREFIX}/netdata/usr/sbin:${searchpath}"
@@ -807,7 +834,10 @@ detect_existing_install() {
fi
if [ -n "${ndpath}" ]; then
- ndprefix="$(dirname "$(dirname "${ndpath}")")"
+ case "${ndpath}" in
+ */usr/bin/netdata|*/usr/sbin/netdata) ndprefix="$(dirname "$(dirname "$(dirname "${ndpath}")")")" ;;
+ *) ndprefix="$(dirname "$(dirname "${ndpath}")")" ;;
+ esac
fi
if echo "${ndprefix}" | grep -Eq '^/usr$'; then
@@ -854,8 +884,11 @@ handle_existing_install() {
case "${INSTALL_TYPE}" in
kickstart-*|legacy-*|binpkg-*|manual-static|unknown)
if [ "${INSTALL_TYPE}" = "unknown" ]; then
- warning "Found an existing netdata install at ${ndprefix}, but could not determine the install type."
- warning "Usually this means you installed Netdata through your distribution’s regular package repositories or some other unsupported method."
+ if [ "${EXISTING_INSTALL_IS_NATIVE}" -eq 1 ]; then
+ warning "Found an existing netdata install managed by the system package manager, but could not determine the install type. Usually this means you installed an unsupported third-party netdata package."
+ else
+ warning "Found an existing netdata install at ${ndprefix}, but could not determine the install type. Usually this means you installed Netdata through your distribution’s regular package repositories or some other unsupported method."
+ fi
else
progress "Found an existing netdata install at ${ndprefix}, with installation type '${INSTALL_TYPE}'."
fi
@@ -873,7 +906,13 @@ handle_existing_install() {
elif [ "${INTERACTIVE}" -eq 0 ]; then
fatal "User requested reinstall, but we cannot safely reinstall over top of a ${INSTALL_TYPE} installation, exiting." F0104
else
- if confirm "Reinstalling over top of a ${INSTALL_TYPE} installation may be unsafe, do you want to continue?"; then
+ if [ "${EXISTING_INSTALL_IS_NATIVE}" ]; then
+ reinstall_prompt="Reinstalling over top of an existing install managed by the system package manager is known to cause things to break, are you sure you want to continue?"
+ else
+ reinstall_prompt="Reinstalling over top of a ${INSTALL_TYPE} installation may be unsafe, do you want to continue?"
+ fi
+
+ if confirm "${reinstall_prompt}"; then
progress "OK, continuing."
else
fatal "Cancelling reinstallation at user request." F0105
@@ -884,7 +923,23 @@ handle_existing_install() {
return 0
elif [ "${INSTALL_TYPE}" = "unknown" ]; then
- fatal "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." F0106
+ claimonly_notice="If you just want to claim this install, you should re-run this command with the --claim-only option instead."
+ if [ "${EXISTING_INSTALL_IS_NATIVE}" -eq 1 ]; then
+ failmsg="Attempting to update an installation managed by the system package manager is known to not work in most cases. If you are trying to install the latest version of Netdata, you will need to manually uninstall it through your system package manager. ${claimonly_notice}"
+ promptmsg="Attempting to update an installation managed by the system package manager is known to not work in most cases. If you are trying to install the latest version of Netdata, you will need to manually uninstall it through your system package manager. ${claimonly_notice} Are you sure you want to continue?"
+ else
+ failmsg="We do not support trying to update or claim installations when we cannot determine the install type. You will need to uninstall the existing install using the same method you used to install it to proceed. ${claimonly_notice}"
+ promptmsg="Attempting to update an existing install is not officially supported. It may work, but it also might break your system. ${claimonly_notice} Are you sure you want to continue?"
+ fi
+ if [ "${INTERACTIVE}" -eq 0 ] && [ "${NETDATA_CLAIM_ONLY}" -eq 0 ]; then
+ fatal "${failmsg}" F0106
+ elif [ "${INTERACTIVE}" -eq 1 ] && [ "${NETDATA_CLAIM_ONLY}" -eq 0 ]; then
+ if confirm "${promptmsg}"; then
+ progress "OK, continuing"
+ else
+ fatal "Cancelling update of unknown installation type at user request." F050C
+ fi
+ fi
fi
ret=0
@@ -945,7 +1000,7 @@ handle_existing_install() {
elif [ "${NETDATA_CLAIM_ONLY}" -eq 1 ]; 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, refusing to proceed." F0103
+ 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
fi
fi
;;
@@ -989,7 +1044,7 @@ EOF
confirm_install_prefix() {
if [ -n "${INSTALL_PREFIX}" ] && [ "${NETDATA_ONLY_BUILD}" -ne 1 ]; then
- fatal "The \`--install-prefix\` and \`--install\` options are only supported together with the \`--build-only\` option." F0204
+ fatal "The --install-prefix and --install options are only supported together with the --build-only option." F0204
fi
if [ -n "${INSTALL_PREFIX}" ]; then
@@ -1071,7 +1126,7 @@ claim() {
fi
if [ ! -x "${NETDATA_CLAIM_PATH}" ]; then
- fatal "Unable to find usable claiming script." F0106
+ fatal "Unable to find usable claiming script. Reinstalling Netdata may resolve this." F050B
fi
if ! is_netdata_running; then
@@ -1092,7 +1147,7 @@ claim() {
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."
+ 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."
@@ -1178,19 +1233,48 @@ set_auto_updates() {
# Check for an already installed package with a given name.
pkg_installed() {
- case "${DISTRO_COMPAT_NAME}" in
- debian|ubuntu)
- # shellcheck disable=SC2016
- dpkg-query --show --showformat '${Status}' "${1}" 2>&1 | cut -f 1 -d ' ' | grep -q '^install$'
- return $?
+ case "${SYSTYPE}" in
+ Linux)
+ case "${DISTRO_COMPAT_NAME}" in
+ debian|ubuntu)
+ # shellcheck disable=SC2016
+ dpkg-query --show --showformat '${Status}' "${1}" 2>&1 | cut -f 1 -d ' ' | grep -q '^install$'
+ return $?
+ ;;
+ centos|fedora|opensuse|ol)
+ rpm -q "${1}" > /dev/null 2>&1
+ return $?
+ ;;
+ alpine)
+ apk -e info "${1}" > /dev/null 2>&1
+ return $?
+ ;;
+ arch)
+ pacman -Qi "${1}" > /dev/null 2>&1
+ return $?
+ ;;
+ *)
+ return 1
+ ;;
+ esac
;;
- centos|fedora|opensuse|ol)
- rpm -q "${1}" > /dev/null 2>&1
- return $?
+ Darwin)
+ if command -v brew > /dev/null 2>&1; then
+ brew list "${1}" > /dev/null 2>&1
+ return $?
+ else
+ return 1
+ fi
;;
- *)
- return 1
+ FreeBSD)
+ if pkg -N > /dev/null 2>&1; then
+ pkg info "${1}" > /dev/null 2>&1
+ return $?
+ else
+ return 1
+ fi
;;
+ *) return 1 ;;
esac
}
@@ -1230,7 +1314,7 @@ check_special_native_deps() {
# shellcheck disable=SC2086
if ! run ${ROOTCMD} env ${env} ${pm_cmd} install ${pkg_install_opts} epel-release; then
- warning "Failed to install EPEL."
+ warning "Failed to install EPEL, even though it is required to install native packages on this system."
return 1
fi
fi
@@ -1241,6 +1325,8 @@ check_special_native_deps() {
}
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
warning "Unable to determine Linux distribution for native packages."
return 2
@@ -1388,18 +1474,18 @@ try_package_install() {
if ! pkg_installed "${repoconfig_name}"; then
progress "Checking for availability of repository configuration package."
if ! check_for_remote_file "${repoconfig_url}"; then
- warning "No repository configuration package available for ${DISTRO} ${SYSVERSION}."
+ warning "No repository configuration package available for ${DISTRO} ${SYSVERSION}. Cannot install native packages on this system."
return 2
fi
if ! download "${repoconfig_url}" "${tmpdir}/${repoconfig_file}"; then
- fatal "Failed to download repository configuration package." F0209
+ fatal "Failed to download repository configuration package. ${BADNET_MSG}." F0209
fi
if [ -n "${needs_early_refresh}" ]; then
# shellcheck disable=SC2086
if ! run ${ROOTCMD} env ${env} ${pm_cmd} ${repo_subcmd} ${repo_update_opts}; then
- warning "Failed to refresh repository metadata."
+ warning "${failed_refresh_msg}"
return 2
fi
fi
@@ -1413,7 +1499,7 @@ try_package_install() {
if [ -n "${repo_subcmd}" ]; then
# shellcheck disable=SC2086
if ! run ${ROOTCMD} env ${env} ${pm_cmd} ${repo_subcmd} ${repo_update_opts}; then
- fatal "Failed to refresh repository metadata." F0205
+ fatal "${failed_refresh_msg}" F0205
fi
fi
else
@@ -1530,16 +1616,16 @@ try_static_install() {
netdata_agent="${NETDATA_STATIC_ARCHIVE_OLD_URL#"https://github.com/netdata/netdata/releases/download/v${INSTALL_VERSION}/"}"
export NETDATA_STATIC_ARCHIVE_URL="${NETDATA_STATIC_ARCHIVE_OLD_URL}"
else
- warning "No static build available for ${SYSARCH} CPUs."
+ warning "There is no static build available for ${SYSARCH} CPUs. This usually means we simply do not currently provide static builds for ${SYSARCH} CPUs."
return 2
fi
if ! download "${NETDATA_STATIC_ARCHIVE_URL}" "${tmpdir}/${netdata_agent}"; then
- fatal "Unable to download static build archive for ${SYSARCH}." F0208
+ fatal "Unable to download static build archive for ${SYSARCH}. ${BADNET_MSG}." F0208
fi
if ! download "${NETDATA_STATIC_ARCHIVE_CHECKSUM_URL}" "${tmpdir}/sha256sum.txt"; then
- fatal "Unable to fetch checksums to verify static build archive." F0206
+ fatal "Unable to fetch checksums to verify static build archive. ${BADNET_MSG}." F0206
fi
if [ "${DRY_RUN}" -eq 1 ]; then
@@ -1547,7 +1633,7 @@ try_static_install() {
else
if [ -z "${INSTALL_VERSION}" ]; then
if ! grep "${netdata_agent}" "${tmpdir}/sha256sum.txt" | safe_sha256sum -c - > /dev/null 2>&1; then
- fatal "Static binary checksum validation failed. Usually this is a result of an older copy of the file being cached somewhere upstream and can be resolved by retrying in an hour." F0207
+ fatal "Static binary checksum validation failed. ${BADCACHE_MSG}." F0207
fi
fi
fi
@@ -1615,7 +1701,7 @@ install_local_build_dependencies() {
fi
if ! download "${PACKAGES_SCRIPT}" "${tmpdir}/install-required-packages.sh"; then
- fatal "Failed to download dependency handling script for local build." F000D
+ fatal "Failed to download dependency handling script for local build. ${BADNET_MSG}." F000D
fi
if [ "${DRY_RUN}" -eq 1 ]; then
@@ -1665,19 +1751,15 @@ build_and_install() {
opts="${opts} --disable-cloud"
fi
- export NETDATA_SAVE_WARNINGS=1
- export NETDATA_PROPAGATE_WARNINGS=1
- # shellcheck disable=SC2090
- export NETDATA_WARNINGS="${NETDATA_WARNINGS}"
# shellcheck disable=SC2086
- run ${ROOTCMD} ./netdata-installer.sh ${opts}
+ run_script ./netdata-installer.sh ${opts}
case $? in
1)
if [ -n "${EXIT_REASON}" ]; then
fatal "netdata-installer.sh failed to run: ${EXIT_REASON}" "${EXIT_CODE}"
else
- fatal "netdata-installer.sh failed to run correctly." I0000
+ fatal "netdata-installer.sh failed to run: Encountered an unhandled error in the installer code." I0000
fi
;;
2)
@@ -1703,14 +1785,14 @@ try_build_install() {
if [ -n "${INSTALL_VERSION}" ]; then
if ! download "${NETDATA_SOURCE_ARCHIVE_URL}" "${tmpdir}/netdata-v${INSTALL_VERSION}.tar.gz"; then
- fatal "Failed to download source tarball for local build." F000B
+ fatal "Failed to download source tarball for local build. ${BADNET_MSG}." F000B
fi
elif ! download "${NETDATA_SOURCE_ARCHIVE_URL}" "${tmpdir}/netdata-latest.tar.gz"; then
- fatal "Failed to download source tarball for local build." F000B
+ fatal "Failed to download source tarball for local build. ${BADNET_MSG}." F000B
fi
if ! download "${NETDATA_SOURCE_ARCHIVE_CHECKSUM_URL}" "${tmpdir}/sha256sum.txt"; then
- fatal "Failed to download checksums for source tarball verification." F000C
+ fatal "Failed to download checksums for source tarball verification. ${BADNET_MSG}." F000C
fi
if [ "${DRY_RUN}" -eq 1 ]; then
@@ -1719,7 +1801,7 @@ try_build_install() {
if [ -z "${INSTALL_VERSION}" ]; then
# shellcheck disable=SC2086
if ! grep netdata-latest.tar.gz "${tmpdir}/sha256sum.txt" | safe_sha256sum -c - > /dev/null 2>&1; then
- fatal "Tarball checksum validation failed. Usually this is a result of an older copy of the file being cached somewhere upstream and can be resolved by retrying in an hour." F0005
+ fatal "Tarball checksum validation failed. ${BADCACHE_MSG}." F0005
fi
fi
fi
@@ -1771,7 +1853,7 @@ prepare_offline_install_source() {
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}."
+ warning "Failed to download static installer archive for ${arch}. ${BADNET_MSG}."
fi
done
legacy=0
@@ -1781,13 +1863,13 @@ prepare_offline_install_source() {
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."
+ warning "Failed to download static installer archive for x86_64. ${BADNET_MSG}."
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." F0506
+ fatal "Failed to download checksum file. ${BADNET_MSG}." F0506
fi
fi
@@ -1799,7 +1881,7 @@ prepare_offline_install_source() {
if [ "${DRY_RUN}" -ne 1 ]; then
progress "Verifying checksums."
if ! grep -e "$(find . -name '*.gz.run')" sha256sums.txt | safe_sha256sum -c -; then
- fatal "Checksums for offline install files are incorrect. Usually this is a result of an older copy of the file being cached somewhere upstream and can be resolved by retrying in an hour." F0507
+ fatal "Checksums for offline install files are incorrect. ${BADCACHE_MSG}." F0507
fi
else
progress "Would verify SHA256 checksums of downloaded installation files."
@@ -2037,9 +2119,18 @@ parse_args() {
;;
esac
;;
- "--reinstall") NETDATA_REINSTALL=1 ;;
- "--reinstall-even-if-unsafe") NETDATA_UNSAFE_REINSTALL=1 ;;
- "--claim-only") NETDATA_CLAIM_ONLY=1 ;;
+ "--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
@@ -2076,12 +2167,15 @@ parse_args() {
;;
"--uninstall")
ACTION="uninstall"
+ NETDATA_COMMAND="uninstall"
;;
"--reinstall-clean")
ACTION="reinstall-clean"
+ NETDATA_COMMAND="reinstall-clean"
;;
"--repositories-only")
REPO_ACTION="repositories-only"
+ NETDATA_COMMAND="repositories"
;;
"--native-only")
NETDATA_ONLY_NATIVE=1
@@ -2139,6 +2233,7 @@ parse_args() {
"--prepare-offline-install-source")
if [ -n "${2}" ]; then
ACTION="prepare-offline"
+ NETDATA_COMMAND="prepare-offline"
OFFLINE_TARGET="${2}"
shift 1
else
diff --git a/packaging/installer/methods/kickstart.md b/packaging/installer/methods/kickstart.md
index fc212ea2e..2555e4a83 100644
--- a/packaging/installer/methods/kickstart.md
+++ b/packaging/installer/methods/kickstart.md
@@ -3,7 +3,7 @@ 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
-->
-import { OneLineInstallWget, OneLineInstallCurl } from '../../../../../src/components/OneLineInstall/'
+import { OneLineInstallWget, OneLineInstallCurl } from '@site/src/components/OneLineInstall/'
# Install Netdata with kickstart.sh
@@ -107,7 +107,7 @@ To automatically claim nodes after installation:
- `--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](/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`.
+- `--claim-url`: Specify a URL to use when connecting to the cloud. Defaults to `https://api.netdata.cloud`.
For example:
diff --git a/packaging/installer/methods/macos.md b/packaging/installer/methods/macos.md
index c43d8dfb2..a1b5f60ce 100644
--- a/packaging/installer/methods/macos.md
+++ b/packaging/installer/methods/macos.md
@@ -44,11 +44,11 @@ area](https://learn.netdata.cloud/docs/cloud/spaces#manage-spaces).
- `--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](/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`.
+- `--claim-url`: Specify a URL to use when connecting to the cloud. Defaults to `https://api.netdata.cloud`.
For example:
```bash
-curl https://my-netdata.io/kickstart.sh > /tmp/netdata-kickstart.sh && sh /tmp/netdata-kickstart.sh --install /usr/local/ --claim-token TOKEN --claim-rooms ROOM1,ROOM2 --claim-url https://app.netdata.cloud
+curl https://my-netdata.io/kickstart.sh > /tmp/netdata-kickstart.sh && sh /tmp/netdata-kickstart.sh --install /usr/local/ --claim-token TOKEN --claim-rooms ROOM1,ROOM2 --claim-url https://api.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.
diff --git a/packaging/installer/methods/manual.md b/packaging/installer/methods/manual.md
index c47c2e364..d32075394 100644
--- a/packaging/installer/methods/manual.md
+++ b/packaging/installer/methods/manual.md
@@ -41,7 +41,7 @@ and other operating systems and is regularly tested. You can find this tool [her
- **SLE12** Must have your system registered with SUSE Customer Center or have the DVD. See
[#1162](https://github.com/netdata/netdata/issues/1162)
-Install the packages for having a **basic Netdata installation** (system monitoring and many applications, without `mysql` / `mariadb`, `postgres`, `named`, hardware sensors and `SNMP`):
+Install the packages for having a **basic Netdata installation** (system monitoring and many applications, without `mysql` / `mariadb`, `named`, hardware sensors and `SNMP`):
```sh
curl -Ss 'https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer/install-required-packages.sh' >/tmp/install-required-packages.sh && bash /tmp/install-required-packages.sh -i netdata
@@ -99,7 +99,6 @@ Netdata plugins and various aspects of Netdata can be enabled or benefit when th
| `python-dnspython`|used for monitoring DNS query time|
| `python-ipaddress`|used for monitoring **DHCPd**<br/>this package is required only if the system has python v2. python v3 has this functionality embedded|
| `python-mysqldb`<br/>or<br/>`python-pymysql`|used for monitoring **mysql** or **mariadb** databases<br/>`python-mysqldb` is a lot faster and thus preferred|
-| `python-psycopg2`|used for monitoring **postgresql** databases|
| `python-pymongo`|used for monitoring **mongodb** databases|
| `nodejs`|used for `node.js` plugins for monitoring **named** and **SNMP** devices|
| `lm-sensors`|for monitoring **hardware sensors**|
diff --git a/packaging/installer/netdata-updater.sh b/packaging/installer/netdata-updater.sh
index 15b7deda8..d018d67d2 100755
--- a/packaging/installer/netdata-updater.sh
+++ b/packaging/installer/netdata-updater.sh
@@ -85,9 +85,17 @@ exit_reason() {
EXIT_REASON="${1}"
EXIT_CODE="${2}"
if [ -n "${NETDATA_PROPAGATE_WARNINGS}" ]; then
- export EXIT_REASON
- export EXIT_CODE
- export NETDATA_WARNINGS
+ if [ -n "${NETDATA_SCRIPT_STATUS_PATH}" ]; then
+ {
+ echo "EXIT_REASON=\"${EXIT_REASON}\""
+ echo "EXIT_CODE=\"${EXIT_CODE}\""
+ echo "NETDATA_WARNINGS=\"${NETDATA_WARNINGS}\""
+ } >> "${NETDATA_SCRIPT_STATUS_PATH}"
+ else
+ export EXIT_REASON
+ export EXIT_CODE
+ export NETDATA_WARNINGS
+ fi
fi
fi
}
@@ -602,15 +610,20 @@ update_build() {
export NETDATA_SAVE_WARNINGS=1
export NETDATA_PROPAGATE_WARNINGS=1
export NETDATA_WARNINGS="${NETDATA_WARNINGS}"
+ export NETDATA_SCRIPT_STATUS_PATH="${NETDATA_SCRIPT_STATUS_PATH}"
# shellcheck disable=SC2086
if ! ${env} ./netdata-installer.sh ${REINSTALL_OPTIONS} --dont-wait ${do_not_start} >&3 2>&3; then
+ if [ -r "${NETDATA_SCRIPT_STATUS_PATH}" ]; then
+ # shellcheck disable=SC1090
+ . "${NETDATA_SCRIPT_STATUS_PATH}"
+ rm -f "${NETDATA_SCRIPT_STATUS_PATH}"
+ fi
if [ -n "${EXIT_REASON}" ]; then
fatal "Failed to rebuild existing netdata install: ${EXIT_REASON}" "U${EXIT_CODE}"
else
fatal "Failed to rebuild existing netdata reinstall." UI0000
fi
fi
- eval "${env} ./netdata-installer.sh ${REINSTALL_OPTIONS} --dont-wait ${do_not_start}" >&3 2>&3 || fatal "FAILED TO COMPILE/INSTALL NETDATA" U0009
# We no longer store checksum info here. but leave this so that we clean up all environment files upon next update.
sed -i '/NETDATA_TARBALL/d' "${ENVIRONMENT_FILE}"
@@ -650,7 +663,7 @@ update_static() {
# Do not pass any options other than the accept, for now
# shellcheck disable=SC2086
- if sh "${ndtmpdir}/netdata-${sysarch}-latest.gz.run" --accept -- ${REINSTALL_OPTIONS}; then
+ if sh "${ndtmpdir}/netdata-${sysarch}-latest.gz.run" --accept -- ${REINSTALL_OPTIONS} >&3 2>&3; then
rm -r "${ndtmpdir}"
else
info "NOTE: did not remove: ${ndtmpdir}"
@@ -691,7 +704,7 @@ update_binpkg() {
opensuse-leap)
DISTRO_COMPAT_NAME="opensuse"
;;
- almalinux|rocky|rhel)
+ cloudlinux|almalinux|rocky|rhel)
DISTRO_COMPAT_NAME="centos"
;;
*)