Skip to content

Commit

Permalink
ipfixprobed: extend service to support list of interfaces
Browse files Browse the repository at this point in the history
Configuration file now allows to declare IFCLIST array to specify
multiple instances of `-I` argument.

The example was added into link0.conf.example
  • Loading branch information
cejkato2 authored and hynekkar committed Mar 24, 2021
1 parent 016e752 commit 6b168d9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
18 changes: 16 additions & 2 deletions init/ipfixprobed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/sh
#!/usr/bin/bash

CONFFILE="/etc/ipfixprobe/$1.conf"

Expand All @@ -9,7 +9,21 @@ if [ -e "$CONFFILE" ]; then
else
udpparam=""
fi
exec /usr/bin/ipfixprobe -I "$NIC" -p "$PLUGINS" -L "$LINK" -D "$DIR" -x "$COLLECTOR" $udpparam
ifcargs=""
if `declare -p IFCLIST > /dev/null 2>/dev/null`; then
# list of interfaces/DMA channels
for ifc in "${!IFCLIST[@]}"; do
ifcargs="$ifcargs -I ${IFCLIST[ifc]}"
done
else
# use plain old one NIC interface
if [ -z "$NIC" ]; then
echo "Configuration file '$CONFFILE' does not exist, exitting." >&2
exit 1
fi
ifcargs="-I $NIC"
fi
exec /usr/bin/ipfixprobe $ifcargs -p "$PLUGINS" -L "$LINK" -D "$DIR" -x "$COLLECTOR" $udpparam
else
echo "Configuration file '$CONFFILE' does not exist, exitting." >&2
exit 1
Expand Down
11 changes: 9 additions & 2 deletions init/link0.conf.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
# set up shell-like variables

# Network interface
NIC=eth0
# List of interfaces / DMA channels
# Specify array of devices using IFCLIST[], indexes (subscripts) must be unique
IFCLIST[0]=/dev/nfb0:0
IFCLIST[1]=/dev/nfb0:1
# ... more IFCLIST can be added

# One network interface
# NOTE: remove IFCLIST variables and uncomment NIC if you prefer to use this way:
# NIC=eth0

# List of activated plugins, to skip plugins, use "basic" only:
# PLUGINS=basic
Expand Down

0 comments on commit 6b168d9

Please sign in to comment.