跳转到主要内容

一个Riemann客户端和命令行工具

项目描述

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

这是一个Riemann客户端库和Python命令行工具。它支持UDP和TCP传输、查询和所有指标类型。客户端库旨在提供简单、最小化的API,并且不需要直接与协议缓冲区交互。还有一个可以排队或批量事件然后以单条消息发送的队列客户端。

该项目不再维护。如果您想fork此仓库并接管“riemann-client”PyPI包,请通过在GitHub项目上打开问题与我联系。

使用方法

作为命令行工具

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

命令行工具使用的宿主机和端口号也可以通过RIEMANN_HOSTRIEMANN_PORT环境变量设置。默认情况下,将使用localhost:5555

作为库

import riemann_client.client

with riemann_client.client.Client() as client:
    client.event(service="riemann-client", state="awesome")
    client.query("service = 'riemann-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类修改了event()方法,将其事件添加到队列而不是立即发送,并添加了flush()方法,以将当前事件队列作为单条消息发送。

安装

riemann-client 需要Python 2.6或更高版本,可以使用 pip install riemann-client 进行安装。在Python 2下运行时,它将使用Google的 protobuf 库,在Python 3下运行时,将使用 GreatFruitOmskprotobuf-py3 分支。Python 3支持是实验性的,一旦完全支持Python 3,可能会使用Google的 protobuf

需求

测试(Linux/OSX)

测试使用 tox 进行

tox

变更日志

版本 6.1.3

  • 向CLI添加了 --echo/--no-echo 选项。

版本 6.1.2

  • 修复了tarball中的测试包含问题。

版本 6.1.1

  • 修复了 riemann_client.client.AutoFlushingQueuedClient 中的socket错误处理。

版本 6.1.0

  • riemann_client.client.AutoFlushingQueuedClient 已添加。

版本 6.0.0

  • riemann_client.client.Client.create_dict 仅返回在Protocol Buffers Event 对象上设置的协议字段

  • riemann-client send ... 仅输出消息上设置的字段

版本 5.1.0

  • 添加了Python 3支持

  • riemann_client.riemann_pb2 改为包装 _py2_py3 模块

  • setup.py 改为动态选择 protobuf 依赖项

版本 5.0.x

  • 添加了API文档(http://riemann-client.readthedocs.org/

  • argparse 替换为 click 以改进CLI

  • 更改了各种命令行参数

  • --event-host 变为 --host

  • --print 已删除,send 总是打印发送的事件

  • QueuedClient API 进行了少量修复

  • UDPTransport.send 返回 None 而不是 NotImplemented

版本 4.2.x

  • 向客户端添加了 events()send_events() 方法

  • 向队列客户端添加了 clear_queue() 方法

  • 为基于TCP的传输添加了 --timeout 选项

版本 4.1.x

  • 完全支持Riemann协议(TLS传输,事件属性)

  • 修复了多个损坏的功能(--tags--print

  • 当客户端使用不正确时引发错误

  • 客户端以良好的方式显示来自Riemann的错误

  • 放宽版本要求以适应CentOS 6软件包

版本 3.0.x

  • 将模块从 riemann 重命名为 riemann_client

  • 命令行界面被重写,现在是唯一一个尊重 RIEMANN_HOSTRIEMANN_PORT 环境变量的库部分

  • 添加了对查询Riemann索引的支持

  • 内部,传输现在定义 send 而不是 write,并且 TCPTransport.send 返回Riemann的响应消息

许可

riemann-client 采用 MIT 许可证。协议缓冲区定义来源于 Riemann Java 客户端,该客户端采用 Apache 许可证

作者

riemann-clientSam Clements 编写,当时在 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

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。

源分发

riemann-client-7.0.0.tar.gz (20.8 kB 查看哈希)

上传时间

构建分发

riemann_client-7.0.0-py3-none-any.whl (17.5 kB 查看哈希)

上传时间 Python 3

由以下支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面