Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve riemann-redis client #29

Merged
merged 5 commits into from
Mar 29, 2013
Merged

Conversation

inkel
Copy link
Contributor

@inkel inkel commented Mar 29, 2013

Currently riemann-redis tool only accepts host, port and (optional) password to connect to a Redis server. However it's better if it would additionally would accept an URL in case the user want to connect using via TCP or via socket. Auth is also possible to be specified from there for TCP connections.

Also it currently issues an INFO and sends all the data converted to float by using #to_f. While this conversion is possible for most of the values returned by INFO, some values are actually strings, which will be converted to 0 in that case, most notably aof_last_bgrewrite_status and rdb_last_bgsave_status, which reports ok or error.

Last but not least, Redis 2.6+ allows to query just for a section of the metrics, so it would be nice if each metric could be tagged properly depending on its section:

  • server: General information about the Redis server
  • clients: Client connections section
  • memory: Memory consumption related information
  • persistence: RDB and AOF related information
  • stats: General statistics
  • replication: Master/slave replication information
  • cpu: CPU consumption statistics
  • commandstats: Redis command statistics
  • cluster: Redis Cluster section
  • keyspace: Database related statistics

If anybody wants to join me, feel free to leave a comment, criticism or suggestion.

inkel added 3 commits March 29, 2013 12:15
Add additional Redis connection parameters URL and socket, in case the
user wants to connect to monitor a Redis server by using a Redis URL
that can have the following format:

* redis://server:port
* redis://:password@server:port/db
* unix:///path/to/redis.sock
Send the values of the different Redis INFO metrics that are strings in
the description field of the report.
Send the values of the persistence last status
metrics (rdb_last_bgsave_status and aof_last_bgrewrite_status) in the
state field of the report.
@inkel
Copy link
Contributor Author

inkel commented Mar 29, 2013

This is still a work in progress

@inkel
Copy link
Contributor Author

inkel commented Mar 29, 2013

So far this completes the list of things I was planning to add. It'd be nice that metrics were properly tagged. If there's interest in doing that, please let me know.

if %w{ rdb_last_bgsave_status aof_last_bgrewrite_status }.include?(property)
data[:state] = value
else
data[:description] = value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my testing, the description always gets set to nil. Do want to set it to the property name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, @gsandie, I just did a test run and I'm the description as it's supposed to. Are you here at Monitorama?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I am. In the R workshop but just about to leave it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sitting to the left of the registration table, come and see me if you like :)

@gsandie
Copy link
Contributor

gsandie commented Mar 29, 2013

👍 This is neat.

@@ -11,21 +11,47 @@ class Riemann::Tools::Redis
opt :redis_host, "Redis hostname", :default => 'localhost'
opt :redis_port, "Redis port", :default => 6379
opt :redis_password, "Redis password", :default => ''
opt :redis_url, "Redis URL", :default => ''
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to set a default value here, maybe redis://localhost:6379 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about it, but that would break backwards compatibility with existing clients that rely on using --redis-host and redis-port: if you check line 24 it says if opts[:redis_url] != '' and host and port are set in the else block.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I'm trying to say is: if you use a redis URL, it will use that and no other parameter.

@gsandie
Copy link
Contributor

gsandie commented Mar 29, 2013

Cool, all looks good I think :)

gsandie pushed a commit that referenced this pull request Mar 29, 2013
@gsandie gsandie merged commit 4b69d9d into riemann:master Mar 29, 2013
@aphyr
Copy link
Collaborator

aphyr commented Mar 29, 2013

Nice work guys! BTW feel free to add yourselves to the thank you page whenever you make changes! Fork https://github.com/aphyr/riemann, git checkout gh-pages, open thanks.html, and make a note in "contributors to the next release". :) Thanks for all your hard work.

@inkel
Copy link
Contributor Author

inkel commented Mar 30, 2013

Thank you, Kyle!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants