redis-audit
redis-audit copied to clipboard
NoMethodError : undefined method `divmod' for nil:NilClass
I use git clone redis-audit
[root@www local]# git clone https://github.com/snmaynard/redis-audit.git
Initialized empty Git repository in /usr/local/redis-audit/.git/
remote: Reusing existing pack: 117, done.
remote: Total 117 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (117/117), 17.79 KiB | 11 KiB/s, done.
Resolving deltas: 100% (38/38), done.
And install it by bundle
[root@www redis-audit]# bundle install
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break
this application for all non-root users on this machine.
Fetching gem metadata from http://rubygems.org/..........
Fetching additional metadata from http://rubygems.org/..
Installing redis 3.0.2
Using bundler 1.6.4
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
When I try to run it, error print out as follows:
[root@www redis-audit]# bundle exec ruby redis-audit.rb 127.0.0.1 6379 1 10000
Auditing 192.168.1.6:6379 db:1 sampling 10000 keys
Getting a list of all 0 keys...
Auditing 0 keys...
DB has 0 keys
redis-audit.rb:184:in `output_bytes': undefined method `divmod' for nil:NilClass (NoMethodError)
from redis-audit.rb:207:in `output_stats'
from redis-audit.rb:278:in `<main>'
The bug is because I haven't tested the script with 0 keys in the redis db. If you run it against a db with keys in it you should have more luck.
If you fancy sending a PR to fix I'd merge :-)