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

KeyError: 'mem_fragmentation_ratio' #10

Open
sylarjiang opened this issue Nov 11, 2016 · 2 comments
Open

KeyError: 'mem_fragmentation_ratio' #10

sylarjiang opened this issue Nov 11, 2016 · 2 comments

Comments

@sylarjiang
Copy link

sylarjiang commented Nov 11, 2016

env:centos7+python2.7

`[root@openfalcon redis]# python redis-monitor.py
Traceback (most recent call last):

File "redis-monitor.py", line 116, in
main()
File "redis-monitor.py", line 75, in main
value = float(stats[key])
KeyError: 'mem_fragmentation_ratio'`

help!

@sylarjiang
Copy link
Author

sylarjiang commented Nov 11, 2016

我把那个判断语句注释掉又出现

`[root@openfalcon redis]# python redis-monitor.py

Traceback (most recent call last):
File "redis-monitor.py", line 116, in
main()
File "redis-monitor.py", line 71, in main
value = float(stats['keyspace_hits'])/(int(stats['keyspace_hits']) + int(stats['keyspace_misses']))
KeyError: 'keyspace_hits'
`

@iambocai
Copy link
Owner

@sylarjiang 可能是你redis版本过低,或者是一个全新的redis实例,我脚本改了下,遇到没有的key直接跳过了,你试试看是否ok了

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

No branches or pull requests

2 participants