Skip to main content

A Python library for sending events via kafka_consumer to OpenNMS.

Project description

package version python version

onms_kafka_events

This library will allow you to generate event objects in Python to send to a Kafka topic for OpenNMS Horizon/Meridian to process.

Documentation for this project is available at https://opennms-forge.github.io/kafka-consumer-py/

Documentation for configuring the Kafka Consumer feature on your Horizon/Meridian server can be found at https://docs.opennms.com/horizon/latest/operation/deep-dive/events/sources/kafka.html.

Installation

pip install onms-kafka-events

Associating events to nodes

When received, the eventd daemon will attempt to associate the event to a node in the following order:

  • If the nodeId field is included, the event will be matched to the node with that database ID.
  • If the event does not have nodeID, the parameters _foreignSource and _foreignId can be included to associate the event based on the requisition name and ID.
  • Any event that cannot match a node on either of these criteria will not be associated with a node.

Example

from onms_kafka_events import KafkaConnection, Severity

my_producer = KafkaConnection(
    servers=["broker01:9092", "broker02:9092"], topic="opennms-kafka-events"
)

my_event = my_producer.create_event(
    uei="uei.opennms.org/custom/event",
    severity=Severity.WARNING,
    node_id=1234,
    custom="value"
)

result = my_producer.send_event(my_event)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

onms_kafka_events-1.0.0-4.tar.gz (10.8 kB view hashes)

Uploaded Source

Built Distribution

onms_kafka_events-1.0.0-4-py3-none-any.whl (6.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page