netdata.service.in 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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=netdata
  9. Group=netdata
  10. RuntimeDirectory=netdata
  11. RuntimeDirectoryMode=0775
  12. PIDFile=@localstatedir_POST@/run/netdata/netdata.pid
  13. ExecStart=@sbindir_POST@/netdata -P @localstatedir_POST@/run/netdata/netdata.pid -D
  14. ExecStartPre=/bin/mkdir -p @localstatedir_POST@/cache/netdata
  15. ExecStartPre=/bin/chown -R netdata:netdata @localstatedir_POST@/cache/netdata
  16. ExecStartPre=/bin/mkdir -p @localstatedir_POST@/run/netdata
  17. ExecStartPre=/bin/chown -R netdata:netdata @localstatedir_POST@/run/netdata
  18. ExecStopPost=@pluginsdir_POST@/reset_netdata_trace.sh
  19. PermissionsStartOnly=true
  20. # saving a big db on slow disks may need some time
  21. TimeoutStopSec=150
  22. # restart netdata if it crashes
  23. Restart=on-failure
  24. RestartSec=30
  25. # The minimum netdata Out-Of-Memory (OOM) score.
  26. # netdata (via [global].OOM score in netdata.conf) can only increase the value set here.
  27. # To decrease it, set the minimum here and set the same or a higher value in netdata.conf.
  28. # Valid values: -1000 (never kill netdata) to 1000 (always kill netdata).
  29. OOMScoreAdjust=1000
  30. # Valid policies: other (the system default) | batch | idle | fifo | rr
  31. # To give netdata the max priority, set CPUSchedulingPolicy=rr and CPUSchedulingPriority=99
  32. CPUSchedulingPolicy=idle
  33. # This sets the scheduling priority (for policies: rr and fifo).
  34. # Priority gets values 1 (lowest) to 99 (highest).
  35. #CPUSchedulingPriority=1
  36. # For scheduling policy 'other' and 'batch', this sets the lowest niceness of netdata (-20 highest to 19 lowest).
  37. #Nice=0
  38. # Capabilities
  39. # is required for freeipmi and slabinfo plugins
  40. CapabilityBoundingSet=CAP_DAC_OVERRIDE
  41. # is required for apps plugin
  42. CapabilityBoundingSet=CAP_DAC_READ_SEARCH
  43. # is required for freeipmi plugin
  44. CapabilityBoundingSet=CAP_FOWNER
  45. # is required for apps, perf and slabinfo plugins
  46. CapabilityBoundingSet=CAP_SETPCAP
  47. # is required for perf plugin
  48. CapabilityBoundingSet=CAP_SYS_ADMIN
  49. # is required for apps plugin
  50. CapabilityBoundingSet=CAP_SYS_PTRACE
  51. # is required for ebpf plugin
  52. CapabilityBoundingSet=CAP_SYS_RESOURCE
  53. # is required for fping app
  54. CapabilityBoundingSet=CAP_NET_RAW
  55. # is required for cgroups plugin
  56. CapabilityBoundingSet=CAP_SYS_CHROOT
  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=true
  63. # We whitelist this because it's the standard location to listen on a UNIX socket.
  64. ReadWriteDirectories=/run/netdata
  65. [Install]
  66. WantedBy=multi-user.target