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:

add source
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?

If you have existing sources without an IP field, this command will fail! You must first add '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):

remove source
docker exec netlens bash -c "sed -i \"/'NAME' =>/d\" /var/nfsen/etc/nfsen.conf && /var/nfsen/bin/nfsen reconfig && echo 'Removed'"

List all sources

list sources
docker exec netlens grep -A 20 '%sources' /var/nfsen/etc/nfsen.conf

Check NfSen status

status
docker exec netlens /var/nfsen/bin/nfsen status

Why 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.

check current sources
docker exec netlens grep -A 20 '%sources' /var/nfsen/etc/nfsen.conf

Source names matter for LibreNMS

Keep source identifiers short and stable. NfSen idents are limited to 21 characters, and LibreNMS matching replaces dots with the configured split character. See the LibreNMS integration guide for the naming contract.