Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/riemann/riemann-ruby-client
A Ruby client for the Riemann event system
https://github.com/riemann/riemann-ruby-client
ruby
Last synced: about 1 month ago
JSON representation
A Ruby client for the Riemann event system
- Host: GitHub
- URL: https://github.com/riemann/riemann-ruby-client
- Owner: riemann
- License: mit
- Created: 2012-02-08T06:55:24.000Z (almost 13 years ago)
- Default Branch: main
- Last Pushed: 2024-06-15T15:10:02.000Z (8 months ago)
- Last Synced: 2024-12-09T02:50:47.156Z (about 2 months ago)
- Topics: ruby
- Language: Ruby
- Homepage:
- Size: 188 KB
- Stars: 65
- Watchers: 10
- Forks: 27
- Open Issues: 3
-
Metadata Files:
- Readme: README.markdown
- Changelog: CHANGELOG.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# Riemann Ruby Client
[![CI](https://github.com/riemann/riemann-ruby-client/actions/workflows/ci.yml/badge.svg)](https://github.com/riemann/riemann-ruby-client/actions/workflows/ci.yml)
## Installing
```shell
gem install riemann-client
```## Use
```ruby
require 'riemann/client'# Create a client. Host, port and timeout are optional.
c = Riemann::Client.new host: 'localhost', port: 5555, timeout: 5# Send a simple event
c << {service: 'testing', metric: 2.5}# Or a more complex one
c << {
host: 'web3',
service: 'api latency',
state: 'warn',
metric: 63.5,
description: "63.5 milliseconds per request",
time: Time.now.to_i - 10
}# :host defaults to gethostname(). :time defaults to current unix time. You
# can explicitly override host...c << {host: nil, service: 'the cloud', state: 'nebulous'}
# Get all the states from the server
c['true']# Or specific states matching a query
c['host =~ "%.dc1" and (state = "critical" or state = "warning")']```
## Transports
Riemann::Client sends small events over UDP by default, and uses TCP for
queries and large events. UDP sends are essentially "shouting into the void".
They will not block your application and are roughly an order of magnitude
faster than TCP, but you will not know if the server is down or encountered an
error. You can specify what transport to use by selecting a subclient:``` ruby
c.udp << { :state => "ok" } # => nil
c.tcp << { :state => "ok" } # => #
c.tcp["true"] # => [#, ...]
c.udp["true"] # => raise Riemann::Client::Unsupported
```## Client state management
Riemann::Client provides some classes to make managing state updates easier.
Riemann::MetricThread starts a thread to poll a metric periodically, which can
be used to flush an accumulated value to ustate at regular intervals.Riemann::AutoState bundles a state and a client together. Any changes to the
AutoState automatically send the new state to the client.## License
The MIT License
Copyright (c) 2011-2024 Kyle Kingsbury