bin/metrics-redis-graphite.rb in sensu-plugins-redis-1.4.0 vs bin/metrics-redis-graphite.rb in sensu-plugins-redis-2.0.0
- old
+ new
@@ -95,10 +95,16 @@
description: 'a comma seperated list of keys to be skipped',
short: '-k KEYS',
long: '--skipkeys KEYS',
default: nil
+ option :conn_failure_status,
+ long: '--conn-failure-status EXIT_STATUS',
+ description: 'Returns the following exit status for Redis connection failures',
+ default: 'unknown',
+ in: %w(unknown warning critical)
+
def run
options = {
timeout: config[:timeout],
reconnect_attempts: config[:reconnect_attempts]
}
@@ -140,7 +146,9 @@
output "#{config[:scheme]}.commandstats.#{k}.#{x}", v[x]
end
end
ok
+ rescue
+ send(config[:conn_failure_status], "Could not connect to Redis server on #{config[:host]}:#{config[:port]}")
end
end