Docs
Managing Router Sources
Every router that sends NetFlow needs a source in nfsen.conf. These docker exec commands add, list, and remove them — and the changes persist forever in nfsen-etc/.
Add a source with IP
Replace NAME, IP_ADDRESS, and COLOR with your values:
docker exec netlens bash -c "sed -i \"/^);$/i\\ 'NAME' => { 'port' => '2055', 'IP' => 'IP_ADDRESS', 'col' => '#COLOR', 'type' => 'netflow' },\" /var/nfsen/etc/nfsen.conf && /var/nfsen/bin/nfsen reconfig && echo 'Done'"Existing sources without IP?
'IP' => '0.0.0.0' to all existing sources before adding a new one with an IP.Remove a source
Replace NAME with your source name (e.g. router1):
docker exec netlens bash -c "sed -i \"/'NAME' =>/d\" /var/nfsen/etc/nfsen.conf && /var/nfsen/bin/nfsen reconfig && echo 'Removed'"List all sources
docker exec netlens grep -A 20 '%sources' /var/nfsen/etc/nfsen.confCheck NfSen status
docker exec netlens /var/nfsen/bin/nfsen statusWhy sources persist forever
nfsen.conf lives in the nfsen-etc/ bind mount, so router sources added via docker exec survive restarts, recreates, and even rebuilds. No environment variables are required for day-to-day source management. The NFSEN_SOURCES env var is optional — use it only if you prefer managing sources in docker-compose.yml instead.
IP requirement for multiple sources
When you have more than one source configured, NfSen requires all sources to have an IP field. If you add a source with an IP while existing sources lack one, the command will fail. Fix this by manually adding 'IP' => '0.0.0.0' to each existing source first, then update the auto-filled IPs with the actual source IPs by editing the config directly.
docker exec netlens grep -A 20 '%sources' /var/nfsen/etc/nfsen.confSource names matter for LibreNMS