Fixed handling of perf.plugin capabilities. (#10766)
CAP_PERFMON is only available with Linux kernel 5.8 or newer, and needs a sufficiently up-to-date userspace to be able to set it. With this change, we fall back to CAP_SYS_ADMIN (which CAP_PERFMON is a proper subset of) if we cannot set CAP_PERFMON for the perf plugin.
Austin S. Hemmelgarn committed
Mar 15, 2021 at 10:54 UTC
6c5bb166ca16dad2f6f51e55a3a0c9965de15d04
1 file changed
+1
-1
netdata-installer.sh
+1
-1
@@ -1314,7 +1314,7 @@ if [ "${UID}" -eq 0 ]; then
1314
if [ -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/perf.plugin" ]; then
1315
run chown root:${NETDATA_GROUP} "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/perf.plugin"
1316
run chmod 0750 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/perf.plugin"
1317
- run setcap cap_perfmon+ep "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/perf.plugin"
1317
+ run sh -c "setcap cap_perfmon+ep \"${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/perf.plugin\" || setcap cap_sys_admin+ep \"${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/perf.plugin\""
1318
fi
1319
1320
if [ -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/slabinfo.plugin" ]; then