Skip to main content

A Riemann client and command line tool

Project description

http://img.shields.io/pypi/v/riemann-client.svg http://img.shields.io/pypi/l/riemann-client.svg http://img.shields.io/travis/borntyping/python-riemann-client/master.svg

A Riemann client library and command line tool for Python. It supports UDP and TCP transports, queries, and all metric types. The client library aims to provide a simple, minimal API does not require direct interaction with protocol buffers. There is also a queued client that can queue or batch events and then send them in a single message.

Usage

As a command line tool:

riemann-client [--host HOST] [--port PORT] send [-s SERVICE] [-S STATE] [-m METRIC] [...]
riemann-client [--host HOST] [--port PORT] query QUERY

The host and port used by the command line tool can also be set with the RIEMANN_HOST and RIEMANN_PORT environment variables. By default, localhost:5555 will be used.

As a library:

import riemann_client.client

with riemann_client.client.Client() as client:
    client.event(service="riemann-client", state="awesome")
    client.query("service = 'riemann-client'")

A more detailed example, using both a non-default transport and a queued client:

from riemann_client.transport import TCPTransport
from riemann_client.client import QueuedClient

with QueuedClient(TCPTransport("localhost", 5555)) as client:
    client.event(service="one", metric_f=0.1)
    client.event(service="two", metric_f=0.2)
    client.flush()

The QueuedClient class modifies the event() method to add events to a queue instead of immediately sending them, and adds the flush() method to send the current event queue as a single message.

Installation

riemann-client requires Python 2.6 or above, and can be installed with pip install riemann-client. It will use Google’s protobuf library when running under Python 2, and GreatFruitOmsk’s protobuf-py3 fork when running under Python 3. Python 3 support is experimental and is likley to use Google’s protobuf once it supports Python 3 fully.

Requirements

Changelog

Version 6.0.0

  • riemann_client.client.Client.create_dict only returns event fields that are set on the Protocol Buffers Event object

  • riemann-client send ...` only outputs fields that were set on the message

Version 5.1.0

  • Added Python 3 support

  • Changed riemann_client.riemann_pb2 to wrap _py2 and _py3 modules

  • Changed setup.py to dynamically select a protobuf dependency

Version 5.0.x

  • Added API documentation (http://riemann-client.readthedocs.org/)

  • Replaced argparse with click for an improved CLI

  • Various command line parameters changed

  • --event-host became --host

  • --print was removed, send always prints the sent event

  • Minor fixes to QueuedClient API

  • UDPTransport.send returns None instead of NotImplemented

Version 4.2.x

  • Added events() and send_events() methods to the client

  • Added clear_queue() method to the queued client

  • Add --timeout option for TCP based transports

Version 4.1.x

  • Full Riemann protocol support (TLS transport, event attributes)

  • Fixes for multiple broken features (--tags, --print)

  • Raise errors when clients are used incorrectly

  • Client displays errors from Riemann nicely

  • Relaxed version requirements to fit CentOS 6 packages

Version 3.0.x

  • Renamed module from riemann to riemann_client

  • Command line interface was rewritten, and is now the only part of the library that respects the RIEMANN_HOST and RIEMANN_PORT environment variables

  • Support for querying the Riemann index was added

  • Internally, transports now define send instead of write, and TCPTransport.send returns Riemann’s response message

Licence

riemann-client is licensed under the MIT Licence. The protocol buffer definition is sourced from the Riemann Java client, which is licensed under the Apache Licence.

Authors

riemann-client was written by Sam Clements, while working at DataSift.

https://0.gravatar.com/avatar/8dd5661684a7385fe723b7e7588e91ee?d=https%3A%2F%2Fidenticons.github.com%2Fe83ef7586374403a328e175927b98cac.png&r=x&s=40 https://1.gravatar.com/avatar/a3a6d949b43b6b880ffb3e277a65f49d?d=https%3A%2F%2Fidenticons.github.com%2F065affbc170e2511eeacb3bd0e975ec1.png&r=x&s=40

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

riemann-client-6.0.2.tar.gz (17.3 kB view details)

Uploaded Source

Built Distributions

riemann_client-6.0.2-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

riemann_client-6.0.2-py2-none-any.whl (21.4 kB view details)

Uploaded Python 2

File details

Details for the file riemann-client-6.0.2.tar.gz.

File metadata

File hashes

Hashes for riemann-client-6.0.2.tar.gz
Algorithm Hash digest
SHA256 1b3df517166561fa62e443ef8ed81a32ac53616d61fe43d23a48a66450c357ad
MD5 6e5c7b51a59ccf8a3429b3040c40c8f3
BLAKE2b-256 fa204edcd854522d2a5dc22c3a3f5ff451d65f07838ef8bf15a251503fa6af6d

See more details on using hashes here.

File details

Details for the file riemann_client-6.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for riemann_client-6.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 777e4587fcb55f7285db6ce032c15d586a5df04c9797acf048f369f0f4f22ca4
MD5 cb51fb7374a6262ecc0a4707cded2c7f
BLAKE2b-256 74c6099030bf04c69cad80493080697f29a162017882f11376bc2fff2ac7d90f

See more details on using hashes here.

File details

Details for the file riemann_client-6.0.2-py2-none-any.whl.

File metadata

File hashes

Hashes for riemann_client-6.0.2-py2-none-any.whl
Algorithm Hash digest
SHA256 4953c32631089a6e8a802bbf94bebd04428f1e7ee6cfa6b3ce40c09dfde717bf
MD5 5282c07f9342cb65bca8aae35825d816
BLAKE2b-256 5655dd563d3d4089c0144ab3042bd43058cf6c2dfc2d25305ca549d37d63464b

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