class Easymon::RedisWriteableCheck
Attributes
config[RW]
Public Class Methods
new(config)
click to toggle source
# File lib/easymon/checks/redis_writeable_check.rb, line 7 def initialize(config) self.config = config end
Public Instance Methods
check()
click to toggle source
# File lib/easymon/checks/redis_writeable_check.rb, line 11 def check check_status = redis_writeable? message = check_status ? "Writeable" : "Read Only" [check_status, message] end
Private Instance Methods
redis_writeable?()
click to toggle source
# File lib/easymon/checks/redis_writeable_check.rb, line 19 def redis_writeable? redis = Redis.new(@config) key = "easymon_#{Time.now.to_i}" reply = redis.set(key, "true") redis.del(key) reply == "OK" rescue false ensure if redis.respond_to? :close redis.close # Redis 4+ else redis.client.disconnect # Older redis end end