summaryrefslogtreecommitdiffstats
path: root/system
AgeCommit message (Collapse)Author
2023-03-14Add experimental support for running under runit. (#13841)Austin S. Hemmelgarn
* Add basic runit service script for Netdata. * Integrate runit handling in install-service script. * Add new runit script to .gitignore. * Fix service file installation. We need to ensure the service directory actually gets created, and thus need to use `-D` with the `install` command. * Sync with system restructure. * Fix botched update to Makefile.am.
2023-03-13Add vnodes default configuration file. (#14553)Austin S. Hemmelgarn
Co-authored-by: ilyam8 <ilya@netdata.cloud>
2023-03-13Don’t try to use tput in edit-config unless it’s installed. (#14705)Austin S. Hemmelgarn
2023-03-06Properly handle service type detection failures when installing as a system ↵Austin S. Hemmelgarn
service. (#14658)
2023-03-01Assorted improvements to OpenRC support. (#14620)Austin S. Hemmelgarn
* Add OpenRC conf.d file for Netdata. * Tidy-up handling of retry schedule. It should be computed in stop_pre so it gets evaluated after the conf file, and it also needs to handle variables not being defined properly (which it currently does not). * Add a service description and command descriptions. * Only install `/etc/conf.d/netdata` if it does not already exist. This prevents overwriting user configuration.
2023-02-27Reorganize system directory to better reflect what files are actually used ↵Austin S. Hemmelgarn
for. (#14544) * Move systemd-specific system files to their own directory. * Move non-systemd init scripts to individual subdirectories. * Move cron files to their own directory. * Move logrotate config to it’s own directory. * Fix typos in Makefile.am. * Fix Debian package builds. * Fixed issues reported by @andrewm4894.
2023-02-21Fix two issues with the edit-config script. (#14545)Austin S. Hemmelgarn
Co-authored-by: Ilya Mashchenko <ilya@netdata.cloud>
2023-02-16Assorted shellcheck cleanup. (#14524)Austin S. Hemmelgarn
* Add shellcheck config file to globally disable dead code checks. These checks have an extremely high false positive rate and even when they’re correctly flagging code the impact is generally very low. * Fix assorted shellcheck errors in installer code. This should make reviewing PRs relating to this code much easier. * Make shellcheck quit complaining about shellcheckrc formatting.
2023-02-08Add sbindir_POST template for v235 service file (#14471)Emmanuel Vasilakis
2023-01-16fix(pacakging): fix cpu/memory metrics when running inside LXC container as ↵Ilya Mashchenko
systemd service (#14255) Fixes https://github.com/netdata/netdata/issues/14238
2022-12-23fix logrotate postrotate (#14180)Ilya Mashchenko
2022-12-09remove deprecated fping.plugin in accordance with v1.37.0 deprecation notice ↵Ilya Mashchenko
(#14073)
2022-12-06Cleanly reimplement system/edit-config.in. (#13702)Austin S. Hemmelgarn
* Cleanly reimplement system/edit-config.in - Added support for pulling config files from Docker containers. - Added auto-detection for Docker containers. - Use directory the script is in for target directory for config files instead of templating it in at build time. - Prefix error messages with `ERROR:`. - Robustly check for a valid editor _before_ invoking it. - Add support for actual command-line options, including a proper `--help` option. - Use prefix matching of absolute paths to determine file validity instead of blindly excluding certain path types. - If editing a non-existing file we do not provide a stock copy of, create an empty file instead of throwing an error. - Make the whole script properly modular. * Improve robustness of container autodetection. Instead of relying on the lack of certain directories on a host system, use some relatively standard checks to determine if we appear to be running in a container. * Auto-detect stock config paths at runtinme instead of hard-coding them at build time. THis will simplify testing of the script, as well as making it a bit more resilient to users moving things around. * Add an option to list known config files. * Fix container environment check to not require root. * Fix help output. * Fix path prefix check. * Fix file path handling. * Use correct variable when editing files. * Use correct path for `env`. * Source profile before running `set -e`. To prevent questionablly written profiles from causing the script to exit. * Produce columnar output when listing valid files. * Fix copy check. * Fix build issues. * fix build issues * formatting Co-authored-by: ilyam8 <ilya@netdata.cloud>
2022-10-25Assorted cleanup in the OpenRC init script. (#13115)Austin S. Hemmelgarn
* Properly handle service dependencies in OpenRC init script. This removes the `NETDATA_START_AFTER_SERVICES` variable from our OpenRC script. This variable made the script somewhat harder to read, and did not actually provide any additional functionality (users can simply define appropriate `rc_after` values in `/etc/conf.d/netdata` to achieve exactly the same net effect).. * Provide more concrete descriptions for OpenRC commands. Updates the command descriptions in the OpenRC init script to properly describe exactly what they are doing, instead of going with generic and rather ambiguous names. * Allow use of netdatacli for additional commands in OpenRC init script. This makes life simpler for users who want to run the agent under OpenRC’s native process supervision, which does not allow use of `start-stop-daemon` commands in the init script. Existing behavior (using `start-stop-daemon`) is preserved as the default. * Fix background command handling. THe `pidfile` variable should only be set if the agent is not being run under `supervise-daemon`. * COnsolidate code from additional commands, and handle supervise-daemon correctly. * Fix typo. * Remove pointless `require_files` line. We don’t actually do anything in the script that cares about the config file existing, and the agent starts fine without it, so we should not be requiring it to be present.
2022-10-19Properly guard commands when installing services for offline service ↵Austin S. Hemmelgarn
managers. (#13848)
2022-10-18Fix runtime directory ownership when installed as non-root user. (#13797)Austin S. Hemmelgarn
* Fix runtime directory ownership when installed as non-root user. Followup to #13870. * Fix typo.
2022-10-17Fix service installation on FreeBSD. (#13842)Austin S. Hemmelgarn
Instead of using the correct path for installing the system service file, we were always hard-coding `/etc/init.d/netdata`. This happened to work correctly on Linux, but obviously breaks horribly on FreeBSD.
2022-10-17Further improvements to the new service installation code. (#13774)Austin S. Hemmelgarn
* Improve OpenRC detection. - Check for rc-update command, without that we don’t work so it’s ‘not OpenRC’. - Sort checks so that less expensive ones run first. - If we see `/etc/init.d/local` and it’s got a shebang line with `openrc-run`, then assume we’re dealing with OpenRC. This file gets installed by default as part of OpenRC itself. * Fix runit detection. - `/lib/rc/sv.d` is only used on some runit systems (notably Artix), not all, so don’t bail if we can’t find it. - Check not just for a `runit` command, but also `runsvdir`. * Add support for systemd in WSL. THis just involves running the normal systemd check if we detected WSL, and updating the service manager type appropriately. * Fix tmpdir handling for service installation. * Fix invocation of service install script. * Add fallback to detected but not running service managers. Currently supported for systemd and OpenRC. If no other service manager is detected, but we detected that either systemd or OpenRC is present but not running, fall back to them instead of outright failing. This does not allow starting/stopping the agent using the service manager, but _does_ happen to work for installing the service properly on an offline system. * Fix service-type fallback handling. If we see systemd, even if it not booted into it, we should not install init.d or LSB init scripts. * Fix recursion bug in initd install type checking. * Skip initd if OpenRC is found. Just like systemd, any OpenRC on the system automatically means that it’s _not_ a classic init.d setup. * Fall back to init.d in WSL in some cases. If there is no _usable_ systemd, and the service manager otherwise looks like an init.d setup, fall back to an init.d setup. * Support LSB style init scripts in WSL as well. Also consolidate and update the error message that gets printed when running under WSL. * Fix typo in LSB init script handling code. * Fix command handling for LSB and initd service management. Instead of using `service`, just run the init scripts directly. This way we avoid any bugs in `service` that would cause it to pretend that systemd is in use even though it isn’t. * Fix botched partial commit. * Restructure service type detection to not rely on return codes. * Added option to display service type detection results. This should simplify debugging.
2022-10-09allow netdata installer to install and run netdata as any user (#13780)Costa Tsaousis
* allow netdata installer to install and run netdata as any user * Update netdata-installer.sh Co-authored-by: Austin S. Hemmelgarn <ahferroin7@gmail.com> * Update netdata-installer.sh Co-authored-by: Austin S. Hemmelgarn <ahferroin7@gmail.com> Co-authored-by: Austin S. Hemmelgarn <ahferroin7@gmail.com>
2022-10-06Overhaul handling of installation of Netdata as a system service. (#13451)Austin S. Hemmelgarn
* Install templated files from system directory on target system. This will allow more robust handling of auto-updates and installation of service files. * Add a script to handle installing Netdata as a system service. This uses the files installed as a result of the previous commit, and provides more robust detection and system handling than the existing code used for this purpose. A subsequent commit will convert the various installation mechanisms to use this script instead of their own internal code for this purpose. * Assorted cleanup and fixes for install-service.sh script. * Use new service install script on installs when present. * Fix missing .gitignore line. * Fix install command. * Integrate with warning handling in kickstart script. * Fix systemd version check. * Explicitly exit successfully when done. * Further fixes. * Fix handling of start commands on service install. * Fix handling of passing service commands in installer. * Fix handling of inability to detect service manager type. * Centralize install-service.sh invocation and improve error reporting. * Fix typos in Linux service handling.
2022-08-15netdata.service: Update PIDFile to avoid systemd legacy path warning (#13504)Craig Andrews
Resolves warning logged by systemd: systemd[1]: /lib/systemd/system/netdata.service:14: PIDFile= references a path below legacy directory /var/run/, updating /var/run/netdata/netdata.pid → /run/netdata/netdata.pid; please update the unit file accordingly. Signed-off-by: Craig Andrews <candrews@integralblue.com> Signed-off-by: Craig Andrews <candrews@integralblue.com>
2022-07-27Fix boolean value for ProtectControlGroups (#11281)Didier FABERT
2022-06-16add CAP_SYS_RAWIO to Netdata's systemd unit CapabilityBoundingSet (#13154)Ilya Mashchenko
2022-05-31replace `history` with relevant `dbengine` params (#13041)Andrew Maguire
2022-03-28fix: use internal defaults for sched policy/oom score in native packages ↵Ilya Mashchenko
(#12529)
2022-03-14Remove owner check from webserver (#12339)thiagoftsm
2022-03-11Change default OOM score and scheduling policy to behave more sanely. (#12271)Austin S. Hemmelgarn
2022-03-08fix: use default "bind to" in native packages (#12336)Ilya Mashchenko
2022-02-28netdata.service: unbreak plugins that use sudo (#10201)Steven Noonan
Signed-off-by: Steven Noonan <steven@uplinklabs.net>
2022-01-12Add a missing capability for the perf plugin (#11958)Vladimir Kobal
Co-authored-by: Ilya Mashchenko <ilya@netdata.cloud>
2022-01-12fix(nfacct.plugin): Netfilter accounting data collection (#11951)Ilya Mashchenko
2021-12-10Fix postdrop handling for systemd systems. (#11885)Austin S. Hemmelgarn
2021-09-15remove reset_netdata_trace.sh from netdata.service (#11517)Ilya Mashchenko
2021-05-24Store info about the installation type for later retrieval. (#11157)Austin S. Hemmelgarn
* Store info about the installation type for later retrieval. * Properly handle install type on updates. * Restructure install type values for easier parsing. * Fix checksums. * Fix .gitignore check.
2020-10-14Fix systemd comment syntax (#10066)Holger Hees
* Fix systemd comment syntax comments for systemd service files are only allowed in the beginning of a new line https://www.freedesktop.org/software/systemd/man/systemd.syntax.html otherwise you get error messages like ``` /usr/lib/systemd/system/netdata.service:48: Failed to parse capability in bounding/ambient set, ignoring: # ``` * remove trailing whitespaces
2020-09-28Added improved auto-update support. (#9966)Austin S. Hemmelgarn
* Add systemd timer unit to handle auto updates. This adds a systemd timer unit and associated service for running the updaterscript. This allows better support for auto-updates on systems that use systemd, removing the need for cron or special shims to handle periodic tasks. This will be used in preference to our existing auto-update support on systems running systemd unless the user overrides this behavior. * Add an option to the installer to override auto-updater type detection. This allows users to specify what auto-updater scheduling mechanism to use. This wil persist the selection to updates as well. Supported values are: * systemd': Uses a systemd timer unit and service to handle automatic updates. * 'interval': Uses a script in /etc/cron.daily or /etc/periodic/daily. * `crontab`: Uses a crontab file in /etc/cron.d. * Change priority of systemd support. This way existing users won't get converted, and by default you'll still get emails on failures. * Case-normalize the value passed to --auto-update-type. * Fix incorrect naming of crontab file. * Fixed function naming.
2020-09-15Added support for using `/etc/cron.d` for auto-updates. (#9598)Austin S. Hemmelgarn
* Add crontab fragment for netdata updater. This adds a crontab fragment to be put in `/etc/cron.d` on system swhich do not support either `/etc/cron.daily` or `/etc/periodic/daily`, allowing for proper auto-updater support on such systems. The crontab will run upates at 02:57, which was chosen arbitrarily because it does not conflict with th erun times for any major distribution's daily scheduled tasks. * Utilize the crontab fragment for updates on systems that need it. This adds logic to utilize the crontab fragment added by the previous commit on systems which need it for auto-updates to work. The installer will preferentially use `/etc/cron.daily` or `/etc/periodic/daily` instead if they exist, so this should result in no changes for most users. * Remove systemd scheduler detection. We're not actually using it right now, and it breaks handling of auto-updates on systemd systems.
2020-08-25Remove PrivateMounts (#9619)Steve8291
Since commit #9234 the following has been showing up in my journal logs: > /lib/systemd/system/netdata.service:63: Unknown lvalue 'PrivateMounts' in section 'Service' Running `systemd-analyze verify netdata.service` > /lib/systemd/system/netdata.service:63: Unknown lvalue 'PrivateMounts' in section 'Service' > Attempted to remove disk file system, and we can't allow that. It would appear that the `Attempted to remove disk file system, and we can't allow that.` message is due to a [bug](https://github.com/systemd/systemd/issues/8592) in version 237 of systemd, which is what my Ubuntu 18.04 is currently running. But that doesn't explain the "PrivateMounts" issue. Looking at the [systemd man page](https://www.freedesktop.org/software/systemd/man/systemd.exec.html) for PrivateMounts it would seem that we do not need the `PrivateMounts=true` setting because the service file has `ProtectSystem=full` set: > Other file system namespace unit settings — PrivateMounts=, PrivateTmp=, PrivateDevices=, ProtectSystem=, ProtectHome=, ReadOnlyPaths=, InaccessiblePaths=, ReadWritePaths=, … — also enable file system namespacing in a fashion equivalent to this option. Hence it is primarily useful to explicitly request this behaviour if none of the other settings are used. I have tested this on Ubuntu 18.04 and everything seems to be working fine.
2020-08-13Add CAP_SYS_CHROOT for netdata service (#9726)Vladimir Kobal
2020-07-27Addd sandboxing exception for `/run/netdata`. (#9613)Austin S. Hemmelgarn
This marks `/run/netdata` as writable in our systemd unit files so that users who are listening on a UNIX socket in the 'standard' location can do so witout the sandboxing getting in their way.
2020-07-21Add CAP_SYS_RESOURCE to capability bounding set. (#9569)Austin S. Hemmelgarn
This mitigates failures in the eBPF plugin. The issue is a `setrlimi()` call we're making to allow us to call `memlock()`. The proper fix here is dependent on whether we can prove that we actually need to call `memlock()` or not (I suspect we do not _need_ to but it improves measurement accuracy, in which case it should be optional). If we can, then this is also a fix and not a mitigation. If we can't, then the fix is to get rid of those calls in the eBPF plugin and remove this othewise unneeded capability from our bounding set.
2020-07-20enable simple sandboxing on systemd service (#9234)Yurii Izorkin
2020-07-14Fix potential memory leak in ebpf.plugin (#9484)thiagoftsm
Fix reported bugs with ebpf.plugin.
2020-04-27bind to should be in [web] section and update netdata.service.v235.in too ↵Amish
(#8454) * Update netdata.service.v235.in too Increase timeout for systemd service shutdown to give time to flush the db. When changes are made to netdata.service.in similar changes should be made to netdata.service.v235.in too. * bind to should be in [web] section See documentation: https://docs.netdata.cloud/web/server/
2020-03-30Fix our Debian/Ubuntu packages to actually package the SystemD Unit files we ↵James Mills
expect. (#8468) * update netdata.conf for debian build * Fix Debian Ubuntu SystemD Unit packaging * avoid duplicate netdata.conf files violates single source of truth principle, use schema from #8468 instead * Fixed *DirectoryMode octets and bad ExecStart * Fix dpkg-statoverride warnings * Move the copy of debian/netdata.conf into the correct target (override_dh_install) Co-authored-by: and0x000 <justanpc@gmail.com>
2020-03-16Fix streaming scaling (#8375)Markos Fountoulakis
* Disallow multiple streaming connections to the same master agent * Reject multiple streaming connections quickly without blocking * Increase timeout for systemd service shutdown to give time to flush the db. * Optimize page correlation ID to use atomic counter instead of locks * Reduce contention in global configuration mutex * Optimize complexity of inserting configuration sections from O(N) to O(1) * Reduce overhead of clockgettime() by utilizing CLOCK_MONOTONIC_COARSE when applicable. * Fix unit test compile errors
2020-02-05Fixes support for editing configuration when NetData is installed to a ↵James Mills
symlinked /opt (#7933) * Re-formated ./system/edit-config.in with shfmt -w -i 2 -ci -sr * Fixed and cleaned up ./system/edit-config to work correctly with symlinks
2020-02-05Re-formated ./system/edit-config.in with shfmt -w -i 2 -ci -sr (#7932)James Mills
2020-01-30Better systemd service file (#7790)Amish
* Provide a new service file for systemd v235+ Let systemd create directories, instead of via ExecStartPre. * Do not set global options in service file via -W option. The default set by service file are anyway the defaults used by netdata. Better place is to mention them in netdata.conf and allow user to change those options via netdata.conf file instead of changing in service file.
2019-11-11Ownership and permissions of /etc/netdata (#7244)Konstantinos Natsakis
* make install takes care of ownership and permissions of /etc/netdata Instead of netdata-installer.sh * Fix identation in Makefile.am files * netdata-installer.sh: Clearer variable assignment * netdata-installer.sh: Set /etc/netdata/netdata.conf ownership to root:root and permissions to 0644 * netdata-installer.sh: Set /etc/netdata/.environment permissions to 0644 * install-or-update.sh: Set permissions for /opt/netdata/etc/netdata.conf to 0644 * install-or-update.sh: Use ${NETDATA_PREFIX} more * install-or-update.sh: Improve indentation * install-or-update.sh: Do not create /opt/netdata/etc/netdata directories * debian/rules: /etc/netdata files and directories are now installed by make install * debian/rules: Properly copy files across directories When destination directory exists * netdata.spec.in: /etc/netdata ownership and permissions * Revert "Fix identation in Makefile.am files" This reverts commit 63fdb299b69152fda6984f81b0fef02f364c5efe. * Remove uninstall-local recipes from Makefile.am files * Removed superfluous whitespace and hash