Enable the Kafka Producer
The Kafka Producer is disabled by default and can be enabled as follows.
First, log in to the Karaf shell of your Horizon instance and configure the Kafka client settings to point to your Kafka server(s). See Producer Configs for a complete list of available options.
ssh -p 8101 admin@localhost
config:edit org.opennms.features.kafka.producer.client
config:property-set bootstrap.servers kafka-server-ip:9092 (1)
config:update
| 1 | Set the Kafka server IP or hostname by replacing the kafka-server-ip and port of an existing Kafka cluster that you want to connect to.
Add multiple hosts in a comma-separated list; for example, kafka-server-1:9092,kafka-server-2:9092 |
Per-Topic Kafka Configuration
For advanced deployments, you can configure different Kafka clusters for different types of messages. This allows you to send events to one set of Kafka servers, alarms to another set, and metrics to yet another set. The following configuration PIDs are available for per-topic configuration:
| Message Type | Configuration PID |
|---|---|
Events |
|
Alarms |
|
Metrics |
|
Nodes |
|
Topology (vertices and edges) |
|
Alarm Feedback |
|
If a topic-specific PID configuration does not exist or does not have bootstrap.servers configured, the system will fall back to the global configuration (org.opennms.features.kafka.producer.client).
config:edit org.opennms.features.kafka.producer.client.events
config:property-set bootstrap.servers events-kafka:9092
config:update
config:edit org.opennms.features.kafka.producer.client.alarms
config:property-set bootstrap.servers alarms-kafka:9092
config:update
config:edit org.opennms.features.kafka.producer.client.metrics
config:property-set bootstrap.servers metrics-kafka:9092
config:update
Next, install the opennms-kafka-producer feature from that same shell using:
feature:install opennms-kafka-producer
To ensure that the feature continues to be installed on subsequent restarts, add opennms-kafka-producer to a file in featuresBoot.d:
echo "opennms-kafka-producer" | sudo tee ${OPENNMS_HOME}/etc/featuresBoot.d/kafka-producer.boot
| Whenever configuration is updated at runtime, the feature must be stopped and restarted. |