bin/check-redis-ping.rb in sensu-plugins-redis-1.2.2 vs bin/check-redis-ping.rb in sensu-plugins-redis-1.3.0

- old
+ new

@@ -29,10 +29,16 @@ require 'sensu-plugin/check/cli' require 'redis' class RedisPing < Sensu::Plugin::Check::CLI + option :socket, + short: '-s SOCKET', + long: '--socket SOCKET', + description: 'Redis socket to connect to (overrides Host and Port)', + required: false + option :host, short: '-h HOST', long: '--host HOST', description: 'Redis Host to connect to', required: false, @@ -50,14 +56,21 @@ short: '-P PASSWORD', long: '--password PASSWORD', description: 'Redis Password to connect with' def redis_options - { - host: config[:host], - port: config[:port], - password: config[:password] - } + if config[:socket] + { + path: config[:socket], + password: config[:password] + } + else + { + host: config[:host], + port: config[:port], + password: config[:password] + } + end end def run if Redis.new(redis_options).ping == 'PONG' ok 'Redis is alive'