Skip to content

Commit f461857

Browse files
Zainullin DamirZainullin Damir
authored andcommitted
Process plugins - Introduce MQTT process plugins
1 parent cbc6244 commit f461857

File tree

11 files changed

+617
-327
lines changed

11 files changed

+617
-327
lines changed

src/plugins/process/mqtt/CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,24 @@ project(ipfixprobe-process-mqtt VERSION 1.0.0 DESCRIPTION "ipfixprobe-process-mq
33
add_library(ipfixprobe-process-mqtt MODULE
44
src/mqtt.cpp
55
src/mqtt.hpp
6+
src/mqttContext.hpp
7+
src/mqttFields.hpp
8+
src/mqttHeaderType.hpp
9+
src/mqttTypeFlag.hpp
10+
src/variableLengthInt.hpp
611
)
712

813
set_target_properties(ipfixprobe-process-mqtt PROPERTIES
914
CXX_VISIBILITY_PRESET hidden
1015
VISIBILITY_INLINES_HIDDEN YES
1116
)
1217

13-
target_include_directories(ipfixprobe-process-mqtt PRIVATE
18+
target_include_directories(ipfixprobe-process-mqtt PRIVATE
1419
${CMAKE_SOURCE_DIR}/include/
20+
${CMAKE_SOURCE_DIR}/include/ipfixprobe/processPlugin
21+
${CMAKE_SOURCE_DIR}/include/ipfixprobe/pluginFactory
22+
${CMAKE_SOURCE_DIR}/src/plugins/process/common
23+
${adaptmon_SOURCE_DIR}/lib/include/public/
1524
)
1625

1726
if(ENABLE_NEMEA)

src/plugins/process/mqtt/README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# MQTT Plugin
2+
3+
The **MQTT Plugin** extends flow records with MQTT (Message Queuing Telemetry Transport) message information.
4+
5+
## Features
6+
7+
- Extracts and exports MQTT fields if flow contains MQTT information.
8+
- Only MQTT v3.1.1 and v5.0 are supported.
9+
- Flow is finished when _disconect_ message is received.
10+
11+
## Parameters
12+
13+
| Long name | Short name | Type | Default | Description |
14+
| --------- | ------------ | ----- | ------- | ------------------------------------------------------- |
15+
| `tc` | `topiccount` | `int` | 10 | Maximal count of topics from _publish_ messages to save |
16+
17+
## Output Fields
18+
19+
| Field Name | Data Type | Description |
20+
| -------------------------------------------------------------------------- | ---------- | ----------------------------------------------------------------------------------------- |
21+
| `MQQT_TYPE_CUMULATIVE` | `uint16_t` | Bitfield of messages that were detected during the communication. Each value takes 1 bit. |
22+
| DISCONNECT \| PINGRESP \| PINGREQ \| UNSUBACK \| UNSUBSCRIBE \| |
23+
| SUBACK \| SUBSCRIBE \| PUBCOMP \| PUBREL \| PUBREC \| PUBACK \| PUBLISH \| |
24+
| CONNACK \| CONNECT \| session present flag from _connection_ message\| |
25+
| `MQTT_VERSION` | `uint8_t` | Identifies the MQTT version being used. |
26+
| `MQTT_CONNECTION_FLAGS` | `uint8_t` | Flags of _connection_ message. |
27+
| `MQTT_KEEP_ALIVE` | `uint16_t` | MQTT connection keep alive |
28+
| `MQTT_CONNECTION_RETURN_CODE` | `uint8_t` | Return code value from _connack_ message. |
29+
| `MQTT_PUBLISH_FLAGS` | `uint8_t` | Cumulative of _publish_ message flags. |
30+
| `MQTT_TOPICS` | `string` | Concatenation of **topiccount** topics from _publish_ messages. |
31+
32+
## Usage
33+
34+
### YAML Configuration
35+
36+
Add the plugin to your ipfixprobe YAML configuration:
37+
38+
```yaml
39+
process_plugins:
40+
- mqtt
41+
```
42+
43+
### CLI Usage
44+
45+
You can also enable the plugin directly from the command line:
46+
47+
`ipfixprobe -p mqtt ...`
48+
`ipfixprobe -p "mqtt;tc=<topic_count>" ...`

0 commit comments

Comments
 (0)