diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-24 09:54:23 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-24 09:54:44 +0000 |
commit | 836b47cb7e99a977c5a23b059ca1d0b5065d310e (patch) | |
tree | 1604da8f482d02effa033c94a84be42bc0c848c3 /system | |
parent | Releasing debian version 1.44.3-2. (diff) | |
download | netdata-836b47cb7e99a977c5a23b059ca1d0b5065d310e.tar.xz netdata-836b47cb7e99a977c5a23b059ca1d0b5065d310e.zip |
Merging upstream version 1.46.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'system')
-rw-r--r-- | system/Makefile.am | 136 | ||||
-rw-r--r-- | system/dinit/netdata.in | 11 | ||||
-rw-r--r-- | system/freebsd/rc.d/netdata.in | 10 | ||||
-rwxr-xr-x | system/install-service.sh.in | 63 | ||||
-rw-r--r-- | system/lsb/init.d/netdata.in | 16 | ||||
-rw-r--r-- | system/netdata-updater.conf | 26 | ||||
-rw-r--r-- | system/netdata.conf | 11 | ||||
-rw-r--r-- | system/openrc/init.d/netdata.in | 10 | ||||
-rw-r--r-- | system/systemd/journald@netdata.conf | 5 | ||||
-rw-r--r-- | system/systemd/netdata.service.in | 3 | ||||
-rw-r--r-- | system/systemd/netdata.service.v235.in | 3 |
11 files changed, 118 insertions, 176 deletions
diff --git a/system/Makefile.am b/system/Makefile.am deleted file mode 100644 index 1e96f6f4f..000000000 --- a/system/Makefile.am +++ /dev/null @@ -1,136 +0,0 @@ -# Copyright (C) 2015 Alon Bar-Lev <alon.barlev@gmail.com> -# SPDX-License-Identifier: GPL-3.0-or-later - -MAINTAINERCLEANFILES = $(srcdir)/Makefile.in -CLEANFILES = \ - install-service.sh \ - cron/netdata-updater-daily \ - freebsd/rc.d/netdata \ - initd/init.d/netdata \ - launchd/netdata.plist \ - logrotate/netdata \ - lsb/init.d/netdata \ - openrc/conf.d/netdata \ - openrc/init.d/netdata \ - runit/run \ - systemd/netdata.service \ - systemd/netdata.service.v235 \ - systemd/netdata-updater.service \ - $(NULL) - -include $(top_srcdir)/build/subst.inc -SUFFIXES = .in - -dist_config_SCRIPTS = \ - edit-config \ - $(NULL) - -dist_config_DATA = \ - .install-type \ - netdata-updater.conf \ - $(NULL) - -libconfigvnodesdir=$(libconfigdir)/vnodes -libsyscrondir=$(libsysdir)/cron -libsysfreebsddir=$(libsysdir)/freebsd -libsysfreebsdrcddir=$(libsysfreebsddir)/rc.d -libsysinitddir=$(libsysdir)/initd -libsysinitdinitddir=$(libsysinitddir)/init.d -libsyslaunchddir=$(libsysdir)/launchd -libsyslogrotatedir=$(libsysdir)/logrotate -libsyslsbdir=$(libsysdir)/lsb -libsyslsbinitddir=$(libsyslsbdir)/init.d -libsysopenrcdir=$(libsysdir)/openrc -libsysopenrcinitddir=$(libsysopenrcdir)/init.d -libsysopenrcconfddir=$(libsysopenrcdir)/conf.d -libsysrunitdir=$(libsysdir)/runit -libsyssystemddir=$(libsysdir)/systemd - -# Explicitly install directories to avoid permission issues due to umask -install-exec-local: - $(INSTALL) -d $(DESTDIR)$(configdir) - $(INSTALL) -d $(DESTDIR)$(libsysdir) - $(INSTALL) -d $(DESTDIR)$(libsyscrondir) - $(INSTALL) -d $(DESTDIR)$(libsysfreebsdrcddir) - $(INSTALL) -d $(DESTDIR)$(libsysinitdinitddir) - $(INSTALL) -d $(DESTDIR)$(libsyslaunchddir) - $(INSTALL) -d $(DESTDIR)$(libsyslogrotatedir) - $(INSTALL) -d $(DESTDIR)$(libsyslsbinitddir) - $(INSTALL) -d $(DESTDIR)$(libsyssystemddir) - $(INSTALL) -d $(DESTDIR)$(libsysopenrcinitddir) - $(INSTALL) -d $(DESTDIR)$(libsysopenrcconfddir) - $(INSTALL) -d $(DESTDIR)$(libsysrunitdir) - $(INSTALL) -d $(DESTDIR)$(libconfigvnodesdir) - -dist_libconfigvnodes_DATA = \ - vnodes/vnodes.conf - $(NULL) - -libexecnetdatadir=$(libexecdir)/netdata -nodist_libexecnetdata_SCRIPTS = \ - install-service.sh \ - $(NULL) - -nodist_libsyscron_DATA = \ - cron/netdata-updater-daily \ - $(NULL) - -nodist_libsysfreebsdrcd_DATA = \ - freebsd/rc.d/netdata \ - $(NULL) - -nodist_libsysinitdinitd_DATA = \ - initd/init.d/netdata \ - $(NULL) - -nodist_libsyslaunchd_DATA = \ - launchd/netdata.plist \ - $(NULL) - -nodist_libsyslogrotate_DATA = \ - logrotate/netdata \ - $(NULL) - -nodist_libsyslsbinitd_DATA = \ - lsb/init.d/netdata \ - $(NULL) - -nodist_libsysopenrcinitd_DATA = \ - openrc/init.d/netdata \ - $(NULL) - -nodist_libsysopenrcconfd_DATA = \ - openrc/conf.d/netdata \ - $(NULL) - -nodist_libsysrunit_DATA = \ - runit/run \ - $(NULL) - -nodist_libsyssystemd_DATA = \ - systemd/netdata.service \ - systemd/netdata.service.v235 \ - systemd/netdata-updater.service \ - $(NULL) - -dist_libsyssystemd_DATA = \ - systemd/netdata-updater.timer \ - systemd/50-netdata.preset - $(NULL) - -dist_noinst_DATA = \ - install-service.sh.in \ - netdata.conf \ - cron/netdata-updater-daily.in \ - freebsd/rc.d/netdata.in \ - initd/init.d/netdata.in \ - launchd/netdata.plist.in \ - logrotate/netdata.in \ - lsb/init.d/netdata.in \ - openrc/conf.d/netdata.in \ - openrc/init.d/netdata.in \ - runit/run.in \ - systemd/netdata.service.in \ - systemd/netdata.service.v235.in \ - systemd/netdata-updater.service.in \ - $(NULL) diff --git a/system/dinit/netdata.in b/system/dinit/netdata.in new file mode 100644 index 000000000..607df4520 --- /dev/null +++ b/system/dinit/netdata.in @@ -0,0 +1,11 @@ +# dinit service description for Netdata +# +# Currently only properly tested on Chimera Linux. + +type = bgprocess +command = @sbindir_POST@/netdata -P @localstatedir_POST@/run/netdata.pid -D +pid-file = @localstatedir_POST@/run/netdata.pid +options = signal-process-only +load-options = export-passwd-vars +depends-on = early-fs-local.target +after = network.target diff --git a/system/freebsd/rc.d/netdata.in b/system/freebsd/rc.d/netdata.in index fd544c86c..0ede6621e 100644 --- a/system/freebsd/rc.d/netdata.in +++ b/system/freebsd/rc.d/netdata.in @@ -17,10 +17,9 @@ required_files="@configdir_POST@/netdata.conf" start_precmd="netdata_prestart" stop_postcmd="netdata_poststop" -extra_commands="reloadhealth savedb" +extra_commands="reloadhealth" reloadhealth_cmd="netdata_reloadhealth" -savedb_cmd="netdata_savedb" netdata_prestart() { @@ -42,12 +41,5 @@ netdata_reloadhealth() return 0 } -netdata_savedb() -{ - p=`cat ${pidfile}` - kill -USR2 ${p} && echo "Sent USR1 (save db) to pid ${p}" - return 0 -} - load_rc_config $name run_rc_command "$1" diff --git a/system/install-service.sh.in b/system/install-service.sh.in index cdd1bf52f..0ed4fa1bb 100755 --- a/system/install-service.sh.in +++ b/system/install-service.sh.in @@ -29,7 +29,7 @@ DUMP_CMDS=0 ENABLE="auto" EXPORT_CMDS=0 INSTALL=1 -LINUX_INIT_TYPES="systemd openrc lsb initd runit" +LINUX_INIT_TYPES="systemd openrc lsb initd runit dinit" PLATFORM="$(uname -s)" SHOW_SVC_TYPE=0 SVC_SOURCE="@libsysdir_POST@" @@ -563,6 +563,65 @@ runit_cmds() { } # ===================================================================== +# dinit support functions + +_check_dinit() { + # if /etc/dinit.d does not exist, it’s not dinit + [ ! -d /etc/dinit.d ] && echo "NO" && return 0 + + # if PID 1 is dinit, it’s dinit + [ "$(basename "$(readlink /proc/1/exe)" 2> /dev/null)" = "dinit" ] && echo "YES" && return 0 + + # if /run/dinitctl exists and is a socket, it’s dinit + [ -S /run/dinitctl ] && echo "YES" && return 0 + + # if the dinitctl command exists despite getting to this point, it’s dinit, but not booted as such + [ -n "$(command -v dinitctl 2>/dev/null || true)" ] && echo "OFFLINE" && return 0 + + echo "NO" && return 0 +} + +check_dinit() { + if [ -z "${IS_DINIT}" ]; then + IS_DINIT="$(_check_dinit)" + fi + + echo "${IS_DINIT}" +} + +_run_dinitctl() { + opts='' + + if [ "$(check_dinit)" = "OFFLINE" ]; then + opts="-o" + fi + + # shellcheck disable=SC2086 + dinitctl ${opts} "${@}" +} + +enable_dinit() { + _run_dinitctl enable netdata +} + +enable_dinit() { + _run_dinitctl disable netdata +} + +install_dinit_service() { + install_generic_service dinit/netdata "dinit" /etc/dinit.d enable_dinit disable_dinit +} + +dinit_cmds() { + if [ "$(check_dinit)" = "YES" ]; then + NETDATA_START_CMD='dinitctl start netdata' + NETDATA_STOP_CMD='dinitct stop netdata' + else # Not booted using dinit, use external defaults by not providing commands. + warning "Detected dinit, but the system is not booted using dinit. Unable to provide commands to start or stop Netdata using the service manager." + fi +} + +# ===================================================================== # WSL support functions _check_wsl() { @@ -630,6 +689,8 @@ install_darwin_service() { exit 4 fi + launchctl unload /Library/LaunchDaemons/com.github.netdata.plist 2>/dev/null + if ! launchctl load /Library/LaunchDaemons/com.github.netdata.plist; then error "Failed to load plist file." exit 4 diff --git a/system/lsb/init.d/netdata.in b/system/lsb/init.d/netdata.in index e429ad1c9..2c6ac7f43 100644 --- a/system/lsb/init.d/netdata.in +++ b/system/lsb/init.d/netdata.in @@ -47,18 +47,24 @@ service_start() { chown @netdata_user_POST@:@netdata_user_POST@ $PIDFILE_PATH - log_daemon_msg "Starting real-time performance monitoring" "netdata" + log_success_msg "Starting real-time performance monitoring" start_daemon -p $PIDFILE $DAEMON_PATH/$DAEMON $DAEMONOPTS RETVAL=$? - log_end_msg $RETVAL + case "${RETVAL}" in + 0) log_success_msg "Started real-time performance monitoring" ;; + *) log_error_msg "Failed to start real-time performance monitoring" ;; + esac return $RETVAL } service_stop() { - log_daemon_msg "Stopping real-time performance monitoring" "netdata" + log_success_msg "Stopping real-time performance monitoring" killproc -p ${PIDFILE} $DAEMON_PATH/$DAEMON RETVAL=$? - log_end_msg $RETVAL + case "${RETVAL}" in + 0) log_success_msg "Stopped real-time performance monitoring" ;; + *) log_error_msg "Failed to stop real-time performance monitoring" ;; + esac if [ $RETVAL -eq 0 ]; then rm -f ${PIDFILE} @@ -77,7 +83,7 @@ condrestart() { } service_status() { - status_of_proc -p $PIDFILE $DAEMON_PATH/$DAEMON netdata + pidofproc -p $PIDFILE $DAEMON_PATH/$DAEMON } diff --git a/system/netdata-updater.conf b/system/netdata-updater.conf index 09af046be..ac35131da 100644 --- a/system/netdata-updater.conf +++ b/system/netdata-updater.conf @@ -2,10 +2,30 @@ # # When run non-interactively, the updater script will delay some # random number of seconds up to NETDATA_UPDATER_JITTER before -# actually running the update. The default is 3600 (one -# hour). Most users should not need to change this. +# actually running the update. The default is 3600 (one hour). Most +# users should not need to change this. #NETDATA_UPDATER_JITTER="3600" +# By default, the updater will update to new major versions without asking +# for user confirmation once we consider them ready for general usage. +# +# You can override this behavior by setting NETDATA_ACCEPT_MAJOR_VERSIONS +# to a space separated list of major versions you are willing to update +# to. Attempts to update to newer major versions not listed in this variable +# will be treated as a fatal error. +# +# An empty value is equivalent to the default behavior. +# +# This only applies to static builds and local builds. If you are using +# our native packages, use your package manager’s existing functionality +# to prevent updates (for example, pinning versions on APT-based systems, +# or the DNF versionlock plugin on RHEL/Fedora). +# +# To lock yourself to a specific major version, set this value to exactly +# that major version number. For example, to stay on version 1.x even +# if 2.x has been released, set this to a value of `1`. +#NETDATA_ACCEPT_MAJOR_VERSIONS='' + # On systems using our native packages, the updater will by default # attempt to install optional plugin packages that would be installed by # default on clean installs if those packages are supported on the system. @@ -13,7 +33,7 @@ # This behavior can be disabled on a per-package basis using the below # variables. Setting the variable to a value other than 0 will disable # the corresponding package (note that you still need to remove the package -# yourself if you don0t want it, this just controls whether the updater +# yourself if you don't want it, this just controls whether the updater # will try to ensure it’s installed or not). # # NETDATA_NO_SYSTEMD_JOURNAL controls the `netdata-plugin-systemd-journal` diff --git a/system/netdata.conf b/system/netdata.conf index 94d9ab82c..6131ab56a 100644 --- a/system/netdata.conf +++ b/system/netdata.conf @@ -10,14 +10,3 @@ # or # curl -o /etc/netdata/netdata.conf http://localhost:19999/netdata.conf # -# You can uncomment and change any of the options below. -# The value shown in the commented settings, is the default value. -# - -[global] - run as user = netdata - - # default storage size - increase for longer data retention - page cache size = 32 - dbengine multihost disk space = 256 - diff --git a/system/openrc/init.d/netdata.in b/system/openrc/init.d/netdata.in index 8dede179c..23d1a56cb 100644 --- a/system/openrc/init.d/netdata.in +++ b/system/openrc/init.d/netdata.in @@ -6,10 +6,9 @@ NETDATA_PIDFILE="@localstatedir_POST@/run/netdata/netdata.pid" description="Run the Netdata system monitoring agent." -extra_started_commands="reload rotate save" +extra_started_commands="reload rotate" description_reload="Reload health configuration." description_rotate="Reopen log files." -description_save="Force sync of database to disk." command_prefix="@sbindir_POST@" command="${command_prefix}/netdata" @@ -70,10 +69,3 @@ rotate() { "Failed to reopen Netdata log files" \ SIGHUP } - -save() { - run_cmd save-database \ - "Saving Netdata database" \ - "Failed to save Netdata database" \ - SIGUSR1 -} diff --git a/system/systemd/journald@netdata.conf b/system/systemd/journald@netdata.conf new file mode 100644 index 000000000..28fdca266 --- /dev/null +++ b/system/systemd/journald@netdata.conf @@ -0,0 +1,5 @@ +# See journald.conf(5) for details. + +[Journal] +SystemMaxUse=256M +RuntimeMaxUse=64M diff --git a/system/systemd/netdata.service.in b/system/systemd/netdata.service.in index 7d15dad77..3ea1f9d8e 100644 --- a/system/systemd/netdata.service.in +++ b/system/systemd/netdata.service.in @@ -3,7 +3,8 @@ Description=Real time performance monitoring # append here other services you want netdata to wait for them to start -After=network.target +After=network.target network-online.target nss-lookup.target +Wants=network-online.target nss-lookup.target [Service] LogNamespace=netdata diff --git a/system/systemd/netdata.service.v235.in b/system/systemd/netdata.service.v235.in index 06f03b269..e2878407b 100644 --- a/system/systemd/netdata.service.v235.in +++ b/system/systemd/netdata.service.v235.in @@ -3,7 +3,8 @@ Description=Real time performance monitoring # append here other services you want netdata to wait for them to start -After=network.target +After=network.target network-online.target nss-lookup.target +Wants=network-online.target nss-lookup.target [Service] LogNamespace=netdata |