Skip to content

Commit 14cd897

Browse files
authored
Merge pull request #189 from CESNET/ipfix-template-export
Ipfix - add option to configure template export rate
2 parents 0f52d43 + 44d9d74 commit 14cd897

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

init/ipfixprobed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ if [ -e "$CONFFILE" ]; then
7070
if [[ $UDP == "yes" ]]; then
7171
UDP_PARAM="udp";
7272
fi
73-
output="-o ipfix;host=${HOST:-127.0.0.1};port=${PORT:-4739};id=${LINK:-0};dir=${DIR:-0};${UDP_PARAM}"
73+
output="-o ipfix;host=${HOST:-127.0.0.1};port=${PORT:-4739};id=${LINK:-0};dir=${DIR:-0};${UDP_PARAM};template=${TEMPLATE_REFRESH_RATE:-300}"
7474

7575
exec /usr/bin/ipfixprobe "${dpdkinput[@]}" $input $storage $process $output
7676
else

init/link0.conf.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,3 +174,5 @@ PORT=4739
174174
# Use UDP yes/no? (instead of TCP)
175175
UDP=yes
176176

177+
# Export ipfix template every N seconds (UDP)
178+
TEMPLATE_REFRESH_RATE=300

output/ipfix.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ void IPFIXExporter::init(const char *params)
171171
odid = parser.m_id;
172172
mtu = parser.m_mtu;
173173
dir_bit_field = parser.m_dir;
174+
templateRefreshTime = parser.m_template_refresh_time;
174175

175176
if (parser.m_udp) {
176177
protocol = IPPROTO_UDP;

output/ipfix.hpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,12 @@ class IpfixOptParser : public OptionsParser
7575
bool m_udp;
7676
uint64_t m_id;
7777
uint32_t m_dir;
78+
uint32_t m_template_refresh_time;
7879
bool m_verbose;
7980

8081
IpfixOptParser() : OptionsParser("ipfix", "Output plugin for ipfix export"),
81-
m_host("127.0.0.1"), m_port(4739), m_mtu(DEFAULT_MTU), m_udp(false), m_id(DEFAULT_EXPORTER_ID), m_dir(0), m_verbose(false)
82+
m_host("127.0.0.1"), m_port(4739), m_mtu(DEFAULT_MTU), m_udp(false), m_id(DEFAULT_EXPORTER_ID), m_dir(0),
83+
m_template_refresh_time(TEMPLATE_REFRESH_TIME), m_verbose(false)
8284
{
8385
register_option("h", "host", "ADDR", "Remote collector address", [this](const char *arg){m_host = arg; return true;}, OptionFlags::RequiredArgument);
8486
register_option("p", "port", "PORT", "Remote collector port",
@@ -94,6 +96,9 @@ class IpfixOptParser : public OptionsParser
9496
register_option("d", "dir", "NUM", "Dir bit field value",
9597
[this](const char *arg){try {m_dir = str2num<decltype(m_dir)>(arg);} catch(std::invalid_argument &e) {return false;} return true;},
9698
OptionFlags::RequiredArgument);
99+
register_option("t", "template", "NUM", "Template refresh rate (sec)",
100+
[this](const char *arg){try {m_template_refresh_time = str2num<decltype(m_template_refresh_time)>(arg);}
101+
catch(std::invalid_argument &e) {return false;} return true;}, OptionFlags::RequiredArgument);
97102
register_option("v", "verbose", "", "Enable verbose mode", [this](const char *arg){m_verbose = true; return true;}, OptionFlags::NoArgument);
98103
}
99104
};

0 commit comments

Comments
 (0)