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, and 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.
This project is no longer maintained. Please contact me by opening an issue on the GitHub project if you'd like to fork this repository and take over the ``riemann-client`` PyPI package.
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_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()
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.
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 likely to use
Google's protobuf once it supports Python 3 fully.
Testing is done with tox:
--echo/--no-echooption to the CLI.
- Fixed tests inclusion in tarball.
- Fixed socket error handling in
riemann_client.client.Client.create_dictonly returns event fields that are set on the Protocol Buffers
riemann-client send ...only outputs fields that were set on the message
- Added Python 3 support
setup.pyto dynamically select a
- Added API documentation (http://riemann-client.readthedocs.org/)
clickfor an improved CLI
- Various command line parameters changed
sendalways prints the sent event
- Minor fixes to
send_events()methods to the client
clear_queue()method to the queued client
--timeoutoption for TCP based transports
- Full Riemann protocol support (TLS transport, event attributes)
- Fixes for multiple broken features (
- Raise errors when clients are used incorrectly
- Client displays errors from Riemann nicely
- Relaxed version requirements to fit CentOS 6 packages
- Renamed module from
- Command line interface was rewritten, and is now the only part of the library
that respects the
- Support for querying the Riemann index was added
- Internally, transports now define
TCPTransport.sendreturns Riemann's response message