netdata.service.in 3.1 KB

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