DietPi NetData Setup HowTo

I’m posting this tutorial because the information is not easy to find. This is a NetData setup with lighttpd, the recommended web server for Pihole, which I also run on same DietPi. I included instructions for Nginx, in case you prefer it. You can access your NetData stats locally at http://yourservername.lan/stats/, in my example I will use http://chaos.lan/stats/. I prefer using /stats because there are issues with subdomains in Pihole. If you have a fix for subdomains in Pihole (e.g. http://stats.chaos.lan), feel free to share it with the community here.

Main page:

The setup enables also the stats for temp sensors, so you can set alarms based on your needs:


http://chaos.lan should be functional, prior implementing the changes:

Install netdata software in DietPi. Run all commands listed below as root user, you can copy/paste each block in terminal.

If your Pi is old and the CPU usage is too high, change update every value to 5 or whatever setting you like.

cat >> /etc/netdata/netdata.conf << 'EOF'
{TAB}update every = 1

{TAB}access log = none
{TAB}debug log = none
{TAB}error log = none
sed -i "s|{TAB}|\t|g" /etc/netdata/netdata.conf
echo 'sensors=force' >> /etc/netdata/charts.d.conf
cat > /etc/netdata/charts.d/sensors.conf << 'EOF'
# the directory the kernel keeps sensor data

# how deep in the tree to check for sensor data

# if set to 1, the script will overwrite internal
# script functions with code generated ones
# leave to 1, is faster

# how frequently to collect sensor data
# the default is to collect it at every iteration of charts.d

# array of sensors which are excluded
# the default is to include all

Enable and restart the service:

systemctl enable netdata.service
systemctl restart netdata.service


Configure /stats proxy directory in lighttpd:

cat >> /etc/lighttpd/conf-available/10-proxy.conf << 'EOF'
$HTTP["url"] =~ "^/stats/" {
  proxy.server = ( "" => ( "netdata" => ( "host" => "", "port" => 19999 ) ) )
  proxy.header = ( "map-urlpath" => ( "/stats/" => "/" ) )
lighttpd-enable-mod proxy

Restart the service:

systemctl restart lighttpd.service


The config files are based on my custom nginx configuration setup, feel free to adjust the file locations and server_name to your needs. Configure /stats proxy directory in nginx:

cat > /etc/nginx/conf.d/ << 'EOF'
proxy_buffering    off;
proxy_redirect     off;
proxy_http_version 1.1;
proxy_set_header   Connection $http_connection;
proxy_set_header   Host $host;
proxy_set_header   Upgrade $http_upgrade;
proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header   X-Forwarded-Host $host;
proxy_set_header   X-Forwarded-Server $host;
proxy_set_header   X-Forwarded-Proto $scheme;
proxy_set_header   X-Real-IP $remote_addr;
cat > /etc/nginx/conf.d/chaos.lan.conf << 'EOF'
upstream netdata {
    server     ;
    keepalive            64;

server {
    listen               80;
    listen               [::]:80;
    server_name          chaos.lan;
    index                index.html;
    root                 /usr/share/nginx/html;

    location / {
        try_files        $uri $uri/ =404;

    location ~ /stats/(?<ndpath>.*) {
        proxy_pass       http://netdata/$ndpath$is_args$args;
        include          /etc/nginx/conf.d/;

Restart the service:

systemctl restart nginx.service

Access the console to http://chaos.lan/stats/.


Unrelated to tutorial but I wanted to share my Pi’s rack, rocking DietPi. :smile:

I use an SSD connected to my Pi’s, using a microSD card will not cut it. The NetData stats will burn through your card in no time. So do your Pi a big favour and upgrade to an SSD, 128GB SSDs are very cheap. The only SATA to USB connector I found working perfectly with a Pi 4B and GeeekPi Isolated PoE HAT is the SKL Tech model.


basically you are doing 2 thinks:

  1. create a config to show temp sensor
  2. create revers proxy configuration to be able to reach netdata on a URL sub path instead of dedicated port

I disable the logs, first. They can get quite large. This can be also done at the end, once everything works.