Complete Phase 8: NetDisco Integration with NetBox
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Tasks completed: - 8.1: SNMP configuration on MikroTik devices - 8.2: NetDisco deployment - 8.3: Discovery configuration - 8.4: Traefik ingress with Authentik SSO - 8.5: NetBox sync script - 8.6: Testing and validation Key fix: session_cookie_key manual insertion in database
This commit is contained in:
@@ -1,4 +1,28 @@
|
||||
## 2026-01-19 - NetDisco Web UI Fixed
|
||||
## 2026-01-19 - Phase 8 NetDisco Integration COMPLETED
|
||||
|
||||
### All Tasks Completed
|
||||
- [8.1] SNMP enabled on hAP ax³, cAP ac, CSS326
|
||||
- [8.2] NetDisco deployed (backend + web containers)
|
||||
- [8.3] Discovery configured (3 devices discovered)
|
||||
- [8.4] Traefik ingress with Authentik SSO
|
||||
- [8.5] NetBox sync script created and tested
|
||||
- [8.6] All functionality verified
|
||||
|
||||
### Key Fix
|
||||
- [FIX] session_cookie_key missing from database - manually inserted
|
||||
|
||||
### Metrics
|
||||
- Devices discovered: 3
|
||||
- Ports collected: 52
|
||||
- MAC addresses tracked: 19
|
||||
|
||||
### Access
|
||||
- External: https://netdisco.xtrm-lab.org (SSO)
|
||||
- Internal: http://192.168.31.2:5000
|
||||
|
||||
---
|
||||
|
||||
|
||||
### Task 8.4: Traefik Ingress - VERIFIED WORKING
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Phase 8: NetDisco Integration with NetBox
|
||||
|
||||
**Status:** IN PROGRESS (Tasks 8.1-8.4 Complete)
|
||||
**Status:** ✅ COMPLETED
|
||||
**Priority:** Medium
|
||||
**Created:** 2026-01-19
|
||||
**Last Updated:** 2026-01-19
|
||||
@@ -23,8 +23,8 @@ Deploy NetDisco for enterprise-grade network discovery using SNMP, and integrate
|
||||
| 8.2 | Deploy NetDisco on Unraid | ✅ COMPLETED |
|
||||
| 8.3 | Configure NetDisco Discovery | ✅ COMPLETED |
|
||||
| 8.4 | Traefik Ingress for NetDisco | ✅ COMPLETED |
|
||||
| 8.5 | NetBox Integration | ⏳ PENDING |
|
||||
| 8.6 | Testing & Validation | ⏳ PENDING |
|
||||
| 8.5 | NetBox Integration | ✅ COMPLETED |
|
||||
| 8.6 | Testing & Validation | ✅ COMPLETED |
|
||||
|
||||
---
|
||||
|
||||
@@ -257,3 +257,95 @@ INSERT INTO sessions (id, a_session) VALUES ('dancer_session_cookie_key', md5(ra
|
||||
- [NetDisco GitHub Issues](https://github.com/netdisco/netdisco-docker/issues)
|
||||
- [MikroTik SNMP Documentation](https://help.mikrotik.com/docs/spaces/ROS/pages/8978519/SNMP)
|
||||
- [NetBox Plugin for NetDisco](https://github.com/mksoska/netbox-plugin-netdisco)
|
||||
|
||||
### Task 8.5: NetBox Integration (COMPLETED)
|
||||
|
||||
**Implementation: Custom Sync Script**
|
||||
|
||||
The prototype NetBox plugin for NetDisco was not production-ready, so a custom Python sync script was created.
|
||||
|
||||
**Script Location:** `/mnt/user/appdata/netdisco/scripts/sync_to_netbox.py`
|
||||
|
||||
**What It Does:**
|
||||
1. Reads device data from NetDisco PostgreSQL database
|
||||
2. Matches devices in NetBox by name
|
||||
3. Updates NetBox device comments with NetDisco data:
|
||||
- IP address
|
||||
- OS version
|
||||
- Model
|
||||
- Vendor
|
||||
- Last SNMP discovery timestamp
|
||||
|
||||
**NetBox API Token:**
|
||||
- Token: `kI2HiUD8Bb53KfdkOTaiWYxZuERjhGU30CgGdYxm`
|
||||
- Type: v1 (plaintext)
|
||||
- User: admin
|
||||
- Permissions: Write-enabled
|
||||
|
||||
**Running the Sync:**
|
||||
```bash
|
||||
docker run --rm --network dockerproxy \
|
||||
-v /mnt/user/appdata/netdisco/scripts:/scripts \
|
||||
python:3.11-slim sh -c \
|
||||
'pip install -q psycopg2-binary requests && python /scripts/sync_to_netbox.py'
|
||||
```
|
||||
|
||||
**Sync Results:**
|
||||
| NetBox Device | NetDisco Device | IP | Status |
|
||||
|---------------|-----------------|-----|--------|
|
||||
| HAPax3 | HAPax3 | 192.168.31.1 | ✅ Synced |
|
||||
| CSS326 | CSS326-24G-2S+ | 192.168.31.9 | ✅ Synced |
|
||||
| CAP-XL-ac | CAP XL ac | 192.168.31.6 | ✅ Synced |
|
||||
|
||||
**Scheduling (Optional):**
|
||||
To run automatically, add to cron:
|
||||
```bash
|
||||
# Run sync hourly at :45
|
||||
45 * * * * docker run --rm --network dockerproxy -v /mnt/user/appdata/netdisco/scripts:/scripts python:3.11-slim sh -c 'pip install -q psycopg2-binary requests 2>/dev/null && python /scripts/sync_to_netbox.py' >> /mnt/user/appdata/netdisco/logs/sync.log 2>&1
|
||||
```
|
||||
|
||||
|
||||
### Task 8.6: Testing & Validation (COMPLETED)
|
||||
|
||||
**Verification Results:**
|
||||
|
||||
| Test | Result |
|
||||
|------|--------|
|
||||
| SNMP to hAP ax³ (192.168.31.1) | ✅ Responding |
|
||||
| SNMP to cAP ac (192.168.31.6) | ✅ Responding |
|
||||
| SNMP to CSS326 (192.168.31.9) | ✅ Responding |
|
||||
| Device discovery | ✅ 3 devices discovered |
|
||||
| Port mapping | ✅ 52 ports collected |
|
||||
| MAC address tracking | ✅ 19 nodes tracked |
|
||||
| NetBox sync | ✅ All 3 devices synced |
|
||||
| Internal access (port 5000) | ✅ HTTP 200 |
|
||||
| External access (Traefik) | ✅ SSO redirect working |
|
||||
|
||||
**Data Collected:**
|
||||
- 3 network devices (MikroTik)
|
||||
- 52 switch/router ports
|
||||
- 19 MAC addresses (nodes)
|
||||
- Automatic discovery every 2 hours
|
||||
- MAC polling hourly
|
||||
|
||||
---
|
||||
|
||||
## Phase 8 Summary
|
||||
|
||||
**Status: ✅ COMPLETED**
|
||||
|
||||
All tasks in Phase 8 have been successfully completed:
|
||||
- SNMP enabled on all MikroTik devices
|
||||
- NetDisco deployed and discovering network
|
||||
- Traefik ingress with Authentik SSO configured
|
||||
- NetBox integration via custom sync script
|
||||
- All functionality verified
|
||||
|
||||
**Access URLs:**
|
||||
- NetDisco Web: https://netdisco.xtrm-lab.org (with SSO)
|
||||
- NetDisco Internal: http://192.168.31.2:5000
|
||||
|
||||
**Maintenance:**
|
||||
- Discovery runs automatically every 2 hours
|
||||
- MAC/ARP polling runs hourly
|
||||
- NetBox sync can be run manually or scheduled via cron
|
||||
|
||||
Reference in New Issue
Block a user