The Netdata web server runs as
static-threaded, i.e. with a fixed, configurable number of threads.
It uses non-blocking I/O and respects the
keep-alive HTTP header to serve multiple HTTP requests via the same connection.
You can disable the web server by editing
netdata.conf and setting:
[web] mode = none
With the web server enabled, you can control the number of threads and sockets with the following settings:
[web] web server threads = 4 web server max sockets = 512
The default number of processor threads is
min(cpu cores, 6).
web server max sockets setting is automatically adjusted to 50% of the max number of open files netdata is allowed to use (via
/etc/security/limits.conf or systemd), to allow enough file descriptors to be available for data collection.
Binding netdata to multiple ports¶
Netdata can bind to multiple IPs and ports, offering access to different services on each. Up to 100 sockets can be used (you can increase it at compile time with
CFLAGS="-DMAX_LISTEN_FDS=200" ./netdata-installer.sh ...).
The ports to bind are controlled via
[web].bind to, like this:
[web] default port = 19999 bind to = 127.0.0.1=dashboard 10.1.1.1:19998=management|netdata.conf hostname:19997=badges [::]:19996=streaming localhost:19995=registry *:http=dashboard unix:/tmp/netdata.sock
Using the above, netdata will bind to:
- IPv4 127.0.0.1 at port 19999 (port was used from
default port). Only the UI (dashboard) and the read API will be accessible on this port.
- IPv4 10.1.1.1 at port 19998. The management API and netdata.conf will be accessible on this port.
- All the IPs
hostnameresolves to (both IPv4 and IPv6 depending on the resolved IPs) at port 19997. Only badges will be accessible on this port.
- All IPv6 IPs at port 19996. Only metric streaming requests from other netdata agents will be accepted on this port.
- All the IPs
localhostresolves to (both IPv4 and IPv6 depending the resolved IPs) at port 19996. This port will only accept registry API requests.
- All IPv4 and IPv6 IPs at port
httpas set in
/etc/services. Only the UI (dashboard) and the read API will be accessible on this port.
- Unix domain socket
/tmp/netdata.sock. All requests are serviceable on this socket.
[web].default port is used when an entries in
[web].bind to do not specify a port.
Note that the access permissions specified with the
=request type|request type|... format are available from version 1.12 onwards.
As shown in the example above, these permissions are optional, with the default being to permit all request types on the specified port.
The request types are strings identical to the
allow X from directives of the access lists, i.e.
The access lists themselves and the general setting
allow connections from in the next section are applied regardless of the ports that are configured to provide these services.
The API requests are serviced as follows:
dashboard gives access to the UI, the read API and badges API calls.
badges gives access only to the badges API calls.
management gives access only to the management API calls.
Netdata supports access lists in
[web] allow connections from = localhost * allow dashboard from = localhost * allow badges from = * allow streaming from = * allow netdata.conf from = localhost fd* 10.* 192.168.* 172.16.* 172.17.* 172.18.* 172.19.* 172.20.* 172.21.* 172.22.* 172.23.* 172.24.* 172.25.* 172.26.* 172.27.* 172.28.* 172.29.* 172.30.* 172.31.* allow management from = localhost
* does string matches on the IPs of the clients.
allow connections frommatches anyone that connects on the netdata port(s). So, if someone is not allowed, it will be connected and disconnected immediately, without reading even a single byte from its connection. This is a global settings with higher priority to any of the ones below.
allow dashboard fromreceives the request and examines if it is a static dashboard file or an API call the dashboards do.
allow badges fromchecks if the API request is for a badge. Badges are not matched by
allow dashboard from.
allow streaming fromchecks if the slave willing to stream metrics to this netdata is allowed. This can be controlled per API KEY and MACHINE GUID in stream.conf. The setting in
netdata.confis checked before the ones in stream.conf.
allow netdata.conf fromchecks the IP to allow
http://netdata.host:19999/netdata.conf. The IPs listed are all the private IPv4 addresses, including link local IPv6 addresses. Keep in mind that connections to netdata API ports are filtered by
allow connections from. So, IPs allowed by
allow netdata.conf fromshould also be allowed by
allow connections from.
allow management fromchecks the IPs to allow API management calls. Management via the API is currently supported for health
Other netdata.conf [web] section options¶
|ses max window||
||See single exponential smoothing|
|des max window||
||See double exponential smoothing|
||The port backlog. Check
|web files owner||
||The user that owns the web static files. Netdata will refuse to serve a file that is not owned by this user, even if it has read access to that file. If the user given is not found, netdata will only serve files owned by user given in
|web files group||
||If this is set, Netdata will check if the file is owned by this group and refuse to serve the file if it’s not.|
|disconnect idle clients after seconds||
||The time in seconds to disconnect web clients after being totally idle.|
|timeout for first request||
||How long to wait for a client to send a request before closing the socket. Prevents slow request attacks.|
|accept a streaming request every seconds||
||Can be used to set a limit on how often a master Netdata server will accept streaming requests from the slaves in a streaming and replication setup|
|respect do not track policy||
||If set to
|x-frame-options response header||Avoid clickjacking attacks, by ensuring that the content is not embedded into other sites.|
|enable gzip compression||
||When set to
|gzip compression strategy||
||Valid strategies are
|gzip compression level||
||Valid levels are 1 (fastest) to 9 (best ratio)|
If you publish your netdata to the internet, you may want to apply some protection against DDoS:
- Use the
static-threadedweb server (it is the default)
- Use reasonable
[web].web server max sockets(the default is)
- Don’t use all your cpu cores for netdata (lower
[web].web server threads)
- Run netdata with a low process scheduling priority (the default is the lowest)
- If possible, proxy netdata via a full featured web server (nginx, apache, etc)