diff options
Diffstat (limited to 'packaging')
35 files changed, 553 insertions, 311 deletions
diff --git a/packaging/PLATFORM_SUPPORT.md b/packaging/PLATFORM_SUPPORT.md index 068f0aecc..106c80892 100644 --- a/packaging/PLATFORM_SUPPORT.md +++ b/packaging/PLATFORM_SUPPORT.md @@ -50,13 +50,14 @@ to work on these platforms with minimal user effort. | Platform | Version | Official Native Packages | Notes | | -------- | ------- | ------------------------ | ----- | -| Alpine Linux | 3.16 | No | The latest release of Alpine Linux is guaranteed to remain at **Core** tier due to usage for our Docker images | +| Alpine Linux | 3.17 | No | The latest release of Alpine Linux is guaranteed to remain at **Core** tier due to usage for our Docker images | | Alma Linux | 9.x | x86\_64, AArch64 | Also includes support for Rocky Linux and other ABI compatible RHEL derivatives | | Alma Linux | 8.x | x86\_64, AArch64 | Also includes support for Rocky Linux and other ABI compatible RHEL derivatives | | CentOS | 7.x | x86\_64 | | | Docker | 19.03 or newer | x86\_64, i386, ARMv7, AArch64, POWER8+ | See our [Docker documentation](/packaging/docker/README.md) for more info on using Netdata on Docker | | Debian | 11.x | x86\_64, i386, ARMv7, AArch64 | | | Debian | 10.x | x86\_64, i386, ARMv7, AArch64 | | +| Fedora | 37 | x86\_64, AArch64 | | | Fedora | 36 | x86\_64, ARMv7, AArch64 | | | Fedora | 35 | x86\_64, ARMv7, AArch64 | | | openSUSE | Leap 15.4 | x86\_64, AArch64 | | @@ -66,8 +67,9 @@ to work on these platforms with minimal user effort. | Red Hat Enterprise Linux | 9.x | x86\_64, AArch64 | | | Red Hat Enterprise Linux | 8.x | x86\_64, AArch64 | | | Red Hat Enterprise Linux | 7.x | x86\_64 | | +| Ubuntu | 22.10 | x86\_64, ARMv7, AArch64 | | | Ubuntu | 22.04 | x86\_64, ARMv7, AArch64 | | -| Ubuntu | 20.04 | x86\_64, i386, ARMv7, AArch64 | | +| Ubuntu | 20.04 | x86\_64, ARMv7, AArch64 | | | Ubuntu | 18.04 | x86\_64, i386, ARMv7, AArch64 | | ### Intermediate @@ -81,9 +83,9 @@ with minimal user effort. | Platform | Version | Official Native Packages | Notes | | -------- | ------- | ------------------------ | ----- | +| Alpine Linux | 3.16 | No | | | Alpine Linux | 3.15 | No | | | Alpine Linux | 3.14 | No | | -| Alpine Linux | 3.13 | No | | | Arch Linux | Latest | No | We officially recommend the community packages available for Arch Linux | | Manjaro Linux | Latest | No | We officially recommend the community packages available for Arch Linux | @@ -104,9 +106,9 @@ platforms, but may require some extra effort from users. | FreeBSD | 13-STABLE | No | Netdata is included in the FreeBSD Ports Tree, and this is the recommended installation method on FreeBSD | | FreeBSD | 12-STABLE | No | Netdata is included in the FreeBSD Ports Tree, and this is the recommended installation method on FreeBSD | | Gentoo | Latest | No | | -| macOS | 12 | No | Planned for **Core** tier support. Currently only works for Intel-based hardware. Requires Homebrew for dependencies | -| macOS | 11 | No | Planned for **Core** tier support. Currently only works for Intel-based hardware. Requires Homebrew for dependencies. | -| macOS | 10.15 | No | Planned for **Core** tier support. Requires Homebrew for dependencies. | +| macOS | 12 | No | Currently only works for Intel-based hardware. Requires Homebrew for dependencies | +| macOS | 11 | No | Currently only works for Intel-based hardware. Requires Homebrew for dependencies. | +| macOS | 10.15 | No | Requires Homebrew for dependencies. | | openSUSE | Tumbleweed | No | | ## Third-party supported platforms @@ -144,8 +146,8 @@ This is a list of platforms that we have supported in the recent past but no lon | Platform | Version | Notes | | -------- | ------- | ----- | +| Alpine Linux | 3.13 | EOL as of 2022-11-01 | | Alpine Linux | 3.12 | EOL as of 2022-05-01 | -| Alpine Linux | 3.11 | EOL as of 2021-11-01 | | Debian | 9.x | EOL as of 2022-06-30 | | Fedora | 34 | EOL as of 2022-06-07 | | Fedora | 33 | EOL as of 2021-11-30 | diff --git a/packaging/building-native-packages-locally.md b/packaging/building-native-packages-locally.md new file mode 100644 index 000000000..d4949cf52 --- /dev/null +++ b/packaging/building-native-packages-locally.md @@ -0,0 +1,106 @@ +<!-- +title: How to build native (DEB/RPM) packages locally for testing +description: Instructions for developers who need to build native packages locally for testing. +custom_edit_url: https://github.com/netdata/netdata/edit/master/packaging/building-native-packages-locally.md +keywords: [Netdata native package, Netdata RPM, Netdata DEB, Testing native packages Netdata] +--> + +# How to build native (DEB/RPM) packages locally for testing + +## Requirements + +To build native packages locally, you will need the following: + +* A working Docker or Podman host. +* A local copy of the source tree you want to build from. + +## Building the packages + +In the root of the source tree from which you want to build, clean up any existing files left over from a previous build +and then run: + +```bash +docker run -it --rm -e VERSION=0.1 -v $PWD:/netdata netdata/package-builders:<tag> +``` + +or + +```bash +podman run -it --rm -e VERSION=0.1 -v $PWD:/netdata netdata/package-builders:<tag> +``` + +The `<tag>` should be the lowercase distribution name with no spaces, followed by the +release of that distribution. For example, `centos7` to build on CentOS 7, or `ubuntu20.04` +to build on Ubuntu 20.04. Note that we use Alma Linux for builds on CentOS/RHEL 8 or newer. See +[netdata/package-builders](https://hub.docker.com/r/netdata/package-builders/tags) for all available tags. + +The value passed in the `VERSION` environment variable can be any version number accepted by the type of package +being built. As a general rule, it needs to start with a digit, and must include a `.` somewhere. + +Once it finishes, the built packages can be found under `artifacts/` in the source tree. + +If an error is encountered and the build is being run interactively, it will drop to a shell to allow you to +inspect the state of the container and look at build logs. + +### Detailed explanation + +The environments used for building our packages are fully self-contianed Docker images built from [Dockerfiles](https://github.com/netdata/helper-images/tree/master/package-builders) +These are published on Docker +Hub with the image name `netdata/package-builders`, and tagged using the name and version of the distribution +(with the tag corresponding to the suffix on the associated Dockerfile). + +The build code expects the following requirements to be met: + +- It expects the source tree it should build from to be located at `/netdata`, and expects that said source tree + is clean (no artifacts left over from previous builds). +- It expects an environment variable named `VERSION` to be defined, and uses this to control what version number + will be shown in the package metadata and filenames. + +Internally, the source tree gets copied to a temporary location for the build process so that the source tree can +be mounted directly from the host without worrying about leaving a dirty tree behind, any templating or file +movements required for the build to work are done, the package build command is invoked with the correct arguments, +and then the resultant packages are copied to the `artifacts/` directory in the original source tree so they are +accessible after the container exits. + +## Finding build logs after a failed build + +Build logs and artifacts can be found in the build directory, whose location varies by distribution. + +On DEB systems (Ubuntu and Debian), the build directory inside the container is located at `/usr/src/netdata` + +On RPM systems except openSUSE, the build directory inside the container is located under `/root/rpmbuild/BUILD/` +and varies based on the package version number. + +On openSUSE, the build directory inside the container is located under `/usr/src/packages/BUILD`and varies based +on the package version number. + +## Building for other architectures + +If you need to test a build for an architecture that does not match your host system, you can do so by setting up +QEMU user-mode emulation. This requires a Linux kernel with binfmt\_misc support (all modern distributions provide +this out of the box, but I’m not sure about WSL or Docker Desktop). + +The quick and easy way to do this is to run the following: + +```bash +docker run --rm --privileged multiarch/qemu-user-static --reset -p yes +``` + +or + +```bash +podman run --rm --privileged multiarch/qemu-user-static --reset -p yes +``` + +This will set up the required QEMU user-mode emulation until you reboot. Note that if using Podman, you will need +to run this as root and not as a rootless container (the package builds work fine in a rootless container though, +even if doing cross-architecture builds). + +Once you have that set up, the command to build the packages is the same as above, you just need to add a correct +`--platform` option to the `docker run` or `podman run` command. The current list of architectures we build for, +and the correct value for the `--platform` option is: + +- 32-bit ARMv7: `linux/arm/v7` +- 64-bit ARMv8: `linux/arm64/v8` +- 32-bit x86: `linux/i386` +- 64-bit x86: `linux/amd64` diff --git a/packaging/current_libbpf.checksums b/packaging/current_libbpf.checksums index e7e3985a8..9a8b8f8cf 100644 --- a/packaging/current_libbpf.checksums +++ b/packaging/current_libbpf.checksums @@ -1 +1 @@ -8909385c347848b5994d9daa33be12e35ffc529ba0e01b5c944e0216bf78f79b v0.8.0_netdata.tar.gz +63fe4ac3f6807e8ff4cd3af2ffae0091eb177fb7f6aca2f03d3f201a609b988c v1.0.1_netdata.tar.gz diff --git a/packaging/current_libbpf.version b/packaging/current_libbpf.version index 606129075..bb58ffc40 100644 --- a/packaging/current_libbpf.version +++ b/packaging/current_libbpf.version @@ -1 +1 @@ -0.8.0_netdata +1.0.1_netdata diff --git a/packaging/docker/README.md b/packaging/docker/README.md index e3697fdaa..d00262a1b 100644 --- a/packaging/docker/README.md +++ b/packaging/docker/README.md @@ -252,6 +252,11 @@ If you don't want to destroy and recreate your container, you can edit the Agent above section on [configuring Agent containers](#configure-agent-containers) to find the appropriate method based on how you created the container. +Alternatively, you can directly use the hostname from the node running the container by mounting +`/etc/hostname` from the host in the container. With `docker run`, this can be done by adding `--volume +/etc/hostname:/etc/hostname:ro` to the options. If you are using Docker Compose, you can add an entry to the +container's `volumes` section reading `- /etc/hostname:/etc/hostname:ro`. + ### Add or remove other volumes Some volumes are optional depending on how you use Netdata: diff --git a/packaging/ebpf-co-re.checksums b/packaging/ebpf-co-re.checksums index 041f6dfb2..da7cb0510 100644 --- a/packaging/ebpf-co-re.checksums +++ b/packaging/ebpf-co-re.checksums @@ -1 +1 @@ -9181063ec4a40f1b2ce5d7ac702eb9de233d127c6e21aac8a3d3f7c185502726 netdata-ebpf-co-re-glibc-v0.9.3.3.tar.xz +9fe4fccc160ca9e0fd0ffd8894dbf6e5fddcf9ca3a4ee04cb645bb7703e8cef2 netdata-ebpf-co-re-glibc-v1.0.1.tar.xz diff --git a/packaging/ebpf-co-re.version b/packaging/ebpf-co-re.version index 599038a08..b18d46540 100644 --- a/packaging/ebpf-co-re.version +++ b/packaging/ebpf-co-re.version @@ -1 +1 @@ -v0.9.3.3 +v1.0.1 diff --git a/packaging/ebpf.checksums b/packaging/ebpf.checksums index dc5ce6cf1..e5afcb860 100644 --- a/packaging/ebpf.checksums +++ b/packaging/ebpf.checksums @@ -1,3 +1,3 @@ -cee483b29e1fd3125d635d03f9266d267eab1ba13e02c99afcf6a84bdcb729f4 ./netdata-kernel-collector-glibc-v0.9.3.tar.xz -33aeae2cf7e9c0967c62f262bf6c6c44db49dc5dbb6d3a16e8bfde4433779069 ./netdata-kernel-collector-musl-v0.9.3.tar.xz -9eba23184be7c9b29d22271e439e3fac517d32d500bd796c4e21f653b6f4d337 ./netdata-kernel-collector-static-v0.9.3.tar.xz +e3836908a5cfd5a1b6c71463645ed7040be1a4890767844b744fe1054910b51f ./netdata-kernel-collector-glibc-v1.0.1.tar.xz +091382fece7a470e505df4c655d834a8a49e50aa2a2fec4a52a324ab0ccd9870 ./netdata-kernel-collector-musl-v1.0.1.tar.xz +11497ccb4f2cdac0d80b00bf97d2f1633c972e8720abdda2a63bd0de95859840 ./netdata-kernel-collector-static-v1.0.1.tar.xz diff --git a/packaging/ebpf.version b/packaging/ebpf.version index 188bef592..b18d46540 100644 --- a/packaging/ebpf.version +++ b/packaging/ebpf.version @@ -1 +1 @@ -v0.9.3 +v1.0.1 diff --git a/packaging/go.d.checksums b/packaging/go.d.checksums index 4c73aecd8..806a45f40 100644 --- a/packaging/go.d.checksums +++ b/packaging/go.d.checksums @@ -1,16 +1,17 @@ -c2ad4897acf97555c3874dd301bc6cc76e2e99fa0fdcad469c0869ea70cefaef *config.tar.gz -3d04b65ceb9925f5fac684d54bc6641c0b52314e25d73dae002cc102fe07cd2d *go.d.plugin-v0.35.0.darwin-amd64.tar.gz -7311c4900f2cf24c9f49e5a5dd26d113b2c7b19a5db68dc64643fea1e0f95d29 *go.d.plugin-v0.35.0.freebsd-386.tar.gz -bb9bc9f82cf80ef35df14f1426f91861f749287bccfe54bf8b50da9a28bc434a *go.d.plugin-v0.35.0.freebsd-amd64.tar.gz -e1c7d5670a59348b7adaa16da1445896f5714fef0b8e1d9036729779f6a35fc0 *go.d.plugin-v0.35.0.freebsd-arm.tar.gz -8e129fd490fcf2f6999131e5fe9a48feb50532c2f2dd811204761cc8d7e87649 *go.d.plugin-v0.35.0.freebsd-arm64.tar.gz -a2b01aff7e078aa1ecc1f8a291ea02e8cfdd5fab4c9eaa0d776b606901c1fc51 *go.d.plugin-v0.35.0.linux-386.tar.gz -4aefa432b75bf81ef3cd787740d2ce29ceb3293c749acdd67038ef5a30214a36 *go.d.plugin-v0.35.0.linux-amd64.tar.gz -fd4fb4ffff203235f62e3d668d8b6aabe084fd711c865c4dd0bed7a002b3a671 *go.d.plugin-v0.35.0.linux-arm.tar.gz -005dd629ce9045e8bfb4e710b7aed898f6a39017d37a3d16957665cde0a70a84 *go.d.plugin-v0.35.0.linux-arm64.tar.gz -3a80c16a35e76d7a620b5e7bba8eced78cc44cc9803b8f41814b6c8516d0bfbd *go.d.plugin-v0.35.0.linux-mips.tar.gz -c1da9fec36aefde1af3ac0d70fc64bdc2726e6f5c0434f636e8e114d83f155c4 *go.d.plugin-v0.35.0.linux-mips64.tar.gz -77c0ec5867a1bbe6cc2b718aa00be8b112ca90b951fdd47e1d93218a514863ce *go.d.plugin-v0.35.0.linux-mips64le.tar.gz -740ad96ba6089f82a711863f063f1b4228b279c16eb85638e93c427a410ae719 *go.d.plugin-v0.35.0.linux-mipsle.tar.gz -65fade14e33ccf7323a752a8dd6507cf5ec9db05bd66de8d09ffb24b21b300dd *go.d.plugin-v0.35.0.linux-ppc64.tar.gz -5b6d3b289fa3ec6a3276e896530ed7760b94105870bc52662ed2d8369122e599 *go.d.plugin-v0.35.0.linux-ppc64le.tar.gz +67335df67f1629d9dc6dc559f91d26499f023b43a3fb2cece22d7c2919653dae *config.tar.gz +cae0acc8c19112c35927ccd4ef53f594c8d805467f204db84305ca8ddfccfcfa *go.d.plugin-v0.45.0.darwin-amd64.tar.gz +dcaddcea32a26392db7f13867226c62ba87aeb00c93931d1fc10d0641eb04e3a *go.d.plugin-v0.45.0.darwin-arm64.tar.gz +e89153033d2b8d6b59f163f1419ebaaae8414054f1a33bca52f76651848b528d *go.d.plugin-v0.45.0.freebsd-386.tar.gz +da3ba485995a60879cb51819ac2f9ecf81d23f64a0afb584bdc134a1fe4a2251 *go.d.plugin-v0.45.0.freebsd-amd64.tar.gz +ca1e153ac90714c0956a7ed4bcf14bf263f2c65a1876e9c8c24dd1b2bcd5b74a *go.d.plugin-v0.45.0.freebsd-arm.tar.gz +e25fcd7c3fa8aed01efff8ea25c3276de65d2efacff70fa4670a970272ffbba3 *go.d.plugin-v0.45.0.freebsd-arm64.tar.gz +7bfd345bdc30292a9145e4397b15a9004d78049006702727cd5a52900531dfa1 *go.d.plugin-v0.45.0.linux-386.tar.gz +7a6dd92ab6892aedd0a257ffbded54a0efa7cf95fb7f738387c8d7394e57eb09 *go.d.plugin-v0.45.0.linux-amd64.tar.gz +834a26c486a579991d76dc07625e135bf13fe4387627076bdbbb14bcb55ff978 *go.d.plugin-v0.45.0.linux-arm.tar.gz +1dda73a062ba20d2996334d878fd74207ad49b9f164530a5ad2144c70947d5a8 *go.d.plugin-v0.45.0.linux-arm64.tar.gz +8b52e67cf1e4d11776d5c5c8a4e246412caa1cffd36bafa5a8cb38a8e1867dee *go.d.plugin-v0.45.0.linux-mips.tar.gz +9a95f9df3527693a0a92c7b8ef1bec537e84014c75f32604adce4540e924576e *go.d.plugin-v0.45.0.linux-mips64.tar.gz +4ce0ec6068edf8218f68785f6ce258ed76ffea50a5953f7f75b9a48e1d912a81 *go.d.plugin-v0.45.0.linux-mips64le.tar.gz +360812ea936768926b38031c9dff2ecda2c80733e875f1c317371dee9d56a76c *go.d.plugin-v0.45.0.linux-mipsle.tar.gz +d7b594d84d47a0d2c6265c8fa9317285a53821f3e9aac5d31bcce0c8706fb369 *go.d.plugin-v0.45.0.linux-ppc64.tar.gz +dc29665076eecfb05d63ac243f97bd4d09f8dedae8c5285b349bd227e34ce249 *go.d.plugin-v0.45.0.linux-ppc64le.tar.gz diff --git a/packaging/go.d.version b/packaging/go.d.version index ab4e51c67..67d3cf473 100644 --- a/packaging/go.d.version +++ b/packaging/go.d.version @@ -1 +1 @@ -v0.35.0 +v0.45.0 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" ;; *) diff --git a/packaging/libbpf.checksums b/packaging/libbpf.checksums index e7e3985a8..9a8b8f8cf 100644 --- a/packaging/libbpf.checksums +++ b/packaging/libbpf.checksums @@ -1 +1 @@ -8909385c347848b5994d9daa33be12e35ffc529ba0e01b5c944e0216bf78f79b v0.8.0_netdata.tar.gz +63fe4ac3f6807e8ff4cd3af2ffae0091eb177fb7f6aca2f03d3f201a609b988c v1.0.1_netdata.tar.gz diff --git a/packaging/libbpf.version b/packaging/libbpf.version index 606129075..bb58ffc40 100644 --- a/packaging/libbpf.version +++ b/packaging/libbpf.version @@ -1 +1 @@ -0.8.0_netdata +1.0.1_netdata diff --git a/packaging/makeself/install-or-update.sh b/packaging/makeself/install-or-update.sh index aef67a156..be2b2f75f 100755 --- a/packaging/makeself/install-or-update.sh +++ b/packaging/makeself/install-or-update.sh @@ -215,7 +215,7 @@ for x in apps.plugin freeipmi.plugin ioping cgroup-network ebpf.plugin perf.plug done if [ -f "usr/libexec/netdata/plugins.d/go.d.plugin" ] && command -v setcap 1>/dev/null 2>&1; then - run setcap cap_net_admin+epi "usr/libexec/netdata/plugins.d/go.d.plugin" + run setcap "cap_net_admin+epi cap_net_raw=eip" "usr/libexec/netdata/plugins.d/go.d.plugin" fi # fix the fping binary diff --git a/packaging/version b/packaging/version index b5a0280e2..b909b32cd 100644 --- a/packaging/version +++ b/packaging/version @@ -1 +1 @@ -v1.36.1 +v1.37.0 |