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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file onms_kafka_events-1.0.0-4.tar.gz.

File metadata

  • Download URL: onms_kafka_events-1.0.0-4.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for onms_kafka_events-1.0.0-4.tar.gz
Algorithm Hash digest
SHA256 730d822baed3863cc79d9921f9ef56faf648cc4ff5eecd8f63f76573613d4d12
MD5 c4d707679d819833cf7a8f8114eaa306
BLAKE2b-256 2fab73e9156bf49b72d9e88998b490941ca62e00f144cccfe1ca9b86e055285c

See more details on using hashes here.

File details

Details for the file onms_kafka_events-1.0.0-4-py3-none-any.whl.

File metadata

File hashes

Hashes for onms_kafka_events-1.0.0-4-py3-none-any.whl
Algorithm Hash digest
SHA256 df3225e8427244cf9ade385dc90d4a64d6181a24b6977ca22f729a50c2533074
MD5 866fb06773f17dfb3d752b3268273675
BLAKE2b-256 8eb444cae18a8949527cfe3e3258feca2ba6a3912000a0eeb5051b0413bd032b

See more details on using hashes here.

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