How to install firehol netdata on a Linux Ubuntu 14.04 Box and run it behind an Apache2 Proxy with Basic Auth Protection

2018-04-22 12:30:19 Linux,Ubuntu,Monitoring,Apache,Visualize,EN

firehol netdata "firehol netdata"


Get firehol netdata sources from github and install into /opt folder.

$ cd /tmp
$ git clone --depth=1
$ cd netdata
$ sudo ./ --install /opt

Update iptables

deny any access to the webinterface

iptables -A INPUT -p tcp --dport 19999 -s -j ACCEPT
iptables -A INPUT -p tcp --dport 19999 -j REJECT --reject-with icmp-port-unreachable


Basic Auth

install apache2-utils and create a basic auth password for user netdata

$ sudo apt-get install apache2-utils
$ sudo htpasswd -c /etc/apache2/.htpasswd netdata


Install and enable Proxy Module for Apache2

$ sudo apt-get install libapache2-mod-proxy-html     
$ sudo a2enmod proxy
$ sudo a2enmod proxy_http

Add a Apache2 VHost Entry

$ sudo vim /etc/apache2/sites-available/999-netdata.conf
  • Vhost Entry for Domain on host 999.999.999.999. Replace those by real values:

        RewriteEngine On
        ProxyRequests Off
            Order deny,allow
            Allow from all
        ProxyPass "/netdata/box/" "http://999.999.999.999:19999/" connectiontimeout=5 timeout=30
        ProxyPassReverse "/netdata/box/" "http://999.999.999.999:19999/"
        RewriteRule ^/$ http://%{HTTP_HOST}/netdata/box/ [L,R=301]
        DocumentRoot /var/www/html/
            AuthType Basic
            AuthName "Restricted Content"
            AuthUserFile /etc/apache2/.htpasswd
            Require valid-user
            Order deny,allow
            Allow from all
        CustomLog       /var/log/apache2/ combined
        ErrorLog        /var/log/apache2/

symlink the new vhost entry to the sites-enabled folder.

$ sudo ln -s /etc/apache2/sites-available/999-netdata.conf /etc/apache2/sites-enabled/ 

Restart Apache2

$ sudo service apache2 restart