Netdata via HAProxy
HAProxy is a free, very fast and reliable solution offering high availability, load balancing, and proxying for TCP and HTTP-based applications. It is particularly suited for very high traffic web sites and powers quite a number of the world's most visited ones.
If Netdata is running on a host running HAProxy, rather than connecting to Netdata from a port number, a domain name can
be pointed at HAProxy, and HAProxy can redirect connections to the Netdata port. This can make it possible to connect to
Netdata at https://example.com
or https://example.com/netdata/
, which is a much nicer experience then
http://example.com:19999
.
To proxy requests from HAProxy to Netdata, the following configuration can be used:
#
Default ConfigurationFor all examples, set the mode to http
#
Simple ConfigurationA simple example where the base URL, say http://example.com
, is used with no subpath:
#
FrontendCreate a frontend to receive the request.
#
BackendCreate the Netdata backend which will send requests to port 19999
.
#
Configuration with subpathA example where the base URL is used with a subpath /netdata/
:
#
FrontendTo use a subpath, create an ACL, which will set a variable based on the subpath.
#
BackendSame as simple example, except remove /netdata/
with regex.
#
Using TLS communicationTLS can be used by adding port 443
and a cert to the frontend.
This example will only use Netdata if host matches example.com (replace with your domain).
#
FrontendThis frontend uses a certificate list.
In the cert list file place a mapping from a certificate file to the domain used:
/etc/letsencrypt/certslist.txt
:
The file /etc/letsencrypt/live/example.com/example.com.pem
should contain the key and
certificate (in that order) concatenated into a .pem
file.:
#
BackendSame as simple, except set protocol https
.
#
Enable authenticationTo use basic HTTP Authentication, create an authentication list:
You can create a hashed password using the mkpassword
utility.
Replace passwordhere
with hash:
Now add at the top of the backend:
#
Full ExampleFull example configuration with HTTP auth over TLS with subpath: