Settings
Default configuration can be changed via environment variables in /srv/collector/.env file
(learn more).
Flow Collection
To turn on/off receiving IPv6 packets use:
COLLECTOR_ENABLE_IPV6(default: true)
Collector accepts UDP packets with flow data to any of the following ports defined by environment variables:
COLLECTOR_NETFLOW_V5_PORT(default: 9555)COLLECTOR_NETFLOW_V9_PORT(default: 9995)COLLECTOR_IPFIX_UDP_PORT(default: 4739)COLLECTOR_SFLOW_PORT(default: 6343)
Collector automatically detects flow protocol from UDP payload regardless of the port the packet has arrived on. Variable names contain protocol names only for compatibility with previous versions.
Collector accepts connections from exporters using IPFIX over TCP
on port defined by COLLECTOR_IPFIX_TCP_PORT variable (default: 4739).
For each exporter, Collector keeps flow export parameters (templates and sampling) in memory. The number of simultaneously supported exporters and export domains is limited by the following variables:
COLLECTOR_CFLOW_SESSIONS(default:4096): the maximum number of flow export connections Collector can accept at the same time (the value must be a power of 2, from 16 to 65536). The value can be decreased to reduce memory consumption, but then the number of exporters Collector can support simultaneously decreases too: when the limit is reached, packets from new exporters are dropped.COLLECTOR_CFLOW_SCOPES(default:16384): the maximum number of flow export domains for which Collector keeps the sampling. The value must be a power of 2 (from 16 to 65536) and must not be less thanCOLLECTOR_CFLOW_SESSIONS. The value can be decreased to reduce memory consumption, but then the number of domains for which Collector keeps the sampling decreases too; for the remaining domains the default sampling set when the exporter was added is used, and the flow rate for them is calculated incorrectly.COLLECTOR_CFLOW_SESSION_TIMEOUT(default:60): the time in seconds during which Collector keeps the flow export parameters of an inactive exporter. The value should match the period with which exporters send flow: if an exporter sends flow with pauses longer than 60 seconds, increase the value, otherwise after the pause Collector stops keeping the session parameters and the templates previously sent by the exporter.
PSAMP (IPFIX) or sFlow packets containing frame data
are parsed by Collector taking into account the stack
of MPLS labels. The maximum number of MPLS labels
in the stack that Collector can parse is set by
the COLLECTOR_MAX_MPLS_LABELS variable
(default: 16, allowed values: from 0 to 16).
A frame with a label stack deeper than the value
is not parsed and is not used.
The value can be decreased to drop packets
with frames carrying a deep MPLS label stack.
Flow Processing
The number of CPU cores used by Collector for flow
processing is set by the COLLECTOR_FLOW_THREAD_COUNT
variable (default: 1).
Each of the specified cores is used by Collector
entirely for flow processing.
To increase the flow processing rate, the variable
value can be increased.
The upper limit must be respected: the number
of specified cores must not exceed the number of
available cores minus one; one core must be
left as a reserve.
ClickHouse
Collector saves flow from incoming packets to ClickHouse located using:
COLLECTOR_CLICKHOUSE_ADDRESS(default:127.0.0.1:9000): ClickHouse address and TCP port used by thecollectorservice to write flow.COLLECTOR_BACKEND_CLICKHOUSE_ADDRESS(default:clickhouse.collector:9000): ClickHouse address and TCP port used by thebackendservice.
When using a standalone database, both address variables refer to it. See the standalone ClickHouse installation procedure for deployment steps and CPU configuration.
By default, ClickHouse is configured to work on the server minimum configuration. In order for ClickHouse to efficiently and safely use the entire available amount of RAM, you need to configure its limits.
COLLECTOR_CLICKHOUSE_RAM_RATIO_MAX(default:0.7): the ratio to physical RAM for ClickHouse server amount of RAM used. Recommended value:0.7. If ClickHouse on a single server -0.9.
For example, 32 Gb of RAM is installed on the machine, the RAM limit for the ClickHouse server is 20.8 Gb:
COLLECTOR_CLICKHOUSE_QUERY_RAM_MAX(default:10Gi): the maximum amount of RAM to use for running a query on a single server. The recommended initial value is calculated by the formula:0,9 × COLLECTOR_CLICKHOUSE_RAM_RATIO_MAX × (installed RAM).
This option prevents the exhaustion of available memory during parallel
processing of queries.
When the number of incoming flows or the analyzed period increase,
the value of COLLECTOR_CLICKHOUSE_QUERY_RAM_MAX should be increased.
If the number of parallel user sessions in MITIGATOR web UI
or the number of API clients increases,
the value of COLLECTOR_CLICKHOUSE_QUERY_RAM_MAX should be decreased.
For example, 32 Gb of RAM is installed on the machine, the RAM limit for the ClickHouse server is 22.4 Gb, the RAM limit for one query is 1 Gb:
In this configuration, 12 DB queries can be processed in parallel. For the internal functions of the ClickHouse server (inserting data, background data processing), at least 10.4 Gb remains.
An extended analyzing period at the “Flow Analysis” page of MITIGATOR web UI requires more RAM to process flow records. If any kind of statistics disappears as soon as the analyzed period had been extended, you have to extend RAM size for ClickHouse or enable a file system usage mode (learn more).
Set the following environment variables to change the corresponding ClickHouse configuration options:
COLLECTOR_CLICKHOUSE_MAX_BYTES_BEFORE_EXTERNAL_GROUP_BY(default:0)COLLECTOR_CLICKHOUSE_MAX_BYTES_BEFORE_EXTERNAL_SORT(default:0)
0 - dumping of temporary data is disabled.
Recommended value is calculated by the formula:
COLLECTOR_CLICKHOUSE_QUERY_RAM_MAX / 2.
For example:
Grafana Setup
Grafana is used to display the metrics gathered by Collector.
Grafana is available on port defined by the environment variables:
GRAFANA_PORT(default:3000)
Grafana can be accessed via a browser.
Default login/password: admin/admin.
At the first launch, select Data Sources, then select Collector.
Container Restart Policy
Container restart policy is controlled by the following environment variable:
CONTAINER_RESTART_POLICY(default:always)
Available values are listed in Docker documentation. Podman supports the same restart policy values; see Podman documentation for details.