### Example configuration
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/output/overview/README.rst
This is an example of how to configure the overview output plugin.
```xml
Overview output
overview
false
```
--------------------------------
### Example configuration
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/output/ipfix/README.rst
This is an example configuration for the IPFIX output plugin.
```xml
IPFIX output
ipfix
/tmp/ipfix/%Y%m%d%H%M%S.ipfix
false
300
true
false
false
```
--------------------------------
### Installation
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/output/ipfix/CMakeLists.txt
Installs the ipfix-output library to the specified destination.
```cmake
install(
TARGETS ipfix-output
LIBRARY DESTINATION "${INSTALL_DIR_LIB}/ipfixcol2/"
)
```
--------------------------------
### Installation Rules
Source: https://github.com/cesnet/ipfixcol2/blob/master/extra_plugins/output/unirec/CMakeLists.txt
Specifies where the built library and configuration files should be installed.
```cmake
install(
TARGETS unirec-output
LIBRARY DESTINATION "${INSTALL_DIR_LIB}/ipfixcol2/"
)
install(
FILES config/unirec-elements.txt
DESTINATION "${INSTALL_DIR_SYSCONF}/ipfixcol2/"
)
```
--------------------------------
### Install the library
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/output/overview/CMakeLists.txt
Installs the overview-output library to the specified destination directory.
```cmake
install(
TARGETS overview-output
LIBRARY DESTINATION "${INSTALL_DIR_LIB}/ipfixcol2/"
)
```
--------------------------------
### Install the library
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/output/forwarder/CMakeLists.txt
Installs the forwarder-output library to the specified destination.
```cmake
install(
TARGETS forwarder-output
LIBRARY DESTINATION "${INSTALL_DIR_LIB}/ipfixcol2/"
)
```
--------------------------------
### Example output
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/output/overview/README.rst
This is an example of the JSON output provided by the overview plugin.
```json
{
"total_number_of_records": 24985802,
"elements": [
{
"pen": 0,
"id": 136,
"data_type": "unsigned8",
"name": "iana:flowEndReason",
"aliases": [ ],
"in_number_of_records": 1112239,
"in_percent_of_records": 4.45
},
{
"pen": 0,
"id": 1,
"data_type": "unsigned64",
"name": "iana:octetDeltaCount",
"aliases": [ "bytes" ],
"in_number_of_records": 1112239,
"in_percent_of_records": 4.45
},
...
]
}
```
--------------------------------
### Install the library
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/input/ipfix/CMakeLists.txt
Installs the ipfix-input library to the specified destination.
```cmake
install(
TARGETS ipfix-input
LIBRARY DESTINATION "${INSTALL_DIR_LIB}/ipfixcol2/"
)
```
--------------------------------
### Example configuration
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/output/viewer/README.rst
This is an example of how to configure the viewer output plugin in XML format.
```xml
Viewer output
viewer
```
--------------------------------
### Install the library
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/output/viewer/CMakeLists.txt
Installs the viewer-output library to the specified destination directory.
```cmake
install(
TARGETS viewer-output
LIBRARY DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/ipfixcol2/"
)
```
--------------------------------
### Install Target
Source: https://github.com/cesnet/ipfixcol2/blob/master/extra_plugins/output/lnfstore/CMakeLists.txt
Installs the lnfstore-output library to the IPFIXcol2 library directory.
```cmake
install(
TARGETS lnfstore-output
LIBRARY DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/ipfixcol2/"
)
```
--------------------------------
### Install Target
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/input/tcp/CMakeLists.txt
Installs the tcp-input library to the specified destination.
```cmake
install(
TARGETS tcp-input
LIBRARY DESTINATION "${INSTALL_DIR_LIB}/ipfixcol2/"
)
```
--------------------------------
### Example configuration
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/output/forwarder/README.rst
This is an example configuration for the Forwarder output plugin, demonstrating how to set up forwarding to multiple collectors using round-robin mode.
```xml
Forwarder
forwarder
roundrobin
tcp
Subcollector 1
192.168.1.2
4739
Subcollector 2
192.168.1.3
4739
Subcollector 3
localhost
4739
```
--------------------------------
### Example configuration
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/output/json/README.rst
A complex configuration example with all available output options enabled. Users should remove or comment out outputs they do not intend to use.
```xml
JSON output
json
formatted
formatted
formatted
true
true
true
true
false
false
false
false
Local server
8000
no
Send to my server
```
--------------------------------
### Example Configuration
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/input/ipfix/README.rst
An example XML configuration for the IPFIX File input plugin.
```xml
IPFIX File
ipfix
/tmp/flow/file.ipfix
```
--------------------------------
### Install Target
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/output/json/CMakeLists.txt
Installs the json-output library to the specified destination.
```cmake
install(
TARGETS json-output
LIBRARY DESTINATION "${INSTALL_DIR_LIB}/ipfixcol2/"
)
```
--------------------------------
### Installation Target
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/tools/ipfixsend/CMakeLists.txt
Installs the ipfixsend2 executable to the bin directory.
```cmake
install(
TARGETS ipfixsend2
DESTINATION bin
)
```
--------------------------------
### Dummy Output Plugin Configuration Example
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/output/dummy/README.rst
Example XML configuration for the dummy output plugin, specifying a name, plugin type, and parameters for delay and statistics.
```xml
Dummy output
dummy
0
true
```
--------------------------------
### Project Setup and Dependencies
Source: https://github.com/cesnet/ipfixcol2/blob/master/extra_plugins/output/unirec/CMakeLists.txt
Basic CMake setup, including project name, versioning, and finding required libraries like IPFIXcol2, LibTrap, and LibUnirec.
```cmake
cmake_minimum_required(VERSION 2.8.8)
project(ipfixcol2-unirec-output)
# Description of the project
set(UNIREC_DESCRIPTION
"Output plugin for IPFIXcol2 that sends flow records in UniRec format into NEMEA modules."
)
set(UNIREC_VERSION_MAJOR 2)
set(UNIREC_VERSION_MINOR 4)
set(UNIREC_VERSION_PATCH 0)
set(UNIREC_VERSION
${UNIREC_VERSION_MAJOR}.${UNIREC_VERSION_MINOR}.${UNIREC_VERSION_PATCH})
include(CMakeModules/install_dirs.cmake)
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
# Include custom FindXXX modules
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeModules")
# Find IPFIXcol and libnf
find_package(IPFIXcol2 2.1.0 REQUIRED) # support for basicList is required
find_package(LibTrap 1.13.1 REQUIRED)
find_package(LibUnirec 2.8.0 REQUIRED)
```
--------------------------------
### Install Header Files
Source: https://github.com/cesnet/ipfixcol2/blob/master/include/CMakeLists.txt
Installs the defined header files to their respective destinations.
```cmake
install(
FILES ${TOP_HEADERS}
DESTINATION include
)
install(
FILES ${SUB_HEADERS}
DESTINATION include/ipfixcol2/
)
```
--------------------------------
### Example Configuration
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/output/json-kafka/README.rst
A complex configuration example for the JSON Kafka output plugin with all available options enabled.
```xml
JSON output
json-kafka
formatted
formatted
formatted
true
true
true
true
false
false
false
false
Send to Kafka
127.0.0.1
```
--------------------------------
### Install the library
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/input/fds/CMakeLists.txt
Installs the fds-input library to the specified destination.
```cmake
install(
TARGETS fds-input
LIBRARY DESTINATION "${INSTALL_DIR_LIB}/ipfixcol2/"
)
```
--------------------------------
### Install Library
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/output/json-kafka/CMakeLists.txt
Installs the json-kafka-output library to the specified destination.
```cmake
install(
TARGETS json-kafka-output
LIBRARY DESTINATION "${INSTALL_DIR_LIB}/ipfixcol2/"
)
```
--------------------------------
### Build and Install ipfixcol2
Source: https://github.com/cesnet/ipfixcol2/blob/master/README.rst
Steps to clone the repository, build, and install ipfixcol2 using CMake.
```bash
$ git clone https://github.com/CESNET/ipfixcol2.git
$ cd ipfixcol2
$ mkdir build && cd build && cmake ..
$ make
# make install
```
--------------------------------
### Installation Target
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/core/CMakeLists.txt
Specifies that the 'ipfixcol2' executable should be installed in the 'bin' directory.
```cmake
install(
TARGETS ipfixcol2
DESTINATION bin
)
```
--------------------------------
### Example Configuration
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/input/tcp/README.rst
An example XML configuration for the TCP input plugin, specifying the local port and IP address.
```xml
TCP input
tcp
4739
```
--------------------------------
### Example lnfstore configuration
Source: https://github.com/cesnet/ipfixcol2/blob/master/extra_plugins/output/lnfstore/README.rst
An example XML configuration for the lnfstore output plugin, specifying storage path, compression, dump interval, and indexing.
```xml
LNF storage
lnfstore
/tmp/ipfixcol/
yes
300
yes
yes
yes
```
--------------------------------
### Schema Helper Script Example Usage
Source: https://github.com/cesnet/ipfixcol2/blob/master/extra_plugins/output/clickhouse/README.rst
Example command to run the schema-helper.py script to collect data for 60 seconds, listening on port 4739 using TCP.
```bash
$ schema-helper.py -i 60 -p 4739 -t tcp
```
--------------------------------
### Install the library
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/output/timecheck/CMakeLists.txt
Installs the timecheck-output target to the specified library directory.
```cmake
install(
TARGETS timecheck-output
LIBRARY DESTINATION "${INSTALL_DIR_LIB}/ipfixcol2/"
)
```
--------------------------------
### Example Configuration
Source: https://github.com/cesnet/ipfixcol2/blob/master/extra_plugins/output/clickhouse/README.rst
An example XML configuration snippet for the ClickHouse output plugin, specifying connection details.
```xml
ClickHouse output
clickhouse
clickhouse.example.com
9000
```
--------------------------------
### Example configuration
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/output/fds/README.rst
An example configuration for the FDS output plugin, showing how to set storage path, compression, dump interval, and output selection.
```xml
FDS output
fds
/tmp/ipfixcol2/fds/
none
300
yes
iana:octetDeltaCount
iana@reverse:octetDeltaCount@reverse
iana:packetDeltaCount
iana@reverse:packetDeltaCount@reverse
iana:destinationIPv4Address
iana:destinationIPv6Address
iana:sourceIPv4Address
iana:sourceIPv6Address
iana:destinationTransportPort
iana:sourceTransportPort
iana:protocolIdentifier
cesnet:quicSNI
cesnet:TLSSNI
```
--------------------------------
### Create a linkable module
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/output/dummy/CMakeLists.txt
Defines the dummy-output library as a MODULE, linking dummy.c and config.c, and installing it.
```cmake
add_library(dummy-output MODULE
dummy.c
config.c
config.h
)
install(
TARGETS dummy-output
LIBRARY DESTINATION "${INSTALL_DIR_LIB}/ipfixcol2/"
)
```
--------------------------------
### Install the library
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/output/fds/CMakeLists.txt
Installs the fds-output library to the specified destination directory.
```cmake
install(
TARGETS fds-output
LIBRARY DESTINATION "${INSTALL_DIR_LIB}/ipfixcol2/"
)
```
--------------------------------
### Example Configuration
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/input/fds/README.rst
An example XML configuration for the FDS File input plugin.
```xml
FDS File
fds
/tmp/flow/file.ipfix
```
--------------------------------
### Installation Rule
Source: https://github.com/cesnet/ipfixcol2/blob/master/extra_plugins/output/clickhouse/CMakeLists.txt
Specifies the installation directory for the compiled library.
```cmake
install(
TARGETS clickhouse-output
LIBRARY DESTINATION "${INSTALL_DIR_LIB}/ipfixcol2/"
)
```
--------------------------------
### Example configuration
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/output/timecheck/README.rst
An example XML configuration for the TimeCheck output plugin, specifying maximum allowed deviations for past and future timestamps.
```xml
TimeCheck output
timecheck
600
0
```
--------------------------------
### Plugin subdirectories
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/CMakeLists.txt
Lists the subdirectories for input, intermediate, and output plugins to be built and installed.
```cmake
add_subdirectory(input)
add_subdirectory(intermediate)
add_subdirectory(output)
```
--------------------------------
### Example output
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/output/viewer/README.rst
This is an example of the plain text output generated by the viewer plugin for anonymized IPFIX Messages.
```text
IPFIX Message header:
Version: 10
Length: 176
Export time: 1455534348
Sequence no.: 0
ODID: 1
Set Header:
Set ID: 2 (Template Set)
Length: 160
Template Record (#1)
Template ID: 256
Field Count: 27
EN: 0 ID: 1 Size: 4 | iana:octetDeltaCount
EN: 0 ID: 2 Size: 4 | iana:packetDeltaCount
EN: 0 ID: 152 Size: 8 | iana:flowStartMilliseconds
EN: 0 ID: 153 Size: 8 | iana:flowEndMilliseconds
EN: 0 ID: 10 Size: 2 | iana:ingressInterface
EN: 0 ID: 60 Size: 1 | iana:ipVersion
EN: 0 ID: 8 Size: 4 | iana:sourceIPv4Address
EN: 0 ID: 12 Size: 4 | iana:destinationIPv4Address
EN: 0 ID: 5 Size: 1 | iana:ipClassOfService
EN: 0 ID: 192 Size: 1 | iana:ipTTL
EN: 0 ID: 4 Size: 1 | iana:protocolIdentifier
EN: 0 ID: 7 Size: 2 | iana:sourceTransportPort
EN: 0 ID: 11 Size: 2 | iana:destinationTransportPort
... <~ output shortened for clarity ~> ...
-------------------------------------------------------------------
IPFIX Message header:
Version: 10
Length: 216
Export time: 1455534348
Sequence no.: 0
ODID: 1
Set Header:
Set ID: 256 (Data Set)
Length: 200
Template ID: 256
Data Record (#1) [Length: 95]:
EN: 0 ID: 1 iana:octetDeltaCount : 76 octets
EN: 0 ID: 2 iana:packetDeltaCount : 1 packets
EN: 0 ID: 152 iana:flowStartMilliseconds : 2016-02-15T11:05:48.150Z
EN: 0 ID: 153 iana:flowEndMilliseconds : 2016-02-15T11:05:48.150Z
EN: 0 ID: 10 iana:ingressInterface : 1
EN: 0 ID: 60 iana:ipVersion : 4
EN: 0 ID: 8 iana:sourceIPv4Address : 209.246.218.165
EN: 0 ID: 12 iana:destinationIPv4Address : 93.113.168.59
EN: 0 ID: 5 iana:ipClassOfService : 0
EN: 0 ID: 192 iana:ipTTL : 122 hops
EN: 0 ID: 4 iana:protocolIdentifier : 17
EN: 0 ID: 7 iana:sourceTransportPort : 62299
EN: 0 ID: 11 iana:destinationTransportPort : 53
... <~ output shortened for clarity ~> ...
```
--------------------------------
### Example UDP Input Plugin Configuration
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/input/udp/README.rst
An example XML configuration for the UDP input plugin, specifying the input name, plugin type, and parameters such as local port and optional connection/template timeouts.
```xml
UDP input
udp
4739
600
1800
1800
```
--------------------------------
### Performance Tuning Configuration
Source: https://github.com/cesnet/ipfixcol2/blob/master/extra_plugins/output/clickhouse/README.rst
Example XML configuration for performance tuning by increasing inserterThreads, blocks, and blockInsertThreshold.
```xml
16
128
500000
```
--------------------------------
### Example output
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/output/json/README.rst
This is an example of the JSON output format for an IPFIX flow record. The available IPFIX fields depend on the structure of records sent by the exporter.
```json
{
"@type": "ipfix.entry",
"iana:octetDeltaCount": 3568720,
"iana:packetDeltaCount": 2383,
"iana:flowStartMilliseconds": "2018-05-11T19:44:29.006Z",
"iana:flowEndMilliseconds": "2018-05-11T19:44:30.364Z",
"iana:ingressInterface": 1,
"iana:ipVersion": 4,
"iana:sourceIPv4Address": "192.168.0.100",
"iana:destinationIPv4Address": "192.168.0.101",
"iana:ipClassOfService": 0,
"iana:ipTTL": 62,
"iana:protocolIdentifier": "TCP",
"iana:tcpControlBits": ".AP.S.",
"iana:sourceTransportPort": 47200,
"iana:destinationTransportPort": 20810,
"iana:egressInterface": 0,
"iana:samplingInterval": 0,
"iana:samplingAlgorithm": 0
}
```
--------------------------------
### Example TCP input plugin configuration
Source: https://github.com/cesnet/ipfixcol2/blob/master/doc/sphinx/configuration.rst
An example configuration for a TCP input plugin, specifying its name, plugin type, and parameters like local port and IP address.
```xml
TCP collector
tcp
4739
```
--------------------------------
### Manual Page Generation
Source: https://github.com/cesnet/ipfixcol2/blob/master/extra_plugins/output/unirec/CMakeLists.txt
Conditional logic to build and install a manual page if ENABLE_DOC_MANPAGE is enabled, requiring rst2man.
```cmake
if (ENABLE_DOC_MANPAGE)
find_package(Rst2Man)
if (NOT RST2MAN_FOUND)
message(FATAL_ERROR "rst2man is not available. Install python-docutils or disable manual page generation (-DENABLE_DOC_MANPAGE=False)")
endif()
# Build a manual page
set(SRC_FILE "${CMAKE_CURRENT_SOURCE_DIR}/doc/ipfixcol2-unirec-output.7.rst")
set(DST_FILE "${CMAKE_CURRENT_BINARY_DIR}/ipfixcol2-unirec-output.7")
add_custom_command(TARGET unirec-output PRE_BUILD
COMMAND ${RST2MAN_EXECUTABLE} --syntax-highlight=none ${SRC_FILE} ${DST_FILE}
DEPENDS ${SRC_FILE}
VERBATIM
)
install(
FILES "${DST_FILE}"
DESTINATION "${INSTALL_DIR_MAN}/man7"
)
endif()
```
--------------------------------
### Build IPFIXcol2 from source
Source: https://github.com/cesnet/ipfixcol2/blob/master/README.rst
This snippet outlines the steps to build IPFIXcol2 from source, including installing the libfds library and collector dependencies.
```bash
$ git clone https://github.com/CESNET/libfds.git
$ cd libfds
$ mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr
$ make
# make install
```
--------------------------------
### Install the library
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/intermediate/anonymization/CMakeLists.txt
Installs the anonymization-intermediate library to the specified destination.
```cmake
install(
TARGETS anonymization-intermediate
LIBRARY DESTINATION "${INSTALL_DIR_LIB}/ipfixcol2/"
)
```
--------------------------------
### Build Manual Page
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/input/tcp/CMakeLists.txt
Custom command to build a manual page if ENABLE_DOC_MANPAGE is set.
```cmake
if (ENABLE_DOC_MANPAGE)
# Build a manual page
set(SRC_FILE "${CMAKE_CURRENT_SOURCE_DIR}/doc/ipfixcol2-tcp-input.7.rst")
set(DST_FILE "${CMAKE_CURRENT_BINARY_DIR}/ipfixcol2-tcp-input.7")
add_custom_command(TARGET tcp-input PRE_BUILD
COMMAND ${RST2MAN_EXECUTABLE} --syntax-highlight=none ${SRC_FILE} ${DST_FILE}
DEPENDS ${SRC_FILE}
VERBATIM
)
install(
FILES "${DST_FILE}"
DESTINATION "${INSTALL_DIR_MAN}/man7"
)
endif()
```
--------------------------------
### Example configuration
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/intermediate/anonymization/README.rst
An example XML configuration for the anonymization intermediate plugin.
```xml
Flow anonymization
anonymization
CryptoPAn
0123456789abcdefghijklmnopqrstuv
```
--------------------------------
### Build a manual page
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/output/overview/CMakeLists.txt
Conditionally builds a manual page (man7) for the overview output plugin if ENABLE_DOC_MANPAGE is set.
```cmake
if (ENABLE_DOC_MANPAGE)
# Build a manual page
set(SRC_FILE "${CMAKE_CURRENT_SOURCE_DIR}/doc/ipfixcol2-overview-output.7.rst")
set(DST_FILE "${CMAKE_CURRENT_BINARY_DIR}/ipfixcol2-overview-output.7")
add_custom_command(TARGET overview-output PRE_BUILD
COMMAND ${RST2MAN_EXECUTABLE} --syntax-highlight=none ${SRC_FILE} ${DST_FILE}
DEPENDS ${SRC_FILE}
VERBATIM
)
install(
FILES "${DST_FILE}"
DESTINATION "${INSTALL_DIR_MAN}/man7"
)
endif()
```
--------------------------------
### Create a linkable module
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/output/overview/CMakeLists.txt
Defines the overview-output library as a MODULE and lists its source files.
```cmake
add_library(overview-output MODULE
src/main.cpp
src/plugin.cpp
src/config.cpp
)
```
--------------------------------
### Build Manual Page
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/output/json/CMakeLists.txt
Custom command to build a manual page if ENABLE_DOC_MANPAGE is set.
```cmake
if (ENABLE_DOC_MANPAGE)
# Build a manual page
set(SRC_FILE "${CMAKE_CURRENT_SOURCE_DIR}/doc/ipfixcol2-json-output.7.rst")
set(DST_FILE "${CMAKE_CURRENT_BINARY_DIR}/ipfixcol2-json-output.7")
add_custom_command(TARGET json-output PRE_BUILD
COMMAND ${RST2MAN_EXECUTABLE} --syntax-highlight=none ${SRC_FILE} ${DST_FILE}
DEPENDS ${SRC_FILE}
VERBATIM
)
install(
FILES "${DST_FILE}"
DESTINATION "${INSTALL_DIR_MAN}/man7"
)
endif()
```
--------------------------------
### Configure CPack
Source: https://github.com/cesnet/ipfixcol2/blob/master/pkg/rpm/CMakeLists.txt
Sets up the input and output specification files for CPack.
```cmake
set(FILE_SPEC_IN "${CMAKE_CURRENT_SOURCE_DIR}/ipfixcol2.spec.in")
set(FILE_SPEC_OUT "${RPM_BUILD_DIR}/SPECS/ipfixcol2.spec")
configure_file(
"${FILE_SPEC_IN}"
"${FILE_SPEC_OUT}"
@ONLY
)
```
--------------------------------
### Build a manual page
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/input/ipfix/CMakeLists.txt
Conditionally builds a manual page if ENABLE_DOC_MANPAGE is set, using rst2man.
```cmake
if (ENABLE_DOC_MANPAGE)
# Build a manual page
set(SRC_FILE "${CMAKE_CURRENT_SOURCE_DIR}/doc/ipfixcol2-ipfix-input.7.rst")
set(DST_FILE "${CMAKE_CURRENT_BINARY_DIR}/ipfixcol2-ipfix-input.7")
add_custom_command(TARGET ipfix-input PRE_BUILD
COMMAND ${RST2MAN_EXECUTABLE} --syntax-highlight=none ${SRC_FILE} ${DST_FILE}
DEPENDS ${SRC_FILE}
VERBATIM
)
install(
FILES "${DST_FILE}"
DESTINATION "${INSTALL_DIR_MAN}/man7"
)
endif()
```
--------------------------------
### Build a manual page
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/output/dummy/CMakeLists.txt
Conditionally builds a manual page (man7) for the dummy output plugin if ENABLE_DOC_MANPAGE is set.
```cmake
if (ENABLE_DOC_MANPAGE)
# Build a manual page
set(SRC_FILE "${CMAKE_CURRENT_SOURCE_DIR}/doc/ipfixcol2-dummy-output.7.rst")
set(DST_FILE "${CMAKE_CURRENT_BINARY_DIR}/ipfixcol2-dummy-output.7")
add_custom_command(TARGET dummy-output PRE_BUILD
COMMAND ${RST2MAN_EXECUTABLE} --syntax-highlight=none ${SRC_FILE} ${DST_FILE}
DEPENDS ${SRC_FILE}
VERBATIM
)
install(
FILES "${DST_FILE}"
DESTINATION "${INSTALL_DIR_MAN}/man7"
)
endif()
```
--------------------------------
### Install IPFIXcol2 using Copr package repository on RHEL systems
Source: https://github.com/cesnet/ipfixcol2/blob/master/README.rst
This snippet shows how to install IPFIXcol2 using the Copr package repository on RHEL-based systems.
```bash
$ dnf install 'dnf-command(copr)' # Extra step necessary on some systems
$ dnf copr enable @CESNET/IPFIXcol
$ dnf install ipfixcol2
```
--------------------------------
### JSON Options Entry Example
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/output/json-kafka/README.rst
Example of a JSON representation for an IPFIX options entry, including scope count and field definitions.
```json
{
"@type": "ipfix.optionsTemplate",
"ipfix:templateId": 53252,
"ipfix:scopeCount": 1,
"ipfix:fields": [
{
"ipfix:elementId": 130,
"ipfix:enterpriseId": 0,
"ipfix:fieldLength": 4
}, {
"ipfix:elementId": 103,
"ipfix:enterpriseId": 6871,
"ipfix:fieldLength": 4
}, {
...
}
]
}
```
--------------------------------
### Build lnfstore plugin
Source: https://github.com/cesnet/ipfixcol2/blob/master/extra_plugins/output/lnfstore/README.rst
Steps to build the lnfstore plugin, requiring IPFIXcol and its dependencies.
```sh
$ mkdir build && cd build && cmake ..
$ make
# make install
```
--------------------------------
### Include Directories
Source: https://github.com/cesnet/ipfixcol2/blob/master/extra_plugins/output/lnfstore/CMakeLists.txt
Includes header files from IPFIXcol2, libfds, libnf, and libbfindex.
```cmake
include_directories(
"${IPFIXCOL2_INCLUDE_DIRS}" # IPFIXcol2 header files
"${FDS_INCLUDE_DIRS}" # libfds header files
"${NF_INCLUDE_DIRS}" # libnf header files
"${BFI_INCLUDE_DIRS}" # libbfindex header files
)
```
--------------------------------
### Project and Version Setup
Source: https://github.com/cesnet/ipfixcol2/blob/master/extra_plugins/output/clickhouse/CMakeLists.txt
Sets the minimum CMake version, project name, and version details for the ClickHouse output plugin.
```cmake
cmake_minimum_required(VERSION 3.12)
project(ipfixcol2-clichouse-output)
# Description of the project
set(
CH_DESCRIPTION
"Output plugin for IPFIXcol2 that store flow records to ClickHouse database."
)
set(CH_VERSION_MAJOR 1)
set(CH_VERSION_MINOR 0)
set(CH_VERSION_PATCH 0)
set(CH_VERSION
${CH_VERSION_MAJOR}.${CH_VERSION_MINOR}.${CH_VERSION_PATCH})
```
--------------------------------
### Manual Page Generation
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/output/ipfix/CMakeLists.txt
Conditionally builds a manual page if ENABLE_DOC_MANPAGE is set, using rst2man.
```cmake
if (ENABLE_DOC_MANPAGE)
# Build a manual page
set(SRC_FILE "${CMAKE_CURRENT_SOURCE_DIR}/doc/ipfixcol2-ipfix-output.7.rst")
set(DST_FILE "${CMAKE_CURRENT_BINARY_DIR}/ipfixcol2-ipfix-output.7")
add_custom_command(TARGET ipfix-output PRE_BUILD
COMMAND ${RST2MAN_EXECUTABLE} --syntax-highlight=none ${SRC_FILE} ${DST_FILE}
DEPENDS ${SRC_FILE}
VERBATIM
)
install(
FILES "${DST_FILE}"
DESTINATION "${INSTALL_DIR_MAN}/man7"
)
endif()
```
--------------------------------
### Debian/Ubuntu Dependencies
Source: https://github.com/cesnet/ipfixcol2/blob/master/README.rst
Command to install necessary development packages on Debian/Ubuntu systems.
```bash
apt-get install gcc g++ cmake make python3-docutils zlib1g-dev librdkafka-dev
# Optionally: doxygen pkg-config
```
--------------------------------
### Running IPFIXcol2
Source: https://github.com/cesnet/ipfixcol2/blob/master/doc/sphinx/configuration.rst
Command to start the IPFIXcol2 collector with a specified configuration file.
```bash
ipfixcol2 -c
```
--------------------------------
### Create Static Library
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/core/CMakeLists.txt
Creates a static library named 'ipfixcol2base' from all the defined core source files.
```cmake
add_library(
ipfixcol2base STATIC
${CORE_SOURCE}
)
```
--------------------------------
### Basic List Conversion
Source: https://github.com/cesnet/ipfixcol2/blob/master/src/plugins/output/json/README.rst
Example of a converted basicList, showing 'fieldID' and 'data' fields.
```json
{
"example:blField": {
"@type": "basicList",
"semantic": "anyOf",
"fieldID": "iana:octetDeltaCount",
"data": [23, 34, 23]
}
}
```