docker.recipes

Netdata Real-Time Monitoring

beginner

Netdata real-time performance and health monitoring for systems.

Overview

Netdata is an open-source, real-time performance monitoring and health monitoring system that was created by Costa Tsaousis in 2016. Originally designed to provide instant visibility into system performance with zero configuration, Netdata has evolved into a comprehensive monitoring platform that collects thousands of metrics per second from systems, applications, and services. Unlike traditional monitoring solutions that rely on periodic data collection, Netdata streams metrics in real-time with one-second granularity, making it invaluable for detecting performance anomalies and troubleshooting issues as they occur. This Docker implementation leverages extensive system access through volume mounts and elevated privileges to monitor both the host system and containerized workloads. The configuration maps critical system directories like /proc, /sys, and /var/log from the host into the container, enabling Netdata to collect comprehensive metrics about CPU usage, memory consumption, disk I/O, network traffic, and running processes. The Docker socket mount allows Netdata to discover and monitor other containers automatically, providing a unified view of both bare-metal and containerized infrastructure. This setup is particularly valuable for organizations transitioning to containerized environments, homelab enthusiasts seeking professional-grade monitoring, and development teams needing immediate feedback on application performance. The combination of zero-configuration deployment with Docker's portability means you can have enterprise-class monitoring running in minutes, complete with anomaly detection, customizable alerts, and interactive dashboards that update in real-time.

Key Features

  • Real-time metric collection with 1-second granularity across 2000+ system and application metrics
  • Automatic Docker container discovery and monitoring through Docker socket integration
  • Machine learning-powered anomaly detection that learns normal behavior patterns
  • Interactive web dashboard with drill-down capabilities and customizable charts at port 19999
  • Zero-configuration deployment that automatically detects and monitors available services
  • Memory-efficient design using a custom database engine optimized for time-series data
  • Built-in alerting system with support for multiple notification channels including Slack, PagerDuty, and email
  • Cloud synchronization capability for centralized monitoring across multiple nodes

Common Use Cases

  • 1Homelab monitoring for enthusiasts running multiple Docker services on single-board computers or mini PCs
  • 2Development environment monitoring to track resource usage during application testing and debugging
  • 3Small to medium business server monitoring where dedicated monitoring infrastructure isn't cost-effective
  • 4Container performance analysis for teams optimizing Docker workloads and identifying resource bottlenecks
  • 5Educational environments for learning system administration and performance monitoring concepts
  • 6Temporary monitoring deployment for troubleshooting performance issues on production systems
  • 7Edge computing monitoring for IoT deployments and remote systems with limited connectivity

Prerequisites

  • Docker Engine 20.10 or higher with support for security capabilities and AppArmor
  • Minimum 512MB RAM allocated to Docker (Netdata typically uses 50-100MB for basic monitoring)
  • Host system running Linux with /proc and /sys filesystems available for system metrics
  • Port 19999 available on the host system for web dashboard access
  • Docker socket access permissions if running as non-root user (user must be in docker group)
  • Understanding of system monitoring concepts and willingness to grant elevated container privileges

For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms

docker-compose.yml

docker-compose.yml
1services:
2 netdata:
3 image: netdata/netdata:latest
4 container_name: netdata
5 hostname: ${HOSTNAME}
6 cap_add:
7 - SYS_PTRACE
8 - SYS_ADMIN
9 security_opt:
10 - apparmor:unconfined
11 volumes:
12 - netdata_config:/etc/netdata
13 - netdata_lib:/var/lib/netdata
14 - netdata_cache:/var/cache/netdata
15 - /etc/passwd:/host/etc/passwd:ro
16 - /etc/group:/host/etc/group:ro
17 - /etc/localtime:/etc/localtime:ro
18 - /proc:/host/proc:ro
19 - /sys:/host/sys:ro
20 - /etc/os-release:/host/etc/os-release:ro
21 - /var/log:/host/var/log:ro
22 - /var/run/docker.sock:/var/run/docker.sock:ro
23 ports:
24 - "19999:19999"
25 restart: unless-stopped
26 networks:
27 - netdata-network
28
29volumes:
30 netdata_config:
31 netdata_lib:
32 netdata_cache:
33
34networks:
35 netdata-network:
36 driver: bridge

.env Template

.env
1# Netdata
2HOSTNAME=docker-host

Usage Notes

  1. 1Dashboard at http://localhost:19999
  2. 2Real-time metrics
  3. 3Zero configuration
  4. 4Docker container monitoring
  5. 5Cloud dashboard optional

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 netdata:
5 image: netdata/netdata:latest
6 container_name: netdata
7 hostname: ${HOSTNAME}
8 cap_add:
9 - SYS_PTRACE
10 - SYS_ADMIN
11 security_opt:
12 - apparmor:unconfined
13 volumes:
14 - netdata_config:/etc/netdata
15 - netdata_lib:/var/lib/netdata
16 - netdata_cache:/var/cache/netdata
17 - /etc/passwd:/host/etc/passwd:ro
18 - /etc/group:/host/etc/group:ro
19 - /etc/localtime:/etc/localtime:ro
20 - /proc:/host/proc:ro
21 - /sys:/host/sys:ro
22 - /etc/os-release:/host/etc/os-release:ro
23 - /var/log:/host/var/log:ro
24 - /var/run/docker.sock:/var/run/docker.sock:ro
25 ports:
26 - "19999:19999"
27 restart: unless-stopped
28 networks:
29 - netdata-network
30
31volumes:
32 netdata_config:
33 netdata_lib:
34 netdata_cache:
35
36networks:
37 netdata-network:
38 driver: bridge
39EOF
40
41# 2. Create the .env file
42cat > .env << 'EOF'
43# Netdata
44HOSTNAME=docker-host
45EOF
46
47# 3. Start the services
48docker compose up -d
49
50# 4. View logs
51docker compose logs -f

One-Liner

Run this command to download and set up the recipe in one step:

terminal
1curl -fsSL https://docker.recipes/api/recipes/netdata-monitoring/run | bash

Troubleshooting

  • Permission denied accessing /proc or /sys: Ensure the container has SYS_PTRACE and SYS_ADMIN capabilities and verify host filesystem permissions
  • Dashboard shows 'localhost' instead of hostname: Set the HOSTNAME environment variable in your Docker Compose file or host system
  • Docker container metrics not appearing: Verify Docker socket is properly mounted and the Docker daemon is accessible from within the container
  • High memory usage warnings: Adjust Netdata's memory limits in netdata.conf or increase available system memory as Netdata adapts to available resources
  • Web dashboard not accessible: Check if port 19999 is blocked by firewall rules and ensure no other services are using the same port
  • AppArmor security violations in logs: Add 'apparmor:unconfined' to security_opt or configure a custom AppArmor profile for Netdata container access

Community Notes

Loading...
Loading notes...

Download Recipe Kit

Get all files in a ready-to-deploy package

Includes docker-compose.yml, .env template, README, and license

Ad Space