Kafka Event Manager
- You can send events from a central server, a remote server or a poller.
- By default, this stream connector sends host_status, service_status and ba_status events. The event format is shown there.
- Aformentioned events are fired each time a host or a service is checked. Various parameters let you filter out events.
root on the Centreon central server using your favorite SSH client.
Run the command according on your system:
- Alma / RHEL / Oracle Linux 8
- Alma / RHEL / Oracle Linux 9
dnf install centreon-stream-connector-kafka
dnf install centreon-stream-connector-kafka
apt install centreon-stream-connector-kafka
To configure your stream connector, you must head over the Configuration --> Poller --> Broker configuration menu. Select the central-broker-master configuration (or the appropriate broker configuration if it is a poller or a remote server that will send events) and click the Output tab when the broker form is displayed.
Add a new generic - stream connector output and set the following fields as follow:
Add Kafka mandatory parameters
Each stream connector has a set of mandatory parameters. To add them you must click on the +Add a new entry button located below the filter category input.
|Type||Name||Value explanation||Value exemple|
|string||topic||the topic in which events are going to be written||Monitoring|
|string||brokers||Coma separeted list of brokers that are ready to receive data||broker_address1:port1,broker_address2:port2|
Add Kafka optional parameters
Some stream connectors have a set of optional parameters dedicated to the Software that are associated with. To add them you must click on the +Add a new entry button located below the filter category input.
|Type||Name||Value explanation||default value|
|string||logfile||the file in which logs are written||/var/log/centreon-broker/kafka-stream-connector.log|
|number||log_level||logging level from 1 (errors) to 3 (debug)||1|
All stream connectors can use a set of optional parameters that are made available through Centreon stream connectors lua modules.
All those parameters are documented here.
Some of them are overridden by this stream connector.
|Type||Name||Default value for the stream connector|
Librdkafka (library dependency) parameters
In addition to parameters from stream connectors, there is a handfull of parameters available thanks to the librdkafka library. They are all documented in the librdkafka official documentation. To use them you just need to add the sc_kafka prefix.
With that in mind, the parameter sasl.mechanism becomes _sc_kafka_sasl.mechanism in your broker configuration.
El7 and El8 repos grant access to an old librdkafka library version.
This stream connector is compatible with event bulking. Meaning that it is able to send more that one event in each call to kafka brokers.
To use this feature you must add the following parameter in your stream connector configuration.
This stream connector will send event with the following format.
"output": "CRITICAL: the wind broke my umbrella",
"output": "DOWN: putting gas in my eletric car was not a good idea",
Custom event format
This stream connector allows you to change the format of the event to suit your needs. Only the event part of the json is customisable. It also allows you to handle events type that are not handled by default such as acknowledgement events.
In order to use this feature you need to configure a json event format file and add a new stream connector parameter.
The event format configuration file must be readable by the centreon-broker user.
To learn more about custom event format and templating file, head over the following documentation.
Sending data to Kafka can be quite complicated because of all the involved parameters (either from the stream connector itself or the kafka library).
To make things easier, a lua connection test script is available.
To install it you must follow the installation procdure and then:
wget -O /tmp/kafka_test_connection.lua https://raw.githubusercontent.com/centreon/centreon-stream-connector-scripts/master/modules/tests/kafka_test_connexion.lua
Open the script and configure the kafka options that you want to use from the librdkafka official documentation (you do not need to add the sc_kafka prefix this time, just put the parameter inside the config brackets).
There are already configuration set up as examples to guide you.
If it doesn't work, you should have an error message like below (with the appropriate error message). It is strongly advised to have access to kafka to check if a message is sent from the test script.
%3|1622459610.760|FAIL|rdkafka#producer-1| [thrd:sasl_plaintext://cps-kafkan:9093/bootstrap]: sasl_plaintext://cps-kafkan:9093/bootstrap: Failed to resolve 'cps-kafkan:9093': Name or service not known