# Genereated from VyOS configuration
daemonize: true
promisc: false
syslog: daemon
uacctd_group: 2
uacctd_nl_size: 2097152
snaplen: {{ packet_length }}
aggregate: in_iface{{ ',out_iface' if enable_egress is vyos_defined }},src_mac,dst_mac,vlan,src_host,dst_host,src_port,dst_port,proto,tos,flows
{% set pipe_size = buffer_size | int *1024 *1024 %}
plugin_pipe_size: {{ pipe_size }}
{# We need an integer division (//) without any remainder or fraction #}
plugin_buffer_size: {{ pipe_size // 1000 }}
{% if syslog_facility is vyos_defined %}
syslog: {{ syslog_facility }}
{% endif %}
{% if disable_imt is not defined %}
imt_path: /tmp/uacctd.pipe
imt_mem_pools_number: 169
{% endif %}

{% set plugin = [] %}
{% if netflow.server is vyos_defined %}
{%     for server in netflow.server %}
{%         set nf_server_key = 'nf_' ~ server | dot_colon_to_dash %}
{%         set _ = plugin.append('nfprobe['~ nf_server_key ~ ']') %}
{%     endfor %}
{% endif %}
{% if sflow.server is vyos_defined %}
{%     for server in sflow.server %}
{%         set sf_server_key = 'sf_' ~ server | dot_colon_to_dash %}
{%         set _ = plugin.append('sfprobe[' ~ sf_server_key ~ ']') %}
{%     endfor %}
{% endif %}
{% if disable_imt is not defined %}
{%     set _ = plugin.append('memory') %}
{% endif %}
plugins: {{ plugin | join(',') }}

{% if netflow.server is vyos_defined %}
# NetFlow servers
{%     for server, server_config in netflow.server.items() %}
{#         # prevent pmacct syntax error when using IPv6 flow collectors #}
{%         set nf_server_key = 'nf_' ~ server | dot_colon_to_dash %}
nfprobe_receiver[{{ nf_server_key }}]: {{ server | bracketize_ipv6 }}:{{ server_config.port }}
nfprobe_version[{{ nf_server_key }}]: {{ netflow.version }}
{%         if netflow.engine_id is vyos_defined %}
nfprobe_engine[{{ nf_server_key }}]: {{ netflow.engine_id }}
{%         endif %}
{%         if netflow.max_flows is vyos_defined %}
nfprobe_maxflows[{{ nf_server_key }}]: {{ netflow.max_flows }}
{%         endif %}
{%         if netflow.sampling_rate is vyos_defined %}
sampling_rate[{{ nf_server_key }}]: {{ netflow.sampling_rate }}
{%         endif %}
{%         if netflow.source_address is vyos_defined %}
nfprobe_source_ip[{{ nf_server_key }}]: {{ netflow.source_address | bracketize_ipv6 }}
{%         endif %}
{%         if netflow.timeout is vyos_defined %}
nfprobe_timeouts[{{ nf_server_key }}]: expint={{ netflow.timeout.expiry_interval }}:general={{ netflow.timeout.flow_generic }}:icmp={{ netflow.timeout.icmp }}:maxlife={{ netflow.timeout.max_active_life }}:tcp.fin={{ netflow.timeout.tcp_fin }}:tcp={{ netflow.timeout.tcp_generic }}:tcp.rst={{ netflow.timeout.tcp_rst }}:udp={{ netflow.timeout.udp }}
{%         endif %}

{%     endfor %}
{% endif %}

{% if sflow.server is vyos_defined %}
# sFlow servers
{%     for server, server_config in sflow.server.items() %}
{#         # prevent pmacct syntax error when using IPv6 flow collectors #}
{%         set sf_server_key = 'sf_' ~ server | dot_colon_to_dash %}
sfprobe_receiver[{{ sf_server_key }}]: {{ server | bracketize_ipv6 }}:{{ server_config.port }}
sfprobe_agentip[{{ sf_server_key }}]: {{ sflow.agent_address }}
{%         if sflow.sampling_rate is vyos_defined %}
sampling_rate[{{ sf_server_key }}]: {{ sflow.sampling_rate }}
{%         endif %}
{%         if sflow.source_address is vyos_defined %}
sfprobe_source_ip[{{ sf_server_key }}]: {{ sflow.source_address | bracketize_ipv6 }}
{%         endif %}

{%     endfor %}
{% endif %}