netdata.service.in 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. # SPDX-License-Identifier: GPL-3.0-or-later
  2. [Unit]
  3. Description=infrastructure monitoring and troubleshooting, transformed
  4. # append here other services you want netdata to wait for them to start
  5. After=network.target network-online.target nss-lookup.target
  6. Wants=network-online.target nss-lookup.target
  7. [Service]
  8. LogNamespace=netdata
  9. Type=simple
  10. User=root
  11. Group=netdata
  12. RuntimeDirectory=netdata
  13. RuntimeDirectoryMode=0775
  14. PIDFile=/run/netdata/netdata.pid
  15. ExecStart=@sbindir_POST@/netdata -P /run/netdata/netdata.pid -D
  16. ExecStartPre=/bin/mkdir -p @localstatedir_POST@/cache/netdata
  17. ExecStartPre=/bin/chown -R @netdata_user_POST@ @localstatedir_POST@/cache/netdata
  18. PermissionsStartOnly=true
  19. # saving a big db on slow disks may need some time
  20. TimeoutStopSec=150
  21. # restart netdata if it crashes
  22. Restart=on-failure
  23. RestartSec=30
  24. # Valid policies: other (the system default) | batch | idle | fifo | rr
  25. # To give netdata the max priority, set CPUSchedulingPolicy=rr and CPUSchedulingPriority=99
  26. CPUSchedulingPolicy=batch
  27. # This sets the scheduling priority (for policies: rr and fifo).
  28. # Priority gets values 1 (lowest) to 99 (highest).
  29. #CPUSchedulingPriority=1
  30. # For scheduling policy 'other' and 'batch', this sets the lowest niceness of netdata (-20 highest to 19 lowest).
  31. Nice=0
  32. # Capabilities
  33. # is required for freeipmi and slabinfo plugins
  34. CapabilityBoundingSet=CAP_DAC_OVERRIDE
  35. # is required for apps plugin
  36. CapabilityBoundingSet=CAP_DAC_READ_SEARCH
  37. # is required for freeipmi plugin
  38. CapabilityBoundingSet=CAP_FOWNER CAP_SYS_RAWIO
  39. # is required for apps, perf and slabinfo plugins
  40. CapabilityBoundingSet=CAP_SETPCAP
  41. # is required for perf plugin
  42. CapabilityBoundingSet=CAP_SYS_ADMIN CAP_PERFMON
  43. # is required for apps plugin
  44. CapabilityBoundingSet=CAP_SYS_PTRACE
  45. # is required for ebpf plugin
  46. CapabilityBoundingSet=CAP_SYS_RESOURCE
  47. # is required for go.d/ping app
  48. CapabilityBoundingSet=CAP_NET_RAW
  49. # is required for cgroups plugin
  50. CapabilityBoundingSet=CAP_SYS_CHROOT
  51. # is required for nfacct plugin (bandwidth accounting)
  52. CapabilityBoundingSet=CAP_NET_ADMIN
  53. # is required for plugins that use sudo
  54. CapabilityBoundingSet=CAP_SETGID CAP_SETUID
  55. # is required to change file ownership
  56. CapabilityBoundingSet=CAP_CHOWN
  57. # Sandboxing
  58. ProtectSystem=full
  59. ProtectHome=read-only
  60. # PrivateTmp break netdatacli functionality. See - https://github.com/netdata/netdata/issues/7587
  61. #PrivateTmp=true
  62. ProtectControlGroups=on
  63. # We whitelist this because it's the standard location to listen on a UNIX socket.
  64. ReadWriteDirectories=/run/netdata
  65. # This is needed to make email-based alert deliver work if Postfix is the email provider on the system.
  66. ReadWriteDirectories=-/var/spool/postfix/maildrop
  67. # LXCFS directories (https://github.com/lxc/lxcfs#lxcfs)
  68. # If we don't set them explicitly, systemd mounts procfs from the host. See https://github.com/netdata/netdata/issues/14238.
  69. BindReadOnlyPaths=-/proc/cpuinfo -/proc/diskstats -/proc/loadavg -/proc/meminfo
  70. BindReadOnlyPaths=-/proc/stat -/proc/swaps -/proc/uptime -/proc/slabinfo
  71. [Install]
  72. WantedBy=multi-user.target