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

Implements #945: monitor Redis key lengths #962

Merged
merged 2 commits into from
Jun 6, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions checks.d/redisdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,19 @@ def _check_db(self, instance, custom_tags=None):
self.rate('redis.net.commands', info['total_commands_processed'],
tags=tags)

# Check some key lengths if asked
key_list = instance.get('keys')
if not isinstance(key_list, list) or len(key_list) == 0:
self.warning("keys in redis configuration is either not a list or empty")
else:
l_tags = list(tags)
for key in key_list:
if conn.exists(key):
key_tags = l_tags + ["key:" + key]
self.gauge("redis.key.length", conn.llen(key), tags=key_tags)
else:
self.warning("{0} key not found in redis".format(key))

def check(self, instance):
try:
import redis
Expand Down
5 changes: 4 additions & 1 deletion conf.d/redisdb.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ instances:
# password: mypassword
# tags:
# - optional_tag1
# - optional_tag2
# - optional_tag2
# keys: # check the length of these keys
# - key1
# - key2