From 1aef5a70d8ba6df58ae29cd320fb0f7c0eeca6f0 Mon Sep 17 00:00:00 2001 From: "Austin S. Hemmelgarn" <austin@netdata.cloud> Date: Tue, 30 May 2023 08:38:32 -0400 Subject: [PATCH] Split plugins to individual packages for DEB/RPM packaging. (#13927) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update and normalize plugin package descriptions. This ensures they have accurate and cnocise descriptions of what they do, and that the descriptions are the same for both the RPM and DEB packages. * Split NFACCT plugin to it’s own package. Most users do not actually use it, so make life easier for them by reducing our dependency footprint and cutting down on how much they need to download. * Split charts.d.plugin to it’s own package. * Split eBPF plugin and code to their own packages. The code is in a separate package to simplify handling updates for it separately from the main agent code in the future. The eBPF plugin will still be installed by default in most cases when installing the Netdata Agent * Split python.d plugin to it’s own package. The python.d plugin will still be installed by default in most cases when installing the Netdata Agent * Split go.d plugin to it’s own package. The go.d plugin will still be installed by default in most cases when installing the Netdata Agent * Split apps.plugin to it’s own package The apps plugin will still be installed by default in most cases when installing the Netdata Agent * Properly split out postinst scripts for DEB packages. We should be modifying permissions and filecaps for plugins in the specific packages that install those plugins. * Clean up main files section in RPM spec file. This should get rid of the duplicate files warnings, as well as probably producing a more technically correct RPM. * Properly format DEB package descriptions. They should be folded at 76 characters. * Fix dependencies for split RPM plugin packages. * Fix most duplicate file warnings for RPM builds. * Split slabinfo plugin to it’s own package. * Clean up RPM conditional build. All platforms we build RPMs for have both netns and systemd support, so quit supporting platforms that don’t in our spec file. * Include loopsleepms.sh.inc in RPM package. * Fix packaging of nfacct plugin. * Skip building NFACCT plugin on RHEL clones. They lack the required dependencies. * Split perf.plugin to it’s own package. Also, start using CAP_PERFMON for it in RPM packages when available. * Fix typo in DEB postinstall scripts. * Fix issues with ebpf bundling scripts. They don’t need to preserve permissions, and choosing not to do so makes them work more reliably in a number of cases. * Improve dependency handling of secondary plugins. * Fix dependency handling. * Match ebpf code files more specifically in RPM spec file. * Fix branding and dependencies for RPM packages. - Change the eBPF plugin legacy code package name and description to reflect what it actually is. - Properly have the new plugin packages conflict with the older Netdata packages. This is needed for updates to work cleanly. - Only require the eBPF legacy code on older systems that need it. * Fix branding and dependencies for DEB packages. - Change the eBPF plugin legacy code package name and description to reflect what it actually is. - Properly have the new plugin packages conflict with the older Netdata packages. This is needed for updates to work cleanly. * Update docs for non-default plugins. * Have docs link back to package document. * Address review feedback. * Explicitly suggest plugins we are not including by default. This does not pull them in by default, but does make it easier for users to discover them. * Explicitly pull in default plugins on CentOS 7. * Fix broken merge of netdata spec file. * Resolve typo in kickstart script. * Explicitly disable FreeIPMI and NFACCT in RPMs if they are not available. * Fix RPM changelog. * Fix conditional plugin handling. * Fix disabling FreeIPMI on Amazon Linux. * Split new debugfs plugin to separate package. * Install debugfs plugin by default. --- collectors/charts.d.plugin/README.md | 2 + collectors/charts.d.plugin/ap/README.md | 2 + collectors/charts.d.plugin/apcupsd/README.md | 2 + .../charts.d.plugin/libreswan/README.md | 2 + collectors/charts.d.plugin/nut/README.md | 2 + collectors/charts.d.plugin/opensips/README.md | 2 + collectors/charts.d.plugin/sensors/README.md | 6 +- collectors/nfacct.plugin/README.md | 5 + collectors/perf.plugin/README.md | 3 + collectors/slabinfo.plugin/README.md | 3 + contrib/debian/control | 129 +++++- contrib/debian/netdata-plugin-apps.postinst | 13 + .../debian/netdata-plugin-debugfs.postinst | 13 + contrib/debian/netdata-plugin-ebpf.postinst | 13 + .../debian/netdata-plugin-freeipmi.postinst | 13 + contrib/debian/netdata-plugin-go.postinst | 13 + contrib/debian/netdata-plugin-nfacct.postinst | 13 + contrib/debian/netdata-plugin-perf.postinst | 17 + .../debian/netdata-plugin-slabinfo.postinst | 13 + contrib/debian/netdata.postinst | 17 - contrib/debian/rules | 99 ++++- netdata.spec.in | 410 ++++++++++++++---- packaging/bundle-ebpf.sh | 2 +- packaging/bundle-libbpf.sh | 6 +- packaging/installer/kickstart.sh | 12 + 25 files changed, 692 insertions(+), 120 deletions(-) create mode 100644 contrib/debian/netdata-plugin-apps.postinst create mode 100644 contrib/debian/netdata-plugin-debugfs.postinst create mode 100644 contrib/debian/netdata-plugin-ebpf.postinst create mode 100644 contrib/debian/netdata-plugin-freeipmi.postinst create mode 100644 contrib/debian/netdata-plugin-go.postinst create mode 100644 contrib/debian/netdata-plugin-nfacct.postinst create mode 100644 contrib/debian/netdata-plugin-perf.postinst create mode 100644 contrib/debian/netdata-plugin-slabinfo.postinst diff --git a/collectors/charts.d.plugin/README.md b/collectors/charts.d.plugin/README.md index 3e4edf5625..97c2446fa9 100644 --- a/collectors/charts.d.plugin/README.md +++ b/collectors/charts.d.plugin/README.md @@ -17,6 +17,8 @@ memory, collecting data with as little overheads as possible `charts.d.plugin` looks for scripts in `/usr/lib/netdata/charts.d`. The scripts should have the filename suffix: `.chart.sh`. +By default, `charts.d.plugin` is not included as part of the install when using [our official native DEB/RPM packages](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/packages.md). You can install it by installing the `netdata-plugin-chartsd` package. + ## Configuration `charts.d.plugin` itself can be [configured](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md#use-edit-config-to-edit-configuration-files) using the configuration file `/etc/netdata/charts.d.conf`. This file is also a BASH script. diff --git a/collectors/charts.d.plugin/ap/README.md b/collectors/charts.d.plugin/ap/README.md index bc7460a28f..339ad13751 100644 --- a/collectors/charts.d.plugin/ap/README.md +++ b/collectors/charts.d.plugin/ap/README.md @@ -85,6 +85,8 @@ Station 40:b8:37:5a:ed:5e (on wlan0) ## Configuration +If using [our official native DEB/RPM packages](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/packages.md), make sure `netdata-plugin-chartsd` is installed. + Edit the `charts.d/ap.conf` configuration file using `edit-config` from the Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md), which is typically at `/etc/netdata`. diff --git a/collectors/charts.d.plugin/apcupsd/README.md b/collectors/charts.d.plugin/apcupsd/README.md index 6934d59c03..00e9697dc8 100644 --- a/collectors/charts.d.plugin/apcupsd/README.md +++ b/collectors/charts.d.plugin/apcupsd/README.md @@ -13,6 +13,8 @@ Monitors different APC UPS models and retrieves status information using `apcacc ## Configuration +If using [our official native DEB/RPM packages](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/packages.md), make sure `netdata-plugin-chartsd` is installed. + Edit the `charts.d/apcupsd.conf` configuration file using `edit-config` from the Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md), which is typically at `/etc/netdata`. diff --git a/collectors/charts.d.plugin/libreswan/README.md b/collectors/charts.d.plugin/libreswan/README.md index a20eb86c0a..b6eeb0180c 100644 --- a/collectors/charts.d.plugin/libreswan/README.md +++ b/collectors/charts.d.plugin/libreswan/README.md @@ -24,6 +24,8 @@ The following charts are created, **per tunnel**: ## Configuration +If using [our official native DEB/RPM packages](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/packages.md), make sure `netdata-plugin-chartsd` is installed. + Edit the `charts.d/libreswan.conf` configuration file using `edit-config` from the Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md), which is typically at `/etc/netdata`. diff --git a/collectors/charts.d.plugin/nut/README.md b/collectors/charts.d.plugin/nut/README.md index 4488254451..4608ce3e1a 100644 --- a/collectors/charts.d.plugin/nut/README.md +++ b/collectors/charts.d.plugin/nut/README.md @@ -53,6 +53,8 @@ The following charts will be created: ## Configuration +If using [our official native DEB/RPM packages](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/packages.md), make sure `netdata-plugin-chartsd` is installed. + Edit the `charts.d/nut.conf` configuration file using `edit-config` from the Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md), which is typically at `/etc/netdata`. diff --git a/collectors/charts.d.plugin/opensips/README.md b/collectors/charts.d.plugin/opensips/README.md index c278b53a02..1d73221405 100644 --- a/collectors/charts.d.plugin/opensips/README.md +++ b/collectors/charts.d.plugin/opensips/README.md @@ -11,6 +11,8 @@ learn_rel_path: "Integrations/Monitor/Networking" ## Configuration +If using [our official native DEB/RPM packages](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/packages.md), make sure `netdata-plugin-chartsd` is installed. + Edit the `charts.d/opensips.conf` configuration file using `edit-config` from the Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md), which is typically at `/etc/netdata`. diff --git a/collectors/charts.d.plugin/sensors/README.md b/collectors/charts.d.plugin/sensors/README.md index 2601a2b65f..0dbe96225b 100644 --- a/collectors/charts.d.plugin/sensors/README.md +++ b/collectors/charts.d.plugin/sensors/README.md @@ -21,13 +21,15 @@ One chart for every sensor chip found and each of the above will be created. ## Enable the collector +If using [our official native DEB/RPM packages](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/packages.md), make sure `netdata-plugin-chartsd` is installed. + The `sensors` collector is disabled by default. -To enable the collector, you need to edit the configuration file of `charts.d/sensors.conf`. You can do so by using the `edit config` script. +To enable the collector, you need to edit the configuration file of `charts.d/sensors.conf`. You can do so by using the `edit config` script. > ### Info > -> To edit configuration files in a safe way, we provide the [`edit config` script](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md#use-edit-config-to-edit-configuration-files) located in your [Netdata config directory](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md#the-netdata-config-directory) (typically is `/etc/netdata`) that creates the proper file and opens it in an editor automatically. +> To edit configuration files in a safe way, we provide the [`edit config` script](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md#use-edit-config-to-edit-configuration-files) located in your [Netdata config directory](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md#the-netdata-config-directory) (typically is `/etc/netdata`) that creates the proper file and opens it in an editor automatically. > It is recommended to use this way for configuring Netdata. > > Please also note that after most configuration changes you will need to [restart the Agent](https://github.com/netdata/netdata/blob/master/docs/configure/start-stop-restart.md) for the changes to take effect. diff --git a/collectors/nfacct.plugin/README.md b/collectors/nfacct.plugin/README.md index e8502236fe..ae6597a409 100644 --- a/collectors/nfacct.plugin/README.md +++ b/collectors/nfacct.plugin/README.md @@ -13,6 +13,11 @@ learn_rel_path: "Integrations/Monitor/Networking" ## Prerequisites +If you are using [our official native DEB/RPM packages](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/packages.md), install the +`netdata-plugin-nfacct` package using your system package manager. + +If you built Netdata locally: + 1. install `libmnl-dev` and `libnetfilter-acct-dev` using the package manager of your system. 2. re-install Netdata from source. The installer will detect that the required libraries are now available and will also build `netdata.plugin`. diff --git a/collectors/perf.plugin/README.md b/collectors/perf.plugin/README.md index e519be9c47..a8bd4b0e5e 100644 --- a/collectors/perf.plugin/README.md +++ b/collectors/perf.plugin/README.md @@ -14,6 +14,9 @@ the `perf_event_open()` system call. ## Important Notes +If you are using [our official native DEB/RPM packages](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/packages.md), you will need to install +the `netdata-plugin-perf` package using your system package manager. + Accessing hardware PMUs requires root permissions, so the plugin is setuid to root. Keep in mind that the number of PMUs in a system is usually quite limited and every hardware monitoring diff --git a/collectors/slabinfo.plugin/README.md b/collectors/slabinfo.plugin/README.md index e0abaff807..abcbe1e3fe 100644 --- a/collectors/slabinfo.plugin/README.md +++ b/collectors/slabinfo.plugin/README.md @@ -18,6 +18,9 @@ Each internal structure (process, file descriptor, inode...) is stored within a The plugin is disabled by default because it collects and displays a huge amount of metrics. To enable it set `slabinfo = yes` in the `plugins` section of the `netdata.conf` configuration file. +If you are using [our official native DEB/RPM packages](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/packages.md), you will additionally need to install the `netdata-plugin-slabinfo` +package using your system package manager. + There is currently no configuration needed for the plugin itself. As `/proc/slabinfo` is only readable by root, this plugin is setuid root. diff --git a/contrib/debian/control b/contrib/debian/control index eeeb8d25c6..f4a767b320 100644 --- a/contrib/debian/control +++ b/contrib/debian/control @@ -42,6 +42,17 @@ Conflicts: netdata-core, netdata-plugins-bash, netdata-plugins-python, netdata-web +Recommends: netdata-plugin-ebpf, + netdata-plugin-apps, + netdata-plugin-pythond, + netdata-plugin-go, + netdata-plugin-debugfs +Suggests: netdata-plugin-cups, + netdata-plugin-freeipmi, + netdata-plugin-nfacct, + netdata-plugin-chartsd, + netdata-plugin-slabinfo, + netdata-plugin-perf Pre-Depends: dpkg (>= 1.17.14) Description: real-time charts for system monitoring Netdata is a daemon that collects data in realtime (per second) @@ -54,14 +65,120 @@ Architecture: any Depends: cups, ${shlibs:Depends}, netdata (>= ${source:Version}) -Description: The Common Unix Printing System plugin for metrics collection from cupsd +Description: The CUPS metrics collection plugin for the Netdata Agent + This plugin allows the Netdata Agent to collect metrics from the Common + UNIX Printing System. Package: netdata-plugin-freeipmi Architecture: any Depends: freeipmi, ${shlibs:Depends}, - netdata (= ${source:Version}) -Description: FreeIPMI - The Intelligent Platform Management System. - The IPMI specification defines a set of interfaces for platform management. - It is implemented by a number vendors for system management. The features of IPMI that most users will be interested in - are sensor monitoring, system event monitoring, power control, and serial-over-LAN (SOL). + netdata (>= ${source:Version}) +Description: The FreeIPMI metrics collection plugin for the Netdata Agent + This plugin allows the Netdata Agent to collect metrics from hardware + using FreeIPMI. + +Package: netdata-plugin-nfacct +Architecture: any +Depends: ${shlibs:Depends}, + netdata (>= ${source:Version}) +Conflicts: netdata (< ${source:Version}) +Description: The NFACCT metrics collection plugin for the Netdata Agent + This plugin allows the Netdata Agent to collect metrics from the firewall + using NFACCT objects. + +Package: netdata-plugin-chartsd +Architecture: all +Depends: bash, + netdata (>= ${source:Version}) +Conflicts: netdata (< ${source:Version}) +Suggests: apcupsd, nut, iw, sudo +Description: The charts.d metrics collection plugin for the Netdata Agent + This plugin adds a selection of additional collectors written in shell + script to the Netdata Agent. It includes collectors for NUT, APCUPSD, + LibreSWAN, OpenSIPS, and Wireless access point statistics. + +Package: netdata-plugin-ebpf +Architecture: any +Depends: ${shlibs:Depends}, + netdata (>= ${source:Version}) +Recommends: netdata-ebpf-code-legacy (>= ${source:Version}), + netdata-plugin-apps (>= ${source:Version}) +Conflicts: netdata (< ${source:Version}) +Description: The eBPF metrics collection plugin for the Netdata Agent + This plugin allows the Netdata Agent to use eBPF code to collect more + detailed kernel-level metrics for the system. + +Package: netdata-ebpf-code-legacy +Architecture: i386 amd64 +Depends: netdata-plugin-ebpf (= ${source:Version}) +Conflicts: netdata (< ${source:Version}) +Description: Compiled eBPF legacy code for the Netdata eBPF plugin + This package provides the pre-compiled eBPF legacy code for use by + the Netdata eBPF plugin. This code is only needed when using the eBPF + plugin with kernel that do not include BTF support (mostly kernel + versions lower than 5.10).. + +Package: netdata-plugin-pythond +Architecture: all +Depends: ${shlibs:Depends}, + netdata (>= ${source:Version}) +Suggests: sudo +Conflicts: netdata (< ${source:Version}) +Description: The python.d metrics collection plugin for the Netdata Agent + Many of the collectors provided by this package are also available + in netdata-plugin-god. In msot cases, you probably want to use those + versions instead of the Python versions. + +Package: netdata-plugin-go +Architecture: any +Depends: ${shlibs:Depends}, + libcap2-bin, + netdata (>= ${source:Version}) +Suggests: nvme-cli, sudo +Conflicts: netdata (< ${source:Version}) +Description: The go.d metrics collection plugin for the Netdata Agent + This plugin adds a selection of additional collectors written in Go to + the Netdata Agent. A significant percentage of the application specific + collectors provided by Netdata are part of this plugin, so most users + will want it installed. + +Package: netdata-plugin-apps +Architecture: any +Depends: ${shlibs:Depends}, + libcap2-bin, + netdata (>= ${source:Version}) +Conflicts: netdata (< ${source:Version}) +Description: The per-application metrics collection plugin for the Netdata Agent + This plugin allows the Netdata Agent to collect per-application and + per-user metrics without using cgroups. + +Package: netdata-plugin-slabinfo +Architecture: any +Depends: ${shlibs:Depends}, + libcap2-bin, + netdata (>= ${source:Version}) +Conflicts: netdata (< ${source:Version}) +Description: The slabinfo metrics collector for the Netdata Agent + This plugin allows the Netdata Agent to collect perfromance and + utilization metrics for the Linux kernel’s SLAB allocator. + +Package: netdata-plugin-perf +Architecture: any +Depends: ${shlibs:Depends}, + libcap2-bin, + netdata (>= ${source:Version}) +Conflicts: netdata (< ${source:Version}) +Description: The perf metrics collector for the Netdata Agent + This plugin allows the Netdata to collect metrics from the Linux perf + subsystem. + +Package: netdata-plugin-debugfs +Architecture: any +Depends: ${shlibs:Debends}, + libcap2-bin, + netdata (>= ${source:Version}) +Conflicts: netdata (< ${source:Version}) +Description: The debugfs metrics collector for the Netdata Agent + This plugin allows the Netdata Agent to collect Linux kernel metrics + exposed through debugfs. diff --git a/contrib/debian/netdata-plugin-apps.postinst b/contrib/debian/netdata-plugin-apps.postinst new file mode 100644 index 0000000000..c224edd921 --- /dev/null +++ b/contrib/debian/netdata-plugin-apps.postinst @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e + +case "$1" in + configure|reconfigure) + setcap "cap_dac_read_search=eip cap_sys_ptrace=eip" /usr/libexec/netdata/plugins.d/apps.plugin + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/contrib/debian/netdata-plugin-debugfs.postinst b/contrib/debian/netdata-plugin-debugfs.postinst new file mode 100644 index 0000000000..f4b04406c0 --- /dev/null +++ b/contrib/debian/netdata-plugin-debugfs.postinst @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e + +case "$1" in + configure|reconfigure) + setcap "cap_dac_read_search=eip" /usr/libexec/netdata/plugins.d/debugfs.plugin + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/contrib/debian/netdata-plugin-ebpf.postinst b/contrib/debian/netdata-plugin-ebpf.postinst new file mode 100644 index 0000000000..412bc82e81 --- /dev/null +++ b/contrib/debian/netdata-plugin-ebpf.postinst @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e + +case "$1" in + configure|reconfigure) + chmod -f 4750 /usr/libexec/netdata/plugins.d/ebpf.plugin + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/contrib/debian/netdata-plugin-freeipmi.postinst b/contrib/debian/netdata-plugin-freeipmi.postinst new file mode 100644 index 0000000000..303f77d617 --- /dev/null +++ b/contrib/debian/netdata-plugin-freeipmi.postinst @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e + +case "$1" in + configure|reconfigure) + chmod -f 4750 /usr/libexec/netdata/plugins.d/freeipmi.plugin + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/contrib/debian/netdata-plugin-go.postinst b/contrib/debian/netdata-plugin-go.postinst new file mode 100644 index 0000000000..90888c4df4 --- /dev/null +++ b/contrib/debian/netdata-plugin-go.postinst @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e + +case "$1" in + configure|reconfigure) + setcap "cap_net_admin=eip cap_net_raw=eip" /usr/libexec/netdata/plugins.d/go.d.plugin + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/contrib/debian/netdata-plugin-nfacct.postinst b/contrib/debian/netdata-plugin-nfacct.postinst new file mode 100644 index 0000000000..d9c8671ae3 --- /dev/null +++ b/contrib/debian/netdata-plugin-nfacct.postinst @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e + +case "$1" in + configure|reconfigure) + chmod -f 4750 /usr/libexec/netdata/plugins.d/nfacct.plugin + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/contrib/debian/netdata-plugin-perf.postinst b/contrib/debian/netdata-plugin-perf.postinst new file mode 100644 index 0000000000..731e1aaf62 --- /dev/null +++ b/contrib/debian/netdata-plugin-perf.postinst @@ -0,0 +1,17 @@ +#!/bin/sh + +set -e + +case "$1" in + configure|reconfigure) + if capsh --supports=cap_perfmon 2>/dev/null; then + setcap cap_perfmon+ep /usr/libexec/netdata/plugins.d/perf.plugin + else + setcap cap_sys_admin+ep /usr/libexec/netdata/plugins.d/perf.plugin + fi + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/contrib/debian/netdata-plugin-slabinfo.postinst b/contrib/debian/netdata-plugin-slabinfo.postinst new file mode 100644 index 0000000000..3a66044662 --- /dev/null +++ b/contrib/debian/netdata-plugin-slabinfo.postinst @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e + +case "$1" in + configure|reconfigure) + setcap "cap_dac_read_search=eip" /usr/libexec/netdata/plugins.d/apps.plugin + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/contrib/debian/netdata.postinst b/contrib/debian/netdata.postinst index 07b5b0eb59..d5c84dc5d0 100644 --- a/contrib/debian/netdata.postinst +++ b/contrib/debian/netdata.postinst @@ -59,28 +59,11 @@ case "$1" in dpkg-statoverride --force --update --add root netdata 0775 /var/lib/netdata/registry > /dev/null 2>&1 chown -R root:netdata /usr/libexec/netdata/plugins.d - setcap cap_dac_read_search,cap_sys_ptrace+ep /usr/libexec/netdata/plugins.d/apps.plugin - setcap cap_dac_read_search+ep /usr/libexec/netdata/plugins.d/slabinfo.plugin setcap cap_dac_read_search+ep /usr/libexec/netdata/plugins.d/debugfs.plugin - if capsh --supports=cap_perfmon 2>/dev/null; then - setcap cap_perfmon+ep /usr/libexec/netdata/plugins.d/perf.plugin - else - setcap cap_sys_admin+ep /usr/libexec/netdata/plugins.d/perf.plugin - fi - - if [ -f "/usr/libexec/netdata/plugins.d/go.d.plugin" ]; then - setcap "cap_net_admin+epi cap_net_raw=eip" /usr/libexec/netdata/plugins.d/go.d.plugin - fi - chmod 4750 /usr/libexec/netdata/plugins.d/cgroup-network - chmod 4750 /usr/libexec/netdata/plugins.d/nfacct.plugin - - # Workaround if system does not have ebpf.plugin - chmod -f 4750 /usr/libexec/netdata/plugins.d/ebpf.plugin || true # Workaround for other plugins not installed directly by this package - chmod -f 4750 /usr/libexec/netdata/plugins.d/freeipmi.plugin || true chmod -f 4750 /usr/libexec/netdata/plugins.d/ioping || true ;; diff --git a/contrib/debian/rules b/contrib/debian/rules index 3d458654b8..626b5a69ff 100755 --- a/contrib/debian/rules +++ b/contrib/debian/rules @@ -60,6 +60,67 @@ override_dh_install: mv -f $(TEMPTOP)/usr/libexec/netdata/plugins.d/freeipmi.plugin \ $(TOP)-plugin-freeipmi/usr/libexec/netdata/plugins.d/freeipmi.plugin + # Add free IPMI plugin install rules + # + mkdir -p $(TOP)-plugin-nfacct/usr/libexec/netdata/plugins.d + mv -f $(TEMPTOP)/usr/libexec/netdata/plugins.d/nfacct.plugin \ + $(TOP)-plugin-nfacct/usr/libexec/netdata/plugins.d/nfacct.plugin + + # Add charts.d plugin install rules + # + mkdir -p $(TOP)-plugin-chartsd/usr/libexec/netdata/plugins.d/ + mkdir -p $(TOP)-plugin-chartsd/usr/lib/netdata/conf.d/ + mv -f $(TEMPTOP)/usr/libexec/netdata/plugins.d/charts.d.plugin \ + $(TOP)-plugin-chartsd/usr/libexec/netdata/plugins.d/charts.d.plugin + mv -f $(TEMPTOP)/usr/libexec/netdata/plugins.d/charts.d.dryrun-helper.sh \ + $(TOP)-plugin-chartsd/usr/libexec/netdata/plugins.d/charts.d.dryrun-helper.sh + mv -f $(TEMPTOP)/usr/libexec/netdata/charts.d \ + $(TOP)-plugin-chartsd/usr/libexec/netdata/charts.d + mv -f $(TEMPTOP)/usr/lib/netdata/conf.d/charts.d.conf \ + $(TOP)-plugin-chartsd/usr/lib/netdata/conf.d/charts.d.conf + mv -f $(TEMPTOP)/usr/lib/netdata/conf.d/charts.d \ + $(TOP)-plugin-chartsd/usr/lib/netdata/conf.d/charts.d + + # Add ebpf plugin install rules + [ $(HAVE_EBPF) -eq 1 ] && mkdir -p $(TOP)-plugin-ebpf/usr/libexec/netdata/plugins.d/ + [ $(HAVE_EBPF) -eq 1 ] && mkdir -p $(TOP)-plugin-ebpf/usr/lib/netdata/conf.d/ + [ $(HAVE_EBPF) -eq 1 ] && mv -f $(TEMPTOP)/usr/libexec/netdata/plugins.d/ebpf.plugin \ + $(TOP)-plugin-ebpf/usr/libexec/netdata/plugins.d/ebpf.plugin + [ $(HAVE_EBPF) -eq 1 ] && mv -f $(TEMPTOP)/usr/lib/netdata/conf.d/ebpf.d.conf \ + $(TOP)-plugin-ebpf/usr/lib/netdata/conf.d/ebpf.d.conf + [ $(HAVE_EBPF) -eq 1 ] && mv -f $(TEMPTOP)/usr/lib/netdata/conf.d/ebpf.d \ + $(TOP)-plugin-ebpf/usr/lib/netdata/conf.d/ebpf.d + + # Add python plugin install rules + mkdir -p $(TOP)-plugin-pythond/usr/libexec/netdata/plugins.d/ + mkdir -p $(TOP)-plugin-pythond/usr/lib/netdata/conf.d/ + mv -f $(TEMPTOP)/usr/libexec/netdata/plugins.d/python.d.plugin \ + $(TOP)-plugin-pythond/usr/libexec/netdata/plugins.d/python.d.plugin + mv -f $(TEMPTOP)/usr/libexec/netdata/python.d \ + $(TOP)-plugin-pythond/usr/libexec/netdata/python.d + mv -f $(TEMPTOP)/usr/lib/netdata/conf.d/python.d.conf \ + $(TOP)-plugin-pythond/usr/lib/netdata/conf.d/python.d.conf + mv -f $(TEMPTOP)/usr/lib/netdata/conf.d/python.d \ + $(TOP)-plugin-pythond/usr/lib/netdata/conf.d/python.d + + # Add apps plugin install rules + mkdir -p $(TOP)-plugin-apps/usr/libexec/netdata/plugins.d/ + mkdir -p $(TOP)-plugin-apps/usr/lib/netdata/conf.d/ + mv -f $(TEMPTOP)/usr/libexec/netdata/plugins.d/apps.plugin \ + $(TOP)-plugin-apps/usr/libexec/netdata/plugins.d/apps.plugin + mv -f $(TEMPTOP)/usr/lib/netdata/conf.d/apps_groups.conf \ + $(TOP)-plugin-apps/usr/lib/netdata/conf.d/apps_groups.conf + + # Add slabinfo plugin install rules + mkdir -p $(TOP)-plugin-slabinfo/usr/libexec/netdata/plugins.d/ + mv -f $(TEMPTOP)/usr/libexec/netdata/plugins.d/slabinfo.plugin \ + $(TOP)-plugin-slabinfo/usr/libexec/netdata/plugins.d/slabinfo.plugin + + # Add perf plugin install rules + mkdir -p $(TOP)-plugin-perf/usr/libexec/netdata/plugins.d/ + mv -f $(TEMPTOP)/usr/libexec/netdata/plugins.d/perf.plugin \ + $(TOP)-plugin-perf/usr/libexec/netdata/plugins.d/perf.plugin + # Set the rest of the software in the main package # cp -rp $(TEMPTOP)/usr $(TOP) @@ -82,13 +143,18 @@ override_dh_install: ln -s "/usr/share/netdata/www/$$D" "$(TOP)/var/lib/netdata/www/$$D"; \ done - if [ $(HAVE_EBPF) -eq 1 ]; then \ - packaging/bundle-ebpf.sh . ${TOP}/usr/libexec/netdata/plugins.d; \ - fi - - # Install go + # Handle eBPF code # - debian/install_go.sh $$(cat ${CURDIR}/packaging/go.d.version) $(TOP)/usr/lib/netdata $(TOP)/usr/libexec/netdata + [ $(HAVE_EBPF) -eq 1 ] && mkdir -p $(TOP)-plugin-ebpf-code/usr/libexec/netdata/plugins.d/ + [ $(HAVE_EBPF) -eq 1 ] && packaging/bundle-ebpf.sh . ${TOP}-plugin-ebpf-code/usr/libexec/netdata/plugins.d/ + + # Install go to it's own package directory + # + mkdir -p $(TOP)-plugin-go/usr/lib/netdata/conf.d + mkdir -p $(TOP)-plugin-go/usr/libexec/netdata/plugins.d + debian/install_go.sh $$(cat ${CURDIR}/packaging/go.d.version) \ + $(TOP)-plugin-go/usr/lib/netdata \ + $(TOP)-plugin-go/usr/libexec/netdata override_dh_installdocs: dh_installdocs @@ -109,14 +175,22 @@ override_dh_fixperms: # chmod 0755 $(TOP)/usr/libexec/netdata/netdata-updater.sh + # debugfs plugin + chmod 0750 $(TOP)/usr/libexec/netdata/plugins.d/debugfs.plugin + # apps.plugin should only be runnable by the netdata user. It will be # given extra capabilities in the postinst script. # - chmod 0750 $(TOP)/usr/libexec/netdata/plugins.d/apps.plugin - chmod 0750 $(TOP)/usr/libexec/netdata/plugins.d/debugfs.plugin - chmod 0750 $(TOP)/usr/libexec/netdata/plugins.d/perf.plugin - chmod 0750 $(TOP)/usr/libexec/netdata/plugins.d/slabinfo.plugin - chmod 0750 $(TOP)/usr/libexec/netdata/plugins.d/go.d.plugin + chmod 0750 $(TOP)-plugin-apps/usr/libexec/netdata/plugins.d/apps.plugin + + # slabinfo package + chmod 0750 $(TOP)-plugin-slabinfo/usr/libexec/netdata/plugins.d/slabinfo.plugin + + # perf package + chmod 0750 $(TOP)-plugin-perf/usr/libexec/netdata/plugins.d/perf.plugin + + # Go plugin package + chmod 0750 $(TOP)-plugin-go/usr/libexec/netdata/plugins.d/go.d.plugin # CUPS plugin package chmod 0750 $(TOP)-plugin-cups/usr/libexec/netdata/plugins.d/cups.plugin @@ -124,6 +198,9 @@ override_dh_fixperms: # freeIPMI plugin package chmod 4750 $(TOP)-plugin-freeipmi/usr/libexec/netdata/plugins.d/freeipmi.plugin + # NFACCT plugin package + chmod 4750 $(TOP)-plugin-nfacct/usr/libexec/netdata/plugins.d/nfacct.plugin + override_dh_installlogrotate: cp system/logrotate/netdata debian/netdata.logrotate dh_installlogrotate diff --git a/netdata.spec.in b/netdata.spec.in index 98fdbf71fa..426d105f26 100644 --- a/netdata.spec.in +++ b/netdata.spec.in @@ -27,20 +27,6 @@ AutoReqProv: yes %global _have_ebpf 0 %endif -# Disable FreeIPMI on Amazon Linux -%if 0%{?amzn} -%global _have_freeipmi 0 -%else -%global _have_freeipmi 1 -%endif - -# Disable the NFACCT plugin on Amazon Linux -%if 0%{?amzn} -%global _have_nfacct 0 -%else -%global _have_nfacct 1 -%endif - # Mitigate the cross-distro mayhem by strictly defining the libexec destination %define _prefix /usr %define _sysconfdir /etc @@ -54,13 +40,18 @@ AutoReqProv: yes # Redefine centos_ver to standardize on a single macro %{?rhel:%global centos_ver %rhel} -# -# Conditional build: -%bcond_without netns # build with netns support (cgroup-network) - -%if 0%{?fedora} || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1140 +# Disable FreeIPMI on Amazon Linux 2023 and newer +%if 0%{?amzn} >= 2023 +%global _have_freeipmi 0 %else -%undefine with_netns +%global _have_freeipmi 1 +%endif + +# Disable NFACCT for RHEL equivalents and Amazon Linux +%if 0%{?centos_ver} || 0%{?amzn} +%global _have_nfacct 0 +%else +%global _have_nfacct 1 %endif Summary: Real-time performance monitoring, done right! @@ -149,34 +140,50 @@ Requires: python3 Requires(pre): /usr/sbin/groupadd Requires(pre): /usr/sbin/useradd +# ##################################################################### +# External plugin package dependencies +# ##################################################################### +# CentOS prior to CentOS 8 does not have a new enough version of RPM +# to support weak dependencies. Explicitly requiring our default plugins +# makes it impossible to properly test the packages prior to upload, +# so we just skip depending on them on CentOS 7. +%if 0%{?centos_ver} != 7 +%if 0%{?_have_ebpf} +Recommends: netdata-plugin-ebpf +%endif +Recommends: netdata-plugin-apps +Recommends: netdata-plugin-pythond +Recommends: netdata-plugin-go +Recommends: netdata-plugin-debugfs +%if 0%{?_have_freeipmi} +Suggests: netdata-plugin-freeipmi +%endif +%if 0%{?_have_nfacct} +Suggests: netdata-plugin-nfacct +%endif +Suggests: netdata-plugin-cups +Suggests: netdata-plugin-chartsd +Suggests: netdata-plugin-slabinfo +Suggests: netdata-plugin-perf +%endif + # ##################################################################### # Functionality-dependent package dependencies # ##################################################################### # Note: Some or all of the Packages may be found in the EPEL repo, # rather than the standard ones -# epbf dependencies -%if 0%{?_have_ebpf} -%if 0%{?suse_version} -BuildRequires: libelf-devel -%else -BuildRequires: elfutils-libelf-devel -%endif -%endif -# end - ebpf dependencies - # nfacct plugin dependencies -%if %{_have_nfacct} + +%if 0%{?_have_nfacct} BuildRequires: libmnl-devel -%if 0%{?fedora} || 0%{?suse_version} >= 1140 BuildRequires: libnetfilter_acct-devel %endif -%endif # end nfacct plugin dependencies # freeipmi plugin dependencies -%if %{_have_freeipmi} +%if 0%{?_have_freeipmi} BuildRequires: freeipmi-devel %endif # end - freeipmi plugin dependencies @@ -234,6 +241,12 @@ autoreconf -ivf %if 0%{!?_have_ebpf} --disable-ebpf %endif + %if 0%{!?_have_freeipmi} + --disable-plugin-freeipmi + %endif + %if 0%{!?_have_nfacct} + --disable-plugin-nfacct + %endif %if 0%{?centos_ver:1} %if %{centos_ver} < 8 --with-bundled-protobuf \ @@ -272,7 +285,7 @@ install -m 644 -p system/logrotate/netdata "${RPM_BUILD_ROOT}%{_sysconfdir}/logr # ########################################################### # Install freeipmi -%if %{_have_freeipmi} +%if 0%{?_have_freeipmi} install -m 4750 -p freeipmi.plugin "${RPM_BUILD_ROOT}%{_libexecdir}/%{name}/plugins.d/freeipmi.plugin" %endif @@ -313,6 +326,11 @@ install -m 755 -d "${RPM_BUILD_ROOT}%{_localstatedir}/log/%{name}" # Install registry directory install -m 755 -d "${RPM_BUILD_ROOT}%{_localstatedir}/lib/%{name}/registry" +# ########################################################### +# Install uninstaller script +install -m 750 -p packaging/installer/netdata-uninstaller.sh \ + "${RPM_BUILD_ROOT}%{_libexecdir}/%{name}/netdata-uninstaller.sh" + # ########################################################### # Install netdata service install -m 755 -d "${RPM_BUILD_ROOT}%{_unitdir}" @@ -461,14 +479,13 @@ rm -rf "${RPM_BUILD_ROOT}" %files %doc README.md -%{_sysconfdir}/%{name} %config(noreplace) %{_sysconfdir}/%{name}/netdata.conf +%attr(0755,root,netdata) %{_sysconfdir}/%{name}/edit-config +%attr(0644,root,netdata) %{_sysconfdir}/%{name}/.install-type +%dir %{_sysconfdir}/%{name}/health.d +%dir %{_sysconfdir}/%{name}/statsd.d %config(noreplace) %{_sysconfdir}/logrotate.d/%{name} -%dir %{_libdir}/%{name} -%dir %{_datadir}/%{name} %{_libdir}/%{name} -%{_libdir}/%{name}/conf.d/ -%{_libexecdir}/%{name} %{_sbindir}/%{name} %{_sbindir}/netdatacli %{_sbindir}/netdata-claim.sh @@ -476,43 +493,33 @@ rm -rf "${RPM_BUILD_ROOT}" %{_unitdir}/netdata.service %{_presetdir}/50-netdata.preset -%defattr(0750,root,netdata,0750) - -%dir %{_libexecdir}/%{name}/python.d -%dir %{_libexecdir}/%{name}/charts.d +%dir %{_libexecdir}/%{name} %dir %{_libexecdir}/%{name}/plugins.d +%defattr(0750,root,netdata,0750) +%{_libexecdir}/%{name}/install-service.sh +%{_libexecdir}/%{name}/netdata-updater.sh +%{_libexecdir}/%{name}/netdata-uninstaller.sh +%{_libexecdir}/%{name}/plugins.d/acl.sh +%{_libexecdir}/%{name}/plugins.d/alarm.sh +%{_libexecdir}/%{name}/plugins.d/alarm-email.sh +%{_libexecdir}/%{name}/plugins.d/alarm-notify.sh +%{_libexecdir}/%{name}/plugins.d/alarm-test.sh +%{_libexecdir}/%{name}/plugins.d/anonymous-statistics.sh +%{_libexecdir}/%{name}/plugins.d/cgroup-name.sh +%{_libexecdir}/%{name}/plugins.d/get-kubernetes-labels.sh +%{_libexecdir}/%{name}/plugins.d/health-cmdapi-test.sh +%{_libexecdir}/%{name}/plugins.d/ioping.plugin +%{_libexecdir}/%{name}/plugins.d/loopsleepms.sh.inc +%{_libexecdir}/%{name}/plugins.d/request.sh +%{_libexecdir}/%{name}/plugins.d/system-info.sh +%{_libexecdir}/%{name}/plugins.d/tc-qos-helper.sh +%{_libexecdir}/%{name}/plugins.d/template_dim.sh -%{_libexecdir}/%{name}/python.d -%{_libexecdir}/%{name}/plugins.d - -%caps(cap_dac_read_search,cap_sys_ptrace=ep) %attr(0750,root,netdata) %{_libexecdir}/%{name}/plugins.d/apps.plugin - -%if %{with netns} # cgroup-network detects the network interfaces of CGROUPs # it must be able to use setns() and run cgroup-network-helper.sh as root # the helper script reads /proc/PID/fdinfo/* files, runs virsh, etc. %attr(4750,root,netdata) %{_libexecdir}/%{name}/plugins.d/cgroup-network %attr(0750,root,netdata) %{_libexecdir}/%{name}/plugins.d/cgroup-network-helper.sh -%endif - -# ebpf plugin -%if 0%{?_have_ebpf} -%attr(4750,root,netdata) %{_libexecdir}/%{name}/plugins.d/ebpf.plugin -%endif - -# perf plugin -# This should be CAP_PERFMON once RPM finally learns about it, but needs to be CAP_SYS_ADMIN for now. -# %caps(cap_perfmon=ep) %attr(0750,root,netdata) %{_libexecdir}/%{name}/plugins.d/perf.plugin -%caps(cap_sys_admin=ep) %attr(0750,root,netdata) %{_libexecdir}/%{name}/plugins.d/perf.plugin - -# debugfs plugin -%caps(cap_dac_read_search=ep) %attr(0750,root,netdata) %{_libexecdir}/%{name}/plugins.d/debugfs.plugin - -# slabinfo plugin -%caps(cap_dac_read_search=ep) %attr(0750,root,netdata) %{_libexecdir}/%{name}/plugins.d/slabinfo.plugin - -# go.d.plugin (the capability required for wireguard module) -%caps(cap_net_admin,cap_net_raw=eip) %{_libexecdir}/%{name}/plugins.d/go.d.plugin # Enforce 0644 for files and 0755 for directories # for the netdata web directory @@ -528,45 +535,287 @@ rm -rf "${RPM_BUILD_ROOT}" %attr(0770,netdata,netdata) %dir %{_localstatedir}/lib/%{name}/registry # Free IPMI belongs to a different sub-package -%if %{_have_freeipmi} +%if 0%{?_have_freeipmi} %exclude %{_libexecdir}/%{name}/plugins.d/freeipmi.plugin %endif +# NFACCT belongs to a different sub-package +%if 0%{?_have_nfacct} +%exclude %{_libexecdir}/%{name}/plugins.d/nfacct.plugin +%endif + +# Charts.d belongs to a different sub-package +%exclude %{_libexecdir}/%{name}/plugins.d/charts.d.plugin +%exclude %{_libexecdir}/%{name}/plugins.d/charts.d.dryrun-helper.sh +%exclude %{_libexecdir}/%{name}/charts.d/ +%exclude %{_libdir}/%{name}/conf.d/charts.d.conf +%exclude %{_libdir}/%{name}/conf.d/charts.d/ + +# eBPF belongs to a different sub-package +%if 0%{?_have_ebpf} +%exclude %{_libexecdir}/%{name}/plugins.d/ebpf.plugin +%exclude %{_libdir}/%{name}/conf.d/ebpf.d.conf +%exclude %{_libdir}/%{name}/conf.d/ebpf.d +%exclude %{_libexecdir}/%{name}/plugins.d/ebpf.d +%endif + +# Python.d belongs to a different sub-package +%exclude %{_libexecdir}/%{name}/plugins.d/python.d.plugin +%exclude %{_libexecdir}/%{name}/python.d +%exclude %{_libdir}/%{name}/conf.d/python.d.conf +%exclude %{_libdir}/%{name}/conf.d/python.d + +# Go.d belongs to a different sub-package +%exclude %{_libexecdir}/%{name}/plugins.d/go.d.plugin +%exclude %{_libdir}/%{name}/conf.d/go.d.conf +%exclude %{_libdir}/%{name}/conf.d/go.d + +# apps belongs to a different sub-package +%exclude %{_libexecdir}/%{name}/plugins.d/apps.plugin +%exclude %{_libdir}/%{name}/conf.d/apps_groups.conf + +# slabinfo belongs to a different sub-package +%exclude %{_libexecdir}/%{name}/plugins.d/slabinfo.plugin + +# perf belongs to a different sub-package +%exclude %{_libexecdir}/%{name}/plugins.d/perf.plugin + # CUPS belongs to a different sub package %if 0%{?centos_ver} != 6 && 0%{?centos_ver} != 7 %exclude %{_libexecdir}/%{name}/plugins.d/cups.plugin %package plugin-cups -Summary: The Common Unix Printing System plugin for netdata +Summary: The CUPS metrics collection plugin for the Netdata Agent Group: Applications/System Requires: cups >= 1.7 Requires: netdata = %{version} %description plugin-cups - This is the Common Unix Printing System plugin for the netdata daemon. -Use this plugin to enable metrics collection from cupsd, the daemon running when CUPS is enabled on the system + This plugin allows the Netdata Agent to collect metrics from the Common UNIX Printing System. %files plugin-cups %attr(0750,root,netdata) %{_libexecdir}/%{name}/plugins.d/cups.plugin %endif -%if %{_have_freeipmi} +%if 0%{?_have_freeipmi} %package plugin-freeipmi -Summary: FreeIPMI - The Intelligent Platform Management System +Summary: The FreeIPMI metrics collection plugin for the Netdata Agent Group: Applications/System Requires: freeipmi Requires: netdata = %{version} %description plugin-freeipmi - The IPMI specification defines a set of interfaces for platform management. -It is implemented by a number vendors for system management. The features of IPMI that most users will be interested in -are sensor monitoring, system event monitoring, power control, and serial-over-LAN (SOL). + This plugin allows the Netdata Agent to collect metrics from hardware using FreeIPMI. %files plugin-freeipmi %attr(4750,root,netdata) %{_libexecdir}/%{name}/plugins.d/freeipmi.plugin %endif +%if 0%{?_have_nfacct} +%package plugin-nfacct +Summary: The NFACCT metrics collection plugin for the Netdata Agent +Group: Applications/System +Requires: libmnl +Requires: netdata = %{version} +Conflicts: netdata <= %{version} +%if 0%{?fedora} || 0%{?suse_version} >= 1140 +Requires: libnetfilter_acct +%endif + +%description plugin-nfacct + This plugin allows the Netdata Agent to collect metrics from the firewall using NFACCT objects. + +%files plugin-nfacct +%attr(4750,root,netdata) %{_libexecdir}/%{name}/plugins.d/nfacct.plugin +%endif + +%package plugin-chartsd +Summary: The charts.d metrics collection plugin for the Netdata Agent +Group: Applications/System +Requires: bash +Requires: netdata = %{version} +Conflicts: netdata <= %{version} +%if 0%{?centos_ver} != 7 +Suggests: nut +Suggests: apcupsd +Suggests: iw +Suggests: sudo +%endif + +%description plugin-chartsd + This plugin adds a selection of additional collectors written in shell script to the Netdata Agent. +It includes collectors for NUT, APCUPSD, LibreSWAN, OpenSIPS, and Wireless access point statistics. + +%files plugin-chartsd +%defattr(0750,root,netdata,0750) +%{_libexecdir}/%{name}/plugins.d/charts.d.plugin +%{_libexecdir}/%{name}/plugins.d/charts.d.dryrun-helper.sh +%{_libexecdir}/%{name}/charts.d/ +%defattr(0644,root,netdata,0644) +%{_libdir}/%{name}/conf.d/charts.d.conf +%{_libdir}/%{name}/conf.d/charts.d/ + +%if 0%{?_have_ebpf} +%package plugin-ebpf +Summary: The eBPF metrics collection plugin for the Netdata Agent +Group: Applications/System +Requires: netdata = %{version} +Conflicts: netdata <= %{version} +%if 0%{?centos_ver} != 7 +Recommends: netdata-plugin-apps = %{version} +Recommends: netdata-ebpf-legacy-code >= %{version} +%else +Requires: netdata-plugin-apps = %{version} +Requires: netdata-ebpf-legacy-code >= %{version} +%endif + +%description plugin-ebpf + This plugin allows the Netdata Agent to use eBPF code to collect more detailed kernel-level metrics for the system. + +%files plugin-ebpf +%defattr(4750,root,netdata,4750) +%{_libexecdir}/%{name}/plugins.d/ebpf.plugin +%defattr(0644,root,netdata,0644) +%{_libdir}/%{name}/conf.d/ebpf.d.conf +%{_libdir}/%{name}/conf.d/ebpf.d + +%package ebpf-legacy-code +Summary: Compiled eBPF legacy code for the Netdata eBPF plugin +Group: Applications/System +Requires: netdata-plugin-ebpf = %{version} +Conflicts: netdata <= %{version} + +%description ebpf-legacy-code + This package provides the pre-compiled eBPF legacy code for use by the Netdata eBPF plugin. +This code is only needed when using the eBPF plugin with kernel versions before 5.10. + +%files ebpf-legacy-code +%defattr(0640,root,netdata,0640) +%{_libexecdir}/%{name}/plugins.d/ebpf.d/*.o + +%endif + +%package plugin-pythond +Summary: The python.d metrics collection plugin for the Netdata Agent +Group: Applications/System +Requires: netdata = %{version} +Conflicts: netdata <= %{version} +%if 0%{?centos_ver} == 7 || 0%{?centos_ver} == 6 +Requires: python +%else +%if 0%{?centos_ver} == 8 +Requires: python38 +%else +Requires: python3 +%endif +%endif +%if 0%{?centos_ver} != 7 +Suggests: sudo +%endif + +%description plugin-pythond + This plugin adds a selection of additional collectors written in Python to the Netdata Agent. +Many of the collectors provided by this package are also available in netdata-plugin-go. In msot cases, you probably +want to use those versions instead of the Python versions. + +%files plugin-pythond +%defattr(0750,root,netdata,0750) +%{_libexecdir}/%{name}/plugins.d/python.d.plugin +%{_libexecdir}/%{name}/python.d +%defattr(0640,root,netdata,0640) +%{_libdir}/%{name}/conf.d/python.d.conf +%{_libdir}/%{name}/conf.d/python.d + +%package plugin-go +Summary: The go.d metrics collection plugin for the Netdata Agent +Group: Applications/System +Requires: netdata = %{version} +Conflicts: netdata <= %{version} +%if 0%{?centos_ver} != 7 +Suggests: nvme-cli +Suggests: sudo +%endif + +%description plugin-go + This plugin adds a selection of additional collectors written in Go to the Netdata Agent +A significant percentage of the application specific collectors provided by Netdata are part of this plugin, +so most users will want it installed. + +%files plugin-go +%defattr(0750,root,netdata,0750) +# CAP_NET_ADMIN needed for WireGuard collector +# CAP_NET_RAW needed for ping collector +%caps(cap_net_admin,cap_net_raw=eip) %{_libexecdir}/%{name}/plugins.d/go.d.plugin +%defattr(0644,root,netdata,0644) +%{_libdir}/%{name}/conf.d/go.d.conf +%{_libdir}/%{name}/conf.d/go.d + +%package plugin-apps +Summary: The per-application metrics collection plugin for the Netdata Agent +Group: Applications/System +Requires: netdata = %{version} +Conflicts: netdata <= %{version} + +%description plugin-apps + This plugin allows the Netdata Agent to collect per-application and per-user metrics without using cgroups. + +%files plugin-apps +%defattr(0750,root,netdata,0750) +# CAP_DAC_READ_SEARCH and CAP_SYS_PTRACE needed for data collection by the plugin. +%caps(cap_dac_read_search,cap_sys_ptrace=ep) %{_libexecdir}/%{name}/plugins.d/apps.plugin +%defattr(0644,root,netdata,0644) +%{_libdir}/%{name}/conf.d/apps_groups.conf + +%package plugin-slabinfo +Summary: The slabinfo metrics collector for the Netdata Agent +Group: Applications/System +Requires: netdata = %{version} +Conflicts: netdata <= %{version} + +%description plugin-slabinfo + This plugin allows the Netdata Agent to collect perfromance and utilization metrics for the Linux kernel’s SLAB allocator. + +%files plugin-slabinfo +%defattr(0750,root,netdata,0750) +# CAP_DAC_READ_SEARCH needed to access the files the plugin reads to collect data. +%caps(cap_dac_read_search=ep) %{_libexecdir}/%{name}/plugins.d/slabinfo.plugin + +%package plugin-perf +Summary: The perf metrics collector for the Netdata Agent +Group: Applications/System +Requires: netdata = %{version} +Conflicts: netdata <= %{version} + +%description plugin-perf + This plugin allows the Netdata to collect metrics from the Linux perf subsystem. + +%files plugin-perf +%defattr(0750,root,netdata,0750) +# Either CAP_SYS_ADMIN or CAP_PERFMON needed for data collection +# PERFMON is newer, so only try to use it on platforms which support it. +%if 0%{?centos_ver} >= 9 || 0%{?fedora} >= 36 +%caps(cap_perfmon=ep) %{_libexecdir}/%{name}/plugins.d/perf.plugin +%else +%caps(cap_sys_admin=ep) %{_libexecdir}/%{name}/plugins.d/perf.plugin +%endif + +%package plugin-debugfs +Summary: The debugfs metrics collector for the Netdata Agent +Group: Applications/System +Requires: netdata = %{version} +Conflicts: netdata <= %{version} + +%description plugin-debugfs + This plugin allows the Netdata Agent to collect Linux kernel metrics exposed through debugfs. + +%files plugin-debugfs +%defattr(0750,root,netdata,0750) +# CAP_DAC_READ_SEARCH required for data collection. +%caps(cap_dac_read_search=ep) %attr(0750,root,netdata) %{_libexecdir}/%{name}/plugins.d/debugfs.plugin + %changelog +* Fri Apr 07 2023 Austin Hemmelgarn <austin@netdata.cloud> 0.0.0-19 +- Split additional plugins out in their own packages. * Tue Mar 21 2023 Austin Hemmelgarn <austin@netdata.cloud> 0.0.0-18 - Fix systemd handling to follow BCP. - Drop pre-systemd init support. @@ -609,8 +858,9 @@ First draft refactor on package dependencies section * Wed Jan 02 2019 Pawel Krupa <pkrupa@redhat.com> - 0.0.0-3 - Temporary set version statically - Fix changelog ordering -- Comment-out node.d configuration directory +- Comment-out node.d configuration directory * Wed Jan 02 2019 Pawel Krupa <pkrupa@redhat.com> - 0.0.0-2 - Fix permissions for log files * Sun Nov 15 2015 Alon Bar-Lev <alonbl@redhat.com> - 0.0.0-1 - Initial add. + diff --git a/packaging/bundle-ebpf.sh b/packaging/bundle-ebpf.sh index 3204345b04..29fc6a2aa0 100755 --- a/packaging/bundle-ebpf.sh +++ b/packaging/bundle-ebpf.sh @@ -15,5 +15,5 @@ if [ -x "${PLUGINDIR}/ebpf.plugin" ] ; then mkdir "${PLUGINDIR}/ebpf.d" fi # shellcheck disable=SC2046 - cp -a $(find "${SRCDIR}/tmp/ebpf" -mindepth 1 -maxdepth 1) "${PLUGINDIR}/ebpf.d" + cp -r $(find "${SRCDIR}/tmp/ebpf" -mindepth 1 -maxdepth 1) "${PLUGINDIR}/ebpf.d" fi diff --git a/packaging/bundle-libbpf.sh b/packaging/bundle-libbpf.sh index 7e6e22a9ed..1c55427657 100755 --- a/packaging/bundle-libbpf.sh +++ b/packaging/bundle-libbpf.sh @@ -22,6 +22,6 @@ curl -sSL --connect-timeout 10 --retry 3 "https://github.com/netdata/libbpf/arch sha256sum -c "${1}/packaging/libbpf.checksums" || exit 1 tar -xzf "${LIBBPF_TARBALL}" -C "${1}/externaldeps/libbpf" || exit 1 make -C "${LIBBPF_BUILD_PATH}/src" BUILD_STATIC_ONLY=1 OBJDIR=build/ DESTDIR=../ install || exit 1 -cp -a "${LIBBPF_BUILD_PATH}/usr/${lib_subdir}/libbpf.a" "${1}/externaldeps/libbpf" || exit 1 -cp -a "${LIBBPF_BUILD_PATH}/usr/include" "${1}/externaldeps/libbpf" || exit 1 -cp -a "${LIBBPF_BUILD_PATH}/include/uapi" "${1}/externaldeps/libbpf/include" || exit 1 +cp -r "${LIBBPF_BUILD_PATH}/usr/${lib_subdir}/libbpf.a" "${1}/externaldeps/libbpf" || exit 1 +cp -r "${LIBBPF_BUILD_PATH}/usr/include" "${1}/externaldeps/libbpf" || exit 1 +cp -r "${LIBBPF_BUILD_PATH}/include/uapi" "${1}/externaldeps/libbpf/include" || exit 1 diff --git a/packaging/installer/kickstart.sh b/packaging/installer/kickstart.sh index ea3c6a58d8..4936a40fe4 100755 --- a/packaging/installer/kickstart.sh +++ b/packaging/installer/kickstart.sh @@ -26,6 +26,7 @@ KICKSTART_SOURCE="$( echo "$(pwd -P)/${self##*/}" )" PACKAGES_SCRIPT="https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer/install-required-packages.sh" +DEFAULT_PLUGIN_PACKAGES="netdata-plugin-go netdata-plugin-python netdata-plugin-apps netdata-plugin-ebpf" PATH="${PATH}:/usr/local/bin:/usr/local/sbin" PUBLIC_CLOUD_URL="https://app.netdata.cloud" REPOCONFIG_DEB_URL_PREFIX="https://repo.netdata.cloud/repos/repoconfig" @@ -1398,6 +1399,9 @@ try_package_install() { common_rpm_opts common_dnf_opts repo_prefix="el/${SYSVERSION}" + if [ "${SYSVERSION}" -lt 8 ]; then + explicitly_install_native_plugins=1 + fi ;; fedora|ol) common_rpm_opts @@ -1533,6 +1537,14 @@ try_package_install() { fi return 2 fi + + if [ -n "${explicitly_install_native_plugins}" ]; then + progress "Installing external plugins." + # shellcheck disable=SC2086 + if ! run_as_root env ${env} ${pm_cmd} install ${DEFAULT_PLUGIN_PACKAGES}; then + warning "Failed to install external plugin packages. Some collectors may not be available." + fi + fi } # ======================================================================