Get Redis Status Through Ruby

Viewed 2469

I would like to retrieve the Redis status using a Ruby script, I tried the following commands:

redis_status_command, stdeerr, status = Open3.capture3(`redis-cli -h 127.0.0.1 -p 6379 info|grep status`)

OR

redis_status_command, stdeerr, status = Open3.capture3(`systemctl status redis`)

Then when I try to print the variable redis_status_command it returns a blank space, but I know that the commands that are inside the Open3.capture3 part work in the command line. How can I retrieve the Redis status using Ruby? Thank you

1 Answers
Related