bin/metrics-redis-graphite.rb in sensu-plugins-redis-1.2.2 vs bin/metrics-redis-graphite.rb in sensu-plugins-redis-1.3.0
- old
+ new
@@ -45,10 +45,16 @@
'used_memory_lua_human',
'used_memory_peak_human',
'used_memory_rss_human'
].freeze
+ 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',
default: '127.0.0.1'
@@ -91,14 +97,20 @@
long: '--skipkeys KEYS',
default: nil
def run
options = {
- host: config[:host],
- port: config[:port],
timeout: config[:timeout],
reconnect_attempts: config[:reconnect_attempts]
}
+
+ if config[:socket]
+ options[:path] = config[:socket]
+ else
+ options[:host] = config[:host]
+ options[:port] = config[:port]
+ end
+
options[:password] = config[:password] if config[:password]
redis = Redis.new(options)
skip_keys = if !config[:skip_keys_regex].nil?
config[:skip_keys_regex].split(',')
else