A bridge that connects ntopng network monitoring to Home Assistant.
- 🔌 Dual deployment options: Native HACS integration or Docker/MQTT bridge
- 📊 Real-time network throughput monitoring (upload/download)
- 🖥️ Active hosts and flows tracking
⚠️ Alert and anomaly monitoring- 📉 TCP health metrics (retransmissions, lost packets)
- 🌍 Geographic flow analysis (unique countries)
- 🔒 Security indicators (blacklisted hosts, risk scores)
- 🩺 Health monitoring with API latency and error tracking
- ⚙️ Works with ntopng Community Edition (no paid license required)
| Sensor | Description | Unit |
|---|---|---|
| Network Throughput | Combined throughput | bit/s |
| Upload Speed | Upload throughput | bit/s |
| Download Speed | Download throughput | bit/s |
| Total Bytes | Total bytes transferred | bytes |
| Bytes Uploaded | Upload volume | bytes |
| Bytes Downloaded | Download volume | bytes |
| LAN to WAN Traffic | Outbound from local network | bytes |
| WAN to LAN Traffic | Inbound to local network | bytes |
| Total Packets | Packets processed | packets |
| Packet Drops | Dropped packets | packets |
| Sensor | Description | Unit |
|---|---|---|
| Active Hosts | Number of active hosts | hosts |
| Local Hosts | Number of local hosts | hosts |
| Active Flows | Number of active flows | flows |
| Sensor | Description | Unit |
|---|---|---|
| Engaged Alerts | Total active alerts | alerts |
| Critical Alerts | Error-level alerts | alerts |
| Warning Alerts | Warning-level alerts | alerts |
| Alerted Flows | Flows with alerts | flows |
| Remote Host Anomalies | Remote anomalies detected | anomalies |
| Local Host Anomalies | Local anomalies detected | anomalies |
| Sensor | Description | Unit |
|---|---|---|
| TCP Retransmissions | Retransmitted packets | packets |
| TCP Lost | Lost packets | packets |
| TCP Out of Order | Out-of-order packets | packets |
| Sensor | Description | Unit |
|---|---|---|
| Top Protocol | Most common L7 protocol | - |
| Top Protocol by Traffic | Highest bandwidth protocol | - |
| Unique Countries | Countries in active flows | countries |
| UDP Flows | Count of UDP flows | flows |
| TCP Flows | Count of TCP flows | flows |
| Sensor | Description | Unit |
|---|---|---|
| Blacklisted Hosts | Hosts on blacklists | hosts |
| Total Risk Score | Aggregate risk score | - |
| Sensor | Description | Unit |
|---|---|---|
| CPU Load | ntopng host CPU | % |
| Memory Used | Memory usage | MB |
| Memory Total | Total memory | MB |
| ntopng Memory | Process memory | MB |
| Uptime | Human-readable uptime | - |
| Uptime Seconds | Numeric uptime | seconds |
| Sensor | Description |
|---|---|
| API Healthy | API connectivity status |
| Has Alerts | Alert problem indicator |
| Has Blacklisted Hosts | Security indicator |
- ntopng (Community Edition or higher)
- Home Assistant 2024.1.0 or higher
- For HACS installation: HACS 1.30.0 or higher
- For Docker installation: MQTT broker (e.g., Mosquitto)
- Open HACS in Home Assistant
- Click the three dots in the top right → Custom repositories
- Add
https://github.com/pentafive/ntopng-ha-bridgeas an Integration - Search for "ntopng" and install
- Restart Home Assistant
- Go to Settings → Devices & Services → Add Integration → ntopng
- Copy
custom_components/ntopng/to your Home Assistantconfig/custom_components/directory - Restart Home Assistant
- Go to Settings → Devices & Services → Add Integration → ntopng
Use this method if you prefer to run a standalone bridge that publishes to MQTT.
- Clone the repository:
git clone https://github.com/pentafive/ntopng-ha-bridge.git
cd ntopng-ha-bridge- Copy and configure environment:
cp .env.example .env
# Edit .env with your settings- Build and run:
docker-compose up -dWhen adding the integration, you'll need:
| Field | Description |
|---|---|
| URL | ntopng server URL (e.g., https://192.168.1.1:3000) |
| Username | ntopng username (default: admin) |
| Password | ntopng password |
| Verify SSL | Enable for trusted certificates (disable for self-signed) |
| Interface | Select which network interface to monitor |
Note: The integration uses HTTP Basic Authentication, which is the standard ntopng API authentication method.
| Variable | Description | Default |
|---|---|---|
NTOPNG_URL |
ntopng server URL | https://localhost:3000 |
NTOPNG_USERNAME |
ntopng username | admin |
NTOPNG_PASSWORD |
ntopng password | (required) |
NTOPNG_IFID |
Interface ID to monitor | 0 |
NTOPNG_VERIFY_SSL |
Verify SSL certificate | false |
HA_MQTT_BROKER |
MQTT broker hostname | homeassistant.local |
HA_MQTT_PORT |
MQTT broker port | 1883 |
HA_MQTT_USER |
MQTT username | ntopng-ha-bridge |
HA_MQTT_PASS |
MQTT password | (required) |
POLL_INTERVAL_SECONDS |
Polling interval | 60 |
DEBUG_MODE |
Enable debug logging | false |
- Open ntopng web interface
- Look at the URL when viewing an interface
- The
ifidparameter is your interface ID (e.g.,ifid=0)
Entity IDs follow the pattern: sensor.ntopng_{interface}_{sensor_name}
type: entities
title: Network Monitor
entities:
- entity: sensor.ntopng_eth0_network_throughput
name: Network Throughput
- entity: sensor.ntopng_eth0_upload_speed
name: Upload Speed
- entity: sensor.ntopng_eth0_download_speed
name: Download Speed
- entity: sensor.ntopng_eth0_active_hosts
name: Active Hosts
- entity: sensor.ntopng_eth0_active_flows
name: Active Flows
- entity: sensor.ntopng_eth0_top_protocol
name: Top Protocol
- entity: sensor.ntopng_eth0_unique_countries
name: Countries
- entity: binary_sensor.ntopng_eth0_api_healthy
name: API StatusRun a quick test without starting the monitoring loop:
# With environment variables set
TEST_MODE=true python3 ntopng-ha-bridge.py
# Or with Docker
docker run --rm -e NTOPNG_URL=... -e NTOPNG_TOKEN=... -e TEST_MODE=true ntopng-ha-bridge- Verify ntopng is accessible:
curl -k https://your-ntopng:3000 - Test API token:
curl -k -H "Authorization: Token YOUR_TOKEN" https://your-ntopng:3000/lua/rest/v2/get/ntopng/info.lua - Check interface ID is correct
- Verify MQTT broker is running
- Test with
mosquitto_pub/mosquitto_sub - Check Home Assistant MQTT integration logs
HACS mode:
- Check Home Assistant logs for errors
- Verify the integration shows as loaded in Settings → Devices & Services
Docker mode:
- Check MQTT broker receives messages (use MQTT Explorer)
- Verify discovery prefix matches HA configuration
- Look for errors in Home Assistant logs
Apache License 2.0 - See LICENSE for details.
Contributions welcome! Please open an issue or pull request.
- pskr-ha-bridge - PSKReporter to Home Assistant bridge
- wspr-ha-bridge - WSPR to Home Assistant bridge
- ntopng - The network monitoring tool this bridge integrates with