zenoss / ZenPacks.chudler.redis

ZenPacks.chudler.redis ZenPack
GNU General Public License v2.0
4 stars 3 forks source link

No output from COMMAND plugin #4

Open bputek opened 10 years ago

bputek commented 10 years ago

Hi I am seeing

/DB/Redis No output from COMMAND plugin.

I am running Zenoss 4.2.4 Core

theWizK commented 10 years ago

I see this too. Did you ever find the solution?

When I run from the command line, here is the output:

[zenoss@ip-172-31-48-116 libexec]$ ./check_redis.py -H 172.31.49.54 -p 6379 Traceback (most recent call last): File "./check_redis.py", line 49, in print cmd.run() File "./check_redis.py", line 21, in run metrics = db.info() File "/opt/zenoss/ZenPacks/ZenPacks.chudler.redis-1.0.1.egg/ZenPacks/chudler/redis/lib/redis/client.py", line 381, in info return self.format_inline('INFO') File "/opt/zenoss/ZenPacks/ZenPacks.chudler.redis-1.0.1.egg/ZenPacks/chudler/redis/lib/redis/client.py", line 284, in format_inline return self.execute_command(args[0], cmd, _options) File "/opt/zenoss/ZenPacks/ZenPacks.chudler.redis-1.0.1.egg/ZenPacks/chudler/redis/lib/redis/client.py", line 220, in execute_command return self._execute_command(command_name, command, _options) File "/opt/zenoss/ZenPacks/ZenPacks.chudler.redis-1.0.1.egg/ZenPacks/chudler/redis/lib/redis/client.py", line 215, in _execute_command return self.parse_response(command_name, options) File "/opt/zenoss/ZenPacks/ZenPacks.chudler.redis-1.0.1.egg/ZenPacks/chudler/redis/lib/redis/client.py", line 269, in parse_response return self.RESPONSE_CALLBACKS[command_name](response, options) File "/opt/zenoss/ZenPacks/ZenPacks.chudler.redis-1.0.1.egg/ZenPacks/chudler/redis/lib/redis/client.py", line 129, in parse_info key, value = line.split(':') ValueError: need more than 1 value to unpack

theWizK commented 10 years ago

I updated the file /opt/zenoss/ZenPacks/ZenPacks.chudler.redis-1.0.1.egg/ZenPacks/chudler/redis/lib/redis/client.py

which had this:

def parse_info(response): "Parse the result of Redis's INFO command into a Python dict" info = {} def get_value(value): if ',' not in value: return value sub_dict = {} for item in value.split(','): k, v = item.split('=') try: sub_dict[k] = int(v) except ValueError: sub_dict[k] = v return sub_dict for line in response.splitlines(): ! key, value = line.split(':') try: info[key] = int(value) except ValueError: info[key] = get_value(value) return info

to this:

def parse_info(response): "Parse the result of Redis's INFO command into a Python dict" info = {} def get_value(value): if ',' not in value: return value sub_dict = {} for item in value.split(','): k, v = item.split('=') try: sub_dict[k] = int(v) except ValueError: sub_dict[k] = v return sub_dict for line in response.splitlines(): ! try: ! key, value = line.split(':') ! except ValueError: ! continue try: info[key] = int(value) except ValueError: info[key] = get_value(value) return info

and the command runs now.

bputek commented 10 years ago

Yeah I fixed it in a similar way.

From: Kendal Montgomery [mailto:notifications@github.com] Sent: Friday, August 15, 2014 2:35 PM To: zenoss/ZenPacks.chudler.redis Cc: Brendan Putek Subject: Re: [ZenPacks.chudler.redis] No output from COMMAND plugin (#4)

I updated the file /opt/zenoss/ZenPacks/ZenPacks.chudler.redis-1.0.1.egg/ZenPacks/chudler/redis/lib/redis/client.py

which had this:

def parse_info(response): "Parse the result of Redis's INFO command into a Python dict" info = {} def get_value(value): if ',' not in value: return value sub_dict = {} for item in value.split(','): k, v = item.split('=') try: sub_dict[k] = int(v) except ValueError: sub_dict[k] = v return sub_dict for line in response.splitlines(): ! key, value = line.split(':') try: info[key] = int(value) except ValueError: info[key] = get_value(value) return info

to this:

def parse_info(response): "Parse the result of Redis's INFO command into a Python dict" info = {} def get_value(value): if ',' not in value: return value sub_dict = {} for item in value.split(','): k, v = item.split('=') try: sub_dict[k] = int(v) except ValueError: sub_dict[k] = v return sub_dict for line in response.splitlines(): ! try: ! key, value = line.split(':') ! except ValueError: ! continue try: info[key] = int(value) except ValueError: info[key] = get_value(value) return info

and the command runs now.

— Reply to this email directly or view it on GitHubhttps://github.com/zenoss/ZenPacks.chudler.redis/issues/4#issuecomment-52341998.

This email and any attachments may contain confidential and proprietary information of Blackboard that is for the sole use of the intended recipient. If you are not the intended recipient, disclosure, copying, re-distribution or other use of any of this information is strictly prohibited. Please immediately notify the sender and delete this transmission if you received this email in error.

techguy613 commented 10 years ago

The issue it seems is that new versions of Redis include comment-style lines in the INFO response. Instead of a try / except block, I included the following around line 129 of client.py where the response processing is happening:

if line.startswith('#'): continue

gen-infra commented 8 years ago

we also had to add in a line to skip the blank lines to get around this error:

    if line.startswith('#'):
        continue
    if not line.strip():
        continue